Changeset 1018
- Timestamp:
- 07/31/08 07:47:59 (1 month ago)
- Files:
-
- trunk/chrome/content/common/internalFunctions.js (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/chrome/content/common/internalFunctions.js
r993 r1018 122 122 var rv = {}; 123 123 merge(rv, obj); 124 rv.prototype = this.prototype;124 merge(rv.prototype, this.prototype); 125 125 rv.constructor = this.constructor; 126 126 return rv; … … 129 129 String.prototype, 130 130 { 131 trim : function() {131 trim: function() { 132 132 return this.replace(/^\s+|\s+$/g, ''); 133 133 }, 134 removeBadChars : function() {134 removeBadChars: function() { 135 135 return this 136 136 .replace(/[\n\r\v?:<>*|"]/g, '_') 137 137 .replace(/%(?:25)?20/g, ' '); 138 138 }, 139 addFinalSlash : function() {139 addFinalSlash: function() { 140 140 if (this.length == 0) { 141 141 return SYSTEMSLASH; … … 147 147 return this; 148 148 }, 149 removeFinalChar : function(c) {149 removeFinalChar: function(c) { 150 150 if (this.length == 0) { 151 151 return this; … … 156 156 return this; 157 157 }, 158 removeLeadingChar : function(c) {158 removeLeadingChar: function(c) { 159 159 if (this.length == 0) { 160 160 return this; … … 165 165 return this; 166 166 }, 167 removeFinalSlash : function() {167 removeFinalSlash: function() { 168 168 return this.removeFinalChar(SYSTEMSLASH); 169 169 }, … … 174 174 return this.replaceSlashes(SYSTEMSLASH); 175 175 }, 176 removeLeadingSlash : function() {176 removeLeadingSlash: function() { 177 177 return this.removeLeadingChar(SYSTEMSLASH); 178 178 }, 179 getUsableFileName : function() {179 getUsableFileName: function() { 180 180 let t = this.replace(/\?.*$/, '') 181 181 .normalizeSlashes() … … 184 184 return t.split(SYSTEMSLASH).pop().removeBadChars().trim(); 185 185 }, 186 getExtension : function() {186 getExtension: function() { 187 187 let name = this.getUsableFileName(); 188 188 let c = name.lastIndexOf('.'); … … 438 438 url = _atos(link); 439 439 } 440 let ext = url.getExtension(); 441 url = 'file' + (ext ? '.' + ext : ''); 442 Debug.logString(url); 440 443 return _getIcon(url, size); 441 444 } … … 676 679 } 677 680 681 // XXX switch to nsITimer? 678 682 function Timer(func, interval, persist, now) { 679 683 this._id = newUUIDString();
