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/*
- // @include https://search.customsforge.com/*
- // @version 3
- // @grant none
- // ==/UserScript==
- function fixlinks () {
- //console.log('customsforge userscript startup');
- var trs=document.querySelectorAll('#songs_table tr.odd,#songs_table tr.even');
- var songtd;
- qlink=document.createElement('a');
- qlink.innerHTML=' <b>?</b>';
- for(i=0;i<trs.length;i++) {
- songtd=trs[i].getElementsByTagName('td')[2];
- dllink=trs[i].querySelector('img.dl').parentNode.href;
- if(dllink.match(/r(\d+)$/)){
- qlink.href=songtd.getElementsByTagName('a')[0].href;
- qlink.title='Check for more versions of this song';
- songtd.appendChild(qlink.cloneNode(true));
- songtd.getElementsByTagName('a')[0].href=dllink;
- songtd.getElementsByTagName('a')[0].title='Song Info';
- trs[i].querySelector('img.dl').parentNode.href='http://customsforge.com/process.php?id='+dllink.match(/r(\d+)$/)[1];
- trs[i].querySelector('img.dl').parentNode.title="Download Page";
- }
- }
- }
- function onNodeInserted() {
- if(document.querySelector('.cfinfolink'))
- return;
- else
- window.setTimeout(fixlinks,1000);
- }
- window.setTimeout(fixlinks,1000);
- document.addEventListener('DOMNodeInserted', onNodeInserted, false);
Add Comment
Please, Sign In to add comment