Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Fix Customs Forge Search Page's Download links
- // @namespace CustomsForge
- // @description Fixes the download links on the CustomsForge.com search page
- // @include http://search.customsforge.com/
- // @include https://search.customsforge.com/
- // @include http://search.customsforge.com/-1
- // @include https://search.customsforge.com/-1
- // @include http://search.customsforge.com/#
- // @include https://search.customsforge.com/#
- // @version 1
- // @grant none
- // ==/UserScript==
- function fixlinks () {
- //console.log('customsforge userscript startup');
- var dls=document.querySelectorAll("img.dl");
- var infolink;
- if(dls.length)
- for(i=0;i<dls.length;i++ ) {
- if(dls[i].parentNode.href.match(/r(\d+)$/)){
- temphref=dls[i].parentNode.href;
- infolink=document.createElement('a');
- infolink.href=temphref;
- dls[i].parentNode.href='http://customsforge.com/process.php?id='+dls[i].parentNode.href.match(/r(\d+)$/)[1];
- dls[i].parentNode.parentNode.className='';
- dls[i].parentNode.parentNode.title='Open download page for this track';
- dls[i].parentNode.style.position='relative'
- dls[i].parentNode.style.top='-9px';
- dls[i].parentNode.style.right='-18px';
- infolink.target="_blank";
- 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=" />';
- infolink.className='cfinfolink';
- infolink.title='More Info on this Track';
- infolink.style.position='relative'
- infolink.style.top='8px';
- infolink.style.right='5px';
- dls[i].parentNode.parentNode.insertBefore(infolink, dls[i].parentNode);
- //console.log(dls[i].parentNode.href.match(/r(\d+)$/));
- }
- }
- }
- function onNodeInserted() {
- if(document.querySelector('.cfinfolink'))
- return;
- else
- window.setTimeout(fixlinks,1000);
- }
- window.setTimeout(fixlinks,1000);
- document.addEventListener('DOMNodeInserted', onNodeInserted, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement