Commit 6468be98 authored by Stephan Großberndt's avatar Stephan Großberndt
Browse files

[INITIAL] Gerrit for review.typo3.org based on Docker

Configuration to build and run the Gerrit 2.16.8 Ubuntu Docker image for
https://review.typo3.org based on the last state of the Chef cookbook
`site-reviewtypo3org`
parent 38824b7b
.idea/*
volumes/cache/*
volumes/db/*
volumes/etc/secure.config
volumes/etc/ssh_host*
volumes/git/*
volumes/index/*
volumes/logs/*
\ No newline at end of file
FROM gerritcodereview/gerrit:2.16.8-ubuntu16
# Add assets
ADD assets/hooks /var/gerrit/hooks
ADD assets/lib /var/gerrit/lib
RUN rm -rf /var/gerrit/plugins
ADD assets/plugins /var/gerrit/plugins
ADD assets/static /var/gerrit/static
# Add PHP for hooks
USER root
RUN apt-get update && apt-get install --yes --no-install-recommends \
php7.0-cli php7.0-curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
USER gerrit
\ No newline at end of file
# Gerrit for review.typo3.org based on Docker
This repository contains the configuration to build and run the Gerrit Docker image for https://review.typo3.org
## Directories
- Subdirectories of `assets/` are added to the Docker container in `Dockerfile`.
- Subdirectories of `volumes/` are mounted in `docker-compose.yaml`.
## Development
Traefik is used for development on https://review.typo3.local with a self-signed certificate. In order to do so:
- Add `127.0.0.1 review.typo3.local` to your `/etc/hosts`
- Run `docker-compose build`
- Copy `secure.config.template` to `secure.config` and insert the passwords
- Copy contents of `git/` and `/index` from the production server to `volumes/`
- Replace the database host in `volumes/etc/gerrit.config` with your hostname and have a mysql instance running with the gerrit database from the production server
- Comment the port mapping of the Gerrit service `"80:8080"`
- Uncomment the `environment` section of the Gerrit service and its variable `CANONICAL_WEB_URL`
- Uncomment the `reverse-proxy` service
- Uncomment the Gerrit init entrypoint
- Run `docker-compose up` and wait for `Initialized /var/gerrit`
- Comment the Gerrit init entrypoint again
- Run `docker-compose up` and wait for `Gerrit Code Review 2.16.8 ready`
#!/usr/bin/php
<?php
// parse parameters into sth. easier to access, namely into $args
$args = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
}
}
// do not disclose changes in security repositories!
if (strstr($args['project'], "Teams/Security/")) {
echo "Will not send anything for repositories below Teams/Security/";
exit;
}
// fetch commit message
$commitInfo = '';
exec('GIT_DIR=/var/gerrit/review/git/' . $args['project'] . '.git/ git log -1 --quiet --pretty=medium ' . $args['commit'], $commitInfo);
$commitInfo = implode($commitInfo, chr(10));
$data = $args;
$data['message'] = $commitInfo;
$data['token'] = "<%= @token %>";
$urls = array(
// "http://requestb.in/wg26rfwg",
"https://stage.t3bot.de/hooks/gerrit/?action=" . $data['action'],
"https://www.t3bot.de/hooks/gerrit/?action=" . $data['action'],
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
'ignore_errors' => true,
),
);
$context = stream_context_create($options);
foreach ($urls as $url) {
$result = file_get_contents($url, false, $context);
echo "Request to $url returned " . $http_response_header[0] . "\n";
}
#!/usr/bin/php
<?php
/**
* @api https://review.typo3.org/Documentation/config-hooks.html#_change_merged
*
* Martin Bless <martin@mbless.de>, 2013-05-15, 2013-05-17
*
* Test URL
* ---------
*
./trigger-docstypo3org.phpsh \
--change I7511a12935a6eff29593c0c19c895c625a703ceb \
--change-url http://review.typo3.org/1307 \
--project FLOW3/Packages/SwiftMailer \
--branch master \
--uploader "Karsten Dambekalns (karsten@typo3.org)" \
--commit d8074e04611b5c95ab788b39c9a505329c36964a \
--patchset 1
* Argument reference:
* --------------------
*
* $argv = array (
* 0 => '/var/gerrit/review/hooks/patchset-created',
* 1 => '--change',
* 2 => 'I7511a12935a6eff29593c0c19c895c625a703ceb',
* 3 => '--change-url',
* 4 => 'http://review.typo3.org/1307',
* 5 => '--project',
* 6 => 'FLOW3/Packages/SwiftMailer',
* 7 => '--branch',
* 8 => 'master',
* 9 => '--uploader',
* 10 => 'Karsten Dambekalns (karsten@typo3.org)',
* 11 => '--commit',
* 12 => 'd8074e04611b5c95ab788b39c9a505329c36964a',
* 13 => '--patchset',
* 14 => '1',
* );
*/
$args = array();
$ignoredArgs = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
// echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
$ignoredArgs[$i] = $_SERVER['argv'][$i];
}
}
if (1) {
// add some constants
$args['sender'] = $_SERVER['argv'][0];
$args['repositoryUrl'] = 'git://git.typo3.org/';
$args['ignoredArgs'] = $ignoredArgs;
}
if (0) {
// log input parameters
$parametersGiven = array();
foreach ($args as $key => $value) {
$parametersGiven[] = $key . ":" . $value;
}
echo "Executing hook file " . __FILE__ . " (" . implode(", ", $parametersGiven) . ")";
unset($parametersGiven);
}
$NL = "\n";
$identifierOfThisScript = 'tell-docs-typo3-org';
$destinationUrl = 'http://ubu239.mb.local/LinuxData200/git-typo3-org-change-merged.php';
$destinationUrl = 'https://docs.typo3.org/php/git-typo3-org-change-merged.php';
if (0) {
// here we would use the GET method for Fabien's service
$query = http_build_query($data);
$url = "http://docs.typo3.org/render/index.php/render?$query";
$http = curl_init($url);
$content = curl_exec($http);
$http_status = curl_getinfo($http, CURLINFO_HTTP_CODE);
curl_close($http);
if ($http_status == 200) { 'pass'; } else { 'pass'; }
}
if (1) {
// let's post the data as json string
$postfields = array('json' => json_encode($args));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $destinationUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$returnData = curl_exec($ch);
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_status == 200) { 'pass'; } else { 'pass'; }
if (0) {
// debug, develop, check
$f2name = "zzzlog-2.txt";
$f2 = fopen($f2name, 'w') or die("can't open file");
fwrite($f2, '$http_status: ' . $http_status . $NL);
fwrite($f2, '$returnData : ' . $returnData . $NL);
fclose($f2);
}
}
?>
\ No newline at end of file
#!/usr/bin/php
<?php
// Manual usage:
// php update-packagist.org.php --project TYPO3CMS/Extensions/rss_display --branch master
// parse parameters into sth. easier to access, namely into $args
$args = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
}
}
// log input parameters
$parametersGiven = array();
foreach ($args as $key => $value) {
$parametersGiven[] = $key . ":" . $value;
}
echo "Executing hook file " . __FILE__ . " (" . implode(", ", $parametersGiven) . ")";
unset($parametersGiven);
///////////// START REAL WORK ////////////////////
// Hook into Packagist
exec('GIT_DIR=/var/gerrit/review/git/' . $args['project'] . '.git/ git cat-file blob ' . $args['branch'] . ':composer.json', $composerJson, $result);
if ($result === 0 && !empty($composerJson)) {
$composerJson = json_decode(implode('', $composerJson));
if (is_object($composerJson) && !empty($composerJson->name)) {
// We have a composer.json in our branch, check for packagist package to update
$http = curl_init('https://packagist.org/packages/' . $composerJson->name);
curl_setopt($http, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($http);
$http_status = curl_getinfo($http, CURLINFO_HTTP_CODE);
curl_close($http);
if ($http_status === 200) {
// Package is found on packagist, request an update
$url = sprintf('curl -X PUT -d username=%s -d apiToken=%s -d update=1 --silent https://packagist.org/packages/%s',
'typo3', // Packagist username
'<%= @token %>', // API Token
$composerJson->name
);
exec($url, $result);
$message = 'something unexpected went wrong';
if (!empty($result)) {
$message = implode("\n", $result);
}
echo chr(10);
echo 'Update ' . $composerJson->name . ' on packagist.org returned: ' . $message;
echo chr(10);
# Fabien: I had trouble with this code and replaced by a plain curl command.
#$put = curl_init('https://packagist.org/packages/' . $composerJson->name);
#curl_setopt($put, CURLOPT_POSTFIELDS, array(
# 'update_package' => 1,
# 'username' => 'typo3',
# 'apiToken' => '4k6vm79r45c0g4o848wk'
#));
#curl_setopt($put, CURLOPT_CUSTOMREQUEST, 'PUT');
#curl_setopt($put, CURLOPT_RETURNTRANSFER, TRUE);
#$result = curl_exec($put);
#$put_status = curl_getinfo($put, CURLINFO_HTTP_CODE);
#curl_close($put);
#echo 'Update ' . $composerJson->name . ' on packagist.org returned status: ' . $put_status;
}
}
}
#!/usr/bin/php
<?php
// parse parameters into sth. easier to access, namely into $args
$args = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
}
}
// do not disclose changes in foreign repositories!
if (!strstr($args['project'], "Packages/TYPO3.CMS")) {
echo "Will not send anything for repositories except Packages/TYPO3.CMS";
exit;
}
// fetch commit message
/*$commitInfo = '';
exec('GIT_DIR=/var/gerrit/review/git/' . $args['project'] . '.git/ git log -1 --quiet --pretty=medium ' . $args['commit'], $commitInfo);
$commitInfo = implode($commitInfo, chr(10));*/
$data = $args;
//$data['message'] = $commitInfo;
$data['token'] = "<% @token %>";
$data['changeUrl'] = $data['change-url'];
$fields = $data;
$url = 'https://intercept.typo3.com/gerrit';
//url-ify the data for the POST
$fields_string = '';
foreach($fields as $key=>$value) { $fields_string .= $key . '=' . urlencode($value) . '&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
#!/usr/bin/php
<?php
// parse parameters into sth. easier to access, namely into $args
$args = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
}
}
// do not disclose changes in security repositories!
if (strstr($args['project'], "Teams/Security/")) {
echo "Will not send anything for repositories below Teams/Security/";
exit;
}
// fetch commit message
$commitInfo = '';
exec('GIT_DIR=/var/gerrit/review/git/' . $args['project'] . '.git/ git log -1 --quiet --pretty=medium ' . $args['commit'], $commitInfo);
$commitInfo = implode($commitInfo, chr(10));
$data = $args;
$data['message'] = $commitInfo;
$data['token'] = "<%= @token %>";
$urls = array(
// "http://requestb.in/wg26rfwg",
"https://stage.t3bot.de/hooks/gerrit/?action=" . $data['action'],
"https://www.t3bot.de/hooks/gerrit/?action=" . $data['action'],
);
$options = array(
'http' => array(
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
'ignore_errors' => true,
),
);
$context = stream_context_create($options);
foreach ($urls as $url) {
$result = file_get_contents($url, false, $context);
echo "Request to $url returned " . $http_response_header[0] . "\n";
}
#!/usr/bin/php
<?php
/*
Compatible with Gerrit 2.5, order may change from version to version..
To figure out the input, use
print_r($_SERVER['argv']);
$argv = array (
0 => '/var/gerrit/review/hooks/patchset-created',
1 => '--change',
2 => 'I7511a12935a6eff29593c0c19c895c625a703ceb',
3 => '--is-draft',
4 => 'false',
5 => '--change-url',
6 => 'http://review.typo3.org/1307',
7 => '--project',
8 => 'FLOW3/Packages/SwiftMailer',
9 => '--branch',
10 => 'master',
11 => '--topic',
12 => '12345',
13 => '--uploader',
14 => 'Karsten Dambekalns (karsten@typo3.org)',
15 => '--commit',
16 => 'd8074e04611b5c95ab788b39c9a505329c36964a',
17 => '--patchset',
18 => '1',
);
*/
// parse parameters into sth. easier to access, namely into $args
$args = array();
for ($i = 1; $i < $_SERVER['argc']; $i++) {
if (substr($_SERVER['argv'][$i], 0, 2) == '--') {
$optionName = substr($_SERVER['argv'][$i], 2);
$args[$optionName] = $_SERVER['argv'][$i + 1];
$i++;
} else {
echo "Ignored unexpected parameter #" . $i . ": " . $_SERVER['argv'][$i];
}
}
// log input parameters
$parametersGiven = array();
foreach ($args as $key => $value) {
$parametersGiven[] = $key . ":" . $value;
}
echo "Executing hook file " . __FILE__ . " (" . implode(", ", $parametersGiven) . ")";
unset($parametersGiven);
// fetch commit message
$commitInfo = '';
exec('GIT_DIR=/var/gerrit/review/git/' . $args['project'] . '.git/ git show --quiet --pretty=medium ' . $args['commit'], $commitInfo);
$commitInfo = implode($commitInfo, chr(10));
// extract issue footer(s)
$matches = array();
if (preg_match_all('/^\s*(?:Fixes|Resolves): \#([0-9]+)/mi', $commitInfo, $matches) !== FALSE) {
$issueNumbers = $matches[1];
} else {
exit(0);
}
foreach ($issueNumbers as $issueId) {
ini_set('user_agent', 'Gerrit Hook Script');
$existingIssue = json_decode(file_get_contents('http://forge.typo3.org/issues/' . $issueId . '.json'));
$updatedIssue = array(
'issue' => array(
'id' => $issueId,
'status_id' => '8',
'notes' => 'Patch set ' . $args['patchset'] . ' for branch *' . $args['branch'] . '* of project *' . $args['project'] . '* has been pushed to the review server.' . chr(10) . 'It is available at ' . $args['change-url']
)
);
putIssue($updatedIssue);
}
function putIssue(array $issue) {
$errorNumber = 0;
$errorMessage = '';
$fp = fsockopen('tls://forge.typo3.org', 443, $errorNumber, $errorMessage);
if (!$fp) {
return $errorNumber . ' - ' . $errorMessage;
} else {
fputs($fp, "PUT /issues/" . $issue['issue']['id'] . ".json HTTP/1.1\r\n");
unset($issue['issue']['id']);
fputs($fp, "Host: forge.typo3.org\r\n");
// the key belongs to user "gerrit-review"
fputs($fp, "Authorization: Basic " . base64_encode('<%= @token %>:') . "\r\n");
fputs($fp, "User-Agent: Gerrit Hook Script\r\n");
fputs($fp, "Content-Type: application/json\r\n");
fputs($fp, "Content-Length: " . strlen(json_encode($issue)) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, json_encode($issue));
fputs($fp, "\r\n");
$result = '';
while (!feof($fp)) {
$result .= fgets($fp, 1024);
}
fclose($fp);
return $result;
}
}
?>
LoginForm=function(){var e=null,t=null,n=null;function a(){e=document.getElementById("login_form"),t=document.getElementById("f_user"),n=document.getElementById("f_pass"),setTimeout(function(){var e=document.getElementsByTagName("body");e&&e.length&&(e[0].style.visibility="visible")},500),e&&e.length>0&&(function(){var e=t.parentNode.previousSibling,a=n.parentNode.previousSibling;e&&(t.placeholder=e.textContent.length?e.textContent:"User");a&&(n.placeholder=a.textContent.length?a.textContent:"Password")}(),function(){var e=document.getElementById("error_message");e&&n.parentNode&&n.parentNode.appendChild(e)}())}return window.onload=function(){a()},this}(),function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports?module.exports=t():e.EQCSS=t()}(this,function(){var EQCSS={data:[],version:"1.7.3"};EQCSS.load=function(){for(var e=document.getElementsByTagName("style"),t=0;t<e.length;t++)"http://www.w3.org/2000/svg"!==e[t].namespaceURI&&null===e[t].getAttribute("data-eqcss-read")&&(e[t].setAttribute("data-eqcss-read","true"),EQCSS.process(e[t].innerHTML));var n=document.getElementsByTagName("script");for(t=0;t<n.length;t++)null===n[t].getAttribute("data-eqcss-read")&&"text/eqcss"===n[t].type&&(n[t].src?function(){var e=new XMLHttpRequest;e.open("GET",n[t].src,!0),e.send(null),e.onreadystatechange=function(){EQCSS.process(e.responseText)}}():EQCSS.process(n[t].innerHTML),n[t].setAttribute("data-eqcss-read","true"));var a=document.getElementsByTagName("link");for(t=0;t<a.length;t++)null===a[t].getAttribute("data-eqcss-read")&&"stylesheet"===a[t].rel&&(a[t].href&&function(){var e=new XMLHttpRequest;e.open("GET",a[t].href,!0),e.send(null),e.onreadystatechange=function(){EQCSS.process(e.responseText)}}(),a[t].setAttribute("data-eqcss-read","true"))},EQCSS.parse=function(e){var t=new Array;return(e=(e=(e=(e=(e=e||"").replace(/\s+/g," ")).replace(/\/\*[\w\W]*?\*\//g,"")).replace(/@element/g,"\n@element")).replace(/(@element.*?\{([^}]*?\{[^}]*?\}[^}]*?)*\}).*/g,"$1")).replace(/(@element.*(?!@element))/g,function(e,n){var a={};n.replace(/(@element)\s*(".*?"|'.*?'|.*?)\s*(and\s*\(|{)/g,function(e,t,n){n=(n=n.replace(/^\s?['](.*)[']/,"$1")).replace(/^\s?["](.*)["]/,"$1"),a.selector=n}),a.conditions=[],n.replace(/and ?\( ?([^:]*) ?: ?([^)]*) ?\)/g,function(e,t,n){var r=null;(r=n.replace(/^(\d*\.?\d+)(\D+)$/,"$2"))===n&&(r=null),n=n.replace(/^(\d*\.?\d+)\D+$/,"$1"),a.conditions.push({measure:t,value:n,unit:r})}),n.replace(/{(.*)}/g,function(e,t){a.style=t}),t.push(a)}),t},EQCSS.register=function(e){if("[object Object]"===Object.prototype.toString.call(e)&&(EQCSS.data.push(e),EQCSS.apply()),"[object Array]"===Object.prototype.toString.call(e)){for(var t=0;t<e.length;t++)EQCSS.data.push(e[t]);EQCSS.apply()}},EQCSS.process=function(e){var t=EQCSS.parse(e);return EQCSS.register(t)},EQCSS.apply=function(){var e,t,n,a,r,o,i,d,l,s,c,u,S,p,h,m;for(e=0;e<EQCSS.data.length;e++)for(a=document.querySelectorAll(EQCSS.data[e].selector),t=0;t<a.length;t++){r="data-eqcss-"+e+"-"+t,a[t].setAttribute(r,""),i="data-eqcss-"+e+"-"+t+"-parent",a[t]!=document.documentElement&&a[t].parentNode.setAttribute(i,""),d="data-eqcss-"+e+"-"+t+"-prev";var f=function(e){for(;e=e.previousSibling;)if(1===e.nodeType)return e}(a[t]);f&&f.setAttribute(d,""),l="data-eqcss-"+e+"-"+t+"-next";var E=function(e){for(;e=e.nextSibling;)if(1===e.nodeType)return e}(a[t]);E&&E.setAttribute(l,""),(o=document.querySelector("#"+r))||((o=document.createElement("style")).id=r,o.setAttribute("data-eqcss-read","true"),document.querySelector("head").appendChild(o)),o=document.querySelector("#"+r),p=!0;e:for(n=0;n<EQCSS.data[e].conditions.length;n++){h=window.getComputedStyle(a[t],null),m=null,a[t]!=document.documentElement&&(m=window.getComputedStyle(a[t].parentNode,null));var g,C=!1;if("vw"===EQCSS.data[e].conditions[n].unit)C=!0,g=parseInt(EQCSS.data[e].conditions[n].value),EQCSS.data[e].conditions[n].recomputed_value=g*window.innerWidth/100;else if("vh"===EQCSS.data[e].conditions[n].unit)C=!0,g=parseInt(EQCSS.data[e].conditions[n].value),EQCSS.data[e].conditions[n].recomputed_value=g*window.innerHeight/100;else if("vmin"===EQCSS.data[e].conditions[n].unit)C=!0,g=parseInt(EQCSS.data[e].conditions[n].value),EQCSS.data[e].conditions[n].recomputed_value=g*Math.min(window.innerWidth,window.innerHeight)/100;else if("vmax"===EQCSS.data[e].conditions[n].unit)C=!0,g=parseInt(EQCSS.data[e].conditions[n].value),EQCSS.data[e].conditions[n].recomputed_value=g*Math.max(window.innerWidth,window.innerHeight)/100;else if(null!=EQCSS.data[e].conditions[n].unit&&"px"!=EQCSS.data[e].conditions[n].unit&&"%"!=EQCSS.data[e].conditions[n].unit){var y=document.createElement("div");y.style.visibility="hidden",y.style.border="1px solid red",y.style.width=EQCSS.data[e].conditions[n].value+EQCSS.data[e].conditions[n].unit;var Q=a[t];a[t]!=document.documentElement&&(Q=a[t].parentNode),Q.appendChild(y),EQCSS.data[e].conditions[n].value=parseInt(window.getComputedStyle(y,null).getPropertyValue("width")),EQCSS.data[e].conditions[n].unit="px",Q.removeChild(y)}var v=C?EQCSS.data[e].conditions[n].recomputed_value:parseInt(EQCSS.data[e].conditions[n].value);switch(EQCSS.data[e].conditions[n].measure){case"min-width":if(!(!0!==C&&"px"!==EQCSS.data[e].conditions[n].unit||(c=parseInt(h.getPropertyValue("width")))>=v)){p=!1;break e}if("%"===EQCSS.data[e].conditions[n].unit&&(c=parseInt(h.getPropertyValue("width")),!(parseInt(m.getPropertyValue("width"))/c<=100/v))){p=!1;break e}break;case"max-width":if(!(!0!==C&&"px"!==EQCSS.data[e].conditions[n].unit||(c=parseInt(h.getPropertyValue("width")))<=v)){p=!1;break e}if("%"===EQCSS.data[e].conditions[n].unit&&(c=parseInt(h.getPropertyValue("width")),!(parseInt(m.getPropertyValue("width"))/c>=100/v))){p=!1;break e}break;case"min-height":if(!(!0!==C&&"px"!==EQCSS.data[e].conditions[n].unit||(u=parseInt(h.getPropertyValue("height")))>=v)){p=!1;break e}if("%"===EQCSS.data[e].conditions[n].unit&&(u=parseInt(h.getPropertyValue("height")),!(parseInt(m.getPropertyValue("height"))/u<=100/v))){p=!1;break e}break;case"max-height":if(!(!0!==C&&"px"!==EQCSS.data[e].conditions[n].unit||(u=parseInt(h.getPropertyValue("height")))<=v)){p=!1;break e}if("%"===EQCSS.data[e].conditions[n].unit&&(u=parseInt(h.getPropertyValue("height")),!(parseInt(m.getPropertyValue("height"))/u>=100/v))){p=!1;break e}break;case"min-scroll-x":var w=a[t],b=w.scrollLeft;if(w.hasScrollListener||(w===document.documentElement||w===document.body?window.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0}):w.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0})),!0===C||"px"===EQCSS.data[e].conditions[n].unit){if(!(b>=v)){p=!1;break e}}else if("%"===EQCSS.data[e].conditions[n].unit){var x=a[t].scrollWidth;if(!(b/(x-(a[t]===document.documentElement||a[t]===document.body?window.innerWidth:parseInt(h.getPropertyValue("width"))))*100>=v)){p=!1;break e}}break;case"min-scroll-y":if(w=a[t],b=a[t].scrollTop,w.hasScrollListener||(w===document.documentElement||w===document.body?window.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0}):w.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0})),!0===C||"px"===EQCSS.data[e].conditions[n].unit){if(!(b>=v)){p=!1;break e}}else if("%"===EQCSS.data[e].conditions[n].unit&&!(b/((x=a[t].scrollHeight)-(a[t]===document.documentElement||a[t]===document.body?window.innerHeight:parseInt(h.getPropertyValue("height"))))*100>=v)){p=!1;break e}break;case"max-scroll-x":if(w=a[t],b=a[t].scrollLeft,w.hasScrollListener||(w===document.documentElement||w===document.body?window.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0}):w.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0})),!0===C||"px"===EQCSS.data[e].conditions[n].unit){if(!(b<=v)){p=!1;break e}}else if("%"===EQCSS.data[e].conditions[n].unit&&!(b/((x=a[t].scrollWidth)-(a[t]===document.documentElement||a[t]===document.body?window.innerWidth:parseInt(h.getPropertyValue("width"))))*100<=v)){p=!1;break e}break;case"max-scroll-y":if(w=a[t],b=a[t].scrollTop,w.hasScrollListener||(w===document.documentElement||w===document.body?window.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0}):w.addEventListener("scroll",function(){EQCSS.throttle(),w.hasScrollListener=!0})),!0===C||"px"===EQCSS.data[e].conditions[n].unit){if(!(b<=v)){p=!1;break e}}else if("%"===EQCSS.data[e].conditions[n].unit&&!(b/((x=a[t].scrollHeight)-(a[t]===document.documentElement||a[t]===document.body?window.innerHeight:parseInt(h.getPropertyValue("height"))))*100<=v)){p=!1;break e}break;case"min-characters":if(a[t].value){if(!(a[t].value.length>=v)){p=!1;break e}}else if(!(a[t].textContent.length>=v)){p=!1;break e}break;case"max-characters":if(a[t].value){if(!(a[t].value.length<=v)){p=!1;break e}}else if(!(a[t].textContent.length<=v)){p=!1;break e}break;case"min-children":if(!(a[t].children.length>=v)){p=!1;break e}break;case"max-children":if(!(a[t].children.length<=v)){p=!1;break e}break;case"min-lines":if(u=parseInt(h.getPropertyValue("height"))-parseInt(h.getPropertyValue("border-top-width"))-parseInt(h.getPropertyValue("border-bottom-width"))-parseInt(h.getPropertyValue("padding-top"))-parseInt(h.getPropertyValue("padding-bottom")),"normal"===(S=h.getPropertyValue("line-height"))){var k=parseInt(h.getPropertyValue("font-size"));S=1.125*k}else S=parseInt(S);if(!(u/S>=v)){p=!1;break e}break;case"max-lines":if(!((u=parseInt(h.getPropertyValue("height"))-parseInt(h.getPropertyValue("border-top-width"))-parseInt(h.getPropertyValue("border-bottom-width"))-parseInt(h.getPropertyValue("padding-top"))-parseInt(h.getPropertyValue("padding-bottom")))/(S="normal"===(S=h.getPropertyValue("line-height"))?1.125*(k=parseInt(h.getPropertyValue("font-size"))):parseInt(S))+1<=v)){p=!1;break e}break;case"orientation":if("square"===EQCSS.data[e].conditions[n].value&&a[t].offsetWidth!==a[t].offsetHeight){p=!1;break e}if("portrait"===EQCSS.data[e].conditions[n].value&&!(a[t].offsetWidth<a[t].offsetHeight)){p=!1;break e}if("landscape"===EQCSS.data[e].conditions[n].value&&!(a[t].offsetHeight<a[t].offsetWidth)){p=!1;break e}break;case"min-aspect-ratio":var I=EQCSS.data[e].conditions[n].value.split("/")[0],_=EQCSS.data[e].conditions[n].value.split("/