Skip to content

Commit

Permalink
Add support for Cookies Manager+ extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Sep 4, 2012
1 parent 15a227f commit 4fd2f0c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Cookies_Permissions/cookiesPermissions.js
Expand Up @@ -19,6 +19,7 @@ var options = {
preserveCurrentSitesCookies: true
},
showDefaultPolicy: true,
useCookiesManagerPlus: true, // https://addons.mozilla.org/firefox/addon/cookies-manager-plus/
prefillMode: 1, // 0 - move caret to start, 1 - select all, 2 - move caret to end
};

Expand Down Expand Up @@ -680,6 +681,11 @@ this.permissions = {
var host = this.options.useBaseDomain.showCookies
? this.currentBaseDomain
: this.currentHost;
if("coomanPlus" in window && "coomanPlusCore" in window && this.options.useCookiesManagerPlus) {
// https://addons.mozilla.org/firefox/addon/cookies-manager-plus/
this.showCookiesCMP(host);
return;
}
if(this.isSeaMonkey) {
this.showCookiesSM(host);
return;
Expand All @@ -700,6 +706,29 @@ this.permissions = {
}
this.tweakWindow(win);
},
showCookiesCMP: function(host) {
// See openCMP() function in resource://cookiesmanagerplus/coomanPlusCore.jsm
var win = coomanPlusCore.aWindow;
var _this = this;
var setFilter = function setFilter(e) {
e && win.removeEventListener("load", setFilter, false);
var doc = win.document;
setTimeout(function() { // Just loaded window aren't ready
_this.setTextboxValue(doc.getElementById("lookupcriterium"), host);
}, 0);
};
if(win) {
win.focus();
host && setFilter();
}
else {
win = window.openDialog(
"chrome://cookiesmanagerplus/content/cookiesmanagerplus.xul",
"coomanPlusWindow", "chrome,resizable=yes,toolbar=no,statusbar=no,scrollbar=no,centerscreen"
);
host && win.addEventListener("load", setFilter, false);
}
},
showCookiesSM: function(host) {
var win = this.wm.getMostRecentWindow("mozilla:cookieviewer");
var _this = this;
Expand Down

0 comments on commit 4fd2f0c

Please sign in to comment.