SHOW:
|
|
- or go back to the newest paste.
| 1 | // ==UserScript== | |
| 2 | // @name Fix Customs Forge Search Page's Download links | |
| 3 | // @namespace CustomsForge | |
| 4 | // @description Fixes the download links on the CustomsForge.com search page | |
| 5 | // @include http://search.customsforge.com/ | |
| 6 | // @include https://search.customsforge.com/ | |
| 7 | - | // @version 1 |
| 7 | + | // @include http://search.customsforge.com/* |
| 8 | // @include https://search.customsforge.com/* | |
| 9 | // @version 2 | |
| 10 | // @grant none | |
| 11 | // ==/UserScript== | |
| 12 | ||
| 13 | function fixlinks () {
| |
| 14 | //console.log('customsforge userscript startup');
| |
| 15 | var dls=document.querySelectorAll("img.dl");
| |
| 16 | var infolink; | |
| 17 | if(dls.length) | |
| 18 | for(i=0;i<dls.length;i++ ) {
| |
| 19 | if(dls[i].parentNode.href.match(/r(\d+)$/)){
| |
| 20 | temphref=dls[i].parentNode.href; | |
| 21 | infolink=document.createElement('a');
| |
| 22 | infolink.href=temphref; | |
| 23 | dls[i].parentNode.href='http://customsforge.com/process.php?id='+dls[i].parentNode.href.match(/r(\d+)$/)[1]; | |
| 24 | - | dls[i].parentNode.style.position='relative' |
| 24 | + | |
| 25 | - | dls[i].parentNode.style.top='-9px'; |
| 25 | + | dls[i].parentNode.parentNode.style='display:table'; |
| 26 | - | dls[i].parentNode.style.right='-18px'; |
| 26 | + | |
| 27 | dls[i].parentNode.style.display='table-cell'; | |
| 28 | dls[i].parentNode.style.paddingLeft='4px'; | |
| 29 | infolink.target="_blank"; | |
| 30 | infolink.innerHTML='<img width="16" height="16" alt="info" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAIpQTFRFAAAAMzMzNjY2ODg4OTk5Pj4+QEBARERERUVFRkZGSUlJS0tLTU1NUFBQUVFRWVlZWlpaW1tbbGxsbW1tbm5ub29vdXV1eXp5enp6e3t7fn9+gYGBhYWFlpaWnZ6epKSkpqamqKiorq+utLW1uLi4v8DAxcXFxsbFyMnIzc/N0dLR4OHg4eHh5eXlr9AYygAAAAF0Uk5TAEDm2GYAAAABYktHRACIBR1IAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3AUZDAkDDQjyBgAAAItJREFUGNNdj9cWwjAMQ6VC2FBG2JQyQlnl/3+PRnV5wC86uZZsB4gVPJ0PaCqQHE4HpKGsereeKCrJmj47wNux9lC1Pa+lZuhP0tVIIMBHmT/wWQp4xCSTE8q2gKsBL7jRgCLJCwdaREMXQJc2VGuPuM/2tlaWK8piYwadngM7NqdHTy8d//r/3/8CNq4H/103LSAAAAAASUVORK5CYII=" />'; | |
| 31 | - | infolink.style.position='relative' |
| 31 | + | |
| 32 | - | infolink.style.top='8px'; |
| 32 | + | |
| 33 | - | infolink.style.right='5px'; |
| 33 | + | infolink.style.display='table-cell'; |
| 34 | dls[i].parentNode.parentNode.insertBefore(infolink, dls[i].parentNode); | |
| 35 | - | //console.log(dls[i].parentNode.href.match(/r(\d+)$/)); |
| 35 | + | |
| 36 | } | |
| 37 | } | |
| 38 | ||
| 39 | function onNodeInserted() {
| |
| 40 | if(document.querySelector('.cfinfolink'))
| |
| 41 | return; | |
| 42 | else | |
| 43 | window.setTimeout(fixlinks,1000); | |
| 44 | } | |
| 45 | ||
| 46 | window.setTimeout(fixlinks,1000); | |
| 47 | document.addEventListener('DOMNodeInserted', onNodeInserted, false); |