Skip to content

Commit

Permalink
cmd_copyLink is now configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
diegocr committed Sep 30, 2013
1 parent 61edbde commit 8041358
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
35 changes: 29 additions & 6 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,29 @@ let i$ = {
switch(t) {
case 'nsPref:changed':
switch(d) {
case 'cbc':
case 'enabled':
case 'progltr':
let v = addon.branch.getBoolPref(d);

if(d === 'cbc') {
this.wmForeach(function(w){
if(addon.wms.has(w)) {
let d = addon.wms.get(w);

if(v === true) {
d.controller=3==ia
? new copyLinkMobile(w)
: new copyLinkController(w);
} else if(d.controller) {
d.controller.shutdown();
delete d.controller;
}
}
});
break;
}

addon[d] = v;
if(v === true) {

Expand Down Expand Up @@ -265,12 +284,15 @@ function loadIntoWindow(window) {

i$.putc(doc,wmsData.getCleanLink);
}
},
controller: 3==ia
? new copyLinkMobile(window)
: new copyLinkController(window)
}
};

if(addon.branch.getBoolPref('cbc')) {
wmsData.controller=3==ia
? new copyLinkMobile(window)
: new copyLinkController(window);
}

let gNavToolbox = window.gNavToolbox || $("mail-toolbox");
if(gNavToolbox && gNavToolbox.palette) {
let m = addon.tag+'-toolbar-button';
Expand Down Expand Up @@ -426,7 +448,8 @@ function startup(data) {
highlight : !0,
hlstyle : 'background:rgba(252,252,0,0.6); color: #000',
evdm : !0,
progltr : !1
progltr : !1,
cbc : !0
})) {
if(!addon.branch.getPrefType(k) || Reset) {
switch(typeof v) {
Expand All @@ -439,7 +462,7 @@ function startup(data) {
if(5!=ia) {
addon.branch.addObserver("", i$, false);
} else {
['At','De'].forEach((i)=>i$[i+'tachDOMLoad']=rsc);
['At','De'].forEach(function(i)i$[i+'tachDOMLoad']=rsc);
}

io.getProtocolHandler("resource")
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<em:id>{158d7cb3-7039-4a75-8e0b-3bd0a464edd2}</em:id>
<em:type>2</em:type>
<em:name>Clean Links</em:name>
<em:version>2.4.2a3</em:version>
<em:version>2.4.2a4</em:version>
<em:creator>Diego Casorran</em:creator>
<em:description>Converts obfuscated/nested links to genuine clean links</em:description>
<em:bootstrap>true</em:bootstrap>
Expand Down
2 changes: 2 additions & 0 deletions options.xul
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
</setting>
<setting pref="extensions.cleanlinks.evdm" type="bool" title="Event Delegation Mode?"
tooltiptext="This is a less intrusive mode by just listening to click events. Note that real-time highlighting and counters will not work then, even though the performance should be much better."></setting>
<setting pref="extensions.cleanlinks.cbc" type="bool" title="CopyLink Controller?"
tooltiptext="This installs a cmd_copyLink controller to catch context-menu's Copy Link Location calls to clear links before being copied to the clipboard."></setting>
<setting pref="extensions.cleanlinks.progltr" type="bool" title="Use Redirect Watcher?"
tooltiptext="Set up a HTTP Observer to catch 3xx redirections. For example, this should make possible to clear links hidden behind shortened URLs."></setting>
</vbox>

0 comments on commit 8041358

Please sign in to comment.