天幻 FF1 专题 - 宽屏优化

大屏优化 - 图片展开、强制插入图片。

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

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         天幻 FF1 专题 - 宽屏优化
// @namespace    moe.jixun
// @version      0.1
// @description  大屏优化 - 图片展开、强制插入图片。
// @author       Jixun
// @include      http://ff1.ffsky.cn/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  const style = document.createElement("style");
  style.textContent = `

#wrapper, #content, #content-box { width: initial }

#content-box {
  position: absolute;
  left: 200px;
}

html, body {
  background:#fff;
  margin: 0;
}

#footer {
  display: none;
}

`;
  document.head.appendChild(style);

  const links = document.getElementsByTagName("a");
  [].forEach.call(links, link => {
    if (link.textContent.includes("分辨率")) {
      const m = link.textContent.match(/分辨率:(\d+)[*x](\d+)/);

      link.textContent = '';
      if (link.href.endsWith(".htm")) {
        const frame = document.createElement("iframe");
        frame.style.border = 0;
        frame.src = link.href;
        frame.width = parseInt(m[1]) + 16;
        frame.height = parseInt(m[2]) + 16;
        link.parentNode.insertBefore(frame, link);
      } else {
        const img = document.createElement("img");
        img.src = link.href;
        link.appendChild(img);
      }
    }
  });
})();