Fitgirl repacks bigger images/center-alignment and 1080p optimization

bigger images/center-alignment and 1080p optimization

As of 30.11.2021. See ბოლო ვერსია.

// ==UserScript==
// @name         Fitgirl repacks bigger images/center-alignment and 1080p optimization
// @namespace    https://greasyfork.dpdns.org/en/users/12725-alistair1231
// @version      0.3
// @description  bigger images/center-alignment and 1080p optimization
// @author       Alistair1231
// @match        https://fitgirl-repacks.site/
// @icon         https://icons.duckduckgo.com/ip2/fitgirl-repacks.site.ico
// @grant        none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @license GPL-3.0
// ==/UserScript==

function makeImgBig() {
    // make more space on the site
    jQuery(".site").css("max-width", "1920px");
    jQuery(".entry-content").css("max-width", "1920px");
    jQuery("#masthead").css("max-width", "1920px"); // search bar
  
    // image align center
    jQuery(
      "article .entry-content p:first-of-type img:first-of-type"
    ).removeClass();
    // align torrentInfo stats images
    jQuery(".entry-content ul li img:not(.wplp-lazy)").addClass("aligncenter");
  
    //text align center
    jQuery("article").css("text-align", "center");
    // display to contents text is under image and not blocked by anything
    jQuery("article .entry-content p:first-of-type").css("display", "contents");
  
    document
      .querySelectorAll("article .entry-content h3:not(:first-of-type)+p img") //screenshots
      .forEach((element) => {
        if (element.flag != 1) {
          // preview images
          element.width *= 2.5;
          element.height *= 2.5;
  
          element.src = element.src.replace(/(.*)\.240p\.jpg$/, "$1");
          element.flag = 1;
        }
      });
  }
  document
    .querySelectorAll("article .entry-content p:first-of-type img") //cover images
    .forEach((element) => {
      if (element.flag != 1) {
        // cover images
        element.width *= 2;
        element.height *= 2;
      }
      element.flag = 1;
    });
  
  (function () {
    "use strict";
  
    jQuery.noConflict();
  
    makeImgBig();
    // https://javascript.info/mutation-observer
    let observer = new MutationObserver((mutations) => {
      for (let mutation of mutations) {
        // examine new nodes, is there anything to highlight?
        if (mutation.addedNodes.length > 0) makeImgBig();
      }
    });
  
    let contentElem = document.getElementById("content");
    observer.observe(contentElem, { childList: true, subtree: true });
  })();
  
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元