jmcomic加速

加速jmcomic图册加载

  1. // ==UserScript==
  2. // @name jmcomic加速
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.01
  5. // @description 加速jmcomic图册加载
  6. // @author lyzin
  7. // @include /^https?://.*jmcomic[^/]*/photo/\d+$/
  8. // @include /^https?://.*comic[^/]*/photo/\d+$/
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. function md5(string,bit) {
  17. function md5_RotateLeft(lValue, iShiftBits) {
  18. return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
  19. }
  20. function md5_AddUnsigned(lX, lY) {
  21. var lX4, lY4, lX8, lY8, lResult;
  22. lX8 = (lX & 0x80000000);
  23. lY8 = (lY & 0x80000000);
  24. lX4 = (lX & 0x40000000);
  25. lY4 = (lY & 0x40000000);
  26. lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
  27. if (lX4 & lY4) {
  28. return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
  29. }
  30. if (lX4 | lY4) {
  31. if (lResult & 0x40000000) {
  32. return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
  33. } else {
  34. return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
  35. }
  36. } else {
  37. return (lResult ^ lX8 ^ lY8);
  38. }
  39. }
  40. function md5_F(x, y, z) {
  41. return (x & y) | ((~x) & z);
  42. }
  43. function md5_G(x, y, z) {
  44. return (x & z) | (y & (~z));
  45. }
  46. function md5_H(x, y, z) {
  47. return (x ^ y ^ z);
  48. }
  49. function md5_I(x, y, z) {
  50. return (y ^ (x | (~z)));
  51. }
  52. function md5_FF(a, b, c, d, x, s, ac) {
  53. a = md5_AddUnsigned(a, md5_AddUnsigned(md5_AddUnsigned(md5_F(b, c, d), x), ac));
  54. return md5_AddUnsigned(md5_RotateLeft(a, s), b);
  55. };
  56. function md5_GG(a, b, c, d, x, s, ac) {
  57. a = md5_AddUnsigned(a, md5_AddUnsigned(md5_AddUnsigned(md5_G(b, c, d), x), ac));
  58. return md5_AddUnsigned(md5_RotateLeft(a, s), b);
  59. };
  60. function md5_HH(a, b, c, d, x, s, ac) {
  61. a = md5_AddUnsigned(a, md5_AddUnsigned(md5_AddUnsigned(md5_H(b, c, d), x), ac));
  62. return md5_AddUnsigned(md5_RotateLeft(a, s), b);
  63. };
  64. function md5_II(a, b, c, d, x, s, ac) {
  65. a = md5_AddUnsigned(a, md5_AddUnsigned(md5_AddUnsigned(md5_I(b, c, d), x), ac));
  66. return md5_AddUnsigned(md5_RotateLeft(a, s), b);
  67. };
  68. function md5_ConvertToWordArray(string) {
  69. var lWordCount;
  70. var lMessageLength = string.length;
  71. var lNumberOfWords_temp1 = lMessageLength + 8;
  72. var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
  73. var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
  74. var lWordArray = Array(lNumberOfWords - 1);
  75. var lBytePosition = 0;
  76. var lByteCount = 0;
  77. while (lByteCount < lMessageLength) {
  78. lWordCount = (lByteCount - (lByteCount % 4)) / 4;
  79. lBytePosition = (lByteCount % 4) * 8;
  80. lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
  81. lByteCount++;
  82. }
  83. lWordCount = (lByteCount - (lByteCount % 4)) / 4;
  84. lBytePosition = (lByteCount % 4) * 8;
  85. lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
  86. lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
  87. lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
  88. return lWordArray;
  89. };
  90. function md5_WordToHex(lValue) {
  91. var WordToHexValue = "", WordToHexValue_temp = "", lByte, lCount;
  92. for (lCount = 0; lCount <= 3; lCount++) {
  93. lByte = (lValue >>> (lCount * 8)) & 255;
  94. WordToHexValue_temp = "0" + lByte.toString(16);
  95. WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
  96. }
  97. return WordToHexValue;
  98. };
  99. function md5_Utf8Encode(string) {
  100. string = string.replace(/\r\n/g, "\n");
  101. var utftext = "";
  102. for (var n = 0; n < string.length; n++) {
  103. var c = string.charCodeAt(n);
  104. if (c < 128) {
  105. utftext += String.fromCharCode(c);
  106. } else if ((c > 127) && (c < 2048)) {
  107. utftext += String.fromCharCode((c >> 6) | 192);
  108. utftext += String.fromCharCode((c & 63) | 128);
  109. } else {
  110. utftext += String.fromCharCode((c >> 12) | 224);
  111. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  112. utftext += String.fromCharCode((c & 63) | 128);
  113. }
  114. }
  115. return utftext;
  116. };
  117. var x = Array();
  118. var k, AA, BB, CC, DD, a, b, c, d;
  119. var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
  120. var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
  121. var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
  122. var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
  123. string = md5_Utf8Encode(string);
  124. x = md5_ConvertToWordArray(string);
  125. a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
  126. for (k = 0; k < x.length; k += 16) {
  127. AA = a; BB = b; CC = c; DD = d;
  128. a = md5_FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
  129. d = md5_FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
  130. c = md5_FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
  131. b = md5_FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
  132. a = md5_FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
  133. d = md5_FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
  134. c = md5_FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
  135. b = md5_FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
  136. a = md5_FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
  137. d = md5_FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
  138. c = md5_FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
  139. b = md5_FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
  140. a = md5_FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
  141. d = md5_FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
  142. c = md5_FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
  143. b = md5_FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
  144. a = md5_GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
  145. d = md5_GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
  146. c = md5_GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
  147. b = md5_GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
  148. a = md5_GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
  149. d = md5_GG(d, a, b, c, x[k + 10], S22, 0x2441453);
  150. c = md5_GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
  151. b = md5_GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
  152. a = md5_GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
  153. d = md5_GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
  154. c = md5_GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
  155. b = md5_GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
  156. a = md5_GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
  157. d = md5_GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
  158. c = md5_GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
  159. b = md5_GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
  160. a = md5_HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
  161. d = md5_HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
  162. c = md5_HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
  163. b = md5_HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
  164. a = md5_HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
  165. d = md5_HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
  166. c = md5_HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
  167. b = md5_HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
  168. a = md5_HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
  169. d = md5_HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
  170. c = md5_HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
  171. b = md5_HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
  172. a = md5_HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
  173. d = md5_HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
  174. c = md5_HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
  175. b = md5_HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
  176. a = md5_II(a, b, c, d, x[k + 0], S41, 0xF4292244);
  177. d = md5_II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
  178. c = md5_II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
  179. b = md5_II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
  180. a = md5_II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
  181. d = md5_II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
  182. c = md5_II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
  183. b = md5_II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
  184. a = md5_II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
  185. d = md5_II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
  186. c = md5_II(c, d, a, b, x[k + 6], S43, 0xA3014314);
  187. b = md5_II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
  188. a = md5_II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
  189. d = md5_II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
  190. c = md5_II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
  191. b = md5_II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
  192. a = md5_AddUnsigned(a, AA);
  193. b = md5_AddUnsigned(b, BB);
  194. c = md5_AddUnsigned(c, CC);
  195. d = md5_AddUnsigned(d, DD);
  196. }
  197. if(bit==32){
  198. return (md5_WordToHex(a) + md5_WordToHex(b) + md5_WordToHex(c) + md5_WordToHex(d)).toLowerCase();
  199. }
  200. return (md5_WordToHex(b) + md5_WordToHex(c)).toLowerCase();
  201. }
  202. document.location.href+=`?speed=${md5(document.location.pathname.substr(7),32)}`;
  203. })();