scripts/index.js
/**
 * Add or substract a number from the specified counter
 * @param {HTMLElement} counterButton
 * @param {Number} modifier
 */
Add or substract a number from the specified counter
@param {HTMLElement} counterButton
@param {Number} modifier
Add or substract a number from the specified counter @param { HTMLElement } counterButton @param { Number } modifier
function modifyCounter(counterButton, modifier) {
    let display = $(`#${counterButton.getAttribute("data-display")}`);
    let number = parseInt(display.attr("data-value"));
    let displayNumber = parseInt(display.html());
    let step = parseInt(display.attr("data-step"));
    if (displayNumber !== number) number = displayNumber;
    if (isNaN(number)) {
        number = MinNumber;
        step = 0;
    }
    let finalNumber = number + (modifier * step);
    if (finalNumber < MinNumber) finalNumber = MinNumber;
    if (finalNumber > MaxNumber) finalNumber = MaxNumber;
    display.attr("data-value", finalNumber);
    updateCounters();
    settings[display.attr("data-setting")] = finalNumber;
    updateSettings();
}
function modifyCounter ( counterButton , modifier ) { let display = $ ( ` ${ counterButton . getAttribute ( "data-display" ) } ` ) ; let number = parseInt ( display . attr ( "data-value" ) ) ; let displayNumber = parseInt ( display . html ( ) ) ; let step = parseInt ( display . attr ( "data-step" ) ) ; if ( displayNumber !== number ) number = displayNumber ; if ( isNaN ( number ) ) { number = MinNumber ; step = 0 ; } let finalNumber = number + ( modifier * step ) ; if ( finalNumber < MinNumber ) finalNumber = MinNumber ; if ( finalNumber > MaxNumber ) finalNumber = MaxNumber ; display . attr ( "data-value" , finalNumber ) ; updateCounters ( ) ; settings [ display . attr ( "data-setting" ) ] = finalNumber ; updateSettings ( ) ; }
Add or substract a number from the specified counter
 @param {HTMLElement} counterButton
 @param {Number} modifier
Add or substract a number from the specified counter @param { HTMLElement } counterButton @param { Number } modifier
// Also check the face value, it may have been manually edited: // Also, update the settings