Changeset 615
- Timestamp:
- 2007-09-24 04:57:30 (1 year ago)
- Files:
-
- sandbox/serverswitcher/chrome/content/manager.js (modified) (4 diffs)
- sandbox/serverswitcher/chrome/content/manager.xul (modified) (1 diff)
- sandbox/serverswitcher/chrome/locale/en-US/manager.dtd (modified) (1 diff)
- sandbox/serverswitcher/chrome/skin/manager.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/serverswitcher/chrome/content/manager.js
r614 r615 37 37 const SSW_PREF_ENABLED = 'ssw.enabled'; 38 38 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 40 function _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 } 47 function _ssw_adjustButton() { 61 48 if (Preferences.getDTA(SSW_PREF_ENABLED, true)) { 62 49 $('toolssw').removeAttribute('off'); … … 66 53 } 67 54 }; 55 function _ssw_toggle() { 56 Preferences.setDTA(SSW_PREF_ENABLED, !Preferences.getDTA(SSW_PREF_ENABLED, true)); 57 _ssw_adjustButton(); 58 } 68 59 69 Dialog.ssw_toggle = function() {70 Preferences.setDTA(SSW_PREF_ENABLED, !Preferences.getDTA(SSW_PREF_ENABLED, true));71 this. _ssw_adjustButton();60 function SSWItem() { 61 this.n = 1; 62 this.i = []; 72 63 }; 64 SSWItem.prototype = { 65 cmp: function(a, b) { 66 return b.n - a.n; 67 } 68 } 73 69 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 } 70 QueueItem.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 ); 82 79 83 80 Dialog._ssw_startNext = Dialog.startNext; … … 134 131 } 135 132 while (a.length && this._running.length < Prefs.maxInProgress) { 136 a.sort( );133 a.sort(SSWItem.prototype.cmp); 137 134 this.run(a[0].i.shift()); 138 135 rv = true; … … 150 147 } 151 148 152 addEventListener('load', function() { Dialog._ssw_adjustButton(); }, false);149 addEventListener('load', _ssw_adjustButton, false); sandbox/serverswitcher/chrome/content/manager.xul
r614 r615 9 9 <script type="application/javascript;version=1.7" src="chrome://dtassw/content/manager.js" /> 10 10 <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" /> 12 12 <spacer class="visible" insertafter="toolmovebottom" /> 13 13 </toolbar> sandbox/serverswitcher/chrome/locale/en-US/manager.dtd
r614 r615 1 1 <!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 6 6 } 7 7 #toolssw:hover { 8 -moz-image-region: rect(25px,25px,5 1px,0px) !important;8 -moz-image-region: rect(25px,25px,50px,0px) !important; 9 9 } 10 10 #toolssw[off] { 11 -moz-image-region: rect(0px,5 1px,25px,25px) !important;11 -moz-image-region: rect(0px,50px,25px,25px) !important; 12 12 } 13 13 #toolssw[off]:hover { 14 -moz-image-region: rect(25px,5 1px,51px,25px) !important;14 -moz-image-region: rect(25px,50px,50px,25px) !important; 15 15 }
