firefox userChrome.js greasemonkeyスクリプトスレ 3
■ このスレッドは過去ログ倉庫に格納されています
0166初スレの80
2007/11/17(土) 17:22:56ID:2O/4iQWc0これで駄目だったらお手上げ.
function GM_xmlhttpRequest(obj){
if(typeof(obj) != 'object' || (typeof(obj.url) != 'string' && !(obj.url instanceof String))) return;
var req = new XMLHttpRequest();
req.open(obj.method || 'GET',obj.url,true);
if(typeof(obj.headers) == 'object') for(var i in obj.headers) req.setRequestHeader(i,obj.headers[i]);
['onload','onerror','onreadystatechange'].forEach(function(k){
if(obj[k] && (typeof(obj[k]) == 'function' || obj[k] instanceof Function)) req[k] = function(){
obj[k]({
status : (function(){ try{ return req.status; }catch(e){ return 0; } })(),
statusText : (function(){ try{ return req.statusText; }catch(e){ return ''; } })(),
responseHeaders : (function(){ try{ return req.getAllResponseHeaders(); }catch(e){ return ''; } })(),
responseText : (function(){ try{ return req.responseText; }catch(e){ return ''; } })(),
readyState : req.readyState });
};
});
if(obj.overrideMimeType) req.overrideMimeType(obj.overrideMimeType);
req.send(obj.data || null);
}
■ このスレッドは過去ログ倉庫に格納されています