19 // build XMLHttpRequest object |
19 // build XMLHttpRequest object |
20 var oXhr = new XMLHttpRequest; |
20 var oXhr = new XMLHttpRequest; |
21 // run it |
21 // run it |
22 if(oXhr) { |
22 if(oXhr) { |
23 if("onreadystatechange" in details) |
23 if("onreadystatechange" in details) |
24 oXhr.onreadystatechange = function() { details.onreadystatechange(oXhr) }; |
24 oXhr.onreadystatechange = function() { |
|
25 details.onreadystatechange(oXhr) |
|
26 }; |
25 if("onload" in details) |
27 if("onload" in details) |
26 oXhr.onload = function() { details.onload(oXhr) }; |
28 oXhr.onload = function() { details.onload(oXhr) }; |
27 if("onerror" in details) |
29 if("onerror" in details) |
28 oXhr.onerror = function() { details.onerror(oXhr) }; |
30 oXhr.onerror = function() { details.onerror(oXhr) }; |
29 |
31 |
46 function GM_addStyle(/* String */ styles) { |
48 function GM_addStyle(/* String */ styles) { |
47 var head = document.getElementsByTagName("head")[0]; |
49 var head = document.getElementsByTagName("head")[0]; |
48 if (head === undefined) { |
50 if (head === undefined) { |
49 document.onreadystatechange = function() { |
51 document.onreadystatechange = function() { |
50 if (document.readyState == "interactive") { |
52 if (document.readyState == "interactive") { |
51 var oStyle = document.createElement("style"); |
53 var oStyle = document.createElement("style"); |
52 oStyle.setAttribute("type", "text\/css"); |
54 oStyle.setAttribute("type", "text\/css"); |
53 oStyle.appendChild(document.createTextNode(styles)); |
55 oStyle.appendChild(document.createTextNode(styles)); |
54 document.getElementsByTagName("head")[0].appendChild(oStyle); |
56 document.getElementsByTagName("head")[0].appendChild(oStyle); |
55 } |
57 } |
56 } |
58 } |
57 } |
59 } |
58 else { |
60 else { |
59 var oStyle = document.createElement("style"); |
61 var oStyle = document.createElement("style"); |