tametomo / AniDB-Site-Enhancer: Full

// AniDB-Site-Enhancements
// - Replace vote-dropdowns with textfields (enter integers from 100 to 1000)
// - Added dexter86's status icons script
// - Added dexter86's color groups script
// - Added saji's bigger thumbnails in mylist entries
// - Added belgabor's mylist bar, disabled by default (http://wiki.anidb.net/w/Scripts:Jump_to_mylist)
// - Added Wiidat's mylist status bar (https://greasyfork.org/en/scripts/11004-mylist-status-bar)
//
// Copyright (c) 2005, Lupin III. and (c) 2015 kingtux
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
//
// ==UserScript==
// @name           AniDB-Site-Enhancer: Full
// @namespace   anidb_scripts
// @license     GPL
// @version     20170211.01
// @updateURL   https://openuserjs.org/install/tametomo/AniDB-Site-Enhancer_Full.user.js
// @description  A unified collection of user scripts which enhance AniDB
// @include        http://anidb.net/perl-bin/animedb.pl?*
// @include        https://anidb.net/perl-bin/animedb.pl?*
// @support        http://anidb.net/perl-bin/animedb.pl?show=cmt&id=53763
// @grant        none
// ==/UserScript==

(function() {

   function initialize() {
      // use '//' to disable unwanted functions
      decimal_vote();
      status_icons();
      color_groups();
      bigger_thumbs();
      mylist_status_bar();
      
      // Doesn't play nice with layout, resulting in it getting hidden by sidebar at times
      //mylist_navbar();
   }
   
   function status_icons() {
      var scriptElement = document.createElement( "script" );
      scriptElement.type = "text/javascript";
      scriptElement.src = "https://greasyfork.org/scripts/27285-anidb-net-status-icons-next-to-titles/code/AniDBnet%20status%20icons%20next%20to%20titles.user.js";
      document.body.appendChild( scriptElement );
   }
   
   function color_groups() {
      var scriptElement = document.createElement( "script" );
      scriptElement.type = "text/javascript";
      scriptElement.src = "https://openuserjs.org/src/scripts/Dexter86/AniDB_Change_background_color_of_group_in_filelist.user.js";
      document.body.appendChild( scriptElement );
   }
   
   function bigger_thumbs() {
      var url = window.location.href;
      if (url.indexOf("show=mylist") > -1) {
         var scriptElement = document.createElement( "script" );
         scriptElement.type = "text/javascript";
         scriptElement.src = "https://openuserjs.org/src/scripts/saji/bigger_thumbs_in_anidb.user.js";
         document.body.appendChild( scriptElement );
      }
   }
   
   function mylist_status_bar() {
      var url = window.location.href;
      if (url.indexOf("show=mylist") > -1 && url.indexOf("show=mylist&do=add") == -1) {
         var scriptElement = document.createElement( "script" );
         scriptElement.type = "text/javascript";
         scriptElement.src = "https://github.com/wiidat/MyList-Status-Bar/raw/master/MyList-Status-Bar.user.js";
         document.body.appendChild( scriptElement );
      }
   }
   
   function decimal_vote() {
      // replace vote-dropdowns with textfields
      var selects = document.evaluate("//select[@name = 'vote.rate']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
      for (var i = 0; i < selects.snapshotLength; i++) {
         var textfield = document.createElement('input');
         textfield.setAttribute('type', 'text');
         textfield.setAttribute('size', '25');
         textfield.setAttribute('name', 'vote.rate');
         textfield.setAttribute('value', 'vote from 100 to 1000');
         selects.snapshotItem(i).parentNode.replaceChild(textfield, selects.snapshotItem(i));
      }
   }
   
   function mylist_navbar() {
      var div = document.createElement('div');
      div.style.display='block';
      div.style.position='fixed';
      div.style.bottom='1px';
      div.style.right='1px';
      div.style.background='#FFFFFF';
      div.style.color='#000000';
      div.style.opacity='0.75';
      div.style.border='1px solid black';
      div.style.padding='5px';
      div.style.MozBorderRadiusTopleft='6px';
      div.style.fontFamily='sans-serif';
      div.style.fontSize='smaller';
      div.style.textAlign='justify';
      div.style.whiteSpace='nowrap';
      div.style.zIndex=50;
      div.innerHTML = "Jump to MyList: <a href='/perl-bin/animedb.pl?show=mylist'>all</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=0'>0-9</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=a'>a</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=b'>b</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=c'>c</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=d'>d</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=e'>e</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=f'>f</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=g'>g</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=h'>h</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=i'>i</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=j'>j</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=k'>k</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=l'>l</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=m'>m</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=n'>n</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=o'>o</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=p'>p</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=q'>q</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=r'>r</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=s'>s</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=t'>t</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=u'>u</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=v'>v</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=w'>w</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=x'>x</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=y'>y</a> | "+
         "<a href='/perl-bin/animedb.pl?show=mylist&char=z'>z</a>";
      document.body.appendChild(div);
   }

   window.addEventListener("load", initialize(), false);

})();