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

jQuery call location

Discussion in 'Styling and Customization Questions' started by Adam Howard, Jul 27, 2012.

  1. Adam Howard

    Adam Howard Well-Known Member

    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
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  3. Adam Howard

    Adam Howard Well-Known Member

    You sir are outstanding :D

    Thank you :)
     
  4. Adam Howard

    Adam Howard Well-Known Member

    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 :(
     

Share This Page