ScoreHACK[Dino]

Get unlimited score :)

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        ScoreHACK[Dino]
// @namespace   Violentmonkey Scripts
// @match       *://dino-chrome.com/*
// @match       https://chromedino.com/
// @match       *://chromedino.com/color/
// @match       *://chromedino.com/black/
// @match       *://chromedino.com/batman/
// @match       *://chromedino.com/joker/
// @icon        https://dino-chrome.com/static/images/favicon.ico
// @grant       none
// @version     1.0
// @author      Drik
// @description Get unlimited score :)
// @run-at      document-idle
// @license     MIT
// ==/UserScript==

(function () {
  "use strict";

  function q(s, r) {
    return (r || document).querySelector(s);
  }

  function c(t, p) {
    var e = document.createElement(t);
    if (p) Object.assign(e, p);
    return e;
  }

  function cl(v, a, b) {
    return Math.max(a, Math.min(b, v));
  }

  function R(cb) {
    if (window.Runner && Runner.instance_ && Runner.instance_.distanceMeter) {
      cb(Runner.instance_);
    } else {
      requestAnimationFrame(function () {
        R(cb);
      });
    }
  }

  function ui() {
    if (document.getElementById("score_hackk")) return;

    var w = c("div", { id: "score_hackk" });

    w.style.cssText = [
      "position:fixed",
      "left:12px",
      "top:12px",
      "width:360px",
      "z-index:2147483647",
      "font-family:Arial,Helvetica,sans-serif",
      "font-size:13px",
      "background:rgba(0,0,0,0.78)",
      "color:#fff",
      "padding:10px",
      "border-radius:8px",
      "box-shadow:0 6px 18px rgba(0,0,0,0.6)",
      "backdrop-filter:blur(4px)",
    ].join(";");

    w.innerHTML = '<div style="font-weight:700;margin-bottom:8px">Score Hack</div>';

    var r = c("div");
    r.style.display = "flex";
    r.style.gap = "8px";
    r.style.alignItems = "center";

    var i = c("input", {
      id: "score_inp",
      type: "number",
      placeholder: "Number",
      value: "",
      min: 0,
      step: 1,
    });

    i.style.cssText = "flex:1;padding:6px;border-radius:6px;border:1px solid #444;background:#111;color:#fff";

    var b = c("button", {
      id: "score_app",
      innerText: "Apply",
    });

    b.style.cssText = "padding:6px 10px;border-radius:6px;border:0;cursor:pointer;background:#2ecc71;color:#000;font-weight:600";

    var inf = c("div", {
      innerText: "",
      id: "score_info",
    });

    inf.style.cssText = "margin-top:8px;font-size:12px;color:#ddd";

    r.appendChild(i);
    r.appendChild(b);
    w.appendChild(r);
    w.appendChild(inf);

    document.body.appendChild(w);

    i.addEventListener("input", function () {
      var v = i.value;
      if (v === "") return;

      var n = Number(v);

      if (isNaN(n)) {
        i.value = "";
        inf.innerText = "Only numbers";
        inf.style.color = "#ff8a8a";
        return;
      }

      if (n < 0) {
        i.value = "0";
      }

      inf.innerText = "";
    });

    b.addEventListener("click", function () {
      var raw = i.value;

      if (raw === "") {
        inf.innerText = "field is empty";
        inf.style.color = "#ff8a8a";
        return;
      }

      var n = parseInt(raw, 10);

      if (isNaN(n)) {
        inf.innerText = "Incorrect entry";
        inf.style.color = "#ff8a8a";
        return;
      }

      if (
        location.href.startsWith("https://chromedino.com/color/") && n > 1000000) {
        var ok = confirm("Are you sure you want to give yourself such a large score? There is a chance you may get banned for it",
        );
        if (!ok) return;
      }

      setScore(n);
    });
  }

  function setScore(s) {
    try {
      var r = Runner.instance_;

      if (!r || !r.distanceMeter) return;

      s = Math.floor(Number(s) || 0);
      if (s < 0) s = 0;

      var d = r.distanceMeter;

      var dg = Math.max(String(s).length, 6);
      var cap = 12;
      dg = cl(dg, 6, cap);

      d.config.MAX_DISTANCE_UNITS = dg;
      d.maxScoreUnits = dg;
      d.defaultString = "0".repeat(dg);
      d.maxScore = parseInt("9".repeat(dg), 10);

      d.digits = d.defaultString.split("");
      d.highScore = d.highScore || d.defaultString.split("");

      var cf = d.config && d.config.COEFFICIENT ? d.config.COEFFICIENT : 1;
      if (!cf || cf === 0) cf = 1;

      r.distanceRan = s / cf;

      if (typeof d.update === "function") {
        d.update(0, Math.ceil(r.distanceRan));
      }

      var st = document.getElementById("score_info");

      if (st) {
        st.innerText = "Applied: " + String(s);
        st.style.color = "#aaffaa";
      }
    } catch (e) {
      var st2 = document.getElementById("score_info");

      if (st2) {
        st2.innerText = "Error: " + String(e);
        st2.style.color = "#ff8a8a";
      }
    }
  }

  R(function () {
    ui();
  });
})();
// for TOR users :d
(function () {
  function r() {
    var e = document.querySelector(
      "body#t.offline.color-page div.fc-consent-root",
    );
    if (e) e.remove();
  }

  r();

  new MutationObserver(r).observe(document.documentElement, {
    childList: true,
    subtree: true,
  });
})();