Changeset 694
- Timestamp:
- 03/16/08 06:26:23 (9 months ago)
- Files:
-
- trunk/src/chrome/chromeFiles/content/browser.js (modified) (4 diffs)
- trunk/src/chrome/chromeFiles/content/config.js (modified) (4 diffs)
- trunk/src/chrome/chromeFiles/content/convert2RegExp.js (modified) (2 diffs)
- trunk/src/chrome/chromeFiles/content/install.js (modified) (1 diff)
- trunk/src/chrome/chromeFiles/content/manage.js (modified) (4 diffs)
- trunk/src/chrome/chromeFiles/content/menucommander.js (modified) (1 diff)
- trunk/src/chrome/chromeFiles/content/miscapis.js (modified) (2 diffs)
- trunk/src/chrome/chromeFiles/content/pages-overlay.js (modified) (3 diffs)
- trunk/src/chrome/chromeFiles/content/scriptdownloader.js (modified) (1 diff)
- trunk/src/chrome/chromeFiles/content/updater.js (modified) (2 diffs)
- trunk/src/chrome/chromeFiles/content/utils.js (modified) (2 diffs)
- trunk/src/chrome/chromeFiles/content/xmlhttprequester.js (modified) (1 diff)
- trunk/src/components/greasemonkey.js (modified) (1 diff)
- trunk/src/foo/foo.user.js (modified) (4 diffs)
- trunk/src/install.js (modified) (2 diffs)
- trunk/src/perl/convert2RegExp.js (modified) (2 diffs)
- trunk/src/perl/convert2RegExp_1.js (modified) (1 diff)
- trunk/src/perl/convert2RegExp_2.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/chrome/chromeFiles/content/browser.js
r692 r694 171 171 "chrome://greasemonkey/content/icon_small.png", 172 172 greeting, 173 this.bundle.getString( 'greeting.btn'),173 this.bundle.getString("greeting.btn"), 174 174 null /* default doc shell */, 175 175 "install-userscript", … … 197 197 notificationBox.PRIORITY_WARNING_MEDIUM, 198 198 [{ 199 label: this.bundle.getString( 'greeting.btn'),199 label: this.bundle.getString("greeting.btn"), 200 200 accessKey: "I", 201 201 popup: null, … … 531 531 if (GM_getEnabled()) { 532 532 this.statusImage.src = "chrome://greasemonkey/content/icon_small.png"; 533 this.statusImage.tooltipText = this.bundle.getString( 'tooltip.enabled');533 this.statusImage.tooltipText = this.bundle.getString("tooltip.enabled"); 534 534 } else { 535 535 this.statusImage.src = "chrome://greasemonkey/content/icon_small_disabled.png"; 536 this.statusImage.tooltipText = this.bundle.getString( 'tooltip.disabled');536 this.statusImage.tooltipText = this.bundle.getString("tooltip.disabled"); 537 537 } 538 538 … … 545 545 .getService(Components.interfaces.nsIWindowWatcher); 546 546 windowWatcher.openWindow( 547 window, 'chrome://greasemonkey/content/newscript.xul', null,548 'chrome,dependent,centerscreen,resizable,dialog', null547 window, "chrome://greasemonkey/content/newscript.xul", null, 548 "chrome,dependent,centerscreen,resizable,dialog", null 549 549 ); 550 550 }; trunk/src/chrome/chromeFiles/content/config.js
r693 r694 322 322 if (from == -1) return; 323 323 324 if (typeof destination == 'number') { // if destination is an offset324 if (typeof destination == "number") { // if destination is an offset 325 325 to = from + destination; 326 326 to = Math.max(0, to); … … 334 334 var tmp = this._scripts.splice(from, 1)[0]; 335 335 this._scripts.splice(to, 0, tmp); 336 this._changed(script, 'move', to);336 this._changed(script, "move", to); 337 337 }, 338 338 … … 413 413 get description() { return this._description; }, 414 414 get enabled() { return this._enabled; }, 415 set enabled(enabled) { this._enabled = enabled; this._changed( 'edit-enabled', enabled); },415 set enabled(enabled) { this._enabled = enabled; this._changed("edit-enabled", enabled); }, 416 416 417 417 get includes() { return this._includes.concat(); }, 418 418 get excludes() { return this._excludes.concat(); }, 419 addInclude: function(url) { this._includes.push(url); this._changed( 'edit-include-add', url); },420 removeIncludeAt: function(index) { this._includes.splice(index, 1); this._changed( 'edit-include-remove', index); },421 addExclude: function(url) { this._excludes.push(url); this._changed( 'edit-exclude-add', url); },422 removeExcludeAt: function(index) { this._excludes.splice(index, 1); this._changed( 'edit-exclude-remove', index); },419 addInclude: function(url) { this._includes.push(url); this._changed("edit-include-add", url); }, 420 removeIncludeAt: function(index) { this._includes.splice(index, 1); this._changed("edit-include-remove", index); }, 421 addExclude: function(url) { this._excludes.push(url); this._changed("edit-exclude-add", url); }, 422 removeExcludeAt: function(index) { this._excludes.splice(index, 1); this._changed("edit-exclude-remove", index); }, 423 423 424 424 get requires() { return this._requires.concat(); }, … … 452 452 } 453 453 454 name = name.replace(/\s+/g, '_').replace(/[^-_A-Z0-9]+/gi, '');455 ext = ext.replace(/\s+/g, '_').replace(/[^-_A-Z0-9]+/gi, '');454 name = name.replace(/\s+/g, "_").replace(/[^-_A-Z0-9]+/gi, ""); 455 ext = ext.replace(/\s+/g, "_").replace(/[^-_A-Z0-9]+/gi, ""); 456 456 457 457 // If no Latin characters found - use default trunk/src/chrome/chromeFiles/content/convert2RegExp.js
r692 r694 7 7 for (var i = 0 ; i < s.length ; i++) { 8 8 switch(s[i]) { 9 case '*':9 case "*" : 10 10 res += ".*"; 11 11 break; 12 12 13 case '.':14 case '?':15 case '^':16 case '$':17 case '+':18 case '{':19 case '[':20 case '|':21 case '(':22 case ')':23 case ']':13 case "." : 14 case "?" : 15 case "^" : 16 case "$" : 17 case "+" : 18 case "{" : 19 case "[" : 20 case "|" : 21 case "(" : 22 case ")" : 23 case "]" : 24 24 res += "\\" + s[i]; 25 25 break; 26 26 27 case '\\':27 case "\\" : 28 28 res += "\\\\"; 29 29 break; 30 30 31 case ' ':31 case " " : 32 32 // Remove spaces from URLs. 33 33 break; … … 48 48 res = tldRes[1] + tldStr + tldRes[3]; 49 49 } 50 return new RegExp(res + '$', "i");50 return new RegExp(res + "$", "i"); 51 51 } trunk/src/chrome/chromeFiles/content/install.js
r690 r694 26 26 this.greetz = new Array(); 27 27 for(var i = 0; i < 6; i++){ 28 this.greetz.push(this.bundle.getString( 'greetz.'+ i));28 this.greetz.push(this.bundle.getString("greetz." + i)); 29 29 } 30 30 trunk/src/chrome/chromeFiles/content/manage.js
r693 r694 94 94 if (desc[i].length > wordLen) { 95 95 for (var j = desc[i].length; j > 0; j -= wordLen) { 96 desc[i] = desc[i].substr(0,j) + '\u200B'+ desc[i].substr(j);96 desc[i] = desc[i].substr(0,j) + "\u200B" + desc[i].substr(j); 97 97 } 98 98 } 99 99 } 100 desc = desc.join( ' ');100 desc = desc.join(" "); 101 101 102 102 header.textContent = selectedScript.name; … … 167 167 168 168 onDragStart: function (event, transferData, action) { 169 if ( 'listitem'!= event.target.tagName ) return false;169 if ("listitem" != event.target.tagName ) return false; 170 170 171 171 transferData.data = new TransferData(); … … 218 218 } else { 219 219 if (0 == newIndex) { 220 listbox.firstChild.setAttribute( 'dragover', 'top');220 listbox.firstChild.setAttribute("dragover", "top"); 221 221 } else if (newIndex >= listbox.childNodes.length) { 222 listbox.lastChild.setAttribute( 'dragover', 'bottom');222 listbox.lastChild.setAttribute("dragover", "bottom"); 223 223 } else { 224 listbox.childNodes[newIndex - 1].setAttribute( 'dragover', 'bottom');224 listbox.childNodes[newIndex - 1].setAttribute("dragover", "bottom"); 225 225 } 226 226 } … … 230 230 231 231 clearFeedback: function() { 232 var box = document.getElementById( 'lstScripts');232 var box = document.getElementById("lstScripts"); 233 233 for (var i = 0, el; el = box.childNodes[i]; i++) { 234 el.removeAttribute( 'dragover');234 el.removeAttribute("dragover"); 235 235 } 236 236 }, trunk/src/chrome/chromeFiles/content/menucommander.js
r692 r694 28 28 } 29 29 30 GM_log( 'accelKey: '+ accelKey);31 GM_log( 'modifiers: '+ accelModifiers);32 GM_log( 'accessKey: '+ accessKey);30 GM_log("accelKey: " + accelKey); 31 GM_log("modifiers: " + accelModifiers); 32 GM_log("accessKey: " + accessKey); 33 33 34 34 var menuItem = this.createMenuItem(commandName, commandFunc, accessKey); trunk/src/chrome/chromeFiles/content/miscapis.js
r692 r694 71 71 function GM_addStyle(doc, css) { 72 72 var head, style; 73 head = doc.getElementsByTagName( 'head')[0];73 head = doc.getElementsByTagName("head")[0]; 74 74 if (!head) { return; } 75 style = doc.createElement( 'style');76 style.type = 'text/css';75 style = doc.createElement("style"); 76 style.type = "text/css"; 77 77 style.innerHTML = css; 78 78 head.appendChild(style); … … 96 96 this.log = function() { 97 97 logger.log( 98 Array.prototype.slice.apply(arguments).join( '\n')98 Array.prototype.slice.apply(arguments).join("\n") 99 99 ); 100 100 }; trunk/src/chrome/chromeFiles/content/pages-overlay.js
r693 r694 15 15 this.populate = function(script) { 16 16 this.clear(); 17 includesBox.populate(script, 'includes', script.includes);18 excludesBox.populate(script, 'excludes', script.excludes);17 includesBox.populate(script, "includes", script.includes); 18 excludesBox.populate(script, "excludes", script.excludes); 19 19 this.script = script; 20 20 GM_getConfig().addObserver(this, this.script); … … 85 85 86 86 if (val && val != "") { 87 self.type == 'includes'?87 self.type == "includes" ? 88 88 self.script.addInclude(val): 89 89 self.script.addExclude(val); … … 97 97 98 98 function remove(ev) { 99 self.type == 'includes'?99 self.type == "includes" ? 100 100 self.script.removeIncludeAt(self.listbox.selectedIndex): 101 101 self.script.removeExcludeAt(self.listbox.selectedIndex); trunk/src/chrome/chromeFiles/content/scriptdownloader.js
r692 r694 45 45 if (this.req_.status != 200 && this.req_.status != 0) { 46 46 // NOTE: Unlocalized string 47 alert( 'Error loading user script:\n'+47 alert("Error loading user script:\n" + 48 48 this.req_.status + ": " + 49 49 this.req_.statusText); trunk/src/chrome/chromeFiles/content/updater.js
r690 r694 147 147 .replace(/%ITEM_VERSION%/g, 148 148 this.currentVersion) 149 .replace(/%REQ_VERSION%/gi, '1');149 .replace(/%REQ_VERSION%/gi, "1"); 150 150 GM_log("ExtensionUpdater: UpdateURL: " + this.updateURL); 151 151 return true; … … 265 265 var items = [this.updateLink]; 266 266 267 // Figure out if extension should be updated (default to 'yes')267 // Figure out if extension should be updated (default to "yes") 268 268 var autoupdate = GM_prefRoot.getValue("enableUpdate", 269 269 AUTOUPDATE_DEFAULT_VALUE); 270 270 if (autoupdate == false) { 271 this.success( 'Would have updated, except update is disabled');271 this.success("Would have updated, except update is disabled"); 272 272 } else { 273 273 GM_log("ExtensionUpdater: Extension '" + this.name + "' updating..."); trunk/src/chrome/chromeFiles/content/utils.js
r692 r694 55 55 */ 56 56 function GM_logError(e, opt_warn, fileName, lineNumber) { 57 var consoleService = Components.classes[ '@mozilla.org/consoleservice;1']57 var consoleService = Components.classes["@mozilla.org/consoleservice;1"] 58 58 .getService(Components.interfaces.nsIConsoleService); 59 59 60 var consoleError = Components.classes[ '@mozilla.org/scripterror;1']60 var consoleError = Components.classes["@mozilla.org/scripterror;1"] 61 61 .createInstance(Components.interfaces.nsIScriptError); 62 62 … … 305 305 306 306 for (var i = 0; i < numSubversions; i++) { 307 if (typeof v2[i] == 'undefined') {307 if (typeof v2[i] == "undefined") { 308 308 return 1; 309 309 } 310 310 311 if (typeof v1[i] == 'undefined') {311 if (typeof v1[i] == "undefined") { 312 312 return -1; 313 313 } trunk/src/chrome/chromeFiles/content/xmlhttprequester.js
r692 r694 98 98 responseHeaders:(req.readyState == 4 ? 99 99 req.getAllResponseHeaders() : 100 ''),100 ""), 101 101 status:(req.readyState == 4 ? req.status : 0), 102 statusText:(req.readyState == 4 ? req.statusText : ''),103 finalUrl:(req.readyState == 4 ? req.channel.URI.spec : '')102 statusText:(req.readyState == 4 ? req.statusText : ""), 103 finalUrl:(req.readyState == 4 ? req.channel.URI.spec : "") 104 104 } 105 105 trunk/src/components/greasemonkey.js
r692 r694 30 30 if (stack.filename != null && 31 31 stack.filename != gmSvcFilename && 32 stack.filename.substr(0, 6) != 'chrome') {32 stack.filename.substr(0, 6) != "chrome") { 33 33 GM_logError(new Error("Greasemonkey access violation: unsafeWindow " + 34 34 "cannot call " + apiName + ".")); trunk/src/foo/foo.user.js
r691 r694 14 14 (function() 15 15 { 16 if ( confirm( 'Are you sure you want to run these tests?' )) {16 if (confirm("Are you sure you want to run these tests?")) { 17 17 18 18 const scriptName = "foo.user.js"; 19 19 20 alert( '> '+ scriptName);21 GM_log( '> '+ scriptName);20 alert("> " + scriptName); 21 GM_log("> " + scriptName); 22 22 23 GM_setValue( 'test1', scriptName );24 GM_setValue( 'test2', 31415 );25 GM_setValue( 'test3', true );23 GM_setValue("test1", scriptName ); 24 GM_setValue("test2", 31415 ); 25 GM_setValue("test3", true ); 26 26 27 GM_log( '< test1: ' + GM_getValue('test1', ""));28 GM_log( '< test2: ' + GM_getValue('test2', 0));29 GM_log( '< test3: ' + GM_getValue('test3', undefined));27 GM_log("< test1: " + GM_getValue("test1", "")); 28 GM_log("< test2: " + GM_getValue("test2", 0)); 29 GM_log("< test3: " + GM_getValue("test3", undefined)); 30 30 31 GM_log( '>< test4: ' + GM_getValue('test4', "nofoo"));32 GM_log( '>< test5: ' + GM_getValue('test5', 8675309));33 GM_log( '>< test6: ' + GM_getValue('test6', false));31 GM_log(">< test4: " + GM_getValue("test4", "nofoo")); 32 GM_log(">< test5: " + GM_getValue("test5", 8675309)); 33 GM_log(">< test6: " + GM_getValue("test6", false)); 34 34 35 GM_log( '>< test7: ' + GM_getValue('test7', undefined));36 GM_log( '>< test8: ' + GM_getValue('test8', null));35 GM_log(">< test7: " + GM_getValue("test7", undefined)); 36 GM_log(">< test8: " + GM_getValue("test8", null)); 37 37 38 GM_openInTab( 'http://www.google.com/');39 GM_log( '>< test9: Enough google?');38 GM_openInTab("http://www.google.com/"); 39 GM_log(">< test9: Enough google?"); 40 40 41 41 GM_addStyle("body { color:white; background-color:black }"); 42 GM_log( '>< test10: body inversion');42 GM_log(">< test10: body inversion"); 43 43 44 44 GM_registerMenuCommand( 45 45 "Important Message (jJ)", 46 46 function() { 47 alert( "BOO!"); // And if you're reading this now, you're CHEATING!!! but good for you! ;D47 alert("BOO!"); // And if you're reading this now, you're CHEATING!!! but good for you! ;D 48 48 }, 49 49 "j", … … 51 51 "j" 52 52 ); 53 alert( 'Please press ctrl-alt-shift + j to see an important message later');53 alert("Please press ctrl-alt-shift + j to see an important message later"); 54 54 55 alert( 'This next test you will need Live http headers add-on open\n'+56 'to examine the headers after a brief message from the Monkey source.');55 alert("This next test you will need Live http headers add-on open\n" + 56 "to examine the headers after a brief message from the Monkey source."); 57 57 58 58 GM_xmlhttpRequest({ … … 74 74 }); 75 75 76 alert( GM_getResourceText( "fooSource" ));76 alert(GM_getResourceText("fooSource")); 77 77 78 78 var fooCon1 = GM_getResourceURL("fooCon1"); … … 80 80 var fooCon3 = GM_getResourceURL("fooCon3"); 81 81 82 if ( confirm( 'Are you sure you want to continue to run these tests?' )) {82 if (confirm "Are you sure you want to continue to run these tests?")) { 83 83 document.open(); 84 document.write( "<html>" +85 "<h1>It's as easy as</h1>" +86 "<body>" +87 "<img src=" + fooCon1 + " /><img src=" + fooCon2 + " /><img src=" + fooCon3 + " />" +88 "</body>" +89 "</html>");84 document.write("<html>" + 85 "<h1>It's as easy as</h1>" + 86 "<body>" + 87 "<img src=" + fooCon1 + " /><img src=" + fooCon2 + " /><img src=" + fooCon3 + " />" + 88 "</body>" + 89 "</html>"); 90 90 document.close(); 91 91 } 92 92 93 GM_log( '< ' + scriptName);94 alert( '< ' + scriptName);93 GM_log("< " + scriptName); 94 alert("< " + scriptName); 95 95 } 96 96 })(); trunk/src/install.js
r692 r694 20 20 en-US Localized strings 21 21 ********************************************************************************/ 22 const MSG_ADDING = 'Adding ' + APP_PREFS_FILE + ' in '; 23 const MSG_ERRCODE = 'Error code:'; 24 const MSG_PROMPT = 'Do you wish to install ' + APP_DISPLAY_NAME + ' to your profile?\n' 25 + 'If you are in doubt, this is the preferred option: Select OK.\n' 26 + '(Select Cancel to install in the Mozilla directory.)'; 27 const MSG_RETRYING = 'Chrome registration problem. This maybe transient, trying again...'; 28 const MSG_SUCCESS = APP_DISPLAY_NAME + ' ' + APP_VERSION + ' has been succesfully installed.\n' 29 + 'Please restart your browser before continuing.'; 22 const MSG_ADDING = "Adding " + APP_PREFS_FILE + " in "; 23 const MSG_ERRCODE = "Error code:"; 24 const MSG_PROMPT = "Do you wish to install " + APP_DISPLAY_NAME + 25 " to your profile?\n" + 26 "If you are in doubt, this is the preferred option: Select OK.\n" + 27 "(Select Cancel to install in the Mozilla directory.)"; 30 28 31 const MSG_FAILAPPNAME = 'Failed to create ' + APP_NAME + '\n' 32 + 'You probably do not have appropriate permissions \n' 33 + '(write access to profile or chrome directory). \n' 34 + '_____________________________\nError code:'; 29 const MSG_RETRYING = "Chrome registration problem. This maybe transient, " + 30 "trying again..."; 35 31 36 const MSG_FAILWARNING = 'WARNING: PARTIAL INSTALLATION\n' 37 + 'A component requiring write permissions failed in the SeaMonkey program directory.\n' 38 + 'You will need to either reinstall ' + APP_DISPLAY_NAME + 'once as Adminstrator or root\n' 39 + 'or install SeaMonkey in a user-writable location.'; 32 const MSG_SUCCESS = APP_DISPLAY_NAME + " " + APP_VERSION + 33 " has been succesfully installed.\n" + 34 "Please restart your browser before continuing."; 40 35 41 const MSG_FAILINST = 'Install failed! Error code:'; 36 const MSG_FAILAPPNAME = "Failed to create " + APP_NAME + "\n" + 37 "You probably do not have appropriate permissions \n" + 38 "(write access to profile or chrome directory). \n" + 39 "_____________________________\nError code:"; 42 40 43 const MSG_TRANSIENT = 'This specific error may be transient:' 44 + '\nIf you retry the install again, it may go away.'; 41 const MSG_FAILWARNING = "WARNING: PARTIAL INSTALLATION\n" + 42 "A component requiring write permissions failed in the SeaMonkey program directory.\n" + 43 "You will need to either reinstall " + APP_DISPLAY_NAME + 44 "once as Adminstrator or root\n" + 45 "or install SeaMonkey in a user-writable location."; 46 47 const MSG_FAILINST = "Install failed! Error code:"; 48 49 const MSG_TRANSIENT = "This specific error may be transient:\n" + 50 "If you retry the install again, it may go away."; 45 51 46 52 /******************************************************************************** … … 120 126 } 121 127 } else { 122 alert(((err == -239) ? MSG_FAILINST + '\n'+ MSG_TRANSIENT : MSG_FAILINST) + err);128 alert(((err == -239) ? MSG_FAILINST + "\n"+ MSG_TRANSIENT : MSG_FAILINST) + err); 123 129 cancelInstall(err); 124 130 return; trunk/src/perl/convert2RegExp.js
r392 r694 8 8 for (var i = 0 ; i < s.length ; i++) { 9 9 switch(s[i]) { 10 case '*':10 case "*" : 11 11 res += ".*"; 12 12 break; 13 13 14 case '.':15 case '?':16 case '^':17 case '$':18 case '+':19 case '{':20 case '[':21 case '|':22 case '(':23 case ')':24 case ']':14 case "." : 15 case "?" : 16 case "^" : 17 case "$" : 18 case "+" : 19 case "{" : 20 case "[" : 21 case "|" : 22 case "(" : 23 case ")" : 24 case "]" : 25 25 res += "\\" + s[i]; 26 26 break; 27 27 28 case '\\':28 case "\\" : 29 29 res += "\\\\"; 30 30 break; 31 31 32 case ' ':32 case " " : 33 33 // Remove spaces from URLs. 34 34 break; … … 49 49 res = tldRes[1] + tldStr + tldRes[3]; 50 50 } 51 return new RegExp(res + '$', "i");51 return new RegExp(res + "$", "i"); 52 52 } trunk/src/perl/convert2RegExp_1.js
r392 r694 8 8 for (var i = 0 ; i < s.length ; i++) { 9 9 switch(s[i]) { 10 case '*':10 case "*" : 11 11 res += ".*"; 12 12 break; 13 13 14 case '.':15 case '?':16 case '^':17 case '$':18 case '+':19 case '{':20 case '[':21 case '|':22 case '(':23 case ')':24 case ']':14 case "." : 15 case "?" : 16 case "^" : 17 case "$" : 18 case "+" : 19 case "{" : 20 case "[" : 21 case "|" : 22 case "(" : 23 case ")" : 24 case "]" : 25 25 res += "\\" + s[i]; 26 26 break; 27 27 28 case '\\':28 case "\\" : 29 29 res += "\\\\"; 30 30 break; 31 31 32 case ' ':32 case " " : 33 33 // Remove spaces from URLs. 34 34 break; trunk/src/perl/convert2RegExp_2.js
r348 r694 3 3 res = tldRes[1] + tldStr + tldRes[3]; 4 4 } 5 return new RegExp(res + '$', "i");5 return new RegExp(res + "$", "i"); 6 6 }
