Greasy Fork

Greasy Fork is available in English.

MangaDex Condensed

Condense MangaDex for the whitespace impaired.

当前为 2021-08-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MangaDex Condensed
// @namespace    suckerfree
// @version      1.2
// @description  Condense MangaDex for the whitespace impaired.
// @author       Nalin, u/stonksonlydown
// @match        https://mangadex.org/titles/feed
// @icon         https://www.google.com/s2/favicons?domain=mangadex.org
// @grant        none
// ==/UserScript==

// Based on a script written by u/stonksonlydown.
// https://www.reddit.com/r/mangadex/comments/ogn4al/simple_tampermonkey_script_to_condense_followed/

(function() {
  // Adds a style to the <head> tags.
  function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
  }

  // Remove bolding of the chapter titles.
  addGlobalStyle('.chapter-list__title {font-weight: normal !important;}');

  // Slightly reduce the font size of the series name.
  addGlobalStyle('.chapter-feed__title span {font-size: 0.9rem !important;}');
  
})();

const apply_js_cb = function(mutationsList, observer) {
  observer.disconnect();
  console.log('Applying JS.');

  let containers = document.getElementsByClassName('chapter-feed__container');
  for (const container of containers) {
    let title = container.getElementsByClassName('chapter-feed__title')[0];
    let cover = container.getElementsByClassName('chapter-feed__cover')[0];
    let chapters = container.getElementsByClassName('chapter-feed__chapters')[0];

    if (title && cover && chapters) {
      container.style.display = "block";
      container.style.gap = "0.5rem";
      title.style.paddingBottom = "0.5em";
      cover.style.display = "none";
      chapters.style.paddingTop = "0.5em";

      title.addEventListener('mouseenter', e => {
        container.style.display = "grid";
        title.style.paddingBottom = "0";
        cover.style.display = "block";
        chapters.style.paddingTop = "0";
      });
      title.addEventListener('mouseleave', e => {
        container.style.display = "block";
        title.style.paddingBottom = "0.5em";
        cover.style.display = "none";
        chapters.style.paddingTop = "0.5em";
      });
    }
  }
};

window.onload = (event) => {
  const loading_cb = function(mutationsList, observer) {
    observer.disconnect();

    const page_container = document.getElementsByClassName('container mb-4 wide')[0].parentElement;
    const chapter_observer = new MutationObserver(apply_js_cb);
    chapter_observer.observe(page_container, {attributes: false, childList: true, subtree: true});
  };

  const load_observer = new MutationObserver(loading_cb);
  load_observer.observe(document.body, {attributes: false, childList: true, subtree: false});
};