i漫画

used in the imanhua.com to display all the pages in the same window.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        i漫画
// @namespace   piscat
// @include     http://www.imanhua.com/*
// @version     1.0
// @author      piscat
// @grant       none
// @description:en used in the imanhua.com to display all the pages in the same window.
// @description used in the imanhua.com to display all the pages in the same window.
// ==/UserScript==
var btns = document.getElementsByClassName('main-btn') [0];
btns.innerHTML = btns.innerHTML + '<a class="btn-red" href="javascript:gen();">单窗浏览</a>';
window.number = function (a, l) {
  if (a === 0) return '000';
  var d = l - parseInt(Math.log10(a)) - 1;
  while (d !== 0)
  {
    a = '0' + a;
    d = d - 1;
  }
  return a;
}
window.gen = function () {
  var url = location.href;
  var a = url.split('comic/') [1].split('/') [0];
  var b = url.split('list_') [1].split('.') [0];
  var pn = document.getElementById('pageSelect').children.length;
  img = document.getElementById('comic').getAttribute('src');
  img_pre = img.split(a) [0];
  img_suf = img.split(b) [1];
  if (img_suf.indexOf('imanhua') != - 1) {
    var html = '';
    if (img_suf.indexOf('jpg') != - 1) {
      for (i = 1; i <= pn; i++)
      {
        html = html + '<img src="' + img_pre + a + '/' + b + '/imanhua_' + number(i, 3) + '.jpg"></img></br>';
      }
    } else {
      for (i = 1; i <= pn; i++)
      {
        html = html + '<img src="' + img_pre + a + '/' + b + '/imanhua_' + number(i, 3) + '.png"></img></br>';
      }
    }
    document.getElementsByTagName('body') [0].innerHTML = html;
  } else {
    var html = '';
    if (img_suf.indexOf('jpg') != - 1) {
      for (i = 1; i <= pn; i++)
      {
        html = html + '<img src="' + img_pre + a + '/' + b + '/' + number(i, img_suf.split('.') [0].length - 1) + '.jpg"></img></br>';
      }
    } else {
      for (i = 1; i <= pn; i++)
      {
        html = html + '<img src="' + img_pre + a + '/' + b + '/' + number(i, img_suf.split('.') [0].length - 1) + '.png"></img></br>';
      }
    }
    document.getElementsByTagName('body') [0].innerHTML = html;
  }
}