-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathprefNS.js
More file actions
17 lines (15 loc) · 727 Bytes
/
prefNS.js
File metadata and controls
17 lines (15 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// https://github.com/Infocatcher/Custom_Buttons/blob/master/code_snippets/prefNS.js
// Get unique preferences root for each button
const prefNS = (function() {
const buttonId = "coolButton"; // Human-readable "name" of button
var btnNum = "." + this.id.match(/\d*$/)[0];
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
var windowId = custombuttons.cbService.getWindowId(document.documentURI);
if(windowId != appInfo.name) {
windowId = windowId.substr(appInfo.name.length);
btnNum += "." + windowId.charAt(0).toLowerCase() + windowId.substr(1);
}
return "extensions.custombuttons.buttons." + buttonId + btnNum + ".";
}).call(this);
alert(prefNS);