Dinbendon auto answer

Auto fill answer when dinbendon login

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Dinbendon auto answer
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Auto fill answer when dinbendon login
// @author       Yich Lin
// @include        https://dinbendon.net/do/login*
// @grant        none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @require https://greatest.deepsurf.us/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// ==/UserScript==

(function() {
    var selector = "td.alignRight:contains('='),td.alignRight:contains('等於'),td.alignRight:contains('=')";
        waitForKeyElements(selector, calculateAnswer);
    function calculateAnswer(){
        var formula = $(selector).html();
        var reg = /(\d+).*(\d+)/g
        var match = reg.exec(formula);
        var answer = parseInt(match[1])+parseInt(match[2]);
        $("input[name='result']").val(answer);
    }
})();