Dark Reader

Eğer Kullandığın Sitede Koyu Tema Yoksa Buna Bir Bak

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

Advertisement:

// ==UserScript==
// @name         Dark Reader
// @name:en Dark Reader
// @namespace    http://tampermonkey.net/
// @version      3
// @description  Eğer Kullandığın Sitede Koyu Tema Yoksa Buna Bir Bak
// @description:en If the Site You're Using Doesn't Have a Dark Theme, Check This Out
// @author       Atilla
// @match        https://*/*
// @icon         https://darkreader.org/images/icon-256.png
// @require https://cdnjs.cloudflare.com/ajax/libs/darkreader/4.9.128/darkreader.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.min.js
// @grant        GM_registerMenuCommand
// @grant GM_openInTab
// @grant GM_setValue
// @grant GM_getValue
// @license MIT
// ==/UserScript==
(() => {
  "use strict";

  let data = GM_getValue("aktif", []);
  const alanAdi = tldts.getDomain(location.href);

  const ceviriler = {
    tr: {
      koyuTema: "Koyu Modu Aç (Geçici)",
      koyuTemaKapali: "Koyu Modu Kapat (Geçici)",
      kaydet: "Bu Site İçin Her Zaman Aç",
      sil: "Bu Site İçin Ayarı Kaldır",
    },
    en: {
      koyuTema: "Turn On Dark Mode (Temporary)",
      koyuTemaKapali: "Turn Off Dark Mode (Temporary)",
      kaydet: "Always Open for This Site",
      sil: "Remove Setting for This Site",
    },
  };

  const dil = navigator.language?.split("-")[0];
  const dilSecildi = ceviriler[dil] || ceviriler.en;

  GM_registerMenuCommand(dilSecildi.koyuTema, () => {
    window.DarkReader.enable();
  });

  GM_registerMenuCommand(dilSecildi.koyuTemaKapali, () => {
    window.DarkReader.disable();
  });

  const siteIndex = data.findIndex((value) => value.domain === alanAdi);

  if (siteIndex === -1) {
    GM_registerMenuCommand(dilSecildi.kaydet, () => {
      data.push({ domain: alanAdi, durum: true });
      GM_setValue("aktif", data);
      window.DarkReader.enable();
    });
  } else {
    GM_registerMenuCommand(dilSecildi.sil, () => {
      data.splice(siteIndex, 1);
      GM_setValue("aktif", data);
      window.DarkReader.disable();
    });
  }

  GM_registerMenuCommand("Dark Reader JS", () => {
    GM_openInTab(
      "https://cdnjs.cloudflare.com/ajax/libs/darkreader/4.9.128/darkreader.js",
    );
  });

  GM_registerMenuCommand("Website", () => {
    GM_openInTab("https://darkreader.org/", { active: true });
  });

  const kayitliSite = data.find((hostname) => alanAdi === hostname.domain);
  if (kayitliSite && kayitliSite.durum === true) {
    window.DarkReader.enable();
  }
})();