Browse Source

Merge pull request #552 from jdarwood007/custom_jquery

 Added support for custom jquery libraries
Michael Eshom 11 years ago
parent
commit
746cc7a486

+ 2 - 0
Sources/Load.php

@@ -1820,6 +1820,8 @@ function loadTheme($id_theme = 0, $initialize = true)
 		loadJavascriptFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), 'jquery');
 	elseif (isset($modSettings['jquery_source']) && $modSettings['jquery_source'] == 'local')
 		loadJavascriptFile('jquery-1.7.1.min.js', array('default_theme' => true, 'seed' => false), 'jquery');
+	elseif (isset($modSettings['jquery_source'], $modSettings['jquery_custom']) && $modSettings['jquery_source'] == 'custom')
+		loadJavascriptFile($modSettings['jquery_custom'], array(), 'jquery');
 	// Auto loading? template_javascript() will take care of the local half of this.
 	else
 		loadJavascriptFile('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', array(), 'jquery');

+ 2 - 1
Sources/ManageSettings.php

@@ -510,7 +510,8 @@ function ModifyBasicSettings($return_config = false)
 			array('text', 'default_personal_text', 'subtext' => $txt['default_personal_text_note']),
 		'',
 			// Jquery source
-			array('select', 'jquery_source', array('auto' => $txt['jquery_auto'], 'local' => $txt['jquery_local'], 'cdn' => $txt['jquery_cdn'])),
+			array('select', 'jquery_source', array('auto' => $txt['jquery_auto'], 'local' => $txt['jquery_local'], 'cdn' => $txt['jquery_cdn'], 'custom' => $txt['jquery_custom']), 'onchange' => 'if (this.value == \'custom\'){document.getElementById(\'jquery_custom\').disabled = false; } else {document.getElementById(\'jquery_custom\').disabled = true;}'),
+			array('text', 'jquery_custom', 'javascript' => 'disabled', 'size' => 75),
 		'',
 			// SEO stuff
 			array('check', 'queryless_urls', 'subtext' => '<strong>' . $txt['queryless_urls_note'] . '</strong>'),

+ 2 - 0
Themes/default/languages/ManageSettings.english.php

@@ -67,6 +67,8 @@ $txt['autoFixDatabase'] = 'Automatically fix broken tables';
 $txt['allow_disableAnnounce'] = 'Allow users to disable announcements';
 $txt['disallow_sendBody'] = 'Don\'t allow post text in notifications';
 $txt['jquery_source'] = 'Source for the jQuery Library';
+$txt['jquery_custom_label'] = 'Custom';
+$txt['jquery_custom'] = 'Custom url to the jQuery Library';
 $txt['jquery_local'] = 'Local';
 $txt['jquery_cdn'] = 'Google CDN';
 $txt['jquery_auto'] = 'Auto';