Edgewall Software

Opened 11 years ago

Last modified 10 years ago

#10244 closed enhancement

[Patch] Option for using JQuery from a CDN — at Initial Version

Reported by: psuter <petsuter@…> Owned by:
Priority: normal Milestone: 1.0
Component: general Version:
Severity: normal Keywords: jquery
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Add the option [trac] jquery_location:

  • trac/web/chrome.py

    diff -r 00b3b14d466d trac/web/chrome.py
    a b  
    362362        will not be made available this way and additional rewrite
    363363        rules will be needed in the web server.""")
    364364
     365    jquery_location = Option('trac', 'jquery_location', '',
     366        """CDN URL for JQuery.
     367       
     368        It can be left empty, and the JQuery bundled with Trac will be used.
     369       
     370        Alternatively you can deliver JQuery from a CDN by setting it to a URL
     371        like http://code.jquery.com/jquery-1.5.1.min.js,
     372        http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js or
     373        https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js.""")
     374
    365375    metanav_order = ListOption('trac', 'metanav',
    366376                               'login, logout, prefs, help, about', doc=
    367377        """Order of the items to display in the `metanav` navigation bar,
     
    605615        add_link(req, 'search', req.href.search())
    606616        add_link(req, 'help', req.href.wiki('TracGuide'))
    607617        add_stylesheet(req, 'common/css/trac.css')
    608         add_script(req, 'common/js/jquery.js')
     618        add_script(req, self.jquery_location or 'common/js/jquery.js')
    609619        # Only activate noConflict mode if requested to by the handler
    610620        if handler is not None and \
    611621           getattr(handler.__class__, 'jquery_noconflict', False):

as discussed by comment:16:ticket:9643 and comment:17:ticket:9643.

Change History (1)

by psuter <petsuter@…>, 11 years ago

Note: See TracTickets for help on using tickets.