svn://120.77.245.17/weiqing_sun_wechat/zhyshop_sun
cd d:/zhyshop_sun_wechat
npm install
切换至只有首页模式
配置chrome开发者工具
- 拷贝d:\Tampermonkey_4.14.6144.zip到目录解压。
- 打开chrome扩展程序,打开-开发者模式
- 加载Tampermonkey_4.14.6144目录进去
- 创建Tampermonkey脚本(把192.168.2.91)改成自已IP
// ==UserScript==
// @name first script
// @namespace http://tampermonkey.net/
// @match http://192.168.2.91:8081
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://192.168.2.91:8081/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
console.log("srcipt enabled");
GM_registerMenuCommand("加入新页面",function(){
let url =location.href;
console.log("url:"+url);
let pos1 = url.indexOf("#");
let pos2 = url.indexOf("?",pos1);
let page = "";
if(pos2 != -1){
page = url.substring(pos1 + 2,pos2);
}else{
page = url.substring(pos1 + 2);
}
let newurl = "http://192.168.2.91:7071/controller/devtool/httpRequest?page=" + page;
console.log("打开新窗口url:"+newurl);
GM_xmlhttpRequest({
method: "get",
url: newurl,
onload: function(res){
if(res.status === 200){
console.log('新页面加入成功')
}else{
console.log('新页面加入失败')
console.log(res)
}
},
onerror : function(err){
console.log('error')
console.log(err)
}
});
//GM_openInTab(newurl, { active: true, insert: true, setParent :true })
},"h");
})();
- 在脚本设置tab中"XHR安全"-》用户域名白名单加入自已IP,如:192.168.2.91