1 Star 0 Fork 16

毛毛虫吃肉肉/autojs-demo

forked from lin_bo/autojs-demo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
京东养猪.js 3.44 KB
一键复制 编辑 原始数据 按行查看 历史
[email protected] 提交于 2020-04-26 23:12 . 增加京东金融养猪
"ui";
ui.layout(
<frame w="*" h="*">
<webview id="webView" layout_below="title" src="https://m.baidu.com"/>
</frame>
);
// console.setSize(1000, 1000);
// console.show();
var url = "https://uua.jr.jd.com/uc-fe-wxgrowing/cloudpig/index/home/20191030/158432123100870350/?channelLV=qdy&shareId=vZoq-O6FkuUp62HuKheuTcAdoUJQ3Dik&sourceID=240&actflag=1AEE706F1D&isPay=N&utm_source=Android%2aurl%2a1584321232229&utm_medium=jrappshare&utm_term=qqfriends";
ui.run(() => {ui.webView.loadUrl(url)});
const codeList = [
"/*网页调试工具*/\n(function () {\n if (document.getElementById('mxvConsole2')) {\n } else {\n var version = '3.3.4';\n function getCache(type) {\n try {\n const local = JSON.parse(window.localStorage[type]);\n return local.data ? local : null;\n } catch (e) {\n return null;\n }\n }\n function setCache(type, data) {\n if (!data) {\n return;\n }\n window.localStorage[type] = JSON.stringify({\n version,\n data\n });\n }\n async function getVconsole() {\n const cache = getCache('vconsole');\n if (cache && cache.version == version) {\n return cache.data;\n }\n return window.fetch('//cdn.bootcss.com/vConsole/' + version + '/vconsole.min.js').then(res => res.text())\n .then(data => {\n setCache('vconsole', data);\n return data;\n });\n }\n async function buildVconsole() {\n const data = await getVconsole();\n writeJs(data);\n const vConsole = new VConsole();\n }\n function writeJs(text) {\n var link = document.createElement('script');\n link.innerHTML = text;\n document.getElementsByTagName('head').item(0).appendChild(link);\n }\n function init() {\n getVconsole();\n buildVconsole();\n }\n init();\n }\n var pans = document.createElement('b');\n pans.id = 'mxvConsole2';\n document.body.appendChild(pans);\n})();"
// "(function() {var oHead5415 = document.getElementsByTagName('body').item(0); var oScript5415 = document.createElement('script'); oScript5415.type = 'text/javascript'; oScript5415.src='https://greasyfork.org/scripts/398000-%E4%BA%AC%E4%B8%9C%E5%85%BB%E7%8C%AA/code/%E4%BA%AC%E4%B8%9C%E5%85%BB%E7%8C%AA.user.js'; oHead5415.appendChild( oScript5415);})();"
];
ui.webView.webViewClient = new JavaAdapter(android.webkit.WebViewClient, {
onPageFinished: (webView, url)=>{
toastLog("页面加载完成");
codeList.forEach((code,index) =>{
toastLog("加载脚本" + index);
ui.webView.loadUrl("javascript: " + code);
})
ui.run(() => {
let file = open('pig.js', mode = "r", encoding = "utf-8", bufferSize = 8192);
let js = '';
file.readlines().forEach(item => {
// js += item + "\n\r";
js += item;
});
file.close();
ui.webView.loadUrl("javascript:" + js);
})
}
});
ui.webView.webChromeClient = new JavaAdapter(android.webkit.WebChromeClient, {
onConsoleMessage: (msg) => {
console.log("[%s:%s]: %s", msg.sourceId(), msg.lineNumber(), msg.message())
}
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mmc7rr/autojs-demo.git
[email protected]:mmc7rr/autojs-demo.git
mmc7rr
autojs-demo
autojs-demo
master

搜索帮助