/usr/share/xul-ext/greasemonkey/content/install.js is in xul-ext-greasemonkey 3.8-1~deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | Components.utils.import('chrome://greasemonkey-modules/content/prefmanager.js');
Components.utils.import('chrome://greasemonkey-modules/content/util.js');
var gRemoteScript = window.arguments[0].wrappedJSObject[0];
var gBrowser = window.arguments[0].wrappedJSObject[1];
var gScript = window.arguments[0].wrappedJSObject[2];
var gHtmlNs = 'http://www.w3.org/1999/xhtml';
var gAcceptButton = null;
var gCurrentDelay = null;
var gProgress = 0;
var gShowScriptButton = null;
var gTimer = null;
var gTotalDelay = new GM_PrefManager().getValue('installDelay', 5);
function init() {
setUpIncludes('includes', 'includes-desc', gScript.includes);
setUpIncludes('excludes', 'excludes-desc', gScript.excludes);
var matches = [];
for (var i = 0, match = null; match = gScript.matches[i]; i++) {
matches.push(match.pattern);
}
setUpIncludes('matches', 'matches-desc', matches);
gShowScriptButton = document.documentElement.getButton('extra1');
gAcceptButton = document.documentElement.getButton('accept');
gAcceptButton.baseLabel = gAcceptButton.label;
startTimer();
gShowScriptButton.disabled = true;
var bundle = document.getElementById('gm-browser-bundle');
document.getElementById('heading').appendChild(
document.createTextNode(bundle.getString('greeting.msg')));
var desc = document.getElementById('scriptDescription');
desc.appendChild(document.createElementNS(gHtmlNs, 'strong'));
desc.firstChild.appendChild(document.createTextNode(gScript.localized.name));
if (gScript.version) {
desc.appendChild(document.createTextNode(' ' + gScript.version));
}
desc.appendChild(document.createElementNS(gHtmlNs, 'br'));
desc.appendChild(document.createTextNode(gScript.localized.description));
if (gRemoteScript.done) {
// Download finished before we could open, fake a progress event.
onProgress(null, null, 1);
} else {
// Otherwise, listen for future progress events.
gRemoteScript.onProgress(onProgress);
}
}
function onBlur(e) {
stopTimer();
}
function onCancel() {
gRemoteScript.cancel();
window.close();
}
function onFocus(e) {
startTimer();
}
function onInterval() {
gCurrentDelay--;
updateLabel();
if (gCurrentDelay == 0) stopTimer();
}
function onOk() {
gRemoteScript.install();
window.setTimeout(window.close, 0);
}
function onProgress(aRemoteScript, aEventType, aData) {
if (!document) return; // lingering download after window cancel
gProgress = Math.floor(100 * aData);
if (gRemoteScript.done) {
gShowScriptButton.disabled = false;
document.getElementById('loading').style.display = 'none';
if (gRemoteScript.errorMessage) {
gShowScriptButton.disabled = true;
document.getElementById('dialogContentBox').style.display = 'none';
document.getElementById('errorContentBox').style.display = '-moz-box';
document.getElementById('errorMessage')
.textContent = gRemoteScript.errorMessage;
stopTimer();
updateLabel(false);
return;
}
} else {
document.getElementById('progressmeter').setAttribute('value', gProgress);
}
updateLabel();
}
function onShowSource() {
gRemoteScript.showSource(gBrowser);
window.setTimeout(window.close, 0);
}
function pauseTimer() {
stopTimer();
gCurrentDelay = gTotalDelay;
updateLabel();
}
function setUpIncludes(box, desc, includes) {
if (includes.length > 0) {
desc = document.getElementById(desc);
document.getElementById(box).style.display = '';
for (var i = 0; i < includes.length; i++) {
desc.appendChild(document.createTextNode(includes[i]));
desc.appendChild(document.createElementNS(gHtmlNs, 'br'));
}
desc.removeChild(desc.lastChild);
}
}
function startTimer() {
gCurrentDelay = gTotalDelay;
updateLabel();
gTimer = window.setInterval(onInterval, 500);
}
function stopTimer() {
if (gTimer) window.clearInterval(gTimer);
gCurrentDelay = 0;
}
function updateLabel(aOkAllowed) {
if ('undefined' == typeof aOkAllowed) aOkAllowed = true;
if (gCurrentDelay > 0) {
gAcceptButton.focus();
gAcceptButton.label = gAcceptButton.baseLabel + ' (' + gCurrentDelay + ')';
} else {
gAcceptButton.label = gAcceptButton.baseLabel;
}
var disabled = aOkAllowed
? ((gCurrentDelay > 0) || (gProgress < 100))
: true;
gAcceptButton.disabled = disabled;
}
// See: closewindow.xul .
function GM_onClose() {
gRemoteScript.cleanup();
}
|