Manga Block Killer

解决漫画屏蔽问题

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Manga Block Killer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  解决漫画屏蔽问题
// @author       RiverWind
// @match        http://tw.ikanman.com/comic/*/*.html
// @match        http://www.omanhua.com/comic/*/*/*.html
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var blocked = document.querySelector('span.nopic');
	var currPage = parseInt(document.querySelector('span.current').textContent, 10);
	var mangaBox = document.querySelector('#mangaBox');

	if (!blocked) {
		return;
	}

	// remove block tip
	blocked.remove();

	// create img
	var img = document.createElement('img');
	// load current-page's picture
	img.src = pVars.manga.filePath + cInfo.files[currPage - 1];
	mangaBox.appendChild(img);

	// n is always leagal, no checking is ok
	function goPage(n) {
		// change page
		var page = document.querySelector('#page');
		page.textContent = n;
		var img = document.querySelector('#mangaBox img');
		// load img
		var newImg = document.createElement('img');
		newImg.src = pVars.manga.filePath + cInfo.files[n - 1];
		var imgparent = img.parentElement;
		img.remove();
		imgparent.appendChild(newImg);

        scroll(0,0);
		// change pagination
		var pagination = document.querySelector('#pagination');
		pagination.innerHTML = SMH.pager({cp: n - 1,pc: cInfo.len});
		pVars.page = n;
		// change hash
		window.location.hash = 'p=' + n;
		$('#pageSelect').val(n);
	}

	SMH.utils.goPage = goPage;
})();