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/ |
5 | + | // @include http://search.customsforge.com/-1 |
6 | - | // @include https://search.customsforge.com/ |
6 | + | // @include https://search.customsforge.com/-1 |
7 | // @include http://search.customsforge.com/# | |
8 | // @include https://search.customsforge.com/# | |
9 | // @version 1 | |
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.parentNode.className=''; | |
25 | dls[i].parentNode.parentNode.title='Open download page for this track'; | |
26 | dls[i].parentNode.style.position='relative' | |
27 | dls[i].parentNode.style.top='-9px'; | |
28 | dls[i].parentNode.style.right='-18px'; | |
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.className='cfinfolink'; | |
32 | infolink.title='More Info on this Track'; | |
33 | infolink.style.position='relative' | |
34 | infolink.style.top='8px'; | |
35 | infolink.style.right='5px'; | |
36 | dls[i].parentNode.parentNode.insertBefore(infolink, dls[i].parentNode); | |
37 | //console.log(dls[i].parentNode.href.match(/r(\d+)$/)); | |
38 | } | |
39 | } | |
40 | } | |
41 | ||
42 | function onNodeInserted() { | |
43 | if(document.querySelector('.cfinfolink')) | |
44 | return; | |
45 | else | |
46 | window.setTimeout(fixlinks,1000); | |
47 | } | |
48 | ||
49 | window.setTimeout(fixlinks,1000); | |
50 | document.addEventListener('DOMNodeInserted', onNodeInserted, false); |