aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.class.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/template.class.php42
1 files changed, 37 insertions, 5 deletions
diff --git a/include/template.class.php b/include/template.class.php
index e7d840117..2d6d7078a 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -902,7 +902,14 @@ class ScriptLoader
private static $known_paths = array(
'core.scripts' => 'themes/default/js/scripts.js',
'jquery' => 'themes/default/js/jquery.min.js',
- 'jquery.ui' => 'themes/default/js/jquery.ui.min.js'
+ 'jquery.ui' => 'themes/default/js/ui/minified/jquery.ui.core.min.js',
+ 'jquery.effects' => 'themes/default/js/ui/minified/jquery.effects.core.min.js',
+ );
+
+ private static $ui_core_dependencies = array(
+ 'jquery.ui.widget' => array('jquery'),
+ 'jquery.ui.position' => array('jquery'),
+ 'jquery.ui.mouse' => array('jquery', 'jquery.ui', 'jquery.ui.widget'),
);
function __construct()
@@ -961,6 +968,12 @@ class ScriptLoader
if ($load_mode < $script->load_mode)
$script->load_mode = $load_mode;
}
+ // Load or modify all UI core files
+ if ($id == 'jquery.ui' and $script->path == self::$known_paths['jquery.ui'])
+ {
+ foreach (self::$ui_core_dependencies as $script_id => $required_ids)
+ $this->add($script_id, $load_mode, $required_ids, null, $version);
+ }
}
function did_head()
@@ -1085,10 +1098,29 @@ class ScriptLoader
}
if ( strncmp($id, 'jquery.', 7)==0 )
{
- if ( !in_array('jquery', $script->precedents ) )
- $script->precedents[] = 'jquery';
- if ( strncmp($id, 'jquery.ui.', 10)==0 && !in_array('jquery.ui', $script->precedents ) )
- $script->precedents[] = 'jquery.ui';
+ $required_ids = array('jquery');
+
+ if ( strncmp($id, 'jquery.ui.', 10)==0 )
+ {
+ if ( !isset(self::$ui_core_dependencies[$id]) )
+ $required_ids = array_merge(array('jquery', 'jquery.ui'), array_keys(self::$ui_core_dependencies));
+
+ if ( empty($script->path) )
+ $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
+ }
+ elseif ( strncmp($id, 'jquery.effects.', 15)==0 )
+ {
+ $required_ids = array('jquery', 'jquery.effects');
+
+ if ( empty($script->path) )
+ $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
+ }
+
+ foreach ($required_ids as $required_id)
+ {
+ if ( !in_array($required_id, $script->precedents ) )
+ $script->precedents[] = $required_id;
+ }
}
}