From f5abc5a54b1c8840314531a17d2b5c1bbe873030 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Sun, 7 Jan 2024 00:57:02 -0400 Subject: [PATCH] Set spinner values to 0 and add update url --- VoltorbFlipSpinners/src/VoltorbFlipSpinners.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js b/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js index bac7d0f..2bc5137 100644 --- a/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js +++ b/VoltorbFlipSpinners/src/VoltorbFlipSpinners.js @@ -1,13 +1,15 @@ // ==UserScript== // @name Voltorb Flip Spinners // @namespace http://tampermonkey.net/ -// @version 0.0.1 +// @version 0.0.2 // @description Adds spinners to the inputs of numbers // @author Isaac Shoebottom // @match http://voltorbflip.com/ // @icon http://voltorbflip.com/favicon.ico // @grant none // @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== // 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 * @returns {void} @@ -65,6 +78,7 @@ function execute() { console.log("Found " + inputs.length + " inputs"); inputs.forEach(addMouseOverSpinner) + inputs.forEach((input) => setInputValue(input, 0)); } execute();