Dark Reader

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

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!)

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.

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

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();
  }
})();