1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Use Library Manager to load jQuery, jQuery UI... etc.

This commit is contained in:
lonalore
2016-12-22 14:54:09 +01:00
parent 8ef8a93407
commit 0e7a45d69d

View File

@@ -24,12 +24,7 @@ class e_jsmanager
'scriptaculous/effects.js', 'scriptaculous/effects.js',
'e107.js', 'e107.js',
), ),
'jquery' => array( 'jquery' => array(),
"https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js",
// jQuery Once filters out all elements that had the same filter applied on them before. It can be used to
// ensure that a function is only applied once to an element. jQuery Once is used in e107.behaviors.
"https://cdnjs.cloudflare.com/ajax/libs/jquery-once/2.1.1/jquery.once.min.js",
),
); );
/** /**
@@ -237,23 +232,24 @@ class e_jsmanager
// Try to auto-detect runtime location // Try to auto-detect runtime location
$this->setInAdmin(defset('e_ADMIN_AREA', false)); $this->setInAdmin(defset('e_ADMIN_AREA', false));
if($this->isInAdmin()) // Include jquery-ui in the admin-area only - Jquery-UI to eventually be removed from e107 completely if possible.
{
$minified = deftrue('e_DEBUG') == true ? null : 'minified'; $minified = deftrue('e_DEBUG') == true ? null : 'minified';
if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true' || !deftrue('e_CDN',true)) // Test with Local JS Framework files.
{
// TODO
}
elseif($this->isInAdmin())
{
e107::library('load', 'cdn.jquery', $minified); e107::library('load', 'cdn.jquery', $minified);
// jQuery Once is used in e107.behaviors. // jQuery Once is used in e107.behaviors.
e107::library('load', 'cdn.jquery.once', $minified); e107::library('load', 'cdn.jquery.once', $minified);
e107::library('load', 'cdn.jquery.ui', $minified); e107::library('load', 'cdn.jquery.ui', $minified);
$this->_libraries['jquery'] = array();
} }
else
if(isset($_SERVER['E_DEV_LOCALJS']) && $_SERVER['E_DEV_LOCALJS'] === 'true' || !deftrue('e_CDN',true)) // Test with Local JS Framework files.
{ {
$this->_libraries['jquery'] = array( e107::library('load', 'cdn.jquery', $minified);
"jquery/jquery.min.js" // jQuery Once is used in e107.behaviors.
); e107::library('load', 'cdn.jquery.once', $minified);
} }
$customJqueryUrls = e107::getPref('library-jquery-urls'); $customJqueryUrls = e107::getPref('library-jquery-urls');