• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

jQuery call location

Adam Howard

Well-known member
#1
I figured this would be in the template somewhere, but to my surprise it wasn't. So I can only guess it is hard coded some place, but can't figure out as to where (maybe I'm missing it some how).

What I'm seeking is the coding which calls up the location and version number of jquery
 

Jake Bunce

XenForo moderator
Staff member
#2
XenForo_Application

Code:
	/**
	 * jQuery version currently in use. See XenForo_Dependencies_Public::getJquerySource()
	 *
	 * @var string
	 */
	public static $jQueryVersion = '1.5.2';
Code:
	/**
	 * URL to the location where XenForo's Javascript directories are located.
	 * Can be absolute or relative.
	 *
	 * @var string
	 */
	public static $javaScriptUrl = 'js';
Both of these can be overridden in the config file:

Code:
$config['jsVersion'] = '';

$config['javaScriptUrl'] = '';
This is also relevant:

XenForo_Dependencies_Public

Code:
	/**
	 * Fetch the path / URL to the jQuery core library
	 *
	 * @param boolean $forceLocal If true, forces the local version of jQuery
	 *
	 * @return string
	 */
	public static function getJquerySource($forceLocal = false)
	{
		$jQueryVersion = XenForo_Application::$jQueryVersion;
		$javaScriptUrl = XenForo_Application::$javaScriptUrl;
		$min = '.min';

		$options = XenForo_Application::get('options');

		// CDN sources from http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery
		$source = ($forceLocal ? 'local' : $options->jQuerySource);
		switch ($source)
		{
			case 'jquery':
			case 'mt':
				return "http://code.jquery.com/jquery-{$jQueryVersion}{$min}.js";

			case 'google':
				return "//ajax.googleapis.com/ajax/libs/jquery/{$jQueryVersion}/jquery{$min}.js";

			case 'microsoft':
				return "//ajax.microsoft.com/ajax/jquery/jquery-{$jQueryVersion}{$min}.js";

			default:
				return "{$javaScriptUrl}/jquery/jquery-{$jQueryVersion}{$min}.js";
		}
	}
 

Adam Howard

Well-known member
#4
I've discovered the 1st thing in XenForo I dislike.... Far to many version dependences.

This is not going to make things easy ....... F*ck :(