i-Comic 爱动漫 bug 修复/允许全屏

1.允许googlevideo全屏 2.修复宽度小于约600px后播放窗口无法点击的bug

目前为 2017-04-25 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name i-Comic Player Page Bug Fix / Allow fullscreen
  3. // @name:zh-CN i-Comic 爱动漫 bug 修复/允许全屏
  4. // @name:zh-TW i-Comic 愛動漫 bug 修複/允許全屏
  5. // @namespace http://tampermonkey.net/
  6. // @version 0.1
  7. // @description Fixes misc bugs, allow fullscreen for googlevideo
  8. // @description:zh-CN 1.允许googlevideo全屏 2.修复宽度小于约600px后播放窗口无法点击的bug
  9. // @description:zh-TW 1.允許googlevideo全屏 2.修複寬度小于約600px後播放窗口無法點擊的bug
  10. // @author You
  11. // @match http://www.i-comic.net/anime/*
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. function getElementByXpath(path) {
  18. return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  19. }
  20. var playerContainer = getElementByXpath('/html/body/div[2]');
  21. var oldStyle = playerContainer.getAttribute('style');
  22. var newStyle = oldStyle + " z-index: 100;";
  23. playerContainer.setAttribute('style', newStyle);
  24. //allowfullscreen
  25. var vid = document.getElementById("player");
  26. function onChange () {
  27. var iframes = vid.getElementsByTagName("iframe");
  28. for (var i = 0; i < iframes.length; i++) {
  29. if (iframes[i].allowFullscreen !== true) {
  30. iframes[i].allowFullscreen = true;
  31. }
  32. }
  33. }
  34. vid.addEventListener('DOMSubtreeModified', onChange, false);
  35. onChange();
  36. })();