forked from lastdream2013/userChrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAboutConfigMultipleSelection.uc.js
59 lines (53 loc) · 1.83 KB
/
AboutConfigMultipleSelection.uc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// ==UserScript==
// @name About:config Multiple Selection
// @version 0.2
// @description About:config多选操作
// @author NightsoN
// @include chrome://browser/content/browser.xul
// ==/UserScript==
window.addEventListener("DOMContentLoaded", function (event) {
var doc = event.target;
if (!doc || doc.location.href !== "about:config") return;
content.document.getElementById("configTree").setAttribute("seltype", "multiple");
content.window.getSelected = function () {
var arr = [],
i = 0,
k = 0,
j = content.view.selection.getRangeCount(),
start = {},
end = {};
for (; i < j; i++) {
content.view.selection.getRangeAt(i, start, end);
for (k = start.value; k <= end.value; k++) {
arr.push(content.gPrefView[k]);
}
}
return arr;
}
content.window.ResetSelected = function () {
content.getSelected().forEach(function (i) {
content.gPrefBranch.clearUserPref(i.prefCol);
})
}
content.window.copyPref = function () {
var arr = [];
content.getSelected().forEach(function (i) {
arr.push(i.prefCol + ';' + i.valueCol);
});
content.gClipboardHelper.copyString(arr.join('\n'), document);
}
content.window.copyName = function () {
var arr = [];
content.getSelected().forEach(function (i) {
arr.push(i.prefCol);
});
content.gClipboardHelper.copyString(arr.join('\n'), document);
}
content.window.copyValue = function () {
var arr = [];
content.getSelected().forEach(function (i) {
arr.push(i.valueCol);
});
content.gClipboardHelper.copyString(arr.join('\n'), document);
}
}, true);