|
发表于 2018-11-19 11:49:29
|
显示全部楼层
广东省深圳市
// ==UserScript==
// @name 淘宝测试脚本
// @Namespace http://tampermonkey.net/
// @Version 0.1
// @description try to take over the world!
// @author Su
// @match *.taobao.com/*
// @match *.tmall.com/*
// @grant none
// @require https://code.jquery.com/jquery-3.1.1.min.js
// ==/UserScript==
(function() {
$("#app").hide();
var ID = GetQueryString("id");
GM_xmlhttpRequest({
method: "GET",
url: "接口地址https://bbs.125.la/1.php",
headers: {
referer: "接口域名如https://bbs.125.la/"
},
overrideMimeType: "text/plain; charset=x-user-defined",
onprogress: function(xhr) {
console.log(xhr.lengthComputable + "," + xhr.loaded + "," + xhr.total);
xhr.lengthComputable:布尔值,是否可以获取到文件总长度
xhr.loaded:已加载的字节数
xhr.total:文件总字节数
},
onload: function(xhr) {
var r = xhr.responseText;
var obj1 = eval(r);
for (var i=0;i<value1.length;i++){
if(ID == obj1.itemida){
var skID =obj1.itemidb;
window.location.+skID;
}
}
function GetQueryString(name)
{
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);//search,查询?后面的参数,并匹配正则
if(r!=null)return unescape(r[2]); return null;
}
}
})
// Your code here...
})();
油猴脚本源码在此 给个会写的看看 为什么用不了。我后面给你改调api接口还有问题 需要改一下 被你说成全部没弄好 一句话否定? |
|