Proxer-Kinomodus

Dieses Script fügt Proxer einen Kino-Modus-Button hinzu, der einen Kino-Modus startet

目前为 2015-06-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Proxer-Kinomodus
  3. // @namespace
  4. // @version 1.1
  5. // @description Dieses Script fügt Proxer einen Kino-Modus-Button hinzu, der einen Kino-Modus startet
  6. // @author Dominik Bissinger alias Nihongasuki
  7. // @include http://proxer.me/*
  8. // @include https://proxer.me/*
  9. // @include http://www.proxer.me/*
  10. // @include https://www.proxer.me/*
  11. // @run-at document-start
  12. // ==/UserScript==
  13.  
  14. //Starte die Funktion "addButton" beim Laden der Seite
  15. document.addEventListener('DOMContentLoaded', function(event) {
  16. addButton();
  17. });
  18.  
  19. //Fügt den Button "Kino" hinzu
  20. var t;
  21. var addButton = function() {
  22. if (window.location.href.indexOf('watch') > -1 || window.location.href.indexOf('read') > -1) {
  23. if (window.location.href.indexOf('forum') > -1) {
  24. return;
  25. };
  26. var style1 = document.createElement("style");
  27. var style2 = document.createElement("style");
  28. style1.setAttribute("id","kinoStyle1");
  29. style2.setAttribute("id","kinoStyle2");
  30. document.head.appendChild(style1);
  31. document.head.appendChild(style2);
  32. document.getElementById('kinoStyle1').innerHTML = styleText1;
  33. var button = document.createElement("div");
  34. button.setAttribute("id","kinoButton");
  35. button.setAttribute("style","border-color: #777777; background-color: #5E5E5E; z-index: 2;");
  36. document.body.appendChild(button);
  37. var dimmer = document.createElement("form");
  38. dimmer.setAttribute("id","kinoDimmerBar");
  39. dimmer.setAttribute("style","border-color: #777777; background-color: #5E5E5E; z-index: 2; min-width:200px; display:none;");
  40. document.body.appendChild(dimmer);
  41. document.getElementById('kinoDimmerBar').innerHTML = "<input type='range' id='opacity' name='opacity' min='0' max='1' step='0.01' value='0.5' style='width:100%; margin: 0; box-sizing: border-box;'>";
  42. document.getElementById('kinoButton').innerHTML = "<div id='kino' style='cursor: pointer; width: 100%; text-align: center;'>Kinomodus</div>";
  43. var value = localStorage.getItem('dimmer');
  44. if (value !== null) {
  45. document.getElementById('opacity').value = value;
  46. };
  47. document.getElementById('kinoButton').addEventListener("click",function () {
  48. trigger();
  49. });
  50. document.getElementById('opacity').addEventListener("input",function () {
  51. controlDimmer();
  52. });
  53. var boxes = document.getElementsByClassName('colorbox');
  54. var color;
  55. for (var i = 0; i < 4; i++) {
  56. if (boxes[i].className.indexOf('check') > -1) {
  57. color = boxes[i].className.split(" ");
  58. if (color[1] === "gray") {
  59. document.getElementById('kinoButton').style.backgroundColor = "#5E5E5E";
  60. document.getElementById('kinoButton').style.borderColor = "#777777";
  61. document.getElementById('kinoDimmerBar').style.backgroundColor = "#5E5E5E";
  62. document.getElementById('kinoDimmerBar').style.borderColor = "#777777";
  63. }else if (color[1] === "black") {
  64. document.getElementById('kinoButton').style.backgroundColor = "#000";
  65. document.getElementById('kinoButton').style.borderColor = "#FFF";
  66. document.getElementById('kinoDimmerBar').style.backgroundColor = "#000";
  67. document.getElementById('kinoDimmerBar').style.borderColor = "#FFF";
  68. }else if (color[1] === "old_blue") {
  69. document.getElementById('kinoButton').style.backgroundColor = "#F3FBFF";
  70. document.getElementById('kinoButton').style.borderColor = "#000";
  71. document.getElementById('kinoDimmerBar').style.backgroundColor = "#F3FBFF";
  72. document.getElementById('kinoDimmerBar').style.borderColor = "#000";
  73. }else{
  74. document.getElementById('kinoButton').style.backgroundColor = "#F3FBFF";
  75. document.getElementById('kinoButton').style.borderColor = "#000";
  76. document.getElementById('kinoDimmerBar').style.backgroundColor = "#F3FBFF";
  77. document.getElementById('kinoDimmerBar').style.borderColor = "#000";
  78. };
  79. };
  80. };
  81. var layer = document.createElement("div");
  82. layer.setAttribute("id","kinoDimmer");
  83. layer.setAttribute("style","background-color: #000; z-index:1; position: fixed; top: 0; left: 0; height: 100%; width: 100%; opacity: 0.5; display:none;");
  84. document.body.appendChild(layer);
  85. var opacity = document.getElementById('opacity');
  86. document.getElementById('kinoDimmer').style.opacity = opacity.value;
  87. t = setInterval(repeat,100);
  88. };
  89. };
  90.  
  91. var repeat = function () {
  92. if (window.location.href.indexOf('watch') === -1 && window.location.href.indexOf('read') === -1) {
  93. document.getElementById('kinoButton').style.display = "none";
  94. document.getElementById('kinoDimmer').style.display = "none";
  95. document.getElementById('kinoDimmerBar').style.display = "none";
  96. document.getElementById('kinoStyle2').innerHTML = "";
  97. }else{
  98. document.getElementById('kinoButton').style.display = "block";
  99. };
  100. var opacity = document.getElementById('opacity');
  101. var dimmer = opacity.value;
  102. localStorage.setItem('dimmer', dimmer);
  103. };
  104.  
  105. var trigger = function () {
  106. if (document.getElementById('kinoStyle2').innerHTML === styleText2) {
  107. document.getElementById('kinoStyle2').innerHTML = "";
  108. }else{
  109. document.getElementById('kinoStyle2').innerHTML = styleText2;
  110. };
  111. var layer = document.getElementById('kinoDimmer');
  112. var bar = document.getElementById('kinoDimmerBar');
  113. if (layer.style.display === "none") {
  114. bar.style.display = "inline";
  115. layer.style.display = "block";
  116. }else{
  117. layer.style.display = "none";
  118. bar.style.display = "none";
  119. };
  120. };
  121.  
  122. var controlDimmer = function (event) {
  123. var opacity = document.getElementById('opacity');
  124. document.getElementById('kinoDimmer').style.opacity = opacity.value;
  125. };
  126.  
  127. var styleText1 = "\
  128. #kinoButton {\
  129. height: 20px; \
  130. display: inline; \
  131. position: fixed; \
  132. bottom: 0px; \
  133. left: 0px; \
  134. border-right: 1px solid; \
  135. border-top: 1px solid; \
  136. padding: 5px; \
  137. border-radius: 0 10px 0 0;\
  138. }\
  139. \
  140. #kinoDimmerBar {\
  141. height: 20px; \
  142. display: inline; \
  143. position: fixed; \
  144. bottom: 0px;\
  145. margin: auto 40%;\
  146. left: 0;\
  147. right: 0;\
  148. border-right: 1px solid;\
  149. border-left: 1px solid\
  150. border-top: 1px solid; \
  151. padding: 5px; \
  152. border-radius: 10px 10px 0 0;\
  153. }\
  154. ";
  155.  
  156. var styleText2 = "\
  157. .wStream {\
  158. z-index: 2;\
  159. position: relative;\
  160. }\
  161. \
  162. .wMirror {\
  163. z-index: 2;\
  164. position: relative;\
  165. }\
  166. \
  167. .menu {\
  168. z-index: 2;\
  169. position: relative;\
  170. }\
  171. \
  172. #reader {\
  173. z-index: 2;\
  174. position: relative;\
  175. }\
  176. \
  177. #breadcrumb {\
  178. z-index: 2;\
  179. position: relative;\
  180. }\
  181. \
  182. #navigation {\
  183. z-index: 2;\
  184. position: relative;\
  185. }\
  186. ";