Set spinner values to 0 and add update url

This commit is contained in:
Isaac Shoebottom 2024-01-07 00:57:02 -04:00
parent 307dd6b0dc
commit f5abc5a54b

View File

@ -1,13 +1,15 @@
// ==UserScript== // ==UserScript==
// @name Voltorb Flip Spinners // @name Voltorb Flip Spinners
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 0.0.1 // @version 0.0.2
// @description Adds spinners to the inputs of numbers // @description Adds spinners to the inputs of numbers
// @author Isaac Shoebottom // @author Isaac Shoebottom
// @match http://voltorbflip.com/ // @match http://voltorbflip.com/
// @icon http://voltorbflip.com/favicon.ico // @icon http://voltorbflip.com/favicon.ico
// @grant none // @grant none
// @run-at document-idle // @run-at document-idle
// @updateURL https://git.shoebottom.ca/IsaacShoebottom/Scripts/raw/branch/master/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js
// @downloadURL https://git.shoebottom.ca/IsaacShoebottom/Scripts/raw/branch/master/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js
// ==/UserScript== // ==/UserScript==
// To add spinners I just need to change the input type from text to numbers // To add spinners I just need to change the input type from text to numbers
@ -50,6 +52,17 @@ function addMouseOverSpinner(inputElement) {
}); });
} }
/**
* Sets the content of the input to be the passed value
* @param {HTMLElement} inputElement
* @param {number} value
* @returns {void}
*/
function setInputValue(inputElement, value) {
console.log("Setting input value of" + inputElement + "to" + value);
inputElement.value = value;
}
/** /**
* Executes the script * Executes the script
* @returns {void} * @returns {void}
@ -65,6 +78,7 @@ function execute() {
console.log("Found " + inputs.length + " inputs"); console.log("Found " + inputs.length + " inputs");
inputs.forEach(addMouseOverSpinner) inputs.forEach(addMouseOverSpinner)
inputs.forEach((input) => setInputValue(input, 0));
} }
execute(); execute();