Revert "js: Don't serve scripts utilizing ECMA2016+ features"
This reverts commit 4d4f5b3a69
.
This commit is contained in:
parent
f1e8280c3e
commit
e4450e7368
|
@ -63,13 +63,11 @@ if (in_array($path, $special)) {
|
|||
exit;
|
||||
|
||||
case 'js/icinga.dev.js':
|
||||
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']);
|
||||
JavaScript::send(false, $forIe11);
|
||||
JavaScript::send();
|
||||
exit;
|
||||
|
||||
case 'js/icinga.min.js':
|
||||
$forIe11 = (bool) preg_match('/Trident\/7.0;.*rv:11/', $_SERVER['HTTP_USER_AGENT']);
|
||||
JavaScript::sendMinified($forIe11);
|
||||
JavaScript::sendMinified();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -53,9 +53,9 @@ class JavaScript
|
|||
'js/define.js'
|
||||
];
|
||||
|
||||
public static function sendMinified($forIe11 = false)
|
||||
public static function sendMinified()
|
||||
{
|
||||
self::send(true, $forIe11);
|
||||
self::send(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ class JavaScript
|
|||
*
|
||||
* @param bool $minified Whether to compress the client side script code
|
||||
*/
|
||||
public static function send($minified = false, $forIe11 = false)
|
||||
public static function send($minified = false)
|
||||
{
|
||||
header('Content-Type: application/javascript');
|
||||
$basedir = Icinga::app()->getBootstrapDirectory();
|
||||
|
@ -91,11 +91,9 @@ class JavaScript
|
|||
$files[] = $filePath;
|
||||
}
|
||||
|
||||
if (! $forIe11) {
|
||||
// Prepare library file list
|
||||
foreach (Icinga::app()->getLibraries() as $library) {
|
||||
$files = array_merge($files, $library->getJsAssets());
|
||||
}
|
||||
// Prepare library file list
|
||||
foreach (Icinga::app()->getLibraries() as $library) {
|
||||
$files = array_merge($files, $library->getJsAssets());
|
||||
}
|
||||
|
||||
// Prepare core file list
|
||||
|
@ -151,28 +149,26 @@ class JavaScript
|
|||
$baseJs .= file_get_contents($file) . "\n\n\n";
|
||||
}
|
||||
|
||||
if (! $forIe11) {
|
||||
// Library files need to be namespaced first before they can be included
|
||||
foreach (Icinga::app()->getLibraries() as $library) {
|
||||
foreach ($library->getJsAssets() as $file) {
|
||||
$alreadyMinified = false;
|
||||
if ($minified && file_exists(($minFile = substr($file, 0, -3) . '.min.js'))) {
|
||||
$alreadyMinified = true;
|
||||
$file = $minFile;
|
||||
}
|
||||
// Library files need to be namespaced first before they can be included
|
||||
foreach (Icinga::app()->getLibraries() as $library) {
|
||||
foreach ($library->getJsAssets() as $file) {
|
||||
$alreadyMinified = false;
|
||||
if ($minified && file_exists(($minFile = substr($file, 0, -3) . '.min.js'))) {
|
||||
$alreadyMinified = true;
|
||||
$file = $minFile;
|
||||
}
|
||||
|
||||
$content = self::optimizeDefine(
|
||||
file_get_contents($file),
|
||||
$file,
|
||||
$library->getJsAssetPath(),
|
||||
$library->getName()
|
||||
);
|
||||
$content = self::optimizeDefine(
|
||||
file_get_contents($file),
|
||||
$file,
|
||||
$library->getJsAssetPath(),
|
||||
$library->getName()
|
||||
);
|
||||
|
||||
if ($alreadyMinified) {
|
||||
$out .= ';' . ltrim(trim($content), ';') . "\n";
|
||||
} else {
|
||||
$js .= $content . "\n\n\n";
|
||||
}
|
||||
if ($alreadyMinified) {
|
||||
$out .= ';' . ltrim(trim($content), ';') . "\n";
|
||||
} else {
|
||||
$js .= $content . "\n\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
/*! Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
||||
|
||||
/* IE11 Polyfills */
|
||||
|
||||
if (window.NodeList && !NodeList.prototype.forEach) {
|
||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||
}
|
||||
|
||||
/* jQuery Plugins */
|
||||
(function ($) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue