B站合集-开发中(注:练手作品,多多包涵,不接受恶意差评,不喜欢不要用就行了:一键播放所有视频;一键拉黑。。。)

try to take over the world!

当前为 2021-03-05 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/422731/907313/B%E7%AB%99%E5%90%88%E9%9B%86-%E5%BC%80%E5%8F%91%E4%B8%AD%EF%BC%88%E6%B3%A8%3A%E7%BB%83%E6%89%8B%E4%BD%9C%E5%93%81%2C%E5%A4%9A%E5%A4%9A%E5%8C%85%E6%B6%B5%EF%BC%8C%E4%B8%8D%E6%8E%A5%E5%8F%97%E6%81%B6%E6%84%8F%E5%B7%AE%E8%AF%84%EF%BC%8C%E4%B8%8D%E5%96%9C%E6%AC%A2%E4%B8%8D%E8%A6%81%E7%94%A8%E5%B0%B1%E8%A1%8C%E4%BA%86%EF%BC%9A%E4%B8%80%E9%94%AE%E6%92%AD%E6%94%BE%E6%89%80%E6%9C%89%E8%A7%86%E9%A2%91%3B%E4%B8%80%E9%94%AE%E6%8B%89%E9%BB%91%E3%80%82%E3%80%82%E3%80%82%EF%BC%89.js

  1. // ==UserScript==
  2. // @name B站合集-开发中(注:练手作品,多多包涵,不接受恶意差评,不喜欢不要用就行了:一键播放所有视频;一键拉黑。。。)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1.2
  5. // @description try to take over the world!
  6. // @author 荒年(QQ:2019676120)
  7. // @match *://space.bilibili.com/*
  8. // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
  9. // @resource animate http://cdn.javaex.cn/javaex/pc/css/animate.css
  10. // @resource common http://cdn.javaex.cn/javaex/pc/css/common.css
  11. // @resource defaultCss http://cdn.javaex.cn/javaex/pc/css/skin/default.css
  12. // @grant unsafeWindow
  13. // @grant GM_getValue
  14. // @grant GM_setValue
  15. // @grant GM_xmlhttpRequest
  16. // @grant GM_getResourceText
  17. // @grant GM_openInTab
  18. // @grant GM_addStyle
  19. // @run-at document-idle
  20. // @license MIT License
  21. // @namespace http://tampermonkey.net/
  22. // ==/UserScript==
  23.  
  24.  
  25. GM_addStyle(`
  26. #left_navbar{
  27. z-index: 1000;
  28. position: absolute;
  29. top: 100px;
  30. left: 5px;
  31. }
  32. button[hnBtn="btn_open"] {
  33. z-index: 1001;
  34. z-index: 1000px;
  35. position: absolute;
  36. top: 58px;
  37. left: 220px;
  38. }
  39. .javaex-panel.javaex-panel-right.javaex-animated-zoom-in {
  40. top: 60px;
  41. }
  42. .javaex-menu-container {
  43. border: 1px solid #eee;
  44. }
  45. .javaex-panel-box p {
  46. text-align: center;
  47. background: #fb7299;
  48. }
  49. .fontbold{
  50. color: #00a1d6;
  51. font-weight: bold;
  52. cursor: pointer;
  53. }
  54. `);
  55.  
  56. let Live_info = {
  57. author_uid: 99439379,
  58. room_id: undefined,
  59. uid: undefined,
  60. blocked: undefined,
  61. csrf_token: undefined,
  62. visit_id: undefined,
  63. rnd: undefined,
  64. ruid: undefined,
  65. uname: undefined,
  66. user_level: undefined,
  67. ruid: undefined,
  68. };
  69.  
  70. let BILIBLI_PATH = {
  71.  
  72. "passport": "https://passport.bilibili.com",
  73. "api": "https://api.bilibili.com",
  74. "video": "https://www.bilibili.com/video/",
  75. "single_unread": "http://api.vc.bilibili.com/"
  76. }
  77. /**
  78. * 参考 https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/login/login_info.md
  79. * @type {{nav: string}}
  80. */
  81. let BILIBILI_URL = {
  82. // 导航栏用户信息
  83. "nav": BILIBLI_PATH.api + "/x/web-interface/nav",
  84. }
  85.  
  86. let BiliData = {
  87. login_code: null,
  88. login_message: "",
  89. LoginData: {},
  90. CoinLog: {},
  91. Unread: null,
  92. Video: {},
  93. replyAction: {},
  94. upCard: {},
  95. BVList: [],
  96. }
  97.  
  98.  
  99. window.onload = function () {
  100.  
  101. let script = document.createElement('script');
  102. script.setAttribute('type', 'text/javascript');
  103. script.src = "https://cdn.jsdelivr.net/gh/java-xiaoyi/HNGG-RES@main/javaex/pc/js/javaex.min.js";
  104. document.documentElement.appendChild(script);
  105.  
  106. let script2 = document.createElement('script');
  107. script2.setAttribute('type', 'text/javascript');
  108. script2.src = "https://cdn.jsdelivr.net/gh/java-xiaoyi/HNGG-RES@main/javaex/pc/js/javaex-formVerify.js";
  109. document.documentElement.appendChild(script2);
  110.  
  111.  
  112. //界面显示
  113. init();
  114.  
  115. document.getElementById("getAtMsg").click();
  116.  
  117. }
  118.  
  119.  
  120. function init() {
  121.  
  122. Live_info.csrf_token = HNTOOL.getCookie("bili_jct");
  123. Live_info.uid = HNTOOL.getCookie("DedeUserID");
  124.  
  125. addStyle();
  126. addSetPage();
  127.  
  128. $("#getCoinLog").bind("click", async function () {
  129.  
  130.  
  131. if (HNAPI.getCoinLog()) {
  132.  
  133. await HNTOOL.Sleep(500);
  134. let html = '';
  135. html += '<div class="javaex-panel-box" style="width: 250px;">';
  136. html += ' <ul>';
  137. html += ` <p style="color: #FFF;">硬币使用记录</p>`;
  138.  
  139. BiliData.CoinLog.list.forEach(function (item) {
  140.  
  141. let BV = item.reason.replace(/[^a-z0-9]+/ig, "");
  142. if (BV.indexOf("BV") != -1) {
  143. html += `<li><a href="${BILIBLI_PATH.video}${BV}">${item.reason}${item.delta}币 ${item.time}</a> </li> `;
  144. }
  145. html += `<li>${item.reason}${item.delta}币 ${item.time}</li> `;
  146.  
  147.  
  148. });
  149. html += ' <hr class="javaex-divider"></hr>';
  150. html += ' </ul>';
  151. html += '</div>';
  152.  
  153. javaex.panel(this, {
  154. position: "right",
  155. //offsetTop: "104",
  156. content: html
  157. });
  158. javaex.tip({
  159. content: "获取用户成功!",
  160. type: "success"
  161. });
  162.  
  163. } else {
  164. javaex.tip({
  165. content: "获取硬币记录失败,请稍后重试!",
  166. type: "error"
  167. });
  168. }
  169.  
  170.  
  171. });
  172.  
  173. $("#getUnread").bind("click", async function () {
  174.  
  175. javaex.tip({
  176. content: "获取中,请稍候...",
  177. type: "submit"
  178. });
  179. HNAPI.getUnread();
  180.  
  181.  
  182. });
  183.  
  184.  
  185. $("#likeInDynamicComments").bind("click", async function () {
  186.  
  187. let prid = LocalData.get("likeInDynamic_PRID") == null ? "4015599048" : LocalData.get("likeInDynamic_PRID");
  188. let oid = LocalData.get("likeInDynamic_OID") == null ? "108928314" : LocalData.get("likeInDynamic_OID");
  189.  
  190. let html = '';
  191.  
  192. html += '<div style="padding: 10px 10px 10px 0px;">'
  193. html += '<form id="likeInDynamic_form">'
  194. html += ' <div class="javaex-unit clear">'
  195. html += ' <div class="javaex-unit-left"><p class="subtitle required">评论RPID</p></div>'
  196. html += ' <div class="javaex-unit-right">'
  197. html += ' <input type="text" class="javaex-text" data-type="positive_int" error-msg="评论RPID格式错误"'
  198. html += ` id="likeInDynamic_PRID" value=${prid} placeholder="请输入评论RPID"/>`
  199. html += ' </div>'
  200. html += ' </div>'
  201. html += ' <div class="javaex-unit clear">'
  202. html += ' <div class="javaex-unit-left"><p class="subtitle required">OID</p></div>'
  203. html += ' <div class="javaex-unit-right">'
  204. html += ' <input type="text" class="javaex-text" data-type="positive_int" error-msg="OID格式错误"'
  205. html += ` id="likeInDynamic_OID" value=${oid} placeholder="请输入OID"/>`
  206. html += ' </div>'
  207. html += ' </div>'
  208. html += ' <div class="javaex-unit clear tc">'
  209. html += ' <input type="button" id="likeInDynamic_no" class="javaex-hover-pulse javaex-btn no " value="取消赞"/>'
  210. html += ' <input type="button" id="likeInDynamic_yes" class="javaex-hover-pulse javaex-btn yes" value="点赞"/>'
  211. html += ' </div>'
  212. html += '</form>';
  213. html += '<hr class="javaex-divider"></hr>';
  214. html += '</div>';
  215.  
  216.  
  217. javaex.panel(this, {
  218. position: "right",
  219. content: html
  220. });
  221.  
  222.  
  223. // 监听点击保存按钮事件
  224. $("#likeInDynamic_yes").click(async function () {
  225. // 表单验证函数
  226. if (javaexVerify()) {
  227.  
  228. HNAPI.likeInDynamicComments(+javaex.getSelectVal("#likeInDynamic_OID"), +javaex.getSelectVal("#likeInDynamic_PRID"), 1);
  229. await HNTOOL.Sleep(1000);
  230.  
  231. if (BiliData.replyAction.code == 0) {
  232.  
  233. LocalData.set("likeInDynamic_PRID", javaex.getSelectVal("#likeInDynamic_PRID"));
  234. LocalData.set("likeInDynamic_OID", javaex.getSelectVal("#likeInDynamic_OID"));
  235.  
  236. javaex.tip({content: "评论区点赞成功!", type: "success"});
  237. } else {
  238. javaex.tip({content: "评论区点赞失败!", type: "error"});
  239. }
  240. if (BiliData.replyAction.code == 65006) {
  241. javaex.tip({content: "请勿重复点赞!", type: "error"});
  242. }
  243. }
  244. });
  245.  
  246. // 监听点击返回按钮事件
  247. $("#likeInDynamic_no").click(async function () {
  248.  
  249. if (javaexVerify()) {
  250.  
  251. HNAPI.likeInDynamicComments(+javaex.getLocalStorage("#likeInDynamic_OID"), +javaex.getLocalStorage("#likeInDynamic_PRID"), 0);
  252. await HNTOOL.Sleep(500);
  253.  
  254. if (BiliData.replyAction.code == 0) {
  255.  
  256. javaex.setLocalStorage("likeInDynamic_PRID", javaex.getSelectVal("#likeInDynamic_PRID"));
  257. javaex.setLocalStorage("likeInDynamic_OID", javaex.getSelectVal("#likeInDynamic_OID"));
  258.  
  259. javaex.tip({content: "评论区取消点赞成功!", type: "success"});
  260. } else {
  261. javaex.tip({content: "评论区取消点赞失败!", type: "error"});
  262. }
  263. if (BiliData.replyAction.code == 65006) {
  264. javaex.tip({content: "请勿重复取消点赞!", type: "error"});
  265. }
  266. }
  267. });
  268.  
  269. });
  270.  
  271. $("#biliUserMsg").bind("click", async function () {
  272.  
  273.  
  274. //刷新信息
  275. HNAPI.getUserNav();
  276. await HNTOOL.Sleep(500);
  277.  
  278. let isLogin = "未登录";
  279. let vipType = "无";
  280. //判断是否成功
  281. if (BiliData.login_code == 0) {
  282.  
  283.  
  284. if (BiliData.LoginData.isLogin) {
  285. isLogin = "已登录";
  286. }
  287.  
  288. if (BiliData.LoginData.vipType == 1) {
  289. vipType = "月度大会员";
  290. } else if (BiliData.LoginData.vipType == 2) {
  291. vipType = "年度大会员";
  292. }
  293.  
  294. let html = '';
  295. html += '<div class="javaex-panel-box" style="width: 250px;">';
  296. html += ' <ul>';
  297. html += ` <p style="color: #FFF;">用户信息</p>`;
  298. html += ` <li><a href="https://account.bilibili.com/account/home">当前用户:${BiliData.LoginData.uname}</a> </li> `;
  299. html += ` <li>用户状态:${isLogin} </li> `;
  300. html += ` <li>用户等级:${BiliData.LoginData.level_info.current_level}</li> `;
  301. html += ` <li>升级下一等级需:${BiliData.LoginData.level_info.next_exp - BiliData.LoginData.level_info.current_exp} 经验</li> `;
  302. html += ` <li>UID${BiliData.LoginData.mid} </li> `;
  303. html += ` <li><a href="https://account.bilibili.com/account/coin">硬币:${BiliData.LoginData.money}</a> </li> `;
  304. html += ` <li>节操值:${BiliData.LoginData.moral} </li> `;
  305. html += ` <li>会员:${vipType} </li> `;
  306. html += ' <hr class="javaex-divider"></hr>';
  307. html += ' </ul>';
  308. html += '</div>';
  309.  
  310.  
  311. javaex.panel(this, {
  312. position: "right",
  313. content: html
  314. });
  315.  
  316. javaex.tip({
  317. content: "获取用户成功!",
  318. type: "success"
  319. });
  320.  
  321. } else {
  322. javaex.tip({
  323. content: "获取用户信息失败!",
  324. type: "error"
  325. });
  326. }
  327.  
  328.  
  329. });
  330.  
  331. $("#getAtMsg").bind("click", async function () {
  332.  
  333. if (HNAPI.getMsgfeed("at") && typeof (HNAPI.getMsgfeed("at")) != "undefined") {
  334.  
  335. javaex.tip({
  336. content: "可能中奖了!!!",
  337. type: "success"
  338. });
  339. }
  340. });
  341.  
  342.  
  343. $("#disUser").bind("click", async function () {
  344.  
  345. let html = '';
  346. html += '<div class="javaex-panel-box" style="width: 500px;">';
  347. html += ' <div class="javaex-unit clear">';
  348. html += ' <div class="javaex-unit-left ml-10 mt-10">*拉黑列表</div>';
  349. html += ' <div class="javaex-unit-right mr-10 mt-10">';
  350. html += ' <textarea id="disUser_uidList" class="javaex-desc" placeholder="请填写用户UID,多个用英文逗号,隔开"></textarea>';
  351. html += ' </div>';
  352. html += ' </div>';
  353. html += ' <div class="javaex-unit clear tc">';
  354. html += ' <input type="button" id="disUser_beg" class="javaex-btn yes" value="开始" />';
  355. html += ' </div>';
  356. html += '</div>';
  357.  
  358. javaex.panel(this, {
  359. position: "right",
  360. content: html
  361. });
  362.  
  363. $("#disUser_beg").bind("click", async function () {
  364.  
  365. let disUser_str = javaex.getSelectVal("#disUser_uidList");
  366. let disUser_uidList = disUser_str.split(",");
  367.  
  368. for (const vmid of disUser_uidList) {
  369.  
  370. HNAPI.disUserByUid(vmid);
  371.  
  372. await HNTOOL.Sleep(1500);
  373.  
  374. }
  375.  
  376. });
  377.  
  378. });
  379.  
  380. //
  381. $("#getUpMassage").bind("click", async function () {
  382.  
  383.  
  384. let html = '';
  385.  
  386. html += '<div style="padding: 10px 10px 10px 0px;">'
  387. html += '<form id="getUpMassage_form">'
  388. html += ' <div class="javaex-unit clear">'
  389. html += ' <div class="javaex-unit-left mr-10"><p class="subtitle required">用户uid</p></div>'
  390. html += ' <div class="javaex-unit-left mr-10">'
  391. html += ' <input type="text" class="javaex-text javaex-grid-4" data-type="positive_int" error-msg="用户uid"'
  392. html += ` id="up_uid" value="4578433" placeholder="请输入评论uid"/>`
  393. html += ' </div>'
  394. html += ' <div class="javaex-unit-right mr-10">'
  395. html += ' <input type="button" id="getUpMsg" class="javaex-btn blue" value="查询"/>'
  396. html += ' </div>'
  397. html += ' </div>'
  398. html += ' <div class="javaex-unit clear tc" style="width: 500px;">'
  399. html += ' <table id="upMsgTable" class="javaex-table td-c-1">'
  400. html += ' <thead>'
  401. html += ' <tr><th>内容</th><th>详情</th></tr>'
  402. html += ' </thead>'
  403. html += ' <tbody id="upMsgTbody">'
  404.  
  405. html += ' </tbody>'
  406. html += '</table> '
  407. html += '</div>'
  408. html += '</form>';
  409. html += '<hr class="javaex-divider"></hr>';
  410. html += '</div>';
  411.  
  412.  
  413. javaex.panel(this, {
  414. position: "right",
  415. content: html
  416. });
  417.  
  418. javaex.table({
  419. id: "upMsgTable",
  420. isDragColWidth: true, // 是否允许拖动改变列宽
  421. mode: "overflow", // overflow表示允许使用父容器溢出来调整列的大小
  422. leftFixedColNum: 2, // 左侧固定列数
  423. rightFixedColNum: 1, // 右侧固定列数
  424. sort: {
  425. "1": "create_time", // 4表示第几列(从1开始计)。create_time表示排序字段,回调函数会返回该值
  426. "2": "update_time"
  427. },
  428. sortCallback: function (rtn) {
  429. //console.log(rtn.sortArr);
  430. }
  431. });
  432.  
  433. //
  434. $("#getUpMsg").click(async function () {
  435.  
  436. let temp = HNAPI.getUpCard(parseInt(javaex.getSelectVal("#up_uid")));
  437.  
  438.  
  439. await HNTOOL.Sleep(500);
  440.  
  441.  
  442. if (temp != false) {
  443. let data = BiliData.upCard.data;
  444.  
  445. let html = ``;
  446. html += `<tr><td>用户UID</td><td>${data.card.mid}</td></tr> `
  447. html += `<tr><td>用户等级</td><td>lv${data.card.level_info.current_level}</td></tr> `
  448. html += `<tr><td>用户昵称</td><td>${data.card.name}</td></tr> `
  449. html += `<tr><td>用户性别</td><td>${data.card.sex}</td></tr> `
  450. html += `<tr><td>用户头像</td><td><a href="javascript:;"><img src= ${data.card.face} width="50%"></a></td></tr> `
  451. html += `<tr><td>粉丝数</td><td>${data.follower}</td></tr> `
  452. html += `<tr><td>关注数</td><td>${data.card.friend}</td></tr> `
  453. html += `<tr><td>是否关注此用户</td><td>${data.following}</td></tr> `
  454. html += `<tr><td>用户稿件数</td><td>${data.archive_count}</td></tr> `
  455. html += `<tr><td>用户勋章</td><td>${data.card.nameplate.name}<a href="javascript:;"><img src= ${data.card.nameplate.image} width="50%"></a> </td></tr> `
  456. html += `<tr><td>用户勋章等级</td><td>${data.card.nameplate.level}</td></tr> `
  457. html += `<tr><td>认证信息</td><td>${data.card.Official.title}</td></tr> `
  458.  
  459.  
  460. $("#upMsgTbody").empty();
  461. $("#upMsgTbody").append(html);
  462. }
  463.  
  464.  
  465. });
  466. //点击放大
  467. /* $("img").click(function() {
  468. javaex.dialog({
  469. type : "image", // 弹出层类型
  470. url : $(this).attr("src") // 图片地址
  471. });
  472. });*/
  473.  
  474. });
  475.  
  476.  
  477. $("#addPlay").bind("click", async function () {
  478.  
  479.  
  480. let html = '';
  481.  
  482. html += '<div style="padding: 10px 10px 10px 0px;">'
  483. html += '<form id="getUpMassage_form">'
  484.  
  485. html += ' <div class="javaex-unit clear">'
  486. html += ' <div class="javaex-unit-left"><p class="subtitle required">UID</p></div>'
  487. html += ` <div class="javaex-unit-right" tooltip="请输入用户UID,默认自己" tooltip-pos="up"> `
  488. html += ' <input type="text" class="javaex-text" data-type="positive_int|required" error-msg="请正确输入uid"'
  489. html += ` id="addPlay_uid" value="${Live_info.uid}" placeholder="默认${Live_info.author_uid}"/>`
  490. html += ' </div>'
  491. html += ' </div>'
  492. html += ' <div class="javaex-unit clear">'
  493. html += ' <div class="javaex-unit-left"><p class="subtitle required">BV</p></div>'
  494. html += ' <div class="javaex-unit-right" tooltip="请输入视频BV号 例如BV14r4y1A7Q9 (0表示全部)" tooltip-pos="up">'
  495. html += ' <input type="text" class="javaex-text" data-type="required|english_number" error-msg=""'
  496. html += ` id="addPlay_bv" value="0" placeholder="请输入视频BV号 例如BV14r4y1A7Q9 (0表示全部)"/>`
  497. html += ' </div>'
  498. html += ' </div>'
  499. html += '</form>';
  500. html += ' <div class="javaex-unit clear tc">'
  501. html += ' <button id="addPlay_bgn" class="javaex-btn blue radius-3">开始</button> '
  502. html += ' </div>'
  503. html += '<hr class="javaex-divider"></hr>';
  504. html += '</div>';
  505.  
  506.  
  507. javaex.panel(this, {
  508. position: "right",
  509. content: html
  510. });
  511.  
  512. $("#addPlay_bgn").click(async function () {
  513.  
  514. let MID = javaex.getSelectVal("#addPlay_uid")
  515. let BV = javaex.getSelectVal("#addPlay_bv");
  516. let bvArr = [];
  517. let bvArr2 = [];
  518.  
  519. MID = javaex.ifnull(MID, Live_info.author_uid);
  520.  
  521.  
  522. if (BV == "0") {
  523.  
  524. //1.查询up所有视频BV号 2.发送心跳间隔2s
  525. HNAPI.getUpAllBV(Live_info.author_uid, 1, 2);
  526. await HNTOOL.Sleep(500);
  527. bvArr2 = BiliData.BVList;
  528.  
  529. for (let i = 1; i > 0; i++) {
  530.  
  531. HNAPI.getUpAllBV(MID, i);
  532.  
  533. await HNTOOL.Sleep(500);
  534.  
  535. if (BiliData.BVList.length == 0) {
  536. if (bvArr.length == 0) {
  537. javaex.tip({
  538. content: "该用户无投稿视频,请确认是否有误!",
  539. type: "success"
  540. });
  541. await HNTOOL.Sleep(2000);
  542. }
  543. //bvArr = bvArr.ifnull(bvArr2, bvArr.concat(bvArr2));
  544. bvArr = bvArr.concat(bvArr2);
  545. break;
  546. }
  547.  
  548. bvArr = bvArr.concat(BiliData.BVList);
  549. }
  550.  
  551.  
  552. if (bvArr.length != 0) {
  553.  
  554. for (const emt of bvArr) {
  555.  
  556. HNAPI.playOneVideo(emt.bvid,MID);
  557.  
  558. await HNTOOL.Sleep(2000);
  559.  
  560. }
  561.  
  562. alert("播放完成!!!");
  563.  
  564. }
  565.  
  566.  
  567. } else {
  568. //1.调用点击播放接口
  569. //2.发送心跳
  570.  
  571. await HNTOOL.Sleep(500);
  572.  
  573. HNAPI.playOneVideo(BV);
  574. }
  575.  
  576.  
  577. });
  578.  
  579.  
  580. });
  581.  
  582. }
  583.  
  584.  
  585. let showUnreadMsg = function () {
  586.  
  587. var html = '';
  588. html += '<div class="javaex-panel-box" style="width: 250px;">';
  589. html += ' <ul>';
  590. html += ` <p style="color: #FFF;">用户消息</p>`;
  591. html += ` <li><a href="https://message.bilibili.com/#/at">未读艾特数:${BiliData.Unread.at}</a> </li> `;
  592. html += ` <li><a href="https://message.bilibili.com/#/love">未读点赞数:${BiliData.Unread.like}</a> </li> `;
  593. html += ` <li><a href="https://message.bilibili.com/#/reply">未读回复数:${BiliData.Unread.reply}</a> </li> `;
  594. html += ` <li><a href="https://message.bilibili.com/#/system">未读系统通知数:${BiliData.Unread.sys_msg}</a> </li> `;
  595. html += ` <li><a href="">UP主助手信息数:${BiliData.Unread.up}</a> </li> `;
  596. html += ' <hr class="javaex-divider"></hr>';
  597. html += ' </ul>';
  598. html += '</div>';
  599.  
  600.  
  601. javaex.panel(document.getElementById("getUnread"), {
  602. position: "right",
  603. content: html
  604. });
  605.  
  606. javaex.tip({
  607. content: "查询用户通知成功!",
  608. type: "success"
  609. });
  610.  
  611. }
  612.  
  613. /**
  614. * 检查 艾特信息
  615. * @returns {Promise<void>}
  616. */
  617. let chackAtMsg = async function (items) {
  618.  
  619. await HNTOOL.Sleep(500);
  620.  
  621. if (items != false && typeof (items) != "undefined") {
  622.  
  623.  
  624. var html = '';
  625. html += '<div class="javaex-panel-box" style="width: auto;">';
  626. html += ' <ul>';
  627. html += ` <p style="color: #FFF;">@信息</p>`;
  628. items.forEach(function (item) {
  629.  
  630. var atTime = javaex.dateFormat(item.at_time, 'yyyy-MM-dd HH:mm:ss');
  631.  
  632. html += ` <li>${atTime} <a class="fontbold" href="https://space.bilibili.com/${item.user.mid}">:${item.user.nickname}</a>在动态中艾特了你!</li> `
  633. html += ` <li class="fontbold">内容:${item.item.source_content}</li> `;
  634. html += ` <li><a href="${item.item.uri}">---点击查看详情---</a> </li> `;
  635. html += ' <hr class="javaex-divider"></hr>';
  636. });
  637. html += ' </ul>';
  638. html += '</div>';
  639.  
  640. if (($("#chackList").attr("class")).indexOf("hover") > -1) {
  641. javaex.panel(document.getElementById("getAtMsg"), {
  642. position: "right",
  643. content: html
  644. });
  645. } else {
  646. javaex.panel(document.getElementById("chackList"), {
  647. position: "right",
  648. content: html
  649. });
  650. }
  651.  
  652.  
  653. }
  654.  
  655. }
  656.  
  657.  
  658. let addSetPage = async function () {
  659.  
  660. HNTOOL.Sleep(1000);
  661.  
  662. $('body').append('' +
  663. '<div id="left_navbar">' +
  664. '<div class="javaex-menu-container"> ' +
  665. ' <div id="menu" class="javaex-menu"> ' +
  666. ' <ul> ' +
  667. ' <li class="javaex-menu-item alone hover" > ' +
  668. ' <a href="javaScript:;" style="background: #fb7299;padding-left: 0px;text-align: center;color: #ffffff;font-weight: bold;border-bottom: 1px solid #eee;" ' +
  669. ` tooltip="我是来测试的" tooltip-pos="right">管理中心 v${GM_info.script.version}</a> ` +
  670. ' </li> ' +
  671. ' </ul> ' +
  672. ' <ul> ' +
  673. ' <li class="javaex-menu-item"> ' +
  674. ' <a href="javascript:;">个人中心<i class="icon-angle-down"></i></a> ' +
  675. ' <ul> ' +
  676. ' <li id="biliUserMsg" class="javaex-hover-pulse"><a href="javaScript:;">用户信息</a></li> ' +
  677. ' </ul> ' +
  678. ' </li> ' +
  679. ' <li id="chackList" class="javaex-menu-item"> ' +
  680. ' <a href="javaScript:;">查询<i class="icon-angle-down"></i></a> ' +
  681. ' <ul> ' +
  682. ' <li id="getUpMassage" ><a href="javaScript:;">查询用户详细信息</a></li> ' +
  683. ' <li><a href="javaScript:;">查询每日最热视频【禁用】</a></li> ' +
  684. ' <li id="getAtMsg"><a href="javaScript:;">查询动态艾特信息</a></li> ' +
  685. ' <li id="getCoinLog" class="javaex-hover-pulse"><a href="javaScript:;">查询硬币变化</a></li> ' +
  686. ' <li id="getUnread" class="javaex-hover-pulse"><a href="javaScript:;">查询消息</a></li> ' +
  687. ' </ul> ' +
  688. ' </li> ' +
  689. ' <li class="javaex-menu-item"> ' +
  690. ' <a href="javascript:;">工具<i class="icon-angle-down"></i></a> ' +
  691. ' <ul> ' +
  692. ' <li class="javaex-hover-pulse"><a href="javaScript:;" >移动粉丝勋章【禁用】</a></li> ' +
  693. ' <li id="addPlay" class="javaex-hover-pulse"><a href="javaScript:;" >一键批量播放视频</a></li> ' +
  694. ' <li id="disUser" class="javaex-hover-pulse"><a href="javaScript:;" >一键批量拉黑</a></li> ' +
  695. ' <li id="" class="javaex-hover-pulse" ><a href="javaScript:;">动态评论区点赞【禁用】</a></li> ' +//likeInDynamicComments
  696. ' <li id="HNSetup" class="javaex-hover-pulse" ><span class="icon-cogs" style="font-size:50px;color:#ff0000;"></span><a href="javaScript:;">设置【禁用】</a></li> ' +
  697. ' </ul> ' +
  698. ' </li> ' +
  699.  
  700.  
  701. ' </ul> ' +
  702. ' </div> ' +
  703. '</div>' +
  704. '</div>');
  705. //$("#left_navbar").before('<button hnBtn="btn_open" class="javaex-btn green" onclick="openBar()">点我关闭</button>')
  706.  
  707. javaex.menu({
  708. id: "menu",
  709. isShowAll: false
  710. });
  711.  
  712. }
  713.  
  714.  
  715. let addStyle = function () {
  716. const animate = GM_getResourceText('animate');
  717. const common = GM_getResourceText('common');
  718. const defaultCss = GM_getResourceText('defaultCss');
  719. //const icomoonex = GM_getResourceText('icomoonex');
  720. //const AllCss = animate + common + defaultCss + icomoonex;
  721. const AllCss = animate + common + defaultCss;
  722. const style = document.createElement('style');
  723. style.innerHTML = AllCss;
  724. return document.getElementsByTagName('head')[0].appendChild(style);
  725. }
  726.  
  727. /*-----------------------------------------------点击事件绑定--------------------------------------------------*/
  728.  
  729.  
  730. /*-----------------------------------------------常用API--------------------------------------------------*/
  731.  
  732. let HNAPI = {
  733.  
  734.  
  735. /**
  736. * //https://api.bilibili.com/x/relation/modify
  737. *
  738. * @param UID
  739. */
  740. disUserByUid:function (vmid) {
  741.  
  742. Ajax.post({
  743. url: BILIBLI_PATH.api + '/x/relation/modify',
  744. data: {
  745. fid: parseInt(vmid),
  746. re_src: 11,
  747. act: 5,
  748. jsonp: "jsonp",
  749. csrf: Live_info.csrf_token,
  750. },
  751. hasCookies: true,
  752. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  753. success: responseText => {
  754.  
  755. var json = JSON.parse(responseText);
  756.  
  757. if (json.code != 0) {
  758.  
  759. console.log("拉黑用户失败uid:" + vmid + " 错误信息"+ json.message);
  760. javaex.tip({
  761. content: "拉黑用户失败uid:" + vmid + " 错误信息"+ json.message,
  762. type: "error"
  763. });
  764.  
  765. }else{
  766. console.log("拉黑用户成功 uid:" + vmid);
  767. javaex.tip({
  768. content: "拉黑用户成功 uid:" + vmid,
  769. type: "success"
  770. });
  771. }
  772. }
  773. });
  774.  
  775. },
  776. /**
  777. * http://api.bilibili.com/x/web-interface/view
  778. * @param BV
  779. * 心跳间隔15秒
  780. */
  781. playOneVideo: function (BV,MID) {
  782.  
  783. //1.调用点击播放接口 https://api.bilibili.com/x/click-interface/click/web/h5
  784. Ajax.post({
  785. url: BILIBLI_PATH.api + "/x/click-interface/click/web/h5",
  786. hasCookies: true,
  787. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  788. data: {
  789.  
  790. "bvid": BV,
  791. "part": 1,
  792. "mid": Live_info.uid,
  793. "lv": 2,
  794. "jsonp": "jsonp",
  795. "type": 3,
  796. "sub_type": 0
  797. },
  798. success: responseText => {
  799.  
  800. let json = JSON.parse(responseText);
  801.  
  802. if (/^{"code":0/.test(responseText)) {
  803. //发送一次心跳
  804. HNAPI.sendHeartbeat(BV,MID);
  805.  
  806. } else {
  807. javaex.tip({
  808. content: "视频" + data.bvid + "播放失败!" + json.message,
  809. type: "error"
  810. });
  811. }
  812. }
  813. })
  814.  
  815.  
  816. },
  817.  
  818. //上报视频播放心跳(web端)
  819. /**
  820. * http://api.bilibili.com/x/click-interface/web/heartbeat
  821. * @param json
  822. */
  823. sendHeartbeat: function (bvid,MID) {
  824.  
  825. Ajax.post({
  826. url: BILIBLI_PATH.api + "/x/click-interface/web/heartbeat",
  827. hasCookies: true,
  828. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  829. //aid=756988764&bvid=BV1wr4y1P782&cid=304166326&page=1
  830. data: {
  831. "bvid": bvid,
  832. "type": 3,
  833. "dt": 2,
  834. "played_time": HNTOOL.random(12, 40),
  835. "realtime": HNTOOL.random(12, 40),
  836. "play_type": 0
  837. },
  838. success: responseText => {
  839.  
  840. if (/^{"code":0/.test(responseText) && MID != Live_info.author_uid) {
  841.  
  842. javaex.tip({
  843. content: "视频BV" + bvid + "播放一次!",
  844. type: "success"
  845. });
  846. }
  847. }
  848. })
  849.  
  850. },
  851.  
  852. //获取up所有投稿视频
  853. /**
  854. * https://api.bilibili.com/x/space/arc/search?mid=99439379&ps=30&tid=0&pn=1&keyword=&order=pubdate&jsonp=jsonp
  855. * @param mid
  856. */
  857. getUpAllBV: function (mid, pn, ps) {
  858. ps = (ps === undefined ? 30 : ps); // a默认值为1
  859. Ajax.get({
  860. url: BILIBLI_PATH.api + '/x/space/arc/search',
  861. queryStringsObj: {
  862. mid: mid,
  863. tid: 0,
  864. order: 'pubdate',
  865. jsonp: 'jsonp',
  866. pn: pn,
  867. ps: ps
  868. },
  869. hasCookies: true,
  870. success: responseText => {
  871.  
  872. var json = JSON.parse(responseText);
  873.  
  874. if (json.code != 0) {
  875.  
  876. javaex.tip({
  877. content: "获取up所有投稿视频失败!" + json.message,
  878. type: "success"
  879. });
  880.  
  881. } else {
  882. BiliData.BVList = json.data.list.vlist;
  883.  
  884. }
  885. }
  886. });
  887.  
  888. },
  889.  
  890.  
  891. /**
  892. *
  893. * @param path
  894. * @param data
  895. * @param saveObj
  896. * @param Func
  897. */
  898. publicGet: function (path, queryStringsObj) {
  899.  
  900. if (typeof (queryStringsObj) != "undefined") {
  901. queryStringsObj = {};
  902. }
  903. Ajax.get({
  904. url: BILIBLI_PATH.api + path,
  905. queryStringsObj: queryStringsObj,
  906. hasCookies: true,
  907. success: responseText => {
  908.  
  909. let json = JSON.parse(responseText);
  910. if (chackCode(json.code) && json.code == 0) {
  911.  
  912. return json.data;
  913. }
  914.  
  915. return false;
  916.  
  917. }
  918. })
  919.  
  920. },
  921.  
  922. /**
  923. * 导航栏用户信息
  924. */
  925. getUserNav: async function () {
  926.  
  927. GM_xmlhttpRequest({
  928. method: "GET",
  929. url: BILIBLI_PATH.api + "/x/web-interface/nav",
  930. //timeout:3000,
  931. onload: function (response) {
  932.  
  933. let json = JSON.parse(response.response);
  934. console.log(json);
  935. BiliData.login_code = json.code;
  936. BiliData.login_message = json.message;
  937. BiliData.LoginData = json.data;
  938.  
  939. }
  940. });
  941.  
  942. },
  943.  
  944. /**
  945. * 获取某up详细信息
  946. * http://api.bilibili.com/x/web-interface/card
  947. */
  948. getUpCard: function (mid) {
  949.  
  950. Ajax.get({
  951. url: BILIBLI_PATH.api + '/x/web-interface/card',
  952. queryStringsObj: {
  953. mid: mid,
  954. photo: false
  955. },
  956. hasCookies: true,
  957. success: responseText => {
  958.  
  959. var json = JSON.parse(responseText);
  960.  
  961. if (json.code != 0) {
  962.  
  963. javaex.tip({
  964. content: "查询失败!" + json.message,
  965. type: "success"
  966. });
  967. return false;
  968. } else {
  969. BiliData.upCard = json;
  970.  
  971. }
  972.  
  973.  
  974. }
  975. })
  976.  
  977. },
  978.  
  979. /**
  980. *
  981. * @param uid 用户uid
  982. * @param ps 每页视频个数 默认30个
  983. * @param pn 第几页
  984. */
  985. getUpAllVideo: function (uid, ps, pn) {
  986.  
  987. },
  988. getChallenge: async function () {
  989.  
  990.  
  991. },
  992. /**
  993. * 硬币记录
  994. * @returns {Promise<void>}
  995. */
  996. getCoinLog: async function () {
  997.  
  998. GM_xmlhttpRequest({
  999. method: "GET",
  1000. url: BILIBLI_PATH.api + "/x/member/web/coin/log",
  1001. //url: "http://api.bilibili.com/x/member/web/coin/log",
  1002. onload: function (response) {
  1003.  
  1004. let json = JSON.parse(response.response);
  1005. if (json.code == 0) {
  1006.  
  1007. console.log("硬币记录" + json);
  1008. BiliData.CoinLog = json.data;
  1009.  
  1010. return true;
  1011. }
  1012.  
  1013. }
  1014. });
  1015. },
  1016. /**
  1017. * 未读消息数 http://api.bilibili.com/x/msgfeed/unread
  1018. * @returns {Promise<void>}
  1019. */
  1020. getUnread: async function () {
  1021.  
  1022. Ajax.get({
  1023. url: BILIBLI_PATH.api + "/x/msgfeed/unread",
  1024. hasCookies: true,
  1025. success: responseText => {
  1026.  
  1027. let json = JSON.parse(responseText);
  1028. if (chackCode(json.code) && json.code == 0) {
  1029.  
  1030. BiliData.Unread = json.data;
  1031. showUnreadMsg();
  1032. }
  1033.  
  1034. return false;
  1035.  
  1036. }
  1037. })
  1038.  
  1039. /* GM_xmlhttpRequest({
  1040. method: "GET",
  1041. url: BILIBLI_PATH.api + "/x/msgfeed/unread",
  1042. onload: function (response) {
  1043.  
  1044. let json = JSON.parse(response.response);
  1045.  
  1046. if (chackCode(json.code) && json.code == 0) {
  1047.  
  1048. BiliData.Unread = json.code;
  1049. showUnreadMsg();
  1050.  
  1051. }
  1052.  
  1053. }
  1054. });*/
  1055. },
  1056. /**
  1057. *
  1058. * @param type reply:回复我的 at @我的
  1059. */
  1060. getMsgfeed: function (type) {
  1061. Ajax.get({
  1062. url: BILIBLI_PATH.api + '/x/msgfeed/' + type,
  1063. queryStringsObj: {
  1064. build: 0,
  1065. mobi_app: 'web'
  1066. },
  1067. hasCookies: true,
  1068. success: responseText => {
  1069.  
  1070. var json = JSON.parse(responseText);
  1071.  
  1072. if (json.code != 0 || !json.data.cursor.is_end || json.data.items == null) {
  1073. return false;
  1074. } else {
  1075. chackAtMsg(json.data.items);
  1076.  
  1077. return true;
  1078. }
  1079.  
  1080.  
  1081. }
  1082. })
  1083.  
  1084. },
  1085.  
  1086. /** 未读消息数 http://api.bilibili.com/x/space/arc/search?mid=99439379&pn=1&ps=5
  1087. * @returns {Promise<void>}
  1088. */
  1089. getUnrewad: async function () {
  1090.  
  1091. GM_xmlhttpRequest({
  1092. method: "GET",
  1093. data: {
  1094. "mid": 99439379,
  1095. "pn": 1,
  1096. "ps": 5,
  1097. },
  1098. url: BILIBLI_PATH.api + "/x/space/arc/search",
  1099. onload: function (response) {
  1100.  
  1101. let json = JSON.parse(response.response);
  1102. if (json.code == 0) {
  1103.  
  1104. BiliData.Video = json.data;
  1105. console.log("未读消息数" + json);
  1106. }
  1107.  
  1108. }
  1109. });
  1110. },
  1111.  
  1112. /** 动态评论区点赞 https://api.bilibili.com/x/v2/reply/action
  1113. * @param {number} oid
  1114. * @param {nbumber} rpid
  1115. * @param {number} action
  1116. * @returns {Promise<void>}
  1117. * type: 11
  1118. * ordering: heat
  1119. * jsonp: jsonp
  1120. * csrf: 54a******* CSRF Token(位于cookie)
  1121. */
  1122.  
  1123. likeInDynamicComments: async function (oid, rpid, action) {
  1124.  
  1125.  
  1126. Ajax.post({
  1127. url: BILIBLI_PATH.api + "/x/v2/reply/action",
  1128. hasCookies: true,
  1129. dataType: 'application/x-www-form-urlencoded; charset=UTF-8',
  1130. data: {
  1131. "oid": oid,
  1132. "type": 11,
  1133. "rpid": rpid,
  1134. "action": action,
  1135. "ordering": "heat",
  1136. "jsonp": "jsonp",
  1137. "csrf": Live_info.csrf_token,
  1138. },
  1139. success: responseText => {
  1140.  
  1141. if (/^{"code":0/.test(responseText)) {
  1142.  
  1143. BiliData.replyAction = JSON.parse(responseText);
  1144. console.log("点赞成功!" + responseText);
  1145. }
  1146. }
  1147. })
  1148.  
  1149. },
  1150.  
  1151.  
  1152. }
  1153.  
  1154. /*-----------------------------------------------常用工具函数--------------------------------------------------*/
  1155.  
  1156.  
  1157. let HNTOOL = {
  1158.  
  1159. /**
  1160. * 获取cookie 中某个键对应的值
  1161. * @param name
  1162. */
  1163.  
  1164. getCookie: function (name) {
  1165. let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
  1166. if (arr != null) return unescape(arr[2]);
  1167. return false;
  1168. },
  1169. /**
  1170. * 得到一个字符串数组的中随机一个
  1171. * @param {List} list
  1172. */
  1173. getRandomWordOfList: function (list) {
  1174. var L = list.length;
  1175. var i = Math.ceil(Math.random() * L);
  1176.  
  1177. return list[i];
  1178. },
  1179. random: function (min, max) {
  1180.  
  1181. return Math.floor(Math.random() * (max - min)) + min;
  1182. },
  1183.  
  1184. Sleep: function (ms) {
  1185. return new Promise(resolve => setTimeout(() => resolve('sleep'), ms));
  1186. }
  1187.  
  1188. }
  1189.  
  1190. let errorMsg = {
  1191. "-1": "应用程序不存在或已被封禁!",
  1192. "-2": "Access Key错误!",
  1193. "-3": "API校验密匙错误!",
  1194. "-4": "调用方对该Method没有权限!",
  1195. "-101": "账号未登录!",
  1196. "-102": "账号被封停!",
  1197. "-103": "积分不足!",
  1198. "-104": "硬币不足!",
  1199. "-105": "验证码错误!",
  1200. "-106": "账号非正式会员或在适应期!",
  1201. "-107": "应用不存在或者被封禁!",
  1202. "-108": "未绑定手机!",
  1203. "-109": "未知!",
  1204. "-110": "未绑定手机!",
  1205. "-111": "csrf 校验失败!",
  1206. "-112": "系统升级中!",
  1207. "-113": "账号尚未实名认证!",
  1208. "-114": "请先绑定手机!",
  1209. "-115": "请先完成实名认证!",
  1210. "-304": "木有改动!",
  1211. "-307": "撞车跳转!",
  1212. "-400": "请求错误!",
  1213. "-401": "未认证!",
  1214. "-403": "访问权限不足!",
  1215. "-404": "啥都木有!",
  1216. }
  1217.  
  1218. /*-----------------------------------------------CODE 统一检查--------------------------------------------------*/
  1219. /**
  1220. *
  1221. * @param code
  1222. * @constructor
  1223. */
  1224. let chackCode = function (code) {
  1225.  
  1226. let emsg = errorMsg[code + ""];
  1227. if (emsg != null) {
  1228. javaex.tip({content: emsg, type: "error"});
  1229.  
  1230. return false;
  1231. }
  1232.  
  1233. return true;
  1234. }
  1235.  
  1236.  
  1237. /*-----------------------------------------------localStorage封装 (本地存储信息)--------------------------------------------------*/
  1238. //javaex.setLocalStorage(key, value); var str = javaex.getLocalStorage(key); javaex.deleteLocalStorage(key);
  1239.  
  1240. /*window.onbeforeunload = function() {
  1241. if (!canLeavePage()) {
  1242. return ('确认离开当前页面吗?未保存的数据将会丢失!');
  1243. }
  1244. };*/
  1245.  
  1246.  
  1247. /**
  1248. * Ajax请求对象
  1249. */
  1250. const Ajax = (() => {
  1251. /**
  1252. * 检查options是否符合要求
  1253. * @param {object} options
  1254. * @returns {boolean}
  1255. */
  1256. function checkOptions(options) {
  1257. let result = false;
  1258. if (typeof options !== 'object') {
  1259. console.warn('类型错误: typeof Options !== Object');
  1260. return result;
  1261. } else {
  1262. if (typeof options.url !== 'string') {
  1263. console.warn('类型错误: typeof Link !== Strings');
  1264. return result;
  1265. } else {
  1266. const reg = /^https?:\/\/(?:\w+\.?)+(?:\/.*)*\/?$/i;
  1267. if (!reg.test(options.url)) {
  1268. console.warn('url字符串须为完整http链接');
  1269. return result;
  1270. }
  1271. result = true;
  1272. }
  1273. }
  1274. return result;
  1275. }
  1276.  
  1277. /**
  1278. * 对象转URL编码
  1279. * @param {object} data
  1280. */
  1281. function objToURLCode(data) {
  1282. var _result = [];
  1283. for (var key in data) {
  1284. var value = data[key];
  1285. if (value instanceof Array) {
  1286. value.forEach(function (_value) {
  1287. _result.push(key + "=" + _value);
  1288. });
  1289. } else {
  1290. _result.push(key + '=' + value);
  1291. }
  1292. }
  1293. return _result.join('&');
  1294. }
  1295.  
  1296. /**
  1297. * 请求
  1298. * @param {string} method
  1299. * @param {object} options
  1300. */
  1301. function request(method, options) {
  1302. if (checkOptions(options)) {
  1303. let xhr = new XMLHttpRequest();
  1304. const {url: _url, queryStringsObj, data, dataType, hasCookies} = options
  1305. , url = typeof queryStringsObj === 'object' ?
  1306. _url + '?' + objToURLCode(queryStringsObj) : _url;
  1307. switch (method) {
  1308. case 'GET':
  1309. xhr.open("GET", url);
  1310. break;
  1311. case 'POST':
  1312. xhr.open("POST", url);
  1313. xhr.setRequestHeader('Content-Type', dataType);
  1314. break;
  1315. default:
  1316. break;
  1317. }
  1318. if (hasCookies) xhr.withCredentials = true;
  1319. xhr.timeout = 3000;
  1320. xhr.addEventListener('load', () => {
  1321. if (xhr.status === 200) {
  1322. options.success(xhr.responseText)
  1323. } else {
  1324. console.error(`status:${xhr.status}`);
  1325. options.success(`{"code":${xhr.status},"msg":"频繁访问"}`);
  1326. }
  1327. })
  1328. xhr.addEventListener('error', () => {
  1329. console.error('ajax请求出错')
  1330. options.success('{"code":-1,"msg":"ajax请求出错"}');
  1331. })
  1332. xhr.addEventListener('timeout', () => {
  1333. console.error('请求超时')
  1334. options.success('{"code":-1,"msg":"请求超时"}');
  1335. })
  1336. switch (method) {
  1337. case 'GET':
  1338. xhr.send()
  1339. break;
  1340. case 'POST':
  1341. xhr.send((/urlencoded/.test(dataType)) ? objToURLCode(data) : data)
  1342. break;
  1343. default:
  1344. break;
  1345. }
  1346. }
  1347. }
  1348.  
  1349. return {
  1350. /**
  1351. * 发送Get请求
  1352. * @param {Object} options
  1353. */
  1354. get(options) {
  1355. request("GET", options);
  1356. },
  1357. /**
  1358. * 发送Post请求
  1359. * @param {object} options
  1360. */
  1361. post(options) {
  1362. request("POST", options);
  1363. }
  1364. }
  1365. })()