Skip to content

Commit

Permalink
Re-enable theme.useInternalAssets for jQuery/UI
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed Nov 15, 2023
1 parent 0881284 commit c763d3e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions application/libraries/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -1154,12 +1154,23 @@ function head_js($includeDefaults = true)

if ($includeDefaults) {
$dir = 'javascripts';
$config = Zend_Registry::get('bootstrap')->getResource('Config');
$useInternalAssets = isset($config->theme->useInternalAssets)
? (bool) $config->theme->useInternalAssets
: false;

$headScript->prependScript('jQuery.noConflict();')
->prependFile(src('vendor/jquery.ui.touch-punch.js', 'javascripts'))
->prependScript('window.jQuery.ui || document.write(' . js_escape(js_tag('vendor/jquery-ui')) . ')')
->prependFile('//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js')
->prependScript('window.jQuery || document.write(' . js_escape(js_tag('vendor/jquery')) . ')')
->prependFile('//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js');
->prependFile(src('vendor/jquery.ui.touch-punch.js', 'javascripts'));

if ($useInternalAssets) {
$headScript->prependFile(src('vendor/jquery-ui', $dir, 'js'))
->prependFile(src('vendor/jquery', $dir, 'js'));
} else {
$headScript->prependScript('window.jQuery.ui || document.write(' . js_escape(js_tag('vendor/jquery-ui')) . ')')
->prependFile('//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js')
->prependScript('window.jQuery || document.write(' . js_escape(js_tag('vendor/jquery')) . ')')
->prependFile('//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js');
}
}
return $headScript;
}
Expand Down

0 comments on commit c763d3e

Please sign in to comment.