Scripts:Animepage:Sourcecode3

Revision as of 01:03, 10 August 2005 by Techniko (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
// AniDB-Site-Enhancer-DecimalVote
// - Replace vote-dropdowns with textfields (enter integers from 100 to 1000)
//
// Version 20050809.02
// Copyright (c) 2005, Lupin III.
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
//
// ==UserScript==
// @name           AniDB-Site-Enhancer-DecimalVote
// @namespace   lupin_sanseis_scripts
// @description  replaces vote dropdowns with textfields
// @include        http://anidb.info/perl-bin/animedb.pl?show=anime*
// ==/UserScript==

(function() {

   function initialize() {
      decimal_vote();
   }

   function decimal_vote() {
      // replace vote-dropdowns with textfields
      var selects = document.evaluate("//select[../input[@name = 'votea.tmpratenow' or @name = 'votea.ratenow']]", 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', 'votea.rate');
         textfield.setAttribute('value', 'vote from 100 to 1000');
         selects.snapshotItem(i).parentNode.replaceChild(textfield, selects.snapshotItem(i));
      }
   }

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

})();
MediaWiki spam blocked by CleanTalk.
MediaWiki spam blocked by CleanTalk.