Edgewall Software

Changes between Version 8 and Version 9 of TracDev/JavaScript


Ignore:
Timestamp:
Feb 14, 2015, 12:35:04 PM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/JavaScript

    v8 v9  
    1 = JavaScript for Trac and plugin development =
     1= JavaScript for Trac and plugin development
    22
    33JavaScript is used in Trac to add dynamics to web interface elements on the browser side:
    4  * expanding/folding in TracBrowser
     4 * expanding/folding in the TracBrowser
    55 * providing [TracKeys keyboard shortcuts]
    6  * ...
     6 * and many other features
    77
    88{{{
     
    1111}}}
    1212
    13 == 3rd party libraries
     13== Third party libraries
    1414
    15 === jQuery ===
     15=== jQuery
    1616
    17 Trac makes heavy use of [http://en.wikipedia.org/wiki/JQuery jQuery] library to ease development. Access to this library contents is usually provided through the main function named $. $ as a name used for brevity and clarity. Unfortunately, other libraries may use it too and this may cause conflicts. $ in fact is just a shortcut for ''jQuery'' namespace and it is possible to use full name instead. But to avoid conflicts with other libraries $ shortcut should is turned off by switching jQuery into non-conflict mode with ''jQuery.noConflict()'' call.  This is well explained in http://docs.jquery.com/Using_jQuery_with_Other_Libraries
     17Trac makes heavy use of [http://en.wikipedia.org/wiki/JQuery jQuery] library. Access to this library contents is provided through the main function named $, which is just a shortcut for ''jQuery'' namespace and it is possible to use the full name instead. However, other libraries may use $ too, which may cause conflicts. To avoid these conflicts, switch jQuery into non-conflict mode with ''jQuery.noConflict()'' call.  This is well explained in http://docs.jquery.com/Using_jQuery_with_Other_Libraries.
    1818
    19 However, you will see many blocks in Trac that use $ for jQuery. They do it in their local scope defined by nameless function (or closure):
     19You will see many blocks in Trac that use $ for jQuery. They do it in their local scope defined by nameless function or closure:
    2020{{{
    2121(function($) { /* some code that uses $ */ })(jQuery)
    2222}}}
    23 There is a good description of closures and `(function(){})()` construct at http://ajaxian.com/archives/secrets-of-the-javascript-ninja-a-sneak-peak-for-ajaxians
     23There is a good description of closures and `(function(){})()` construct at http://ajaxian.com/archives/secrets-of-the-javascript-ninja-a-sneak-peak-for-ajaxians.
    2424
    25 ==== $(document).ready() ====
     25==== $(document).ready()
    2626
    27 To execute and modify DOM tree JavaScript function should usually wait until a page fully loads. With jQuery it looks like:
     27To execute and modify the DOM tree the JavaScript function should wait until a page fully loads. With jQuery it looks like:
    2828{{{
    2929$(document).ready(function_name);
     
    5151  `http://code.jquery.com/ui/x.y.z/jquery-ui.min.js`
    5252
    53 
    54 This correspond to the minified version of the whole of jQuery UI i.e. we don't use a subset of what is currently used by Trac on purpose, so that plugins can assume they have access to the all the jQuery UI components.
     53This correspond to the minified version of the whole of jQuery UI, ie we don't use a subset of what is currently used by Trac on purpose, so that plugins can assume they have access to the all the jQuery UI components.
    5554
    5655We use a custom theme for the CSS, built using the jQuery UI Theme Roller.
    57 The [source:trunk/trac/htdocs/css/jquery-ui/jquery-ui.css@11493:50#40 jquery-ui.css] file contains a link to the theme roller with preselected values ([http://jqueryui.com/themeroller/?ctl=themeroller&ffDefault=Verdana,Arial,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Bitstream%20Vera%20Sans\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\',Helvetica,sans-serif&fwDefault=normal&fsDefault=13px&cornerRadius=.3em&bgColorHeader=ffffdd&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=80&borderColorHeader=bbbbbb&fcHeader=000000&iconColorHeader=707070&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=00&borderColorContent=bbbbbb&fcContent=000000&iconColorContent=222222&bgColorDefault=ffffff&bgTextureDefault=01_flat.png&bgImgOpacityDefault=0&borderColorDefault=bbbbbb&fcDefault=b00000&iconColorDefault=b00000&bgColorHover=ffffdd&bgTextureHover=01_flat.png&bgImgOpacityHover=0&borderColorHover=505050&fcHover=505050&iconColorHover=505050&bgColorActive=303030&bgTextureActive=03_highlight_soft.png&bgImgOpacityActive=30&borderColorActive=bbbbbb&fcActive=eeeeee&iconColorActive=d7d7d7&bgColorHighlight=c0f0c0&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=c0f0c0&fcHighlight=363636&iconColorHighlight=4b954f&bgColorError=ffddcc&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=9b081d&fcError=500000&iconColorError=9b081d&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px link] at the time of this writing, for Trac 1.0.0).
     56The [source:trunk/trac/htdocs/css/jquery-ui/jquery-ui.css@11493:50#40 jquery-ui.css] file contains a link to the theme roller with preselected values. [http://jqueryui.com/themeroller/?ctl=themeroller&ffDefault=Verdana,Arial,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'Bitstream%20Vera%20Sans\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\',Helvetica,sans-serif&fwDefault=normal&fsDefault=13px&cornerRadius=.3em&bgColorHeader=ffffdd&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=80&borderColorHeader=bbbbbb&fcHeader=000000&iconColorHeader=707070&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=00&borderColorContent=bbbbbb&fcContent=000000&iconColorContent=222222&bgColorDefault=ffffff&bgTextureDefault=01_flat.png&bgImgOpacityDefault=0&borderColorDefault=bbbbbb&fcDefault=b00000&iconColorDefault=b00000&bgColorHover=ffffdd&bgTextureHover=01_flat.png&bgImgOpacityHover=0&borderColorHover=505050&fcHover=505050&iconColorHover=505050&bgColorActive=303030&bgTextureActive=03_highlight_soft.png&bgImgOpacityActive=30&borderColorActive=bbbbbb&fcActive=eeeeee&iconColorActive=d7d7d7&bgColorHighlight=c0f0c0&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=c0f0c0&fcHighlight=363636&iconColorHighlight=4b954f&bgColorError=ffddcc&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=9b081d&fcError=500000&iconColorError=9b081d&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px Themeroller link] for Trac 1.0.0.
    5857
    59 
    60 ===== jQuery UI Timepicker Addon #Timepicker
     58==== jQuery UI Timepicker Addon #Timepicker
    6159
    6260We use the [http://trentrichardson.com/examples/timepicker/ Timepicker extension] for the standard jQuery UI datepicker.
    6361
    64 We get the releases from the following URLs:
     62Get the release that matches the jQuery UI version:
    6563  `https://github.com/trentrichardson/jQuery-Timepicker-Addon/tree/v1.1.1`
    66 
    67 Get the release matching the jQuery UI version we use.
    6864
    6965The `jquery-ui-timepicker-addon.js` file is usually compressed using the [https://developers.google.com/closure/compiler/ Google Closure Compiler], which gives good results. The minified file is saved in [source:trunk/trac/htdocs/js/jquery-ui-addons.js trac/htdocs/js/jquery-ui-addons.js].
     
    7167Finally, the `jquery-ui-timepicker-addon.css` file is merged with the [source:trunk/trac/htdocs/css/jquery-ui-addons.css trac/htdocs/css/jquery-ui-addons.css] file.
    7268
    73 ===== TracIni settings
     69==== TracIni settings
    7470
    7571After an upgrade, don't forget to update the default values for the `jquery_ui_location` and `jquery_ui_theme_location` settings. See for example r11576.