TraderSamwise / Coingrats Local Converter

// ==UserScript==
// @name         Coingrats Local Converter
// @namespace    http://github.com/tradersamwise/
// @version      0.1
// @description  Fix local number issue on dutch calculator site
// @author       @TraderSamwise
// @match        https://coingrats.nl/positie-calculator/
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
// @license      MIT
// ==/UserScript==


// Convert to comma
function convertComma(value) {
    return value.replace(/\./g, ',')
}

// Convert defined dom element commas
function convertThisComma(name) {
    const input1 = document.getElementById(name)
    input1.value = convertComma(input1.value)
}


// Set event listeners to convert commas
(function() {
    'use strict';

    setTimeout(function(){
        document.getElementById("fieldname9_3").addEventListener("change", function() {
          convertThisComma("fieldname9_3")
        })
        document.getElementById("fieldname8_3").addEventListener("change", function() {
          convertThisComma("fieldname8_3")
        })
    }, 2000);


})();