i-Comic 愛動漫 bug 修複/允許全屏

1.允許googlevideo全屏 2.修複寬度小于約600px後播放窗口無法點擊的bug

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         i-Comic Player Page Bug Fix / Allow fullscreen
// @name:zh-CN   i-Comic 爱动漫 bug 修复/允许全屏
// @name:zh-TW   i-Comic 愛動漫 bug 修複/允許全屏
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Fixes misc bugs, allow fullscreen for googlevideo
// @description:zh-CN    1.允许googlevideo全屏 2.修复宽度小于约600px后播放窗口无法点击的bug
// @description:zh-TW    1.允許googlevideo全屏 2.修複寬度小于約600px後播放窗口無法點擊的bug
// @author       Yifan Gu
// @match        http://www.i-comic.net/anime/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function getElementByXpath(path) {
        return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
    }
    var playerContainer = getElementByXpath('/html/body/div[2]');
    var oldContainerStyle = playerContainer.getAttribute('style');
    oldContainerStyle = oldContainerStyle ? oldContainerStyle : '';
    var newContainerStyle = oldContainerStyle + ' z-index: 100;';
    playerContainer.setAttribute('style', newContainerStyle);
    //fix body padding
    var body = document.getElementsByTagName('body')[0];
    var oldBodyStyle = body.getAttribute('style');
    oldBodyStyle = oldBodyStyle ? oldBodyStyle : '';
    var newBodyStyle = oldBodyStyle + ' padding-top: 50px;';
    body.setAttribute('style', newBodyStyle);
    //allowfullscreen
    var vid = document.getElementById('player');
    function onChange () {
        var iframes = vid.getElementsByTagName('iframe');
        for (var i = 0; i < iframes.length; i++) {
            if (iframes[i].allowFullscreen !== true) {
                iframes[i].allowFullscreen = true;
            }
        }
    }
    vid.addEventListener('DOMSubtreeModified', onChange, false);
    onChange();
})();