// ==UserScript== // @name:en-US Coolapk open in app // @name 在酷安APP中打开 // @namespace coolapk // @version 0.0.2 // @description:en-US Fix Open Coolapk APP from Web // @description 修复从Coolapk网页调起APP客户端 // @author wherewhere // @match https://www.coolapk.com/* // @match http://www.coolapk.com/* // @match https://*.coolapk.com/* // @icon https://static.coolapk.com/static/web/v8/img/under_logo.png // @grant unsafeWindow // @downloadURL none // ==/UserScript== function toApp() { var url = window.location.href; var URI = ""; URI= "coolapk://" + url.replace("https://","").replace("http://","").replace("www.coolapk.com/",""); window.open(URI) } addJS_Node(toApp); function addJS_Node(text, s_URL, funcToRun, runOnLoad) { var D = document; var scriptNode = D.createElement('script'); if (runOnLoad) { scriptNode.addEventListener("load", runOnLoad, false); } scriptNode.type = "text/javascript"; if (text) scriptNode.textContent = text; if (s_URL) scriptNode.src = s_URL; if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; var targ = D.getElementsByTagName('head')[0] || D.body || D.documentElement; targ.appendChild(scriptNode); }