manatoki viewer

press i to open

اعتبارا من 05-12-2020. شاهد أحدث إصدار.

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 or Violentmonkey 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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         manatoki viewer
// @version      2012052228
// @description  press i to open
// @include      /^https:\/\/manatoki\d+\.net\/comic\/\d+/
// @author       nanikit
// @namespace    https://greatest.deepsurf.us/ko/users/713014-nanikit
// @grant        GM_getResourceText
// @grant        window.close
// @run-at       document-start
// @require      https://cdn.jsdelivr.net/npm/[email protected]/require.js
// @resource     react            https://cdn.jsdelivr.net/npm/[email protected]/umd/react.development.js
// @resource     react-dom        https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.development.js
// @resource     @stitches/core   https://cdn.jsdelivr.net/npm/@stitches/[email protected]/dist/core.cjs.dev.js
// @resource     @stitches/react  https://cdn.jsdelivr.net/npm/@stitches/[email protected]/dist/react.cjs.dev.js
// @resource     vim_comic_viewer https://greatest.deepsurf.us/scripts/417893-vim-comic-viewer/code/vim%20comic%20viewer.js?version=877253
// ==/UserScript==
"use strict";

unsafeWindow.process = { env: { NODE_ENV: "development" } };

if (typeof define !== "function") {
  throw new Error("requirejs not found.");
}

for (
  const name of [
    "react",
    "react-dom",
    "@stitches/core",
    "@stitches/react",
    "vim_comic_viewer",
  ]
) {
  const body = `${GM_getResourceText(name)}`;
  define(name, Function("require", "exports", "module", body));
}

define("main", (require, exports, module) => {
  "use strict";

  var vim_comic_viewer = require("vim_comic_viewer");

  const registerEpisodeNavigator = () => {
    window.addEventListener("keydown", (event) => {
      switch (event.key) {
        case "h":
          document.getElementById("goPrevBtn")?.click?.();
          break;
        case "l":
          document.getElementById("goNextBtn")?.click?.();
          break;
        case "m":
          document.querySelector(".view-good")?.scrollIntoView({
            block: "center",
          });
          break;
      }
    });
  };
  const isApplicable = () => {
    return !!location.href.match(/https:\/\/manatoki\d+\.net\/comic\/\d+/);
  };
  const getUrl = (image) => {
    if (image.offsetParent === null) {
      return [];
    }
    return Object.values(image.dataset);
  };
  const getUrls = () => {
    const imgs = document.querySelectorAll("div.view-padding img");
    const urls = [
      ...imgs,
    ].flatMap(getUrl);
    if (urls.length === 0) {
      debugger;
    }
    return urls;
  };
  const comicSource = async () => {
    vim_comic_viewer.utils.insertCss(
      `\r\n.vim_comic_viewer {\r\n  display: none;\r\n}`,
    );
    await vim_comic_viewer.utils.waitDomContent(document);
    registerEpisodeNavigator();
    const urls = getUrls();
    return urls;
  };
  const manatokiSource = {
    name: "manatoki",
    isApplicable,
    comicSource,
  };
  vim_comic_viewer.initialize(manatokiSource); //
});

require(["main"]);