Changeset 615

Show
Ignore:
Timestamp:
2007-09-24 04:57:30 (1 year ago)
Author:
MaierMan
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/serverswitcher/chrome/content/manager.js

    r614 r615  
    3737const SSW_PREF_ENABLED = 'ssw.enabled'; 
    3838 
    39 function SSWItem() { 
    40         this.n = 1; 
    41         this.i = []; 
    42 }; 
    43 SSWItem.prototype = { 
    44         toString: function() { 
    45                 return this.n; 
    46         } 
    47 }; 
    48  
    49 QueueItem.prototype.__defineGetter__( 
    50         '_ssw_host', 
    51         function() { 
    52                 if (!('_ssw_real_host' in this)) { 
    53                         this._ssw_real_host = Dialog._ssw_getHost(IOService.newURI(this.urlManager.url, null, null).host); 
    54                 } 
    55                 return this._ssw_real_host; 
    56         } 
    57 ); 
    58  
    59  
    60 Dialog._ssw_adjustButton = function() { 
     39// isn't accurate, but is good enough for this use case 
     40function _ssw_getHost(host) { 
     41    var m = host.match(/([^.]+\.(?:[\w]{2,4}|museum)?(?:\.\w{2})?)$/); 
     42    if (m) {  
     43        return m[1]; 
     44    } 
     45    return host; 
     46
     47function _ssw_adjustButton() { 
    6148        if (Preferences.getDTA(SSW_PREF_ENABLED, true)) { 
    6249                $('toolssw').removeAttribute('off'); 
     
    6653        } 
    6754}; 
     55function _ssw_toggle() { 
     56        Preferences.setDTA(SSW_PREF_ENABLED, !Preferences.getDTA(SSW_PREF_ENABLED, true)); 
     57        _ssw_adjustButton();     
     58} 
    6859 
    69 Dialog.ssw_toggle = function() { 
    70         Preferences.setDTA(SSW_PREF_ENABLED, !Preferences.getDTA(SSW_PREF_ENABLED, true))
    71         this._ssw_adjustButton()
     60function SSWItem() { 
     61        this.n = 1
     62        this.i = []
    7263}; 
     64SSWItem.prototype = { 
     65        cmp: function(a, b) { 
     66                return b.n - a.n; 
     67        } 
     68} 
    7369 
    74 // isn't accurate, but is good enough for this use case 
    75 Dialog._ssw_getHost = function ssw_gh(host) { 
    76     var m = host.match(/([^.]+\.(?:[\w]{2,4}|museum)?(?:\.\w{2})?)$/); 
    77     if (m) {  
    78         return m[1]; 
    79     } 
    80     return host; 
    81 
     70QueueItem.prototype.__defineGetter__( 
     71        '_ssw_host', 
     72        function() { 
     73                if (!('_ssw_real_host' in this)) { 
     74                        this._ssw_real_host = _ssw_getHost(IOService.newURI(this.urlManager.url, null, null).host); 
     75                } 
     76                return this._ssw_real_host; 
     77        } 
     78); 
    8279 
    8380Dialog._ssw_startNext = Dialog.startNext; 
     
    134131                } 
    135132                while (a.length && this._running.length < Prefs.maxInProgress) { 
    136                         a.sort(); 
     133                        a.sort(SSWItem.prototype.cmp); 
    137134                        this.run(a[0].i.shift()); 
    138135                        rv = true; 
     
    150147} 
    151148 
    152 addEventListener('load', function() { Dialog._ssw_adjustButton(); }, false); 
     149addEventListener('load', _ssw_adjustButton, false); 
  • sandbox/serverswitcher/chrome/content/manager.xul

    r614 r615  
    99        <script type="application/javascript;version=1.7" src="chrome://dtassw/content/manager.js" /> 
    1010        <toolbar id="tools"> 
    11                 <toolbarbutton label="&ssw.switch.label;" tooltiptext="&ssw.switch.tip;" id="toolssw" onclick="Dialog.ssw_toggle();" insertafter="toolmovebottom" /> 
     11                <toolbarbutton label="&ssw.switch.label;" tooltiptext="&ssw.switch.tip;" id="toolssw" onclick="_ssw_toggle();" insertafter="toolmovebottom" /> 
    1212                <spacer class="visible" insertafter="toolmovebottom" />          
    1313        </toolbar> 
  • sandbox/serverswitcher/chrome/locale/en-US/manager.dtd

    r614 r615  
    11<!ENTITY ssw.switch.label "ServSwitch"> 
    2 <!ENTITY ssw.switch.tip "Try to switch between servers whenever possible"> 
     2<!ENTITY ssw.switch.tip "Try to evenly distribute the load between servers"> 
  • sandbox/serverswitcher/chrome/skin/manager.css

    r614 r615  
    66} 
    77#toolssw:hover { 
    8         -moz-image-region: rect(25px,25px,51px,0px) !important; 
     8        -moz-image-region: rect(25px,25px,50px,0px) !important; 
    99} 
    1010#toolssw[off] { 
    11         -moz-image-region: rect(0px,51px,25px,25px) !important; 
     11        -moz-image-region: rect(0px,50px,25px,25px) !important; 
    1212} 
    1313#toolssw[off]:hover { 
    14         -moz-image-region: rect(25px,51px,51px,25px) !important; 
     14        -moz-image-region: rect(25px,50px,50px,25px) !important; 
    1515}