| ... | |||
|---|---|---|---|
| 2 | 2 | // @name AMO to FoxieWire | |
| 3 | 3 | // @namespace http://zoolcar9.lhukie.net/greasemonkey | |
| 4 | 4 | // @include https://addons.mozilla.org/* | |
| 5 | + | // @exclude https://addons.mozilla.org/*/addons/versions/* | |
| 5 | 6 | // @description Submit add-on page on AMO to FoxieWire news site | |
| 6 | 7 | // ==/UserScript== | |
| 7 | 8 | ||
| 8 | - | var xpiButts = getXPathNodeList("//p[not(@style='display: none;')]" + | |
| 9 | - | "/a[starts-with(@id, 'installTrigger')]"); | |
| 10 | - | if (!xpiButts.snapshotLength) return; | |
| 11 | - | ||
| 12 | - | var xpitButt, foxieButt, addonURL, addonId, appName; | |
| 9 | + | var divs = getXPathNodeList("//div[@class='install-container']"); | |
| 10 | + | ||
| 11 | + | if (!divs.snapshotLength) return; | |
| 12 | + | ||
| 13 | + | var div, xpiButts, xpiButt, n, foxieButt, img, addonURL, addonId, appName; | |
| 13 | 14 | var amoURL = "https://addons.mozilla.org/"; | |
| 14 | 15 | var foxieURL = "http://www.foxiewire.com/submit.php" + | |
| 15 | 16 | "?sourceid=Amo+to+FoxieWire&url="; | |
| 16 | 17 | ||
| 17 | - | for (var i = 0; i < xpiButts.snapshotLength; i++) { | |
| 18 | + | for (var i = 0; i < divs.snapshotLength; i++) { | |
| 18 | 19 | try { | |
| 19 | 20 | addonURL = getXPathNodeList("//*[@class='name']/a[@href]"). | |
| 20 | 21 | snapshotItem(i).href; | |
| ... | |||
| 25 | 26 | addonId = addonURL.match(/\d+/).toString(); | |
| 26 | 27 | appName = addonURL.match(/([^\/]+)/g)[3].toString(); | |
| 27 | 28 | ||
| 28 | - | xpiButt = xpiButts.snapshotItem(i); | |
| 29 | - | foxieButt = xpiButt.parentNode.appendChild(xpiButt.cloneNode(true)); | |
| 30 | - | while (foxieButt.hasAttributes()) { | |
| 31 | - | foxieButt.removeAttribute(foxieButt.attributes[0].name); | |
| 32 | - | } | |
| 33 | - | ||
| 34 | - | getStrong(foxieButt).textContent = "FoxieWire"; | |
| 35 | - | getStrong(foxieButt).style.textAlign = "center"; | |
| 36 | - | getStrong(foxieButt).style.width = getComputedStyle(getStrong(xpiButt), ""). | |
| 37 | - | width; | |
| 38 | - | ||
| 39 | - | foxieButt.href = foxieURL + escape(amoURL + appName + "/addon/" + addonId); | |
| 40 | - | foxieButt.title = "Submit to FoxieWire"; | |
| 41 | - | foxieButt.addEventListener("click", submitToFoxieWire, false); | |
| 42 | - | ||
| 29 | + | xpiButts = getXPathNodeList(".//a[starts-with(@id, 'installTrigger')]", | |
| 30 | + | divs.snapshotItem(i), null, 6, null); | |
| 31 | + | n = 0; | |
| 32 | + | for (var j = 0; j < xpiButts.snapshotLength; j++) { | |
| 33 | + | xpiButt = xpiButts.snapshotItem(j); | |
| 34 | + | if (xpiButt.parentNode.style.display != "none") { | |
| 35 | + | n++; | |
| 36 | + | foxieButt = xpiButt.parentNode.appendChild(xpiButt.cloneNode(true)); | |
| 37 | + | while (foxieButt.hasAttributes()) { | |
| 38 | + | foxieButt.removeAttribute(foxieButt.attributes[0].name); | |
| 39 | + | } | |
| 40 | + | ||
| 41 | + | getStrong(foxieButt).removeChild(getStrong(foxieButt).firstChild); | |
| 42 | + | getStrong(foxieButt).style.textAlign = "center"; | |
| 43 | + | getStrong(foxieButt).style.width = getComputedStyle(getStrong(xpiButt), ""). | |
| 44 | + | width; | |
| 45 | + | img = getStrong(foxieButt).appendChild(document.createElement("img")); | |
| 46 | + | img.src = "data:image/png;base64,\ | |
| 47 | + | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZ\ | |
| 48 | + | G9iZSBJbWFnZVJlYWR5ccllPAAAA19JREFUeNpEk1toHFUYx79zZs7Mzs5u9pJ03U2ybL\ | |
| 49 | + | qpSbDFKm0ERRCFYrFg8cVC8UXpU6EvPvRVFEEfvKC+KiiKD6JYEO+KICilMTG2pWyjCYl\ | |
| 50 | + | ht7vZ3exl7jPn4pkNXQ/MgTPw/3/f9zv/g4QQMGtqgBHIJSCnqcefmDFf/DcIP5/Ja+Gu\ | |
| 51 | + | FbkRF1eXi8lTW71g4Y4TvetRwfdsBrfbPqixrOdzMHUdFjMEDMH4VDr11OML6lmiUkYI4\ | |
| 52 | + | ze7wR/DnvJY0SCf7VohTxGstAQVUspHBnFlTVGgG2HA3NkjR4o71XuyJw61N4BVZ6C9ZZ\ | |
| 53 | + | 3WeBf+qgc/FEz1nBsJ4kT801iJ443LMQRCJaySMoposLblh909H9rDCLb8JCzNFmHX8S7\ | |
| 54 | + | lEkrq1VPFD3wqWvLjsXbUQUFXIWMkzh+dLryUGQa/VHR6rL/XhIgpINZqoE+o+7UOr196\ | |
| 55 | + | NPcWi6EBtEppAmOD+Uzq9LRBL2iDRrqSTT2dt/eBJQkgXYEcUSGvKpnLD0x+REORbluMH\ | |
| 56 | + | slrZYLQ9bFBN6BH788b1YKhdNa7fm8+o1VdJss3GSyUCBQMVUkLnB7R4kht9Oj8tboHYw\ | |
| 57 | + | ZN31/ZtMLV2sA/f73vPvR9Y/D6th1BpCHoRMyu9UNXoQiEDzDscziRMc9EVJRjLYpHSml\ | |
| 58 | + | qMYFR0Y74+oSCwaI8/3B+Ys3UkLI6sJ/Makri5QcPfVHUyVy9x6QKRR/v9C5+3ei/PxpB\ | |
| 59 | + | ejQlnKYsCAmBp48ZyYv3gV7xXNELfBH+HQS3VupBZ4mgOcQRICxIWSGVMYMY61JWj2HBT\ | |
| 60 | + | FJ7+5Ep81lTRTClkVypg964ajsv7LbpyqKJT/qIgy9Lbltha2wwnVYAa/JuKAUZlI17l1\ | |
| 61 | + | QwpEHAOTxzOH32uK19892qc6s1oKDK/5uBf+1Px/1xzGBxMgGUC2AyGtkkNucntTMXlnO\ | |
| 62 | + | vVXNaFSME6QSGzTuh+PJbF2GG4Gdn+Py653zIpGbUge2NQiUTCeCAcP4R4Q1Owdh3mTM7\ | |
| 63 | + | QcyOTSEUAmEJ6be2/d5G4H0iU/J/kBR090UISAA6+Vwl/86NzSACBt3lUtI05M3UWpH1U\ | |
| 64 | + | 9t6Zd2z31QREvhAcmDA2MGByQ6Igud+33a/8jD/tSz0y80dZyjBrd50vSsNGl5R5Eh3xf\ | |
| 65 | + | H6T4ABAI2eodevN/03AAAAAElFTkSuQmCC"; | |
| 66 | + | img.align = "left"; | |
| 67 | + | getStrong(foxieButt).appendChild(document.createTextNode("FoxieWire")); | |
| 68 | + | ||
| 69 | + | foxieButt.href = foxieURL + escape(amoURL + appName + "/addon/" + addonId); | |
| 70 | + | foxieButt.title = "Submit to FoxieWire"; | |
| 71 | + | foxieButt.addEventListener("click", submitToFoxieWire, false); | |
| 72 | + | } | |
| 73 | + | if (n > 1) { | |
| 74 | + | xpiButts.snapshotItem(j-1).parentNode.removeChild(xpiButts.snapshotItem(j-1).parentNode.lastChild); | |
| 75 | + | } | |
| 76 | + | } | |
| 43 | 77 | } | |
| 44 | 78 | ||
| 45 | 79 | GM_addStyle(".install-button a:not([id]),\n\ | |
| ... |