Guest User

LDView Parts List Sorter v1.1

a guest
Feb 24th, 2014
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript:(function(d){var n,m,i,c='Sorted by Stephen\'s LDView Parts List Sorter v1.1';if(d.body.id=='LDVS'){alert('Already Run');return;}d.body.id='LDVS';function ga(n,m,l){if(n.innerHTML==l)n.innerHTML='<a href=%22#%22 onclick=%22Resort('+m+');return false;%22>'+l+'</a>';};n=d.getElementsByTagName('th');i=n.length;while(i--){if(n[i].className=='title')n[i].title=c;ga(n[i],1,'Quantity');ga(n[i],2,'Part');ga(n[i],3,'Color');ga(n[i],4,'Description');}i=0;n=d.getElementsByTagName('tbody')[1].firstChild;while(n){if(n.tagName=='TR'){i++;m=n.firstChild;while(m){c=m.className;if(m.tagName=='TD'){if(c==''){if(!m.innerHTML.match(/ /)){m.className='xpart';m.innerHTML='<span onclick=\'Bump(this);\'>'+m.innerHTML+'</span>';m.id='p'+i;}else if(!m.innerHTML.match(/\n/))m.className='xdesc';}else if(c=='image')m.id='i'+i;else if(c=='colorNumber')m.id='c'+i;}m=m.nextSibling;}}n=n.nextSibling;}var s=d.createElement('script');s.type='text/javascript';s.text='function SetAI(a,c){a.innerHTML=\'<img alt=%22View on Peeron.com%22 title=%22View on Peeron.com%22 src=%22http://media.peeron.com/ldraw/images/\'+c+\'/100/\'+a.href.match(/[^\\/]*$/)+\'.png%22>\';}function Bump(e){var n,i,c,nc,o,t,r;i=e.parentNode.id.substr(1);c=o=0;if(n=document.getElementById(\'c\'+i)){o=n.innerHTML.match(/^#?\\-?\\d*/);c=o<\'-\'?7:o<0?0:o;}if(n=document.getElementById(\'i\'+i)){n=n.firstChild;if(n.firstChild.tagName==\'IMG\'){c=n.firstChild.src.split(\'/\')[5];if(nc=prompt(\'Set image color. Include = for similar or == for global\',c)){c=nc.replace(/=/g,\'\');r=nc.match(/=+/);if(r)for(t=document.getElementsByTagName(\'td\'),i=0;i<t.length;i++)if(((t[i].className==\'colorNumber\')&&(t[i].innerHTML.match(/^#?\\-?\\d*/)+\'\'==o))||((t[i].className==\'image\')&&(r==\'==\')))SetAI(document.getElementById(\'i\'+t[i].id.substr(1)).firstChild,c);}else return;}SetAI(n,c);}}function Resort(m){var o,t,n,r,i;function gk(f,n){n=n.firstChild;while(n){i=n.innerHTML;o=n.className;if((f==1)&&(o==\'quantity\'))return parseInt(i);if((f==2)&&(o==\'xpart\'))return n.firstChild.innerHTML;if((f==3)&&(o==\'colorNumber\'))return i[0]==\'#\'?parseInt(i.substr(1),16):parseInt(i.replace(/[^\\-\\d]*/g,\'\'));if((f==4)&&(o==\'xdesc\'))return i;n=n.nextSibling;}return 0;}function sorter(f,r){return function(a,b){var at=parseInt(a.title),bt=parseInt(b.title);return a=gk(f,a),b=gk(f,b),a!=b?r*((a>b)-(b>a)):at>bt?1:-1;}}t=document.getElementsByTagName(\'tbody\')[1];n=t.firstChild;var r=new Array();i=1;while(n){o=n;n=n.nextSibling;if((o.tagName==\'TR\')&&(!o.innerHTML.match(/list generated by/))){o.title=i++;r.push(t.removeChild(o));}}try{if(m==om)m=-m;}catch(e){}om=m;r.sort(sorter(m<0?-m:m,m<0?-1:1));n=r.length;while(n--){r[n].removeAttribute(\'title\');t.insertBefore(r[n],t.firstChild);}}';d.getElementsByTagName('head')[0].appendChild(s);})(document);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×