LNW Tweaks

Small tweaks to LNW to make the reading experience better

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         LNW Tweaks
// @namespace    https://www.lightnovelworld.com/
// @version      0.6
// @license      MIT
// @description  Small tweaks to LNW to make the reading experience better
// @author       Meliodas#0001
// @match        https://www.lightnovelworld.com/*
// @grant        none
// @require      https://code.jquery.com/jquery-3.5.1.min.js
// ==/UserScript==

(function () {
  "use strict";

  /***** Delete Ads *****/
  $("div.ad-sticky").remove();
  $("div.adsbox").remove();
  $("div.vl-ad").remove();
  $("div.ad-container").remove();
  $("li.listads").remove();

  /***** Allow Selecting Text *****/
  $("div.chapter-content").css({
    "user-select": "auto",
  });

  /***** Delete Trinity Audio *****/
  $('div.chapter-content > div.trinity-player-iframe-wrapper').first().remove();
  $('div.chapter-content > script').first().remove();

  /***** Update the notices page *****/
  // Change button colors
  $('div.stats > span').css({
      'background-color': 'rgb(42, 37, 148)',
      'color': 'rgb(232, 230, 227)'
  })

  /***** Change Update Bell *****/
  $("span.notify-bell").css({
    "animation": "none",
    "-webkit-animation": "none",
    "-moz-animation": "none",
    "color": "#B21634",
  });

  /***** Remove Top Banner *****/
  $('div.head-slider-top').parent().remove();

  /***** Change Icon *****/
  $(() => {
    if ($("head > style.darkreader").length < 1) {
      // Darkmode disabled
      $("div.nav-logo > a > img").attr(
        "src",
        "https://i.imgur.com/z8WIMZI.png"
      );
      $("div.wrapper > div.logo > img").attr(
        "src",
        "https://i.imgur.com/z8WIMZI.png"
      );
    } else {
      // Darkmode enabled
      $("div.nav-logo > a > img").attr(
        "src",
        "https://i.imgur.com/uf3Q4yE.png"
      );
      $("div.wrapper > div.logo > img").attr(
        "src",
        "https://i.imgur.com/uf3Q4yE.png"
      );
    }
  });

  const observeDOM = (() => {
    const MutationObserver =
      window.MutationObserver || window.WebKitMutationObserver;

    return (obj, callback) => {
      if (!obj || obj.nodeType !== 1) return;

      if (MutationObserver) {
        const obs = new MutationObserver(function (mutations, observer) {
          callback(mutations);
        });
        obs.observe(obj, {
          childList: true,
          subtree: true,
        });
      } else if (window.addEventListener) {
        obj.addEventListener("DOMNodeInserted", callback, false);
        obj.addEventListener("DOMNodeRemoved", callback, false);
      }
    };
  })();

  observeDOM(document.head, (m) => {
    if (m.length == 18) {
      $("div.nav-logo > a > img").attr(
        "src",
        "https://i.imgur.com/z8WIMZI.png"
      );
      $("div.wrapper > div.logo > img").attr(
        "src",
        "https://i.imgur.com/z8WIMZI.png"
      );
    } else if (m.length == 11) {
      $("div.nav-logo > a > img").attr(
        "src",
        "https://i.imgur.com/uf3Q4yE.png"
      );
      $("div.wrapper > div.logo > img").attr(
        "src",
        "https://i.imgur.com/uf3Q4yE.png"
      );
    }
  });

  /***** In Text Ads *****/

  const inTextAds = [
    "Find authorized novels in ReadNovelFull,faster updates, better experience,Please click for visiting.",
    "Find authorized novels in ReadNovelFull,faster updates, better experience,Please click www.ReadNovelFull.com for visiting.",
  ];

  const containsAd = (str, substrs) => {
    for (let i = 0; i != substrs.length; i++) {
      let subStr = substrs[i];

      if (str.includes(subStr)) {
        return subStr;
      }
    }
    return null;
  };

  $("div.chapter-content")
    .children()
    .each((i, v) => {
      let para = $(v);
      let text = para.text();
      if (text.trim().length > 1) {
        let hasAd = containsAd(text, inTextAds);

        if (hasAd) {
          para.text(text.replace(hasAd, ""));
        }
      }
    });

  /***** Testing *****/
  $("span.azdkqi").remove();
  $("span.ljkmoi").remove();
  $("article#chapter-article > section.recommends").remove();
  $("footer").remove();
  $("div.izknfc").remove();
  //$("div.chapter-content > br").remove();
})();