PageSourceSearch

https://heartlog.github.io/penghitung-wr/assets/js/home.js

js heartlog.github.io collected 2026-10-03 09:17:18 UTC 2,937 bytes, 91 lines download raw bytes

1// Variables
2const hasil = document.querySelector("#hasil");
3const resultText = document.querySelector("#resultText");
4
5// Functions
6function res() {
7    validation();
8}
9
10function validation() {
11    const tMatch = parseFloat(document.querySelector("#tMatch").value);
12    const tWr = parseFloat(document.querySelector("#tWr").value);
13    const wrReq = parseFloat(document.querySelector("#wrReq").value);
14
15    const resultNum = rumus(tMatch, tWr, wrReq);
16    const loseNum = rumusLose(tMatch, tWr, wrReq);
17
18    let text = "";
19    if (isNaN(tMatch) || isNaN(tWr) || isNaN(wrReq)) {
20        text = `Field harus diisi bro.`;
21        display(text);
22    } else if (tMatch < 0 || tWr < 0 || wrReq < 0) {
23        text = `Field tidak boleh lebih kecil dari 0`;
24        display(text);
25    } else if (tMatch % 1 != 0) {
26        text = `Field harus bilangan bulat`;
27        display(text);
28    } else if (tWr == 100 && wrReq == 100) {
29        text = `Kamu memerlukan sekitar <b>0</b> win tanpa lose untuk mendapatkan win rate <b>${wrReq}%</b>`;
30        display(text);
31    } else if (wrReq > 100 || tWr > 100) {
32        text = `WR tidak boleh lebih dari 100%`;
33        display(text);
34    } else if (tWr > wrReq) {
35        text = `Kamu memerlukan sekitar <b>${loseNum}</b> lose tanpa win untuk mendapatkan win rate <b>${wrReq}%</b>`;
36        display(text);
37    } else if (tMatch == 0 && tWr == 0 && wrReq == 100) {
38        text = `Kamu memerlukan sekitar <b>1</b> win tanpa lose untuk mendapatkan win rate <b>${wrReq}%</b>`;
39        display(text);
40    } else if (wrReq == 100) {
41        text = `Gak bisa bro, jangan aneh-aneh.`;
42        display(text);
43    } else if (resultNum >= 100000) {
44        text = `<b>LU GAK AKAN BISA!</b> <br> Kamu memerlukan lebih dari <b>100.000</b> win tanpa lose untuk mendapatkan win rate <b>${wrReq}%</b>`;
45        display(text);
46    } else {
47        text = `Kamu memerlukan sekitar <b>${resultNum}</b> win tanpa lose untuk mendapatkan win rate <b>${wrReq}%</b>`;
48        display(text);
49    }
50}
51
52function display(text) {
53    return resultText.innerHTML = text;
54}
55
56function rumus(tMatch, tWr, wrReq) {
57    let tWin = tMatch * (tWr / 100);
58    let tLose = tMatch - tWin;
59    let sisaWr = 100 - wrReq;
60    let wrResult = 100 / sisaWr;
61    let seratusPersen = tLose * wrResult;
62    let final = seratusPersen - tMatch;
63    return Math.round(final);
64}
65
66function rumusLose(tMatch, tWr, wrReq) {
67    let persen = tWr - wrReq;
68    let final = tMatch * (persen / 100);
69    return Math.round(final);
70}
71
72function updateVisitCount() {
73    fetch("https://api.countapi.xyz/update/johsteven/ccac8049-f0da-408a-b6d7-8826b199afd0/?amount=1").then(res => res.json()).then(res => { console.log(res) });
74}
75
76// Main
77window.addEventListener("load", init);
78
79function init() {
80    load();
81    eventListener();
82}
83
84function load() {
85    updateVisitCount();
86    welcomeMsg();
87}
88
89function eventListener() {
90    hasil.addEventListener("click", res);
91}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.