parent
f95d46953f
commit
038e4f5014
8 changed files with 87 additions and 77 deletions
@ -1 +1 @@ |
||||
"undefined"===typeof GM_xmlhttpRequest&&(GM_xmlhttpRequest=function(a){a.method=a.method.toUpperCase()||"GET";if(!a.url)throw"GM_xmlhttpRequest requires an URL.";var b=new XMLHttpRequest;if(b){"onreadystatechange"in a&&(b.onreadystatechange=function(){a.onreadystatechange(b)});"onload"in a&&(b.onload=function(){a.onload(b)});"onerror"in a&&(b.onerror=function(){a.onerror(b)});b.open(a.method,a.url,!0);if("headers"in a)for(var c in a.headers)b.setRequestHeader(c,a.headers[c]);"data"in a?b.send(a.data): b.send()}else throw"This Browser is not supported, please upgrade.";}); if("undefined"===typeof GM_addStyle)var GM_addStyle=function(a){var b=document.getElementsByTagName("head")[0];if(void 0===b)document.onreadystatechange=function(){if("interactive"==document.readyState){var b=document.createElement("style");b.setAttribute("type","text/css");b.appendChild(document.createTextNode(a));document.getElementsByTagName("head")[0].appendChild(b)}};else{var c=document.createElement("style");c.setAttribute("type","text/css");c.appendChild(document.createTextNode(a));b.appendChild(c)}}; if("undefined"===typeof GM_log)var GM_log=function(a){console&&console.log(a)};if("undefined"===typeof GM_openInTab)var GM_openInTab=function(a){return window.open(a)};if("undefined"===typeof GM_setClipboard)var GM_setClipboard=function(a){window._qz_greasemonkey.setClipboard(a)};if("undefined"===typeof GM_getValueImpl)var GM_getValueImpl=function(a,b,c){return window._qz_greasemonkey.getValue(a,b,c)}; if("undefined"===typeof GM_setValueImpl)var GM_setValueImpl=function(a,b,c){window._qz_greasemonkey.setValue(a,b,c)};if("undefined"===typeof GM_deleteValueImpl)var GM_deleteValueImpl=function(a,b){window._qz_greasemonkey.deleteValue(a,b)};if("undefined"===typeof GM_listValuesImpl)var GM_listValuesImpl=function(a){return window._qz_greasemonkey.listValues(a)};var unsafeWindow=window;window.wrappedJSObject=unsafeWindow; if("undefined"===typeof GM_registerMenuCommand)var GM_registerMenuCommand=function(a,b,c){};if("undefined"===typeof GM_getResourceText)var GM_getResourceText=function(a){throw"QupZilla: GM Resource is not supported!";};if("undefined"===typeof GM_getResourceURL)var GM_getResourceURL=function(a){throw"QupZilla: GM Resource is not supported!";}; |
||||
"undefined"===typeof GM_xmlhttpRequest&&(GM_xmlhttpRequest=function(a){a.method=a.method.toUpperCase()||"GET";if(!a.url)throw"GM_xmlhttpRequest requires an URL.";var b=new XMLHttpRequest;"onreadystatechange"in a&&(b.onreadystatechange=function(){a.onreadystatechange(b)});"onload"in a&&(b.onload=function(){a.onload(b)});"onerror"in a&&(b.onerror=function(){a.onerror(b)});b.open(a.method,a.url,!0);if("headers"in a)for(var c in a.headers)b.setRequestHeader(c,a.headers[c]);"data"in a?b.send(a.data):b.send()});if("undefined"===typeof GM_addStyle)var GM_addStyle=function(a){var b=document.getElementsByTagName("head")[0];if(void 0===b)document.onreadystatechange=function(){if("interactive"==document.readyState){var b=document.createElement("style");b.setAttribute("type","text/css");b.appendChild(document.createTextNode(a));document.getElementsByTagName("head")[0].appendChild(b)}};else{var c=document.createElement("style");c.setAttribute("type","text/css");c.appendChild(document.createTextNode(a));b.appendChild(c)}};if("undefined"===typeof GM_log)var GM_log=function(a){console&&console.log(a)};if("undefined"===typeof GM_openInTab)var GM_openInTab=function(a){return window.open(a)};if("undefined"===typeof GM_setClipboard)var GM_setClipboard=function(a){};var unsafeWindow=window;window.wrappedJSObject=unsafeWindow;if("undefined"===typeof GM_registerMenuCommand)var GM_registerMenuCommand=function(a,b,c){}; |
||||
@ -0,0 +1,30 @@ |
||||
// Modified from https://gist.githubusercontent.com/arantius/3123124/raw/grant-none-shim.js
|
||||
//
|
||||
// %1 - unique script id
|
||||
|
||||
function GM_deleteValue(aKey) { |
||||
localStorage.removeItem("%1" + aKey); |
||||
} |
||||
|
||||
function GM_getValue(aKey, aDefault) { |
||||
var val = localStorage.getItem("%1" + aKey) |
||||
if (null === val && 'undefined' != typeof aDefault) return aDefault; |
||||
return val; |
||||
} |
||||
|
||||
function GM_listValues() { |
||||
var prefixLen = "%1".length; |
||||
var values = []; |
||||
var i = 0; |
||||
for (var i = 0; i < localStorage.length; i++) { |
||||
var k = localStorage.key(i); |
||||
if (k.substr(0, prefixLen) === "%1") { |
||||
values.push(k.substr(prefixLen)); |
||||
} |
||||
} |
||||
return values; |
||||
} |
||||
|
||||
function GM_setValue(aKey, aVal) { |
||||
localStorage.setItem("%1" + aKey, aVal); |
||||
} |
||||
@ -0,0 +1 @@ |
||||
function GM_deleteValue(b){localStorage.removeItem("%1"+b)}function GM_getValue(b,a){var c=localStorage.getItem("%1"+b);return null===c&&"undefined"!=typeof a?a:c}function GM_listValues(){for(var b=[],a=0,a=0;a<localStorage.length;a++){var c=localStorage.key(a);"%1"===c.substr(0,2)&&b.push(c.substr(2))}return b}function GM_setValue(b,a){localStorage.setItem("%1"+b,a)}; |
||||
Loading…
Reference in new issue