Commits

David Jean Louis committed cf6cce2

use jQuery.noConflict() and replaced all occurences of $

  • Participants
  • Parent commits cf3ebcf

Comments (0)

Files changed (4)

admin_tools/dashboard/templates/dashboard/dashboard.html

     if (typeof jQuery == 'undefined') {
         var script_url = '{{ media_url }}/admin_tools/js/jquery/jquery-1.4.1.min.js';
         document.write(unescape('%3Cscript src="' + script_url + '" type="text/javascript"%3E%3C/script%3E'));
+        jQuery.noConflict();
     }
 </script>
 <script type="text/javascript" charset="utf-8">
 
 <script type="text/javascript">
 // <![CDATA[
-$(document).ready(function() {
-    $('#{{ dashboard.get_id }}').dashboard({
+jQuery(document).ready(function() {
+    jQuery('#{{ dashboard.get_id }}').dashboard({
         'columns': {{ dashboard.columns }}
     });
 });

admin_tools/media/admin_tools/js/jquery/jquery.dashboard.js

  * DEALINGS IN THE SOFTWARE.
  */
 
-(function($) {
+(function(jQuery) {
 
-    $.fn.extend({
+    jQuery.fn.extend({
         //pass the options variable to the function
         dashboard: function(options) {
             //Set the default values, use comma to separate the settings, example:
                 dashboard_module_class: 'dashboard-module',
                 columns: 2
             }    
-            var options = $.extend(defaults, options);
+            var options = jQuery.extend(defaults, options);
 
             return this.each(function() {
                 // set ids for dashboard modules
-                _initialize($(this), options);
+                _initialize(jQuery(this), options);
                 // restore positions, must be done *before* columnize
-                _restore_positions($(this), options);
+                _restore_positions(jQuery(this), options);
                 // columnize the dashboard modules
-                _columnize($(this), options);
+                _columnize(jQuery(this), options);
                 // add draggable behaviour
-                _set_draggable($(this), options);
+                _set_draggable(jQuery(this), options);
                 // add collapsible behaviour
-                _set_collapsible($(this), options);
+                _set_collapsible(jQuery(this), options);
                 // add deletable behaviour
-                _set_deletable($(this), options);
+                _set_deletable(jQuery(this), options);
                 // add addable behaviour to dashboard panel items
-                _set_addable($(this), options);
+                _set_addable(jQuery(this), options);
                 // restore user preferences
-                _restore_preferences($(this), options);
+                _restore_preferences(jQuery(this), options);
             });
         }
     });
             cookie_name = 'admin-tools.' + options.dashboard_id;
         }
         if (preferences === false) {
-            var json_str = $.cookie(cookie_name);
+            var json_str = jQuery.cookie(cookie_name);
             preferences = json_str ? JSON.parse(json_str) : {};
         }
         // set ids if not set
         elt.children('div[id!=' + options.panel_id +']').each(function(index) {
-            if (!$(this).attr('id')) {
-                $(this).attr('id', 'module_' + index);
+            if (!jQuery(this).attr('id')) {
+                jQuery(this).attr('id', 'module_' + index);
             }
         });
     };
 
     var _restore_preferences = function(elt, options) {
         elt.children().children('.disabled').each(function() {
-            _delete_element($(this), options);
+            _delete_element(jQuery(this), options);
         });
         if (preferences['disabled']) {
-            $.each(preferences['disabled'], function(k, v) {
-                v ? _delete_element($('#'+k), options) : _add_element($('#'+k), options);
+            jQuery.each(preferences['disabled'], function(k, v) {
+                v ? _delete_element(jQuery('#'+k), options) : _add_element(jQuery('#'+k), options);
             });
         }
         if (preferences['collapsed']) {
-            $.each(preferences['collapsed'], function(k, v) {
+            jQuery.each(preferences['collapsed'], function(k, v) {
                 if (v) {
-                    _toggle_element($('#'+k), options);
+                    _toggle_element(jQuery('#'+k), options);
                 }
             });
         }
         // if there's no element in the panel, hide it
-        if (!$('#' + options.panel_id).find('li').length) {
-            $('#' + options.panel_id).hide();
+        if (!jQuery('#' + options.panel_id).find('li').length) {
+            jQuery('#' + options.panel_id).hide();
         }
     };
 
                 _set_preference('positions', false, _get_positions(elt, options));
                 var columns = [];
                 elt.children('.dashboard-column').each(function() {
-                    columns.push($(this).children().length);
+                    columns.push(jQuery(this).children().length);
                 });
                 _set_preference('columns', false, columns);
             }
 
     var _set_collapsible = function(elt, options) {
         elt.find('.collapsible h2').each(function() {
-            $(this).append('<a href="#" class="toggle-icon">Toggle</a>').find('a.toggle-icon').click(function() {
-                var prnt = $(this).parent().parent();
+            jQuery(this).append('<a href="#" class="toggle-icon">Toggle</a>').find('a.toggle-icon').click(function() {
+                var prnt = jQuery(this).parent().parent();
                 _toggle_element(prnt, options, true);
             });
         });
 
     var _set_deletable = function(elt, options) {
         elt.find('.deletable h2').each(function() {
-            $(this).append('<a href="#" class="close-icon">Close</a>').find('a.close-icon').click(function() {
-                var prnt = $(this).parent().parent();
+            jQuery(this).append('<a href="#" class="close-icon">Close</a>').find('a.close-icon').click(function() {
+                var prnt = jQuery(this).parent().parent();
                 _delete_element(prnt, options, true);
             });
         });
     };
 
     var _delete_element = function(elt, options, save_preference) {
-        var existing = $('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']');
+        var existing = jQuery('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']');
         if (!existing.length) {
-            var panel_ul = $('#' + options.panel_id).find('ul');
+            var panel_ul = jQuery('#' + options.panel_id).find('ul');
             if (!panel_ul.length) {
-                $('#' + options.panel_id).append('<ul/>');
-                panel_ul = $('#' + options.panel_id).find('ul');
+                jQuery('#' + options.panel_id).append('<ul/>');
+                panel_ul = jQuery('#' + options.panel_id).find('ul');
             }
             panel_ul.append(
                 '<li><a href="#" rel="' 
                 + elt.find('h2').contents().first().text() 
                 + '</a></li>'
             );
-            _set_addable(elt, options, $('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']'));
+            _set_addable(elt, options, jQuery('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']'));
         } else {
             existing.parent().show();
         }
         elt.fadeOut('fast');
-        $('#' + options.panel_id).show();
+        jQuery('#' + options.panel_id).show();
         if (save_preference) {
             _set_preference('disabled', elt.attr('id'), true);
         }
 
     var _set_addable = function(elt, options, elts) {
         if (!elts) {
-            elts = $('#'+options.panel_id).find('li a');
+            elts = jQuery('#'+options.panel_id).find('li a');
         }
         elts.click(function() {
-            _add_element($('#'+$(this).attr('rel')), options, true);
+            _add_element(jQuery('#'+jQuery(this).attr('rel')), options, true);
         });
     };
 
     var _add_element = function(elt, options, save_preference) {
-        panel_elt = $('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']');
+        panel_elt = jQuery('#'+options.panel_id).find('li a[rel='+elt.attr('id')+']');
         panel_elt.parent().remove();
         elt.removeClass('disabled');
         elt.fadeIn('fast');
             _set_preference('disabled', elt.attr('id'), false);
         }
         // if there's no element in the panel, hide it
-        if (!$('#' + options.panel_id).find('li').length) {
-            $('#' + options.panel_id).hide();
+        if (!jQuery('#' + options.panel_id).find('li').length) {
+            jQuery('#' + options.panel_id).hide();
         }
     };
 
             }
         } catch (e) {
         }
-        $.cookie(cookie_name, JSON.stringify(preferences), {expires: 1825});
+        jQuery.cookie(cookie_name, JSON.stringify(preferences), {expires: 1825});
     };
 
     var _get_positions = function(elt, options) {
         var modules = [];
         if (!elt.children('.dashboard-column').length) {
             elt.children('div[id!=' + options.panel_id +']').each(function() {
-                modules.push($(this).attr('id'));
+                modules.push(jQuery(this).attr('id'));
             });
         } else {
             elt.children('.dashboard-column').each(function() {
-                $.each($(this).sortable('toArray'), function(index, item) {
+                jQuery.each(jQuery(this).sortable('toArray'), function(index, item) {
                     modules.push(item);
                 });
             });

admin_tools/media/admin_tools/js/menu.js

  * @return void
  */
 var process_bookmarks = function(url, title, prompt_msg) {
-    var json_str = $.cookie('menu.bookmarks');
+    var json_str = jQuery.cookie('menu.bookmarks');
     var bookmarks = json_str ? JSON.parse(json_str) : [];
-    $('#bookmark-button').click(function() {
-        if ($(this).hasClass('bookmarked')) {
-            $(this).removeClass('bookmarked');
-            $('#navigation-menu li.bookmark ul li a[href="' + url + '"]').parent().remove();
-            if (!$('#navigation-menu li.bookmark ul li').length) {
-                $('#navigation-menu li.bookmark ul').remove();
-                $('#navigation-menu li.bookmark a span').remove();
-                $('#navigation-menu li.bookmark').addClass('disabled');
+    jQuery('#bookmark-button').click(function() {
+        if (jQuery(this).hasClass('bookmarked')) {
+            jQuery(this).removeClass('bookmarked');
+            jQuery('#navigation-menu li.bookmark ul li a[href="' + url + '"]').parent().remove();
+            if (!jQuery('#navigation-menu li.bookmark ul li').length) {
+                jQuery('#navigation-menu li.bookmark ul').remove();
+                jQuery('#navigation-menu li.bookmark a span').remove();
+                jQuery('#navigation-menu li.bookmark').addClass('disabled');
             }
             for (var i=0; i < bookmarks.length; i++) {
                 if (bookmarks[i].url == url) {
                     bookmarks.splice(i, 1);
-                    $.cookie('menu.bookmarks', JSON.stringify(bookmarks), {
+                    jQuery.cookie('menu.bookmarks', JSON.stringify(bookmarks), {
                         expires: 1825,
                         path: '/admin/' // harcode path to have a unique cookie across pages
                     });
             if (!title) {
                 return;
             }
-            $(this).addClass('bookmarked');
-            if (!$('#navigation-menu li.bookmark ul').length) {
-                $('#navigation-menu li.bookmark a').prepend('<span class="icon"/>');
-                $('#navigation-menu li.bookmark').append('<ul/>');
+            jQuery(this).addClass('bookmarked');
+            if (!jQuery('#navigation-menu li.bookmark ul').length) {
+                jQuery('#navigation-menu li.bookmark a').prepend('<span class="icon"/>');
+                jQuery('#navigation-menu li.bookmark').append('<ul/>');
             }
-            $('#navigation-menu li.bookmark ul').append(
+            jQuery('#navigation-menu li.bookmark ul').append(
                 '<li><a href="' + url + '">' + title + '</a></li>'
             );
-            $('#navigation-menu li.bookmark').removeClass('disabled');
+            jQuery('#navigation-menu li.bookmark').removeClass('disabled');
             var already_bookmarked = false;
             for (var i=0; i < bookmarks.length; i++) {
                 if (bookmarks[i].url == url) {
             }
             if (!already_bookmarked) {
                 bookmarks.push({url: url, title: title});
-                $.cookie('menu.bookmarks', JSON.stringify(bookmarks), {
+                jQuery.cookie('menu.bookmarks', JSON.stringify(bookmarks), {
                     expires: 1825,
                     path: '/admin/' // harcode path to have a unique cookie across pages
                 });

admin_tools/menu/templates/menu/menu.html

     if (typeof jQuery == 'undefined') {
         var jquery_url = '{{ media_url }}/admin_tools/js/jquery/jquery-1.4.1.min.js';
         document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E'));
+        jQuery.noConflict();
     }
 </script>
 <script type="text/javascript" charset="utf-8">
 <script type="text/javascript" charset="utf-8" src="{{ media_url }}/admin_tools/js/menu.js"></script>
 <!--[if IE 6]>
 <script type="text/javascript">
-$(document).ready(function() {
-    $('#navigation-menu').children('li').hover(
-        function() { $(this).addClass('over'); },
-        function() { $(this).removeClass('over'); }
+jQuery(document).ready(function() {
+    jQuery('#navigation-menu').children('li').hover(
+        function() { jQuery(this).addClass('over'); },
+        function() { jQuery(this).removeClass('over'); }
     });
 });
 </script>
 <![endif]-->
 {% if has_bookmark_item %}
 <script type="text/javascript">
-$(document).ready(function() {
+jQuery(document).ready(function() {
     process_bookmarks("{{ request.get_full_path }}", "{{ title }}", "{% trans 'Please enter a name for the bookmark' %}");
 });
 </script>