Loading advagg_mod/advagg_mod.module +55 −9 Changes for advagg_mod/advagg_mod.module: 55 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -1731,32 +1731,51 @@ function advagg_mod_js_async_defer(array &$js) { if ($use_on_error) { $jquery_update_fallback = ''; $jquery_update_ui_fallback = ''; $jquery_migrate_fallback = ''; $inline_array = array(); if (module_exists('jquery_update') && variable_get('jquery_update_jquery_cdn', 'none') !== 'none') { if (module_exists('jquery_update') && (variable_get('jquery_update_jquery_cdn', 'none') !== 'none' || variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none' )) { $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $path = drupal_get_path('module', 'jquery_update'); foreach ($js as $name => &$values) { if ($values['type'] !== 'inline') { continue; } // JQuery UI. if (stripos($values['data'], 'window.jQuery.ui') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_cdn', 'none') !== 'none' ) { $path = drupal_get_path('module', 'jquery_update'); $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $js_path = ($min == '.min') ? '/replace/ui/ui/minified/jquery-ui.min.js' : '/replace/ui/ui/jquery-ui.js'; $jquery_update_ui_fallback = base_path() . $path . $js_path; $jquery_update_ui_fallback = "{$GLOBALS['base_path']}{$path}{$js_path}"; if (empty($inline_array)) { $inline_array = $values; } unset($js[$name]); continue; } // JQuery Migrate. if (stripos($values['data'], 'window.jQuery.migrateWarnings') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none' ) { $version = '1.2.1'; $jquery_migrate_fallback = "{$GLOBALS['base_path']}{$path}/replace/jquery-migrate/{$version}/jquery-migrate{$min}.js"; $inline_array = $values; unset($js[$name]); continue; } // JQuery. // This should always be last. if (stripos($values['data'], 'window.jQuery') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_cdn', 'none') !== 'none' ) { $path = drupal_get_path('module', 'jquery_update'); $version = variable_get('jquery_update_jquery_version', '1.10'); $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $jquery_update_fallback = base_path() . $path . '/replace/jquery/' . $version . '/jquery' . $min . '.js'; $jquery_update_fallback = "{$GLOBALS['base_path']}{$path}/replace/jquery/{$version}/jquery{$min}.js"; $inline_array = $values; unset($js[$name]); continue; Loading @@ -1764,7 +1783,11 @@ function advagg_mod_js_async_defer(array &$js) { } unset($values); } if (!empty($jquery_update_fallback) || !empty($jquery_update_ui_fallback)) { if (!empty($jquery_update_fallback) || !empty($jquery_update_ui_fallback) || !empty($jquery_migrate_fallback) ) { // Add in the advagg_fallback() function so it's available inline. $inline_array['group'] = '-150'; $inline_array['weight'] += -10; $inline_array['data'] = 'function advagg_fallback(file){var head = document.getElementsByTagName("head")[0];var script = document.createElement("script");script.src = file;script.type = "text/javascript";head.appendChild(script);};'; Loading @@ -1772,7 +1795,7 @@ function advagg_mod_js_async_defer(array &$js) { $inline_array['movable'] = FALSE; $inline_array['no_defer'] = TRUE; $inline_array['scope'] = 'header'; $js[] = $inline_array; $js['advagg_fallback'] = $inline_array; } } Loading Loading @@ -1825,6 +1848,29 @@ function advagg_mod_js_async_defer(array &$js) { continue; } } // Special handling for jQuery migrate. if (stripos($name, '/jquery-migrate') !== FALSE) { // jquery_update ui fallback. if (module_exists('jquery_update') && variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none') { if ($use_on_error) { if (!isset($values['onerror'])) { $values['onerror'] = ''; } $values['onerror'] .= 'advagg_fallback(' . $jquery_migrate_fallback . ');'; } // Do not defer/async the loading of jquery-migrate. if (!variable_get('advagg_mod_js_defer_jquery', ADVAGG_MOD_JS_DEFER_JQUERY)) { if (variable_get('advagg_mod_js_defer', ADVAGG_MOD_JS_DEFER)) { $values['defer'] = FALSE; } } if (variable_get('advagg_mod_js_async', ADVAGG_MOD_JS_ASYNC)) { $values['async'] = FALSE; } // Defer/async is off; done with loop. continue; } } // Special handling for jQuery UI. if (stripos(strrev($name), $jquery_ui_rev) === 0 || stripos(strrev($name), $jquery_ui_min_rev) === 0 Loading Loading
advagg_mod/advagg_mod.module +55 −9 Changes for advagg_mod/advagg_mod.module: 55 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -1731,32 +1731,51 @@ function advagg_mod_js_async_defer(array &$js) { if ($use_on_error) { $jquery_update_fallback = ''; $jquery_update_ui_fallback = ''; $jquery_migrate_fallback = ''; $inline_array = array(); if (module_exists('jquery_update') && variable_get('jquery_update_jquery_cdn', 'none') !== 'none') { if (module_exists('jquery_update') && (variable_get('jquery_update_jquery_cdn', 'none') !== 'none' || variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none' )) { $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $path = drupal_get_path('module', 'jquery_update'); foreach ($js as $name => &$values) { if ($values['type'] !== 'inline') { continue; } // JQuery UI. if (stripos($values['data'], 'window.jQuery.ui') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_cdn', 'none') !== 'none' ) { $path = drupal_get_path('module', 'jquery_update'); $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $js_path = ($min == '.min') ? '/replace/ui/ui/minified/jquery-ui.min.js' : '/replace/ui/ui/jquery-ui.js'; $jquery_update_ui_fallback = base_path() . $path . $js_path; $jquery_update_ui_fallback = "{$GLOBALS['base_path']}{$path}{$js_path}"; if (empty($inline_array)) { $inline_array = $values; } unset($js[$name]); continue; } // JQuery Migrate. if (stripos($values['data'], 'window.jQuery.migrateWarnings') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none' ) { $version = '1.2.1'; $jquery_migrate_fallback = "{$GLOBALS['base_path']}{$path}/replace/jquery-migrate/{$version}/jquery-migrate{$min}.js"; $inline_array = $values; unset($js[$name]); continue; } // JQuery. // This should always be last. if (stripos($values['data'], 'window.jQuery') !== FALSE && stripos($values['data'], 'document.write("<script') !== FALSE && variable_get('jquery_update_jquery_cdn', 'none') !== 'none' ) { $path = drupal_get_path('module', 'jquery_update'); $version = variable_get('jquery_update_jquery_version', '1.10'); $min = variable_get('jquery_update_compression_type', 'min') == 'none' ? '' : '.min'; $jquery_update_fallback = base_path() . $path . '/replace/jquery/' . $version . '/jquery' . $min . '.js'; $jquery_update_fallback = "{$GLOBALS['base_path']}{$path}/replace/jquery/{$version}/jquery{$min}.js"; $inline_array = $values; unset($js[$name]); continue; Loading @@ -1764,7 +1783,11 @@ function advagg_mod_js_async_defer(array &$js) { } unset($values); } if (!empty($jquery_update_fallback) || !empty($jquery_update_ui_fallback)) { if (!empty($jquery_update_fallback) || !empty($jquery_update_ui_fallback) || !empty($jquery_migrate_fallback) ) { // Add in the advagg_fallback() function so it's available inline. $inline_array['group'] = '-150'; $inline_array['weight'] += -10; $inline_array['data'] = 'function advagg_fallback(file){var head = document.getElementsByTagName("head")[0];var script = document.createElement("script");script.src = file;script.type = "text/javascript";head.appendChild(script);};'; Loading @@ -1772,7 +1795,7 @@ function advagg_mod_js_async_defer(array &$js) { $inline_array['movable'] = FALSE; $inline_array['no_defer'] = TRUE; $inline_array['scope'] = 'header'; $js[] = $inline_array; $js['advagg_fallback'] = $inline_array; } } Loading Loading @@ -1825,6 +1848,29 @@ function advagg_mod_js_async_defer(array &$js) { continue; } } // Special handling for jQuery migrate. if (stripos($name, '/jquery-migrate') !== FALSE) { // jquery_update ui fallback. if (module_exists('jquery_update') && variable_get('jquery_update_jquery_migrate_cdn', 'none') !== 'none') { if ($use_on_error) { if (!isset($values['onerror'])) { $values['onerror'] = ''; } $values['onerror'] .= 'advagg_fallback(' . $jquery_migrate_fallback . ');'; } // Do not defer/async the loading of jquery-migrate. if (!variable_get('advagg_mod_js_defer_jquery', ADVAGG_MOD_JS_DEFER_JQUERY)) { if (variable_get('advagg_mod_js_defer', ADVAGG_MOD_JS_DEFER)) { $values['defer'] = FALSE; } } if (variable_get('advagg_mod_js_async', ADVAGG_MOD_JS_ASYNC)) { $values['async'] = FALSE; } // Defer/async is off; done with loop. continue; } } // Special handling for jQuery UI. if (stripos(strrev($name), $jquery_ui_rev) === 0 || stripos(strrev($name), $jquery_ui_min_rev) === 0 Loading