Don't support dark/light mode for IE
This commit is contained in:
parent
f1c984cd65
commit
baeca33789
|
@ -56,10 +56,12 @@ if (in_array($path, $special)) {
|
|||
|
||||
switch ($path) {
|
||||
case 'css/icinga.css':
|
||||
Stylesheet::send();
|
||||
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']);
|
||||
Stylesheet::send(false, $forIe11);
|
||||
exit;
|
||||
case 'css/icinga.min.css':
|
||||
Stylesheet::send(true);
|
||||
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']);
|
||||
Stylesheet::send(true, $forIe11);
|
||||
exit;
|
||||
|
||||
case 'js/icinga.dev.js':
|
||||
|
|
|
@ -14,10 +14,16 @@ require_once 'lessphp/lessc.inc.php';
|
|||
|
||||
class LessParser extends lessc
|
||||
{
|
||||
public function __construct()
|
||||
/**
|
||||
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
|
||||
* light mode calls
|
||||
*/
|
||||
public function __construct($disableModes = false)
|
||||
{
|
||||
$this->registerFunction('extract-variable-default', [$this, 'extractVariableDefault']);
|
||||
$this->setOption('plugins', [new Visitor()]);
|
||||
if (! $disableModes) {
|
||||
$this->setOption('plugins', [new Visitor()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +41,7 @@ class LessParser extends lessc
|
|||
* background: drop-shadow(5px 0 3px @mixin-parameter);
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param bool $valAsDefault
|
||||
* @param bool $valAsDefault
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
@ -58,10 +58,13 @@ class LessCompiler
|
|||
|
||||
/**
|
||||
* Create a new LESS compiler
|
||||
*
|
||||
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
|
||||
* light mode calls
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($disableModes = false)
|
||||
{
|
||||
$this->lessc = new LessParser();
|
||||
$this->lessc = new LessParser($disableModes);
|
||||
// Discourage usage of import because we're caching based on an explicit list of LESS files to compile
|
||||
$this->lessc->importDisabled = true;
|
||||
}
|
||||
|
|
|
@ -113,12 +113,15 @@ class StyleSheet
|
|||
|
||||
/**
|
||||
* Create the StyleSheet
|
||||
*
|
||||
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
|
||||
* light mode calls
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct($disableModes = false)
|
||||
{
|
||||
$app = Icinga::app();
|
||||
$this->app = $app;
|
||||
$this->lessCompiler = new LessCompiler();
|
||||
$this->lessCompiler = new LessCompiler($disableModes);
|
||||
$this->pubPath = $app->getBaseDir('public');
|
||||
$this->collect();
|
||||
}
|
||||
|
@ -221,11 +224,13 @@ class StyleSheet
|
|||
*
|
||||
* Does not cache the stylesheet if the HTTP header Cache-Control or Pragma is set to no-cache.
|
||||
*
|
||||
* @param bool $minified Whether to compress the stylesheet
|
||||
* @param bool $minified Whether to compress the stylesheet
|
||||
* @param bool $disableModes Disable replacing compiled Less colors with CSS var() function calls and don't inject
|
||||
* light mode calls
|
||||
*/
|
||||
public static function send($minified = false)
|
||||
public static function send($minified = false, $disableModes = false)
|
||||
{
|
||||
$styleSheet = new self();
|
||||
$styleSheet = new self($disableModes);
|
||||
|
||||
$request = $styleSheet->app->getRequest();
|
||||
$response = $styleSheet->app->getResponse();
|
||||
|
|
Loading…
Reference in New Issue