Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yichahucha committed Apr 30, 2020
1 parent d5d1173 commit 13f1de1
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tb_pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,26 @@ if (headers["User-Agent"].indexOf("%E6%89%8B%E6%9C%BA%E6%B7%98%E5%AE%9D") != -1)
}
$done({
body
})
})

function Qs2Json(url) {
var search = url.substring(url.lastIndexOf("?") + 1);
var obj = {};
var reg = /([^?&=]+)=([^?&=]*)/g;
search.replace(reg, function(rs, $1, $2) {
var name = decodeURIComponent($1);
var val = decodeURIComponent($2);
val = String(val);
obj[name] = val;
return rs;
});
return obj;
}

function Json2Qs(json) {
var temp = [];
for (var k in json) {
temp.push(k + "=" + json[k]);
}
return temp.join("&");
}

0 comments on commit 13f1de1

Please sign in to comment.