Bug Tracker

Changeset 4990

Show
Ignore:
Timestamp:
03/15/08 18:42:59 (10 months ago)
Author:
paul.bakaus
Message:

ui: added new ui.base.js file. Please include this file in every test and demo. It includes the helper functions previously found in ui.mouse.js.

Location:
trunk/ui
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.mouse.js

    r4829 r4990  
    11(function($) { 
    2      
    3     //If the UI scope is not available, add it 
    4     $.ui = $.ui || {}; 
    5      
    6     //Add methods that are vital for all mouse interaction stuff (plugin registering) 
    7     $.extend($.ui, { 
    8         plugin: { 
    9             add: function(module, option, set) { 
    10                 var proto = $.ui[module].prototype; 
    11                 for(var i in set) { 
    12                     proto.plugins[i] = proto.plugins[i] || []; 
    13                     proto.plugins[i].push([option, set[i]]); 
    14                 } 
    15             }, 
    16             call: function(instance, name, arguments) { 
    17                 var set = instance.plugins[name]; if(!set) return; 
    18                 for (var i = 0; i < set.length; i++) { 
    19                     if (instance.options[set[i][0]]) set[i][1].apply(instance.element, arguments); 
    20                 } 
    21             }    
    22         }, 
    23         cssCache: {}, 
    24         css: function(name) { 
    25             if ($.ui.cssCache[name]) return $.ui.cssCache[name]; 
    26              
    27             var tmp = $('<div class="ui-resizable-gen">').addClass(name).css( 
    28                 {position:'absolute', top:'-5000px', left:'-5000px', display:'block'} 
    29             ).appendTo('body'); 
    30              
    31             //Opera and Safari set width and height to 0px instead of auto 
    32             //Safari returns rgba(0,0,0,0) when bgcolor is not set 
    33             $.ui.cssCache[name] = !!( 
    34                 ((/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||  
    35                 !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))) 
    36             ); 
    37             try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){} 
    38             return $.ui.cssCache[name]; 
    39         }, 
    40         disableSelection: function(e) { 
    41             if (!e) return; 
    42             e.unselectable = "on"; 
    43             e.onselectstart = function() {  return false; }; 
    44             if (e.style) e.style.MozUserSelect = "none"; 
    45         }, 
    46         enableSelection: function(e) { 
    47             if (!e) return; 
    48             e.unselectable = "off"; 
    49             e.onselectstart = function() { return true; }; 
    50             if (e.style) e.style.MozUserSelect = ""; 
    51         }, 
    52         hasScroll: function(e, a) { 
    53       var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; 
    54       if (e[scroll] > 0) return true; e[scroll] = 1; 
    55       has = e[scroll] > 0 ? true : false; e[scroll] = 0; 
    56       return has;  
    57     } 
    58     }); 
    59      
    60     /********************************************************************************************************/ 
    612 
    623    $.fn.extend({ 
     
    7314        } 
    7415    }); 
    75      
    76     /********************************************************************************************************/ 
    7716     
    7817    $.ui.mouseInteraction = function(element, options) {