Guest User

Untitled

a guest
Mar 11th, 2015
197
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        MAL Radio Filter
  3. // @namespace   myanimelist.net
  4. // @include     http://myanimelist.net/animelist/*
  5. // @require     http://code.jquery.com/jquery-latest.min.js
  6. // @require     http://code.jquery.com/ui/1.10.2/jquery-ui.js
  7. // @description This script adds four radio buttons (All, TV, Movie, OVA & Special) that allows you to show just one type of anime at a time. e.g. if you click on the "Movie" button, it will show you only the movies, and hide TV series, OVAs and other stuff.
  8. // @version     1.5.9
  9. // @grant       GM_getValue
  10. // @grant       GM_setValue
  11. // ==/UserScript==
  12.  
  13. typevar='All';
  14. scorevar='All';
  15. progressvar='All';
  16. airingvar='All';
  17. ratingvar='All';
  18. equalscore='0';
  19. selecttype=1;
  20. selectrat=1;
  21. rangescore='';
  22. animename='';
  23.  
  24. function myFunction() {
  25.     var x=$(this).val();
  26.     if ($(this).attr('class')=='type') { typevar=x; }
  27.     else if ($(this).attr('class')=='score') { scorevar=x; }
  28.     else if ($(this).attr('class')=='progress') { progressvar=x; }
  29.     else if ($(this).attr('class')=='airing') { airingvar=x; airselect = $(this)[0].checked; }
  30.     else if ($(this).attr('class')=='rating') { ratingvar=x; }
  31.     else if ($(this).attr('id')=='select') { selecttype=parseInt(x); }
  32.     else if ($(this).attr('id')=='ratselect') { selectrat=parseInt(x); }
  33.     else if ($(this).attr('id')=='equal') { equalscore=x; }
  34.     else if ($(this).attr('id')=='name') { animename=x; }
  35.  
  36.     $("tbody > tr:has(.td1,.td2)").hide();
  37. //console.log(item.parent().is("thead") ? "Yes" : "No");
  38.     var exp="tbody > tr";
  39.  
  40.     $.expr[':'].ratingEquals = $.expr.createPseudo(function(arg) {
  41.         return function( elem ) {
  42.             return $(elem).text().match(" " + arg + "$");
  43.         };
  44.     });
  45.  
  46.     if ( $(table).is(':visible') ) {
  47.         GM_setValue('type', typevar);
  48.         GM_setValue('select', selecttype.toString());
  49.     }
  50.     if ( $(table2).is(':visible') ) {
  51.         GM_setValue('score', scorevar);
  52.         GM_setValue('equal', equalscore);
  53.         GM_setValue('range', rangescore);
  54.     }
  55.     if ( $(table3).is(':visible') ) {
  56.         GM_setValue('progress', progressvar);
  57.         GM_setValue('name', animename);
  58.     }
  59.     if ( $(table5).is(':visible') ) {
  60.         GM_setValue('rating', ratingvar);
  61.         GM_setValue('ratselect', selectrat.toString());
  62.     }
  63.  
  64.  
  65.     if (typevar!='All' && selecttype) { exp=exp+":has(td[width='50']:contains('"+typevar+"'))"; }
  66.     else if (typevar!='All' && !selecttype) { exp=exp+":not(:has(td[width='50']:contains('"+typevar+"')))"; }
  67.     if (scorevar!='All' && equalscore=='0') { exp=exp+":has(td[width='45']:contains('"+scorevar+"'))"; }
  68.     else if (scorevar!='All' && equalscore=='1') { exp=exp+":has(td[width='45']:not(:contains('"+scorevar+"')))"; }
  69.     if (ratingvar!='All' && selectrat) { exp=exp+":has(td[width='50']:ratingEquals('"+ratingvar+"'))"; }
  70.     else if (ratingvar!='All' && !selectrat) { exp=exp+":not(:has(td[width='50']:ratingEquals('"+ratingvar+"')))"; }
  71.  
  72.     exp=exp + ":has(td[style='border-left-width: 0']";
  73.     if (notairing.checked) { exp=exp+":not(:contains('Airing'),:contains('Not Yet Aired')),"; }
  74.     if (airingt.checked) { exp=exp+":contains('Airing'),"; }
  75.     if (notyetaired.checked) { exp=exp+":contains('Not Yet Aired')"; }
  76.     else if (exp.slice(-1) == ',') { exp = exp.slice(0,-1); }
  77.     exp=exp + ")";
  78.  
  79.     if (progressvar!='All') { begin=progressvar.split('-')[0]; end=progressvar.split('-')[1]; exp = $(exp).filter(function() { return parseInt($("td[width='70']", this).text()) < parseInt(end) && parseInt($("td[width='70']", this).text()) >= parseInt(begin); }); }
  80.     if (scorevar!='All' && equalscore=='2') { exp=$(exp).filter(function() { return parseInt($("td[width='45']", this).text()) >= parseInt(scorevar); }); }
  81.     else if (scorevar!='All' && equalscore=='3') { exp=$(exp).filter(function() { return parseInt($("td[width='45']", this).text()) <= parseInt(scorevar); }); }
  82.     else if (equalscore=='4') { scorebegin=rangescore.split('-')[0]; scoreend=rangescore.split('-')[1]; exp=$(exp).filter(function() { return parseInt($("td[width='45']", this).text()) <= parseInt(scoreend) && parseInt($("td[width='45']", this).text()) >= parseInt(scorebegin); }); }
  83.  
  84.     if (airingvar != 'All') {
  85.         GM_setValue(airingvar, airselect);
  86.     }
  87.  
  88.     $(exp).each(function(){
  89.         if ($(this).text().search(new RegExp(animename, "i")) >=0) { $(this).show(); }
  90.     });
  91. }
  92.  
  93. $(document).ready(function() {
  94.     $(".type,.score,.progress,.airing,select,.rating,ratselect").click(myFunction);
  95.     $("#name").focusin(function() {
  96.         if (this.value=='Enter a title') { $(this).val(''); }
  97.     });
  98.     $("#name").focusout(function() {
  99.         if (this.value=='') { $(this).val('Enter a title'); }
  100.     });
  101.     $("#name").keyup(myFunction);
  102.  
  103.     $("#choose").click(function() {
  104.         var bha = prompt('Choose score range separated by a minus','6-8');
  105.         $(this).text(bha);
  106.         rangescore=bha;
  107.         myFunction();
  108.     });
  109.  
  110.     $(function() {
  111.         $(".drag").draggable({
  112.             // Remove right position so that two last options in 'Airing' table do not get distorted (breaked to a new line) when dragged close to the right edge of the screen.
  113.             start: function(event, ui) {
  114.                 $(this).css('right', '');
  115.             },
  116.  
  117.             // Find position where image is dropped.
  118.             stop: function(event, ui) {
  119.                 // Save dropped position.
  120.                 var stopPos = $(this).position();
  121.                 GM_setValue(this.id + ".left", stopPos.left + 'px');
  122.                 GM_setValue(this.id + ".top", stopPos.top + 'px');
  123.             }
  124.         });
  125.     });
  126.  
  127.     columnChecker = xpath("//td[@class='table_header'][@width='50']");
  128.     if (columnChecker.snapshotLength < 2) {
  129.         if (columnChecker.snapshotLength == 0) {
  130.             $(table).hide();
  131.             $(table5).hide();
  132.         } else {
  133.             columnChecker = xpath("//td[@class='table_header'][@width='50'][@nowrap='']");
  134.             if (columnChecker.snapshotLength == 1) {
  135.                 $(table5).hide();
  136.             } else {
  137.                 $(table).hide();
  138.             }
  139.         }
  140.     }
  141.     if ( $(table).is(':visible') ) {
  142.         typevar = loadValue(typevar, 'type');
  143.         selecttype = parseInt(loadValue(selecttype, 'select'));
  144.     }
  145.     if ( $(table5).is(':visible') ) {
  146.         ratingvar = loadValue(ratingvar, 'rating');
  147.         selectrat = parseInt(loadValue(selectrat, 'ratselect'));
  148.     }
  149.     columnChecker = xpath("//td[@class='table_header'][@width='45']");
  150.     if (columnChecker.snapshotLength != 1) {
  151.         $(table2).hide();
  152.     } else {
  153.         scorevar = loadValue(scorevar, 'score');
  154.         equalscore = loadValue(equalscore, 'equal');
  155.         rangescore = loadValue(rangescore, 'range');
  156.     }
  157.     columnChecker = xpath("//td[@class='table_header'][@width='70']");
  158.     if (columnChecker.snapshotLength != 1) {
  159.         $(table3).hide();
  160.     } else {
  161.         progressvar = loadValue(progressvar, 'progress');
  162.         animename = loadValue(animename, 'name');
  163.     }
  164.     //One 'Airing' and one 'Not Yet Aired' strings are present in the filter table itself
  165.     if ($("tr:contains('Airing')").length == 1 && $("tr:contains('Not Yet Aired')").length == 1) {
  166.         $(table4).hide();
  167.     } else {
  168.         airingt.checked = loadValue(airingt.checked, 'Airing')
  169.         notairing.checked = loadValue(notairing.checked, 'Finished')
  170.         notyetaired.checked = loadValue(notyetaired.checked, 'Not Yet Aired')
  171.     }
  172.  
  173.     if ( $(table).is(':visible') ) {
  174.         menutype.value = selecttype;
  175.         loadState(typevar, 'type');
  176.     }
  177.     if ( $(table2).is(':visible') ) {
  178.         menuscore.value = equalscore;
  179.         if (equalscore == 4) {
  180.             choose.innerHTML = rangescore;
  181.         } else {
  182.             rangescore = '';
  183.         }
  184.         loadState(scorevar, 'score');
  185.     }
  186.     if ( $(table3).is(':visible') ) {
  187.         if (animename != '') {
  188.             namee.value=animename;
  189.         }
  190.         loadState(progressvar, 'progress');
  191.     }
  192.     if ( $(table5).is(':visible') ) {
  193.         menurating.value = selectrat;
  194.         loadState(ratingvar, 'rating');
  195.     }
  196.     if ( $(table4).is(':visible') ) {
  197.         myFunction();
  198.     }
  199.  
  200.     /*$(".drag div").hide();
  201.     $(".drag").hover(function() {
  202.         $("div", this).stop(true, true).slideToggle(200);
  203.     })*/
  204. });
  205.  
  206. table=document.createElement('table');
  207. table.className='drag';
  208. table.id='type';
  209. table.style.right='190px';
  210. table2=document.createElement('table');
  211. table2.className='drag';
  212. table2.id='score';
  213. table2.style.right='40px';
  214. table3=document.createElement('table');
  215. table3.className='drag';
  216. table3.id='progress';
  217. table3.style.right='190px';
  218. table4=document.createElement('table');
  219. table4.className='drag';
  220. table4.id='airing';
  221. table4.style.right='60px';
  222. table5=document.createElement('table');
  223. table5.className='drag';
  224. table5.id='rating';
  225. table5.style.right='190px';
  226.  
  227. type=document.createElement('td');
  228. type.className='td';
  229. score=document.createElement('td');
  230. score.className='td';
  231. progress=document.createElement('td');
  232. progress.className='td';
  233. airing=document.createElement('td');
  234. airing.className='td';
  235. rating=document.createElement('td');
  236. rating.className='td';
  237.  
  238. headtype=document.createElement('tr');
  239. headscore=document.createElement('tr');
  240. headprogress=document.createElement('tr');
  241. headairing=document.createElement('tr');
  242. headrating=document.createElement('tr');
  243.  
  244. divtype=document.createElement('div');
  245. divscore=document.createElement('div');
  246. divprogress=document.createElement('div');
  247. divairing=document.createElement('div');
  248. divrating=document.createElement('div');
  249.  
  250. imagetype=document.createElement('div');
  251. imagetype.className='group_header';
  252. imagetype.innerHTML='type';
  253. imagescore=document.createElement('div');
  254. imagescore.className='group_header';
  255. imagescore.innerHTML='score';
  256. imageprogress=document.createElement('div');
  257. imageprogress.className='group_header';
  258. imageprogress.innerHTML='progress';
  259. imageairing=document.createElement('div');
  260. imageairing.className='group_header';
  261. imageairing.innerHTML='status';
  262. imagerating=document.createElement('div');
  263. imagerating.className='group_header';
  264. imagerating.innerHTML='rating';
  265.  
  266. tr1=document.createElement('tr');
  267. tr2=document.createElement('tr');
  268. tr3=document.createElement('tr');
  269. tr4=document.createElement('tr');
  270. tr5=document.createElement('tr');
  271. tr6=document.createElement('tr');
  272. tr7=document.createElement('tr');
  273. tr8=document.createElement('tr');
  274. tr9=document.createElement('tr');
  275. tr10=document.createElement('tr');
  276. tr11=document.createElement('tr');
  277. tr12=document.createElement('tr');
  278. tr13=document.createElement('tr');
  279. tr14=document.createElement('tr');
  280. tr15=document.createElement('tr');
  281. tr16=document.createElement('tr');
  282. tr17=document.createElement('tr');
  283. tr18=document.createElement('tr');
  284. tr19=document.createElement('tr');
  285. tr20=document.createElement('tr');
  286. tr21=document.createElement('tr');
  287. tr22=document.createElement('tr');
  288. tr23=document.createElement('tr');
  289. tr24=document.createElement('tr');
  290. tr25=document.createElement('tr');
  291. tr26=document.createElement('tr');
  292. tr27=document.createElement('tr');
  293. tr28=document.createElement('tr');
  294. tr29=document.createElement('tr');
  295. tr30=document.createElement('tr');
  296. tr31=document.createElement('tr');
  297. tr32=document.createElement('tr');
  298. tr33=document.createElement('tr');
  299. tr34=document.createElement('tr');
  300. tr35=document.createElement('tr');
  301. tr36=document.createElement('tr');
  302. tr37=document.createElement('tr');
  303. tr38=document.createElement('tr');
  304. tr39=document.createElement('tr');
  305.  
  306. alltype=document.createElement('input');
  307. alltype.className='type';
  308. alltype.value='All';
  309. alltype.checked='yes';
  310. alltypetext=document.createElement('a');
  311. alltypetext.innerHTML='All';
  312.  
  313. tv=document.createElement('input');
  314. tv.className='type';
  315. tv.value='TV';
  316. tvtext=document.createElement('a');
  317. tvtext.innerHTML='TV';
  318.  
  319. movie=document.createElement('input');
  320. movie.className='type';
  321. movie.value='Movie';
  322. movietext=document.createElement('a');
  323. movietext.innerHTML='Movie';
  324.  
  325. ova=document.createElement('input');
  326. ova.className='type';
  327. ova.value='OVA';
  328. ovatext=document.createElement('a');
  329. ovatext.innerHTML='OVA';
  330.  
  331. ona=document.createElement('input');
  332. ona.className='type';
  333. ona.value='ONA';
  334. onatext=document.createElement('a');
  335. onatext.innerHTML='ONA';
  336.  
  337. special=document.createElement('input');
  338. special.className='type';
  339. special.value='Special';
  340. specialtext=document.createElement('a');
  341. specialtext.innerHTML='Special';
  342.  
  343. music=document.createElement('input');
  344. music.className='type';
  345. music.value='Music';
  346. musictext=document.createElement('a');
  347. musictext.innerHTML='Music';
  348.  
  349.  
  350. menutype=document.createElement('select');
  351. menutype.id='select';
  352.  
  353. select=document.createElement('option');
  354. select.value='1';
  355. select.selected='selected';
  356. select.innerHTML='Select';
  357.  
  358. remove=document.createElement('option');
  359. remove.value='0';
  360. remove.innerHTML='Remove';
  361.  
  362.  
  363. allscore=document.createElement('input');
  364. allscore.className='score';
  365. allscore.value='All';
  366. allscore.checked='yes';
  367. allscoretext=document.createElement('a');
  368. allscoretext.innerHTML='All';
  369.  
  370. score10=document.createElement('input');
  371. score10.className='score';
  372. score10.value='10';
  373. score10text=document.createElement('a');
  374. score10text.innerHTML='10';
  375.  
  376. score9=document.createElement('input');
  377. score9.className='score';
  378. score9.value='9';
  379. score9text=document.createElement('a');
  380. score9text.innerHTML='9';
  381.  
  382. score8=document.createElement('input');
  383. score8.className='score';
  384. score8.value='8';
  385. score8text=document.createElement('a');
  386. score8text.innerHTML='8';
  387.  
  388. score7=document.createElement('input');
  389. score7.className='score';
  390. score7.value='7';
  391. score7text=document.createElement('a');
  392. score7text.innerHTML='7';
  393.  
  394. score6=document.createElement('input');
  395. score6.className='score';
  396. score6.value='6';
  397. score6text=document.createElement('a');
  398. score6text.innerHTML='6';
  399.  
  400. score5=document.createElement('input');
  401. score5.className='score';
  402. score5.value='5';
  403. score5text=document.createElement('a');
  404. score5text.innerHTML='5';
  405.  
  406. score4=document.createElement('input');
  407. score4.className='score';
  408. score4.value='4';
  409. score4text=document.createElement('a');
  410. score4text.innerHTML='4';
  411.  
  412. score3=document.createElement('input');
  413. score3.className='score';
  414. score3.value='3';
  415. score3text=document.createElement('a');
  416. score3text.innerHTML='3';
  417.  
  418. score2=document.createElement('input');
  419. score2.className='score';
  420. score2.value='2';
  421. score2text=document.createElement('a');
  422. score2text.innerHTML='2';
  423.  
  424. score1=document.createElement('input');
  425. score1.className='score';
  426. score1.value='1';
  427. score1text=document.createElement('a');
  428. score1text.innerHTML='1';
  429.  
  430. scorenull=document.createElement('input');
  431. scorenull.className='score';
  432. scorenull.value='-';
  433. scorenulltext=document.createElement('a');
  434. scorenulltext.innerHTML='-';
  435.  
  436.  
  437. menuscore=document.createElement('select');
  438. menuscore.id='equal';
  439.  
  440. equal=document.createElement('option');
  441. equal.value='0';
  442. equal.selected='selected';
  443. equal.innerHTML='Equal to';
  444.  
  445. notequal=document.createElement('option');
  446. notequal.value='1';
  447. notequal.innerHTML='Not equal to';
  448.  
  449. greater=document.createElement('option');
  450. greater.value='2';
  451. greater.innerHTML='Greater than';
  452.  
  453. smaller=document.createElement('option');
  454. smaller.value='3';
  455. smaller.innerHTML='Smaller than';
  456.  
  457. choose=document.createElement('option');
  458. choose.value='4';
  459. choose.id='choose';
  460. choose.innerHTML='Choose range';
  461.  
  462.  
  463. namee=document.createElement('input');
  464. namee.id='name';
  465. namee.type='text';
  466. namee.style.width='80px';
  467. namee.value='Enter a title';
  468.  
  469. allprogress=document.createElement('input');
  470. allprogress.className='progress';
  471. allprogress.value='All';
  472. allprogress.checked='yes';
  473. allprogresstext=document.createElement('a');
  474. allprogresstext.innerHTML='All';
  475.  
  476. short=document.createElement('input');
  477. short.className='progress';
  478. short.value='0-25';
  479. shorttext=document.createElement('a');
  480. shorttext.innerHTML='Short';
  481.  
  482. medium=document.createElement('input');
  483. medium.className='progress';
  484. medium.value='25-50';
  485. mediumtext=document.createElement('a');
  486. mediumtext.innerHTML='Medium';
  487.  
  488. long=document.createElement('input');
  489. long.className='progress';
  490. long.value='50-100';
  491. longtext=document.createElement('a');
  492. longtext.innerHTML='Long';
  493.  
  494. infinite=document.createElement('input');
  495. infinite.className='progress';
  496. infinite.value='100-10000';
  497. infinitetext=document.createElement('a');
  498. infinitetext.innerHTML='Infinite';
  499.  
  500.  
  501. allairing=document.createElement('input');
  502. allairing.className='airing';
  503. allairing.value='All';
  504. allairing.checked='yes';
  505. allairingtext=document.createElement('a');
  506. allairingtext.innerHTML='All';
  507.  
  508. airingt=document.createElement('input');
  509. airingt.className='airing';
  510. airingt.value='Airing';
  511. airingt.checked = 'yes';
  512. airingtext=document.createElement('a');
  513. airingtext.innerHTML='Airing';
  514.  
  515. notairing=document.createElement('input');
  516. notairing.className='airing';
  517. notairing.value='Finished';
  518. notairing.checked = 'yes';
  519. notairingtext=document.createElement('a');
  520. notairingtext.innerHTML='Finished';
  521.  
  522. notyetaired=document.createElement('input');
  523. notyetaired.className='airing';
  524. notyetaired.value='Not Yet Aired';
  525. notyetaired.checked = 'yes';
  526. notyetairedtext=document.createElement('a');
  527. notyetairedtext.innerHTML='Not Yet Aired';
  528.  
  529.  
  530. allrating=document.createElement('input');
  531. allrating.className='rating';
  532. allrating.value='All';
  533. allrating.checked='yes';
  534. allratingtext=document.createElement('a');
  535. allratingtext.innerHTML='All';
  536.  
  537. grating=document.createElement('input');
  538. grating.className='rating';
  539. grating.value='G';
  540. gratingtext=document.createElement('a');
  541. gratingtext.innerHTML='G';
  542.  
  543. pgrating=document.createElement('input');
  544. pgrating.className='rating';
  545. pgrating.value='PG';
  546. pgratingtext=document.createElement('a');
  547. pgratingtext.innerHTML='PG';
  548.  
  549. pg13rating=document.createElement('input');
  550. pg13rating.className='rating';
  551. pg13rating.value='PG-13';
  552. pg13ratingtext=document.createElement('a');
  553. pg13ratingtext.innerHTML='PG-13';
  554.  
  555. rrating=document.createElement('input');
  556. rrating.className='rating';
  557. rrating.value='R';
  558. rratingtext=document.createElement('a');
  559. rratingtext.innerHTML='R';
  560.  
  561. rprating=document.createElement('input');
  562. rprating.className='rating';
  563. rprating.value='R\\+';
  564. rpratingtext=document.createElement('a');
  565. rpratingtext.innerHTML='R+';
  566.  
  567. rxrating=document.createElement('input');
  568. rxrating.className='rating';
  569. rxrating.value='Rx';
  570. rxratingtext=document.createElement('a');
  571. rxratingtext.innerHTML='Rx';
  572.  
  573. menurating=document.createElement('select');
  574. menurating.id='ratselect';
  575.  
  576. ratselect=document.createElement('option');
  577. ratselect.value='1';
  578. ratselect.selected='selected';
  579. ratselect.innerHTML='Select';
  580.  
  581. ratremove=document.createElement('option');
  582. ratremove.value='0';
  583. ratremove.innerHTML='Remove';
  584.  
  585. document.body.appendChild(table);
  586. table.appendChild(type);
  587. type.appendChild(headtype);
  588.     headtype.appendChild(imagetype);
  589. type.appendChild(divtype);
  590. divtype.appendChild(tr27);
  591.     tr27.appendChild(menutype);
  592.         menutype.appendChild(select);
  593.         menutype.appendChild(remove);
  594. divtype.appendChild(tr16);
  595.     tr16.appendChild(alltype);
  596.     tr16.appendChild(alltypetext);
  597. divtype.appendChild(tr1);
  598.     tr1.appendChild(tv);
  599.     tr1.appendChild(tvtext);
  600. divtype.appendChild(tr2);
  601.     tr2.appendChild(movie);
  602.     tr2.appendChild(movietext);
  603. divtype.appendChild(tr3);
  604.     tr3.appendChild(ova);
  605.     tr3.appendChild(ovatext);
  606. divtype.appendChild(tr23);
  607.     tr23.appendChild(ona);
  608.     tr23.appendChild(onatext);
  609. divtype.appendChild(tr4);
  610.     tr4.appendChild(special);
  611.     tr4.appendChild(specialtext);
  612. divtype.appendChild(tr38);
  613.     tr38.appendChild(music);
  614.     tr38.appendChild(musictext);
  615.  
  616. document.body.appendChild(table2);
  617. table2.appendChild(score);
  618. score.appendChild(headscore);
  619.     headscore.appendChild(imagescore);
  620. score.appendChild(divscore);
  621. divscore.appendChild(tr28);
  622.     tr28.appendChild(menuscore);
  623.         menuscore.appendChild(equal);
  624.         menuscore.appendChild(notequal);
  625.         menuscore.appendChild(greater);
  626.         menuscore.appendChild(smaller);
  627.         menuscore.appendChild(choose);
  628. divscore.appendChild(tr17);
  629.     tr17.appendChild(allscore);
  630.     tr17.appendChild(allscoretext);
  631. divscore.appendChild(tr5);
  632.     tr5.appendChild(score10);
  633.     tr5.appendChild(score10text);
  634. divscore.appendChild(tr6);
  635.     tr6.appendChild(score9);
  636.     tr6.appendChild(score9text);
  637. divscore.appendChild(tr7);
  638.     tr7.appendChild(score8);
  639.     tr7.appendChild(score8text);
  640. divscore.appendChild(tr8);
  641.     tr8.appendChild(score7);
  642.     tr8.appendChild(score7text);
  643. divscore.appendChild(tr9);
  644.     tr9.appendChild(score6);
  645.     tr9.appendChild(score6text);
  646. divscore.appendChild(tr10);
  647.     tr10.appendChild(score5);
  648.     tr10.appendChild(score5text);
  649. divscore.appendChild(tr11);
  650.     tr11.appendChild(score4);
  651.     tr11.appendChild(score4text);
  652. divscore.appendChild(tr12);
  653.     tr12.appendChild(score3);
  654.     tr12.appendChild(score3text);
  655. divscore.appendChild(tr13);
  656.     tr13.appendChild(score2);
  657.     tr13.appendChild(score2text);
  658. divscore.appendChild(tr14);
  659.     tr14.appendChild(score1);
  660.     tr14.appendChild(score1text);
  661. divscore.appendChild(tr15);
  662.     tr15.appendChild(scorenull);
  663.     tr15.appendChild(scorenulltext);
  664.  
  665. document.body.appendChild(table3);
  666. table3.appendChild(progress);
  667. progress.appendChild(headprogress);
  668.     headprogress.appendChild(imageprogress);
  669. progress.appendChild(divprogress);
  670. divprogress.appendChild(tr29);
  671.     tr29.appendChild(namee);
  672. divprogress.appendChild(tr18);
  673.     tr18.appendChild(allprogress);
  674.     tr18.appendChild(allprogresstext);
  675. divprogress.appendChild(tr19);
  676.     tr19.appendChild(short);
  677.     tr19.appendChild(shorttext);
  678. divprogress.appendChild(tr20);
  679.     tr20.appendChild(medium);
  680.     tr20.appendChild(mediumtext);
  681. divprogress.appendChild(tr21);
  682.     tr21.appendChild(long);
  683.     tr21.appendChild(longtext);
  684. divprogress.appendChild(tr22);
  685.     tr22.appendChild(infinite);
  686.     tr22.appendChild(infinitetext);
  687.  
  688. document.body.appendChild(table4);
  689. table4.appendChild(airing);
  690. airing.appendChild(headairing);
  691.     headairing.appendChild(imageairing);
  692. airing.appendChild(divairing);
  693. /*divairing.appendChild(tr24);
  694.     tr24.appendChild(allairing);
  695.     tr24.appendChild(allairingtext);*/
  696. divairing.appendChild(tr25);
  697.     tr25.appendChild(airingt);
  698.     tr25.appendChild(airingtext);
  699. divairing.appendChild(tr26);
  700.     tr26.appendChild(notairing);
  701.     tr26.appendChild(notairingtext);
  702. divairing.appendChild(tr39);
  703.     tr39.appendChild(notyetaired);
  704.     tr39.appendChild(notyetairedtext);
  705.  
  706. document.body.appendChild(table5);
  707. table5.appendChild(rating);
  708. rating.appendChild(headrating);
  709.     headrating.appendChild(imagerating);
  710. rating.appendChild(divrating);
  711. divrating.appendChild(tr30);
  712.     tr30.appendChild(menurating);
  713.         menurating.appendChild(ratselect);
  714.         menurating.appendChild(ratremove);
  715. divrating.appendChild(tr31);
  716.     tr31.appendChild(allrating);
  717.     tr31.appendChild(allratingtext);
  718. divrating.appendChild(tr32);
  719.     tr32.appendChild(grating);
  720.     tr32.appendChild(gratingtext);
  721. divrating.appendChild(tr33);
  722.     tr33.appendChild(pgrating);
  723.     tr33.appendChild(pgratingtext);
  724. divrating.appendChild(tr34);
  725.     tr34.appendChild(pg13rating);
  726.     tr34.appendChild(pg13ratingtext);
  727. divrating.appendChild(tr35);
  728.     tr35.appendChild(rrating);
  729.     tr35.appendChild(rratingtext);
  730. divrating.appendChild(tr36);
  731.     tr36.appendChild(rprating);
  732.     tr36.appendChild(rpratingtext);
  733. divrating.appendChild(tr37);
  734.     tr37.appendChild(rxrating);
  735.     tr37.appendChild(rxratingtext);
  736.  
  737.  
  738. $(".drag").css({"position":"fixed","top":"100px","background":"white","opacity":"0.7","padding":"10px","borderRadius":"10px"});
  739. $(".group_header").css({"font-size":"14pt","font-family":"Verdana, Arial, sans-serif","font-weight":"normal","color":"black"});
  740. table3.style.top='325px';
  741. table4.style.top='465px';
  742. table5.style.top='510px';
  743. // Load saved position (if present)
  744. function loadPos (ID) {
  745.     leftX = GM_getValue(ID + '.left');
  746.     topY = GM_getValue(ID + '.top');
  747.     if(leftX != null) {
  748.         document.getElementById(ID).style.left = leftX;
  749.         document.getElementById(ID).style.right = '';
  750.     }
  751.     if(topY != null) {
  752.         document.getElementById(ID).style.top = topY;
  753.     }
  754. }
  755. loadPos('type');
  756. loadPos('score');
  757. loadPos('progress');
  758. loadPos('airing');
  759. loadPos('rating');
  760. $(".td a").css({"color":"black"});
  761. $(".type").attr({type:"radio",name:"group1"});
  762. $(".score").attr({type:"radio",name:"group2"});
  763. $(".progress").attr({type:"radio",name:"group3"});
  764. $(".airing").attr({type:"checkbox",name:"group4"});
  765. $(".select").attr({type:"radio",name:"group5"});
  766. $(".equal").attr({type:"radio",name:"group6"});
  767. $(".rating").attr({type:"radio",name:"group7"});
  768.  
  769. function xpath(query, object) {
  770.     if(!object) var object = document;
  771.     return document.evaluate(query, object, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  772. }
  773. function loadValue(defaultValue, value) {
  774.     loaded = GM_getValue(value);
  775.     if(loaded != null) {
  776.         return loaded;
  777.     } else {
  778.         return defaultValue;
  779.     }
  780. }
  781. function loadState(value, classVal)
  782. {
  783.     if (value  != 'All') {
  784.         var allInputs = document.getElementsByTagName("input");
  785.         for(var x=0; x < allInputs.length; x++) {
  786.             if((allInputs[x].value == value) && (allInputs[x].className == classVal)) {
  787.                 var byValue = allInputs[x];
  788.             }
  789.         }
  790.         $(byValue).click();
  791.     }
  792. }
RAW Paste Data