Scripts:Animepage:Sourcecode3: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Fix for recent site changes which broke decimal vote) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
// AniDB-Site- | // AniDB-Site-Enhancements: Decimal Vote | ||
// - Replace vote-dropdowns with textfields (enter integers from 100 to 1000) | // - Replace vote-dropdowns with textfields (enter integers from 100 to 1000) | ||
// | // | ||
// Version | // Version 20051210.01 | ||
// works with FF1.5 and greasemonkey 0.6.4 | |||
// Copyright (c) 2005, Lupin III. | // Copyright (c) 2005, Lupin III. | ||
// Released under the GPL license | // Released under the GPL license | ||
// http://www.gnu.org/copyleft/gpl.html | // http://www.gnu.org/copyleft/gpl.html | ||
// | // | ||
// Thanks to | |||
// TechNiko for the webspace | |||
// visnu for some advice on speedups for long animelists | |||
// | // | ||
// ==UserScript== | // ==UserScript== | ||
// @name AniDB-Site-Enhancer | // @name AniDB-Site-Enhancer: Decimal Vote | ||
// @namespace lupin_sanseis_scripts | // @namespace lupin_sanseis_scripts | ||
// @description replaces vote dropdowns with textfields | // @description selects all files of a release group, replaces vote dropdowns with textfields | ||
// @include http://anidb. | // @include http://anidb.net/perl-bin/animedb.pl?show=anime&* | ||
// ==/UserScript== | // ==/UserScript== | ||
(function() { | (function() { | ||
// 2D-array containing all the checkbox names corresponding to a group | |||
checkbox_names = new Object(); | |||
function initialize() { | function initialize() { | ||
// use '//' to disable unwanted functions | |||
decimal_vote(); | decimal_vote(); | ||
} | } | ||
Line 24: | Line 32: | ||
function decimal_vote() { | function decimal_vote() { | ||
// replace vote-dropdowns with textfields | // replace vote-dropdowns with textfields | ||
var selects = document.evaluate("//select[ | var selects = document.evaluate("//select[@name = 'votea.rate']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); | ||
for (var i = 0; i < selects.snapshotLength; i++) { | for (var i = 0; i < selects.snapshotLength; i++) { | ||
var textfield = document.createElement('input'); | var textfield = document.createElement('input'); | ||
Line 37: | Line 45: | ||
window.addEventListener("load", initialize(), false); | window.addEventListener("load", initialize(), false); | ||
})();</pre> | })(); </pre> |
Latest revision as of 01:26, 10 March 2015
// AniDB-Site-Enhancements: Decimal Vote // - Replace vote-dropdowns with textfields (enter integers from 100 to 1000) // // Version 20051210.01 // works with FF1.5 and greasemonkey 0.6.4 // Copyright (c) 2005, Lupin III. // Released under the GPL license // http://www.gnu.org/copyleft/gpl.html // // Thanks to // TechNiko for the webspace // visnu for some advice on speedups for long animelists // // ==UserScript== // @name AniDB-Site-Enhancer: Decimal Vote // @namespace lupin_sanseis_scripts // @description selects all files of a release group, replaces vote dropdowns with textfields // @include http://anidb.net/perl-bin/animedb.pl?show=anime&* // ==/UserScript== (function() { // 2D-array containing all the checkbox names corresponding to a group checkbox_names = new Object(); function initialize() { // use '//' to disable unwanted functions decimal_vote(); } function decimal_vote() { // replace vote-dropdowns with textfields var selects = document.evaluate("//select[@name = 'votea.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', 'votea.rate'); textfield.setAttribute('value', 'vote from 100 to 1000'); selects.snapshotItem(i).parentNode.replaceChild(textfield, selects.snapshotItem(i)); } } window.addEventListener("load", initialize(), false); })();