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