您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Play Flash games on Kongregate with Flash again!
当前为
// ==UserScript== // @name Kongregate Flash games fixer // @version 1.0 // @description Play Flash games on Kongregate with Flash again! // @author Matrix4348 // @license MIT // @match *://*.konggames.com/games/*/*/frame/* // @grant none // @namespace https://greasyfork.org/users/4818 // ==/UserScript== // The script must be restrained to the Flash iframes (the URL for the html games iframes look a bit different, but there may be some exceptions). if ((document.URL.search("/frame/")>-1)&(document.body.innerHTML.search("kong_flash_variables")>-1)){ // First, we need to extract the link to the swf (the game file). var file_url0, file_url, file_url_base; var scripts=document.getElementsByTagName("script"); for(var i=0; i<scripts.length;i++) {var script_text=scripts[i].text; var url_text; if(script_text.indexOf("game_swf")!== -1) { url_text=String(script_text.match(/game_swf\"\:\"(.*?)\"\,\"game_url/g)); file_url0="https://"+decodeURIComponent(url_text.substring(17,(url_text.length/2)-11)); break; } else if(script_text.indexOf("swfurl")!== -1) { url_text=String(script_text.match(/swfurl\"\:\"(.*?)\"\,\"flashvars/g)); file_url0=decodeURI(url_text.substring(9,url_text.length-12)); break; }; }; file_url=file_url0.substring(file_url0.search("//"),file_url0.length-1); file_url_base="http:"+file_url.substring(0,file_url.search("/live/")+6); // Now, let's write in the page's HTML. var a=document.createElement("script"); a.id="Fixing area"; // IMPORTANT: Apparently, something in the code knows the correct flashvars, this is why I will not input any. a.innerHTML= `//<![CDATA[ gameLoader = { loadGame: function(urlOptions) { var swf_location = "`+file_url+`"; var swfobject_flash_vars = {}; if(typeof(kong_flash_variables) == "object"){ for(var k in kong_flash_variables){ swfobject_flash_vars[k] = encodeURIComponent(kong_flash_variables[k]); } } swfobject.embedSWF(swf_location, "gamediv","100%","100%","6","/flash/expressInstall.swf",swfobject_flash_vars,{"bgcolor":"#000000","allownetworking":"all","allowscriptaccess":"always","base":"`+file_url_base+`"},{}); } } function activateGameWithFlash(urlOptions) { if (!urlOptions) { urlOptions = ''; } gameLoader.loadGame(urlOptions); document.fire('game:activated'); }; activateGameWithFlash(); //]]>`; document.body.appendChild(a); }