Draft -- QuickAdd complementary functions QuickRemove, QuickToggle, wasQuickAdded
//
// Replace the original onQuickAdd() function with the following code.
// Then re-launch Firefox.app
1 2 onQuickAdd : function(window, doc) { 3 var url = doc.location.href; 4 var match = this.getPatternFromTemplate(window, url); 5 if (match) { 6 // Check for duplicates and exclusions due to black lists 7 var m = match.isBlackList ? this.proxy.isBlackMatch(match.pattern, url) : this.proxy.isWhiteMatch(match.pattern, url); 8 if (m) { 9 this._notify && this.fp.notifier.alert(this.fp.getMessage(this.notificationTitle), 10 fp.getMessage("superadd.url.added", [m.pattern, this._proxy.name])); 11 } 12 else 13 this.addPattern(match, doc.location); 14 } 15 }, 16 17 onQuickRemove : function(window, doc) { 18 var url = doc.location.href; 19 var match = this.getPatternFromTemplate(window, url); 20 if (match) { 21 // Check for duplicates and exclusions due to black lists 22 var m = match.isBlackList ? this.proxy.isBlackMatch(match.pattern, url) : this.proxy.isWhiteMatch(match.pattern, url); 23 if (m) { 24 this.proxy.matches = this.proxy.matches.filter(function(e) {return e != m;}); 25 this.fp.writeSettings(); 26 27 this._notifyWhenCanceled && 28 this.fp.notifier.alert(this.fp.getMessage("foxyproxy.quickadd.label"), 29 this.fp.getMessage("quickadd.quickadd.canceled", [m.name, this._proxy.name])); 30 31 this._reload && loc.reload(); 32 } 33 else 34 ;// No match; nothing removed 35 } 36 }, 37 38 39 onQuickToggle : function(window, doc) { 40 var url = doc.location.href; 41 var match = this.getPatternFromTemplate(window, url); 42 if (match) { 43 // Check for duplicates and exclusions due to black lists 44 var m = match.isBlackList ? this.proxy.isBlackMatch(match.pattern, url) : this.proxy.isWhiteMatch(match.pattern, url); 45 if (m) { 46 this.proxy.matches = this.proxy.matches.filter(function(e) {return e != m;}); 47 this.fp.writeSettings(); 48 49 this._notifyWhenCanceled && 50 this.fp.notifier.alert(this.fp.getMessage("foxyproxy.quickadd.label"), 51 this.fp.getMessage("quickadd.quickadd.canceled", [m.name, this._proxy.name])); 52 53 this._reload && loc.reload(); 54 } 55 else 56 this.addPattern(match, doc.location); 57 } 58 }, 59 60 61 wasQuickAdded : function(window, doc) { 62 var url = doc.location.href; 63 var match = this.getPatternFromTemplate(window, url); 64 if (match) { 65 // Check for duplicates and exclusions due to black lists 66 var m = match.isBlackList ? this.proxy.isBlackMatch(match.pattern, url) : this.proxy.isWhiteMatch(match.pattern, url); 67 if (m) { 68 return true; 69 } 70 else 71 return false; 72 } 73 return false; 74 },