IE7Pro Compatibility Script 將 Firefox 的 GreaseMonkey 語法移植到 IE7 上的 script。直接安裝後即可使用。
支援語法:
- GM_setValue
- GM_getValue
- GM_log
- GM_openInTab
- GM_addStyle
- GM_xmlhttpRequest
// FremyCompany Script // version 0.1 build 4 ALPHA! // 28/03/07 // // -------------------------------------------------------------------- // // This is a Greasemonkey user script. To install it, you need // IE Pro 9.12 or later (see at : http://www.iepro.com) // Then restart Internet Explorer and revisit this script. // // -------------------------------------------------------------------- // // ==UserScript== // @name .FremyCompany Script // @description Scripts made by FremyCompany to make IE Pro more compatbile with GreaseMonkey // @include * // ==/UserScript== (function(w,d) { w.GM_setValue=function(name, value) { return PRO_setValue(name, value); }; w.GM_getValue=function(name, defaultValue) { return PRO_getValue(name, defaultValue); }; w.GM_log=function(text) { return PRO_log(text); }; w.GM_openInTab=function(url) { return PRO_openInTab(url); }; w.GM_addStyle=function(css) { return PRO_addStyle(css); }; w.GM_xmlhttpRequest=function (d) { // url, method, headers, data, onload, onerror, onreadystatechange; if (!d.url) { GM_log("URL is missing in xhr-call"); return false; } if (!d.method) { d.method="POST"; } if (!d.headers) { d.headers=new Array(); } var xhr={"readyState":0,"status":0,"statusText":"not loaded"}; var xhr_value=xhr; try { xhr=GM_xmlhttpRequest._createRequest(); // OPENING of the xhr xhr.open(d.method, d.url, true); for (h in d.headers) { try { xhr.setRequestHeader(h, d.headers[h]); } catch (ex) {} } // CallBack gesture xhr.onreadystatechange=function() { GM_xmlhttpRequest._createValue(xhr,xhr_value); try { d.onreadystatechange(xhr_value); } catch (ex) {} if (xhr.readyState==4) { if (xhr.status==200||xhr.status==0) { try { d.onload(xhr_value); } catch (ex) {} } else { try { d.onerror(xhr_value); } catch (ex) {} } } } // SENDING the data xhr.send(d.data?d.data:null) } catch (ex) { try { d.onerror(xhr_value, ex); } catch (ex2) {} } }; w.GM_xmlhttpRequest._createRequest=PRO_xmlhttpRequest; w.GM_xmlhttpRequest._createValue=function(x,v) { v.abort=function() { x.abort(); } v.getResponseHeader=function(n) { return x.getResponseHeader(n); } v.getAllResponseHeaders=function() { return x.getAllResponseHeaders(); } v.responseText=x.responseText; v.responseHeaders=x.getAllResponseHeaders(); v.responseText=x.responseText; v.responseBody=x.responseBody; v.readyState=x.readyState; v.status=x.status; v.statusText=x.statusText; }; })(window,document);
沒有留言:
張貼留言