CSS: uakino.best

Corrections to UI of uakino.best

目前為 2025-09-30 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          CSS: uakino.best
// @description   Corrections to UI of uakino.best
// @author        MK
// @namespace     max44
// @homepage      https://greasyfork.org/en/users/309172-max44
// @match         *://uakino.best/*
// @match         *://*.uakino.best/*
// @match         *://uakino.me/*
// @match         *://*.uakino.me/*
// @icon          https://uakino.best/templates/uakino/images/icons/favicon-32x32.png
// @version       1.0.0
// @license       MIT
// @run-at        document-idle
// ==/UserScript==

(function() {
  'use strict';

  //Workaround: This document requires 'TrustedHTML' assignment
  if (window.trustedTypes && trustedTypes.createPolicy) {
    if (!trustedTypes.defaultPolicy) {
      const passThroughFn = (x) => x;
      trustedTypes.createPolicy('default', {
        createHTML: passThroughFn,
        createScriptURL: passThroughFn,
        createScript: passThroughFn,
      });
    }
  }

  //CSS for any mode
  var css = `
  /*Change color of episodes*/
  .playlists-items li.watched:not(.active) {
    border-color: #562318 !important;
    color: #888888 !important;
  }
  .playlists-items li.watched:not(.active) > span {
    opacity: 0.5 !important;
  }
  .playlists-items li.notwatched:not(.active) {
    background-color: #3F1810 !important;
  }
  .playlists-items li.notwatched:not(.active) > span {
    opacity: 0.2 !important;
  }
  .playlists-items li:not(.active):hover {
    background-color: #6B2B1D !important;
  }
  `;

  const rootCallback = function (mutationsList, observer) {
    //Add classes to episodes
    document.querySelectorAll(".playlists-items li:not(.watched) > span.watched").forEach(makeWatched);
    document.querySelectorAll(".playlists-items li:not(.notwatched) > span:not(.watched)").forEach(makeNotWatched);
  }

  const rootNode = document.querySelector("body");
  if (rootNode != null) {
    const rootObserver = new MutationObserver(rootCallback);
    rootObserver.observe(rootNode, {childList: true, subtree: true, attributes: true, characterData: false});
  }

  function makeWatched(link) { //Mark episodes as watched
    link.parentElement.className = "watched";
  }

  function makeNotWatched(link) { //Mark episodes as not watched
    link.parentElement.className = "notwatched";
  }

  if (typeof GM_addStyle != 'undefined') {
    GM_addStyle(css);
  } else if (typeof PRO_addStyle != 'undefined') {
    PRO_addStyle(css);
  } else if (typeof addStyle != 'undefined') {
    addStyle(css);
  } else {
    var node = document.createElement('style');
    node.type = 'text/css';
    node.appendChild(document.createTextNode(css));
    document.documentElement.appendChild(node);
  }

})();