CrazyGames+

CrazyGames Sitesi Eğer Türkçe Değilse Otomatik Türkçeye Geçer ve Bazı Gereksiz Görülen Ögeleri Gizler

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         CrazyGames+
// @namespace    http://tampermonkey.net/
// @version      5
// @description  CrazyGames Sitesi Eğer Türkçe Değilse Otomatik Türkçeye Geçer ve Bazı Gereksiz Görülen Ögeleri Gizler
// @author       Atilla
// @match        https://www.crazygames.com/*
// @icon         https://www.crazygames.com/images/logo/themed/worldcup-logo.svg
// @grant        GM_addStyle
// @grant GM.xmlHttpRequest
// @require https://cdnjs.cloudflare.com/ajax/libs/js-cookie/3.0.6/js.cookie.min.js
// @require https://update.greasyfork.org/scripts/586910/1875145/simple-notify.js
// @license MIT
// ==/UserScript==
(async () => {
  "use strict";

  // Toplam Oyun Sayısı
  (() => {
    function updateGameCount() {
      const targetContainer = document.querySelector(
        "html > body > div > div > div:first-of-type > div:nth-of-type(2)",
      );
      if (!targetContainer) return;

      let span = targetContainer.querySelector("#games");
      if (!span) {
        span = document.createElement("span");
        span.id = "games";
        span.textContent = "Yükleniyor...";
        span.setAttribute(
          "class",
          "GameThumbLabel_label__dz3yR GameThumbLabel_withOriginals__7mhGw GameThumbLabel_new__8GnG6",
        );
        targetContainer.prepend(span);
      }

      const sitemapUrl = "https://www.crazygames.com/sitemap";

      GM.xmlHttpRequest({
        method: "GET",
        url: sitemapUrl,
        onload: function (response) {
          try {
            const parser = new DOMParser();
            const xmlDoc = parser.parseFromString(
              response.responseText,
              "text/xml",
            );
            const locElements = xmlDoc.querySelectorAll("loc");

            const gameUrls = Array.from(locElements)
              .map((el) => el.textContent.trim())
              .filter((url) => url.includes("/game/"));

            span.textContent = `Oyunlar: ${gameUrls.length}`;
          } catch (e) {
            console.error("XML ayrıştırılamadı:", e);
            span.textContent = "Veri okunamadı.";
          }
        },
        onerror: function (error) {
          console.error("İstek sırasında hata oluştu:", error);
          span.textContent = "Bağlantı hatası.";
        },
      });
    }

    if (window.onurlchange === null) {
      window.addEventListener("urlchange", () => {
        updateGameCount();
      });
    }

    (async () => {
      setTimeout(updateGameCount, 500);
    })();
  })();
  //==SON==

  if (window.trustedTypes && window.trustedTypes.createPolicy) {
    window.trustedTypes.createPolicy("default", {
      createHTML: (string) => string, // Gelen string'i filtrelemeden aynen kabul eder ve onaylar
    });
  }

  let css = document.createElement("link");
  css.rel = "stylesheet";
  css.href =
    "https://cdn.jsdelivr.net/npm/simple-notify/dist/simple-notify.css";
  document.head.appendChild(css);

  let dil = window.Cookies.get("czy_locale");

  if (dil !== "tr-TR") {
    window.Cookies.set("czy_locale", "tr-TR", { secure: true, path: "/" });
    new Notify({
      status: "warning",
      title: "Türkçeye Çevrildi",
      text: "Sayfa 3 Saniye İçinde Yenlienecek",
      effect: "slide",
      speed: 300,
      customClass: "",
      customIcon: "",
      showIcon: false,
      showCloseButton: true,
      autoclose: false,
      autotimeout: 3000,
      notificationsGap: null,
      notificationsPadding: null,
      type: "filled",
      position: "right top",
      customWrapper: "",
    });

    await new Promise((resolve) => setTimeout(resolve, 3000));

    location.reload();
  }

  if (window.onurlchange === null) {
    window.addEventListener("urlchange", async (info) => {
      let dil = window.Cookies.get("czy_locale");

      if (dil !== "tr-TR") {
        window.Cookies.set("czy_locale", "tr-TR", { secure: true, path: "/" });
        new Notify({
          status: "warning",
          title: "Türkçeye Çevrildi",
          text: "Sayfa 3 Saniye İçinde Yenlienecek",
          effect: "slide",
          speed: 300,
          customClass: "",
          customIcon: "",
          showIcon: false,
          showCloseButton: true,
          autoclose: false,
          autotimeout: 3000,
          notificationsGap: null,
          notificationsPadding: null,
          type: "filled",
          position: "right top",
          customWrapper: "",
        });

        await new Promise((resolve) => setTimeout(resolve, 3000));

        location.reload();
      }
    });
  }

  (() => {
    GM_addStyle(
      "[class^=GamePageDesktop_rightMpuContainer__],[class^=GamePageDesktop_leaderboardContainer__],[class^=GameInfo_rightColumn__],[class*=ThumbVideo],[class*=hovered]{display:none!important}",
    );
  })();
})();