一键下载 4399, 7k7k flash游戏 + flash 播放器

✨一键下载 4399, 7k7k flash 游戏, 并提供 flash 播放器✨

目前为 2022-08-01 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 一键下载 4399, 7k7k flash游戏 + flash 播放器
  3. // @description ✨一键下载 4399, 7k7k flash 游戏, 并提供 flash 播放器✨
  4. // @namespace https://fcmsb250.github.io/
  5. // @version 0.2.1
  6. // @author mininb666 https://gf.qytechs.cn/zh-CN/users/822325-mininb666 / dsy4567 https://github.com/dsy4567
  7. // @license MIT
  8. // @run-at document-start
  9.  
  10. // @match *://*.4399.com/*
  11. // @match *://*.7k7k.com/*
  12.  
  13. // @connect *.4399.com
  14. // @connect *.7k7k.com
  15.  
  16. // @grant GM_addValueChangeListener
  17. // @grant GM_openInTab
  18. // @grant GM_registerMenuCommand
  19. // @grant GM_setValue
  20. // @grant unsafeWindow
  21. // @require https://code.jquery.com/jquery-3.6.0.min.js
  22.  
  23. // @homepageURL https://fcmsb250.github.io/
  24. // @supportURL https://github.com/dsy4567/Fucking-Anti-Indulgence/
  25.  
  26. // ==/UserScript==
  27.  
  28. /*
  29. MIT License
  30.  
  31. Copyright (c) 2022 dsy4567(https://github.com/dsy4567/ ; dsy4567@outlook.com)
  32.  
  33. Permission is hereby granted, free of charge, to any person obtaining a copy
  34. of this software and associated documentation files (the "Software"), to deal
  35. in the Software without restriction, including without limitation the rights
  36. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37. copies of the Software, and to permit persons to whom the Software is
  38. furnished to do so, subject to the following conditions:
  39.  
  40. The above copyright notice and this permission notice shall be included in all
  41. copies or substantial portions of the Software.
  42.  
  43. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49. SOFTWARE.
  50. */
  51.  
  52. try {
  53. Object.defineProperty(unsafeWindow, "showBlockFlashIE", {
  54. value: ()=>{},
  55. writable: false,
  56. });
  57. } catch (e) {}
  58. try {
  59. Object.defineProperty(unsafeWindow, "showBlockFlash", {
  60. value: ()=>{},
  61. writable: false,
  62. });
  63. } catch (e) {}
  64.  
  65. // ==download.js==
  66.  
  67. //download.js v4.2, by dandavis; 2008-2016. [CCBY2] see http://danml.com/download.html for tests/usage
  68. // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
  69. // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
  70. // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
  71. // v4 adds AMD/UMD, commonJS, and plain browser support
  72. // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
  73. // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
  74. // https://github.com/rndme/download
  75.  
  76. (function (root, factory) {
  77. if (typeof define === "function" && define.amd) {
  78. // AMD. Register as an anonymous module.
  79. define([], factory);
  80. } else if (typeof exports === "object") {
  81. // Node. Does not work with strict CommonJS, but
  82. // only CommonJS-like environments that support module.exports,
  83. // like Node.
  84. module.exports = factory();
  85. } else {
  86. // Browser globals (root is window)
  87. root.download = factory();
  88. }
  89. })(this, function () {
  90. return function download(data, strFileName, strMimeType) {
  91. var self = window, // this script is only for browsers anyway...
  92. defaultMime = "application/octet-stream", // this default mime also triggers iframe downloads
  93. mimeType = strMimeType || defaultMime,
  94. payload = data,
  95. url = !strFileName && !strMimeType && payload,
  96. anchor = document.createElement("a"),
  97. toString = function (a) {
  98. return String(a);
  99. },
  100. myBlob = self.Blob || self.MozBlob || self.WebKitBlob || toString,
  101. fileName = strFileName || "download",
  102. blob,
  103. reader;
  104. myBlob = myBlob.call ? myBlob.bind(self) : Blob;
  105.  
  106. if (String(this) === "true") {
  107. //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
  108. payload = [payload, mimeType];
  109. mimeType = payload[0];
  110. payload = payload[1];
  111. }
  112.  
  113. if (url && url.length < 2048) {
  114. // if no filename and no mime, assume a url was passed as the only argument
  115. fileName = url.split("/").pop().split("?")[0];
  116. anchor.href = url; // assign href prop to temp anchor
  117. if (anchor.href.indexOf(url) !== -1) {
  118. // if the browser determines that it's a potentially valid url path:
  119. var ajax = new XMLHttpRequest();
  120. ajax.open("GET", url, true);
  121. ajax.responseType = "blob";
  122. ajax.onload = function (e) {
  123. download(e.target.response, fileName, defaultMime);
  124. };
  125. setTimeout(function () {
  126. ajax.send();
  127. }, 0); // allows setting custom ajax headers using the return:
  128. return ajax;
  129. } // end if valid url?
  130. } // end if url?
  131.  
  132. //go ahead and download dataURLs right away
  133. if (/^data\:[\w+\-]+\/[\w+\-]+[,;]/.test(payload)) {
  134. if (payload.length > 1024 * 1024 * 1.999 && myBlob !== toString) {
  135. payload = dataUrlToBlob(payload);
  136. mimeType = payload.type || defaultMime;
  137. } else {
  138. return navigator.msSaveBlob // IE10 can't do a[download], only Blobs:
  139. ? navigator.msSaveBlob(dataUrlToBlob(payload), fileName)
  140. : saver(payload); // everyone else can save dataURLs un-processed
  141. }
  142. } //end if dataURL passed?
  143.  
  144. blob = payload instanceof myBlob ? payload : new myBlob([payload], { type: mimeType });
  145.  
  146. function dataUrlToBlob(strUrl) {
  147. var parts = strUrl.split(/[:;,]/),
  148. type = parts[1],
  149. decoder = parts[2] == "base64" ? atob : decodeURIComponent,
  150. binData = decoder(parts.pop()),
  151. mx = binData.length,
  152. i = 0,
  153. uiArr = new Uint8Array(mx);
  154.  
  155. for (i; i < mx; ++i) uiArr[i] = binData.charCodeAt(i);
  156.  
  157. return new myBlob([uiArr], { type: type });
  158. }
  159.  
  160. function saver(url, winMode) {
  161. if ("download" in anchor) {
  162. //html5 A[download]
  163. anchor.href = url;
  164. anchor.setAttribute("download", fileName);
  165. anchor.className = "download-js-link";
  166. anchor.innerHTML = "downloading...";
  167. anchor.style.display = "none";
  168. document.body.appendChild(anchor);
  169. setTimeout(function () {
  170. anchor.click();
  171. document.body.removeChild(anchor);
  172. if (winMode === true) {
  173. setTimeout(function () {
  174. self.URL.revokeObjectURL(anchor.href);
  175. }, 250);
  176. }
  177. }, 66);
  178. return true;
  179. }
  180.  
  181. // handle non-a[download] safari as best we can:
  182. if (/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
  183. url = url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
  184. if (!window.open(url)) {
  185. // popup blocked, offer direct download:
  186. if (
  187. confirm(
  188. "Displaying New Document\n\nUse Save As... to download, then click back to return to this page."
  189. )
  190. ) {
  191. location.href = url;
  192. }
  193. }
  194. return true;
  195. }
  196.  
  197. //do iframe dataURL download (old ch+FF):
  198. var f = document.createElement("iframe");
  199. document.body.appendChild(f);
  200.  
  201. if (!winMode) {
  202. // force a mime that will download:
  203. url = "data:" + url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
  204. }
  205. f.src = url;
  206. setTimeout(function () {
  207. document.body.removeChild(f);
  208. }, 333);
  209. } //end saver
  210.  
  211. if (navigator.msSaveBlob) {
  212. // IE10+ : (has Blob, but not a[download] or URL)
  213. return navigator.msSaveBlob(blob, fileName);
  214. }
  215.  
  216. if (self.URL) {
  217. // simple fast and modern way using Blob and URL:
  218. saver(self.URL.createObjectURL(blob), true);
  219. } else {
  220. // handle non-Blob()+non-URL browsers:
  221. if (typeof blob === "string" || blob.constructor === toString) {
  222. try {
  223. return saver("data:" + mimeType + ";base64," + self.btoa(blob));
  224. } catch (y) {
  225. return saver("data:" + mimeType + "," + encodeURIComponent(blob));
  226. }
  227. }
  228.  
  229. // Blob but not URL support:
  230. reader = new FileReader();
  231. reader.onload = function (e) {
  232. saver(this.result);
  233. };
  234. reader.readAsDataURL(blob);
  235. }
  236. return true;
  237. }; /* end download() */
  238. });
  239.  
  240. // ==/download.js==
  241.  
  242. /**
  243. * @param {String} 开始
  244. * @param {String} 结束
  245. * @param {String} 值
  246. * @param {String} 类型 "1": url, "2": 字母+数字, "3": 数字
  247. * @param {String} 前面追加
  248. * @returns {String}
  249. */
  250. function 获取中间(开始, 结束, 值, 类型, 前面追加) {
  251. if (开始 && !值.indexOf(开始) != -1) {
  252. = 值.substring(值.indexOf(开始) + 开始.length);
  253. }
  254. if (结束) {
  255. = decodeURI(值.substring(0, 值.indexOf(结束)));
  256. }
  257. if (前面追加) {
  258. = 前面追加 + 值;
  259. }
  260. switch (类型) {
  261. case "1":
  262. if (
  263. !(
  264. 值.substring(0, 2) == "//" ||
  265. 值.substring(0, 7) == "http://" ||
  266. 值.substring(0, 8) == "https://"
  267. )
  268. ) {
  269. throw new Error("不正确的字符串");
  270. }
  271. break;
  272. case "2":
  273. if (!/^[0-9a-zA-Z]*$/g.test(值)) {
  274. throw new Error("不正确的字符串");
  275. }
  276. break;
  277. case "3":
  278. if (isNaN(Number(值))) {
  279. throw new Error("不正确的字符串");
  280. }
  281. break;
  282.  
  283. default:
  284. break;
  285. }
  286. return 值;
  287. }
  288.  
  289. // ==/Fucking-Anti-Indulgence.user.js==
  290.  
  291. (() => {
  292. if (self == top) {
  293. GM_registerMenuCommand("注意: 请勿直接下载 h5 游戏");
  294. GM_registerMenuCommand("注意: 请勿在下载时同时打开其它游戏");
  295. GM_registerMenuCommand("注意: 建议在游戏加载完成后下载游戏");
  296. GM_registerMenuCommand("注意: 若等待时间过长则说明下载失败");
  297. GM_registerMenuCommand("----------");
  298. GM_registerMenuCommand("打开flash播放器", () => {
  299. GM_openInTab("https://fcmsb250.github.io/flash.html");
  300. });
  301.  
  302. GM_registerMenuCommand("下载4399 flash 游戏", () => {
  303. let url = "";
  304. try {
  305. url = document.querySelector("#flashgame > param[name='movie']").value;
  306. if (url.includes("?")) {
  307. url = 获取中间("gameswf=", ".swf", url) + ".swf";
  308. }
  309. } catch (e) {
  310. console.error(e);
  311. try {
  312. url = document.querySelector("#swf1 > param[name='movie']").value;
  313.  
  314. if (url.includes("?")) {
  315. url = 获取中间("gameswf=", ".swf", url) + ".swf";
  316. }
  317. } catch (e) {
  318. console.error(e);
  319. }
  320. }
  321. if (url) {
  322. if (
  323. !(
  324. url.substring(0, 2) == "//" ||
  325. url.substring(0, 7) == "http://" ||
  326. url.substring(0, 8) == "https://"
  327. )
  328. ) {
  329. url = location.href.substring(0, location.href.lastIndexOf("/") + 1) + url;
  330. }
  331. GM_setValue("url", url);
  332. } else {
  333. console.log("失败");
  334. GM_setValue("down4399", Math.random());
  335. }
  336. });
  337.  
  338. GM_registerMenuCommand("下载7k7k flash 游戏", () => {
  339. try {
  340. let url = document.querySelector("#gameobj").src;
  341. if (url == location.href || !url) {
  342. throw "";
  343. }
  344. location.href = url;
  345. } catch (e) {
  346. console.error(e);
  347. try {
  348. var game_path = "";
  349. var game_id = unsafeWindow.gameInfo.gameId;
  350. //同步请求
  351. $.ajaxSettings.async = false;
  352. $.get(
  353. "http://www.7k7k.com/open_api/request?action=Flash.Game&game=" + game_id,
  354. function (data) {
  355. try {
  356. game_path = JSON.parse(data).result.url;
  357. location.href = game_path;
  358. } catch (e) {
  359. alert("失败");
  360. }
  361. }
  362. );
  363. $.ajaxSettings.async = true;
  364. } catch (e) {
  365. console.error(e);
  366. alert("失败");
  367. }
  368. }
  369. });
  370.  
  371. GM_addValueChangeListener("url", (name, old_value, new_value, remote) => {
  372. location.href = new_value;
  373. });
  374. } else {
  375. if (location.href.includes("4399") && location.href.includes("upload_swf")) {
  376. GM_addValueChangeListener("down4399", (name, old_value, new_value, remote) => {
  377. let url = "";
  378. try {
  379. url = document.querySelector("#flashgame > param[name='movie']").value;
  380. if (url.includes("?")) {
  381. url = 获取中间("gameswf=", ".swf", url) + ".swf";
  382. }
  383. } catch (e) {
  384. console.error(e);
  385. try {
  386. url = document.querySelector("#swf1 > param[name='movie']").value;
  387.  
  388. if (url.includes("?")) {
  389. url = 获取中间("gameswf=", ".swf", url) + ".swf";
  390. }
  391. } catch (e) {
  392. console.error(e);
  393. }
  394. }
  395. if (url) {
  396. if (
  397. !(
  398. url.substring(0, 2) == "//" ||
  399. url.substring(0, 7) == "http://" ||
  400. url.substring(0, 8) == "https://"
  401. )
  402. ) {
  403. url = location.href.substring(0, location.href.lastIndexOf("/") + 1) + url;
  404. }
  405. GM_setValue("url", url);
  406. } else {
  407. console.log("失败");
  408. }
  409. });
  410. }
  411. }
  412.  
  413. if (
  414. location.pathname.includes(".swf") &&
  415. !document.documentElement.innerHTML.includes("was not found on this server.")
  416. ) {
  417. download(location.href);
  418. return;
  419. }
  420. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址