11 'run-at': "document-end",
15 scriptHandler: "Falkon GreaseMonkey",
25function GM_xmlhttpRequest(/* object */ details) {
26 details.method = details.method.toUpperCase() || "GET";
29 throw("GM_xmlhttpRequest requires an URL.");
32 // build XMLHttpRequest object
33 var oXhr = new XMLHttpRequest;
35 if("onreadystatechange" in details)
36 oXhr.onreadystatechange = function() { details.onreadystatechange(oXhr) };
37 if("onload" in details)
38 oXhr.onload = function() { details.onload(oXhr) };
39 if("onerror" in details)
40 oXhr.onerror = function() { details.onerror(oXhr) };
42 oXhr.open(details.method, details.url, true);
44 if("headers" in details)
45 for(var header in details.headers)
46 oXhr.setRequestHeader(header, details.headers[header]);
49 oXhr.send(details.data);
54function GM_addStyle(/* string */ styles) {
55 var head = document.getElementsByTagName("head")[0];
56 if (head === undefined) {
57 document.onreadystatechange = function() {
58 if (document.readyState == "interactive") {
59 var oStyle = document.createElement("style");
60 oStyle.setAttribute("type", "text/css");
61 oStyle.appendChild(document.createTextNode(styles));
62 document.getElementsByTagName("head")[0].appendChild(oStyle);
67 var oStyle = document.createElement("style");
68 oStyle.setAttribute("type", "text/css");
69 oStyle.appendChild(document.createTextNode(styles));
70 head.appendChild(oStyle);
79function GM_openInTab(url) {
80 return window.open(url);
83function GM_setClipboard(text) {
84 external.extra.greasemonkey.setClipboard(text);
87// GM_registerMenuCommand not supported
88function GM_registerMenuCommand(caption, commandFunc, accessKey) { }
90// GM_getResourceUrl not supported
91function GM_getResourceUrl(resourceName) { }
93// GreaseMonkey 4.0 support
94GM.openInTab = GM_openInTab;
95GM.setClipboard = GM_setClipboard;
96GM.xmlhttpRequest = GM_xmlhttpRequest;
98// GM_getResourceUrl not supported
99GM.getResourceUrl = function(resourceName) {
100 return new Promise((resolve, reject) => {