网购省钱助手,自动显示京东、淘宝、聚划算、天猫隐藏优惠券。

【🧡网购省钱助手~ 自动显示京东(jd.com)、淘宝(taobao.com)、天猫(tmall.com)、聚划算、天猫超市、天猫国际(tmall.hk)、京东国际(jd.hk)、京东图书、京东大药房(yiyaojd.com)隐藏优惠券,让您开心购物🧡】。

  1. // ==UserScript==
  2. // @name 网购省钱助手,自动显示京东、淘宝、聚划算、天猫隐藏优惠券。
  3. // @name:zh-TW 網購省錢助手,自動顯示京東、淘寶、聚劃算、天貓隱藏優惠券。
  4. // @namespace wangpanzhilianxiazai
  5. // @version 1.1.5
  6. // @description 【🧡网购省钱助手~ 自动显示京东(jd.com)、淘宝(taobao.com)、天猫(tmall.com)、聚划算、天猫超市、天猫国际(tmall.hk)、京东国际(jd.hk)、京东图书、京东大药房(yiyaojd.com)隐藏优惠券,让您开心购物🧡】。
  7. // @description:zh-TW 【🧡網購省錢助手~ 自動顯示京東(jd.com)、淘寶(taobao.com)、天貓(tmall.com)、聚劃算、天貓超市、天貓國際(tmall.hk)、京東國際(jd.hk)、京東圖書、京東大藥房(yiyaojd.com)隱藏優惠券,讓您開心購物🧡】。
  8. // @author GreasyFork
  9. // @match *://*.taobao.com/*
  10. // @match *://*.tmall.com/*
  11. // @match *://chaoshi.detail.tmall.com/*
  12. // @match *://*.tmall.hk/*
  13. // @match *://*.liangxinyao.com/*
  14. // @match *://*.jd.com/*
  15. // @match *://*.jd.hk/*
  16. // @match *://*.jkcsjd.com/*
  17. // @match *://*.yiyaojd.com/*
  18. // @match *://*.vip.com/*
  19. // @match *://*.vipglobal.hk/*
  20. // @exclude *://login.taobao.com/*
  21. // @exclude *://login.tmall.com/*
  22. // @exclude *://uland.taobao.com/*
  23. // @exclude *://pages.tmall.com/*
  24. // @exclude *://wq.jd.com/*
  25. // @require https://lib.baomitu.com/jquery/1.8.3/jquery.min.js
  26. // @require https://lib.baomitu.com/jquery.qrcode/1.0/jquery.qrcode.min.js
  27. // @antifeature referral-link 【应GreasyFork代码规范要求:含有优惠券查询功能的脚本必须添加此提示!在此感谢大家的理解...】
  28. // @grant unsafeWindow
  29. // @license AGPL
  30. // ==/UserScript==
  31. (function() {
  32. 'use strict';
  33. var index_num = 0;
  34. var $ = $ || window.$;
  35. var item = [];
  36. var urls = [];
  37. var selectorList = [];
  38. var obj = {};
  39. var html = '';
  40. obj.onclicks = function(link) {
  41. if (document.getElementById('redirect_form')) {
  42. var form = document.getElementById('redirect_form');
  43. form.action = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(link);
  44. } else {
  45. var form = document.createElement('form');
  46. form.action = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(link);
  47. form.target = '_blank';
  48.  
  49. form.method = 'POST';
  50. form.setAttribute("id", 'redirect_form');
  51. document.body.appendChild(form);
  52.  
  53. }
  54. form.submit();
  55. form.action = "";
  56. form.parentNode.removeChild(form);
  57. };
  58. obj.GetQueryString = function(name) {
  59. var reg = eval("/" + name + "/g");
  60. var r = window.location.search.substr(1);
  61. var flag = reg.test(r);
  62. if (flag) {
  63. return true;
  64. } else {
  65. return false;
  66. }
  67. };
  68. obj.getUrlParam=function(name) {
  69. var query = window.location.search.substring(1);
  70. var vars = query.split("&");
  71. for (var i=0;i<vars.length;i++) {
  72. var pair = vars[i].split("=");
  73. if(pair[0] == name){return pair[1];}
  74. }
  75. return(false);
  76. }
  77. obj.get_url = function() {
  78. item[index_num] = [];
  79. urls[index_num] = [];
  80. $("#J_goodsList li").each(function(index) {
  81. if ($(this).attr('data-type') != 'yes') {
  82. var skuid = $(this).attr('data-sku');
  83. var itemurl = '//item.jd.com/' + skuid + '.html';
  84. if (skuid != undefined) {
  85. if (urls[index_num].length < 4) {
  86. item[index_num].push($(this));
  87. urls[index_num].push(itemurl);
  88. $(this).attr('data-type', 'yes');
  89. }
  90.  
  91.  
  92. }
  93. }
  94.  
  95. })
  96.  
  97. $("#plist li").each(function(index) {
  98. if ($(this).attr('data-type') != 'yes') {
  99. var skuid = $(this).find('.j-sku-item').attr('data-sku');
  100. var itemurl = '//item.jd.com/' + skuid + '.html';
  101. if (skuid != undefined) {
  102. if (urls[index_num].length < 4) {
  103. item[index_num].push($(this));
  104. urls[index_num].push(itemurl);
  105. $(this).attr('data-type', 'yes');
  106. }
  107.  
  108.  
  109. }
  110. }
  111.  
  112. })
  113.  
  114. $(".m-aside .aside-bar li").each(function(index) {
  115. if ($(this).attr('data-type') != 'yes') {
  116. var itemurl = $(this).find("a").attr('href');
  117. if (itemurl != '') {
  118. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  119. var sku_c = $(this).attr('sku_c');
  120. if (sku_c == undefined) {
  121. var arr = [];
  122. var str = $(this).attr('onclick');
  123. arr = str.split(",");
  124. sku_c = trim(arr[6].replace(/\"/g, ""));
  125. itemurl = '//item.jd.com/' + sku_c + '.html';
  126. }
  127.  
  128. }
  129. if (urls[index_num].length < 4) {
  130. item[index_num].push($(this));
  131. urls[index_num].push(itemurl);
  132. $(this).attr('data-type', 'yes');
  133. }
  134.  
  135.  
  136.  
  137. }
  138. }
  139.  
  140. })
  141. $(".goods-chosen-list li").each(function(index) {
  142. if ($(this).attr('data-type') != 'yes') {
  143. var itemurl = $(this).find("a").attr('href');
  144. if (itemurl != '') {
  145. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  146. var arr = [];
  147. var str = $(this).attr('onclick');
  148. arr = str.split(",");
  149. var sku_c = trim(arr[6].replace(/\"/g, ""));
  150. itemurl = '//item.jd.com/' + sku_c + '.html';
  151.  
  152. }
  153. if (urls[index_num].length < 4) {
  154. item[index_num].push($(this));
  155. urls[index_num].push(itemurl);
  156. $(this).attr('data-type', 'yes');
  157. }
  158.  
  159. }
  160.  
  161.  
  162.  
  163.  
  164. }
  165.  
  166. })
  167.  
  168. $(".may-like-list li").each(function(index) {
  169. if ($(this).attr('data-type') != 'yes') {
  170. var itemurl = $(this).find("a").attr('href');
  171. if (itemurl != '') {
  172. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  173. var arr = [];
  174. var str = $(this).attr('onclick');
  175. arr = str.split(",");
  176. var sku_c = trim(arr[6].replace(/\"/g, ""));
  177. itemurl = '//item.jd.com/' + sku_c + '.html';
  178. }
  179. if (urls[index_num].length < 4) {
  180. item[index_num].push($(this));
  181. urls[index_num].push(itemurl);
  182. $(this).attr('data-type', 'yes');
  183. }
  184.  
  185.  
  186. }
  187. }
  188.  
  189. })
  190.  
  191.  
  192.  
  193. if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) {
  194.  
  195.  
  196. var u = urls[index_num].join(',');
  197. $.getJSON('https://s.idey.cn/jd.php', {
  198. act: 'itemlink',
  199. itemurl: u,
  200. num: index_num
  201. }, function(res) {
  202. if (res.type == 'success') {
  203. for (var i = 0; i < res.data.length; i++) {
  204. item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl);
  205. item[res.num][i].find("a").attr('target', '');
  206. item[res.num][i].find("a").unbind("click");
  207. item[res.num][i].find("a").bind("click", function(e) {
  208. if ($(this).attr('data-ref')) {
  209. e.preventDefault();
  210. obj.onclicks($(this).attr('data-ref'));
  211.  
  212. }
  213. })
  214.  
  215. }
  216.  
  217. }
  218. })
  219.  
  220.  
  221. }
  222. index_num += 1;
  223.  
  224. };
  225. obj.get_miaosha = function() {
  226. item[index_num] = [];
  227. urls[index_num] = [];
  228. $(".seckill_mod_goodslist li").each(function(index) {
  229.  
  230. if ($(this).attr('data-type') != 'yes') {
  231.  
  232. var itemurl = $(this).find("a").attr('href');
  233. var skuid = $(this).attr('data-sku');
  234. var that = $(this);
  235. if (itemurl != '') {
  236. if (urls[index_num].length < 4) {
  237.  
  238. item[index_num].push($(this));
  239. urls[index_num].push(itemurl);
  240. $(this).attr('data-type', 'yes');
  241. }
  242.  
  243.  
  244. }
  245. }
  246.  
  247. })
  248.  
  249.  
  250.  
  251. if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) {
  252.  
  253.  
  254. var u = urls[index_num].join(',');
  255. $.getJSON('https://s.idey.cn/jd.php', {
  256. act: 'itemlink',
  257. itemurl: u,
  258. num: index_num
  259. }, function(res) {
  260. if (res.type == 'success') {
  261. for (var i = 0; i < res.data.length; i++) {
  262. item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl);
  263. item[res.num][i].find("a").attr('href', "javascript:void(0);");
  264. item[res.num][i].find("a").attr('target', '');
  265. // item[res.num][i].find("a").unbind("click");
  266.  
  267. item[res.num][i].find("a").click(function(e) {
  268. e.preventDefault();
  269. obj.onclicks($(this).attr('data-ref'));
  270. })
  271.  
  272. }
  273.  
  274. }
  275. })
  276.  
  277.  
  278. }
  279. index_num += 1;
  280. };
  281. var domhtml = $(`<div class='downbox'>
  282. <div class='item_text'>
  283. <div class="box"><a id="down">文库下载</a></div></div></div>`);
  284. const style =
  285. `
  286. .gwd_taobao .gwd-minibar-bg, .gwd_tmall .gwd-minibar-bg {
  287. display: block;
  288. }
  289.  
  290. .idey-minibar_bg{
  291. position: relative;
  292. min-height: 40px;
  293. display: inline-block;
  294. }
  295. #idey_minibar{
  296. width: 525px;
  297. background-color: #fff;
  298. position: relative;
  299. border: 1px solid #e8e8e8;
  300. display: block;
  301. line-height: 36px;
  302. font-family: 'Microsoft YaHei',Arial,SimSun!important;
  303. height: 36px;
  304. float: left;
  305. }
  306. #idey_minibar .idey_website {
  307. width: 48px;
  308. float: left;
  309. height: 36px;
  310. }
  311. #idey_minibar .minibar-tab {
  312. float: left;
  313. height: 36px;
  314. border-left: 1px solid #edf1f2!important;
  315. padding: 0;
  316. margin: 0;
  317. text-align: center;
  318. }
  319.  
  320. #idey_minibar .idey_website em {
  321. background-position: -10px -28px;
  322. height: 36px;
  323. width: 25px;
  324. float: left;
  325. margin-left: 12px;
  326. }
  327.  
  328. .setting-bg {
  329. background: url(https://cdn.gwdang.com/images/extensions/xbt/new_wishlist_pg5_2.png) no-repeat;
  330. }
  331.  
  332. #idey_minibar .minibar-tab {
  333. float: left;
  334. height: 36px;
  335. border-left: 1px solid #edf1f2!important;
  336. padding: 0;
  337. margin: 0;
  338. width: 134px;
  339. }
  340. #idey_price_history span {
  341. float: left;
  342. width: 100%;
  343. text-align: center;
  344. line-height: 36px;
  345. color: #666;
  346. font-size: 14px;
  347. }
  348.  
  349. #mini_price_history .trend-error-info-mini {
  350. position: absolute;
  351. top: 37px;
  352. left: 0px;
  353. width: 100%;
  354. background: #fff;
  355. z-index: 99999999;
  356. height: 268px;
  357. box-shadow: 0px 5px 15px 0 rgb(23 25 27 / 15%);
  358. border-radius: 0 0 4px 4px;
  359. width:559px;
  360. border: 1px solid #ddd;
  361. border-top: none;
  362. display:none;
  363.  
  364. }
  365. .minibar-btn-box {
  366. display: inline-block;
  367. margin: 0 auto;
  368. float: none;
  369. }
  370. #mini_price_history .error-p {
  371. width: 95px;
  372. margin: 110px auto;
  373. height: 20px;
  374. line-height: 20px;
  375. text-align: center;
  376. color: #000!important;
  377. border: 1px solid #333;
  378. border-radius: 5px;
  379. display: block;
  380. text-decoration: none!important;
  381. }
  382. #mini_price_history:hover .trend-error-info-mini {
  383. display: block;
  384. }
  385.  
  386. .collect_mailout_icon {
  387. background-position: -247px -134px;
  388. width: 18px;
  389. }
  390.  
  391. #idey_mini_compare_detail li *, .mini-compare-icon, .minibar-btn-box * {
  392. float: left;
  393. }
  394. .panel-wrap{
  395. width: 100%;
  396. height: 100%;
  397. }
  398. .collect_mailout_icon, .mini-compare-icon {
  399. height: 18px;
  400. margin-right: 8px;
  401. margin-top: 9px;
  402. }
  403. .all-products ul li {
  404. float: left;
  405. width: 138px;
  406. height: 262px;
  407. overflow: hidden;
  408. text-align: center;
  409. }
  410. .all-products ul li .small-img {
  411. text-align: center;
  412. display: table-cell;
  413. vertical-align: middle;
  414. line-height: 90px;
  415. width: 100%;
  416. height: 100px;
  417. position: relative;
  418. float: left;
  419. margin-top: 23px;
  420. }
  421. .all-products ul li a img {
  422. vertical-align: middle;
  423. display: inline-block;
  424. width: auto;
  425. height: auto;
  426. max-height: 100px;
  427. max-width: 100px;
  428. float: none;
  429. }
  430. .all-products ul li a.b2c-other-info {
  431. text-align: center;
  432. float: left;
  433. height: 16px;
  434. line-height: 16px;
  435. margin-top: 13px;
  436. }
  437.  
  438. .b2c-other-info .gwd-price {
  439. height: 17px;
  440. line-height: 17px;
  441. font-size: 16px;
  442. color: #E4393C;
  443. font-weight: 700;
  444. width: 100%;
  445. display: block;
  446. }
  447. .b2c-other-info .b2c-tle {
  448. height: 38px;
  449. line-height: 19px;
  450. margin-top: 8px;
  451. font-size: 12px;
  452. width: 138px;
  453. margin-left: 29px;
  454. }
  455. .bjgext-mini-trend span {
  456. float: left;
  457. /*width: 100%;*/
  458. text-align: center;
  459. line-height: 36px;
  460. color: #666;
  461. font-size: 14px;
  462. }
  463. .bjgext-mini-trend .trend-error-info-mini {
  464. position: absolute;
  465. top: 37px;
  466. left: 0px;
  467. width: 100%;
  468. background: #fff;
  469. z-index: 99999999;
  470. height: 268px;
  471. display: none;
  472. box-shadow: 0px 5px 15px 0 rgba(23,25,27,0.15);
  473. border-radius: 0 0 4px 4px;
  474. width: 460px;
  475. border: 1px solid #ddd;
  476. border-top: none;
  477. }
  478. .bjgext-mini-trend .error-p {
  479. width: 100%;
  480. float: left;
  481. text-align: center;
  482. margin-top: 45px;
  483. font-size: 14px;
  484. color: #666;
  485. }
  486. .bjgext-mini-trend .error-sp {
  487. width: 95px;
  488. margin: 110px auto;
  489. height: 20px;
  490. line-height: 20px;
  491. text-align: center;
  492. color: #000!important;
  493. border: 1px solid #333;
  494. border-radius: 5px;
  495. display: block;
  496. text-decoration: none!important;
  497. }
  498. .bjgext-mini-trend:hover .trend-error-info-mini {
  499. display: block;
  500. }
  501.  
  502.  
  503. #coupon_box.coupon-box1 {
  504. width: 525px;
  505. height: 125px;
  506. background-color: #fff;
  507. border: 1px solid #e8e8e8;
  508. border-top: none;
  509. position: relative;
  510. margin: 0px;
  511. padding: 0px;
  512. float: left;
  513. display: block;
  514. }
  515. #coupon_box:after {
  516. display: block;
  517. content: "";
  518. clear: both;
  519. }
  520. .idey_tmall #idey_minibar {
  521. float: none;
  522. }
  523.  
  524.  
  525. .minicoupon_detail {
  526. position: absolute;
  527. top: 35px;
  528. right: -1px;
  529. height: 150px;
  530. width: 132px;
  531. display: none;
  532. z-index: 99999999999;
  533. background: #FFF7F8;
  534. border: 1px solid #F95774;
  535. }
  536. #coupon_box:hover .minicoupon_detail {
  537. display: block;
  538. }
  539. .minicoupon_detail img {
  540. width: 114px;
  541. height: 114px;
  542. float: left;
  543. margin-left: 9px;
  544. margin-top: 9px;
  545. }
  546. .minicoupon_detail span {
  547. font-size: 14px;
  548. color: #F95572;
  549. letter-spacing: 0;
  550. font-weight: bold;
  551. float: left;
  552. height: 12px;
  553. line-height: 14px;
  554. width: 100%;
  555. margin-top: 6px;
  556. text-align: center;
  557. }
  558. .coupon-box1 * {
  559. font-family: 'Microsoft YaHei',Arial,SimSun;
  560. }
  561. .coupon-icon {
  562. float: left;
  563. width: 20px;
  564. height: 20px;
  565. background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_icon.png') 0px 0px no-repeat;
  566. margin: 50px 8px 9px 12px;
  567. }
  568. #coupon_box .coupon-tle {
  569. color: #FF3B5C;
  570. font-size: 24px;
  571. margin-right: 11px;
  572. float: left;
  573. height: 114px;
  574. overflow: hidden;
  575. text-overflow: ellipsis;
  576. white-space: nowrap;
  577. width: 336px;
  578. line-height: 114px;
  579. text-decoration: none!important;
  580. }
  581. #coupon_box .coupon-row{
  582. color: #FF3B5C;
  583. font-size: 12px;
  584. margin-right: 11px;
  585. float: left;
  586. height: 60px;
  587. overflow: hidden;
  588. text-overflow: ellipsis;
  589. white-space: nowrap;
  590. width: 100%;
  591. line-height: 60px;
  592. text-decoration: none!important;
  593. text-align: center;
  594. }
  595. #coupon_box .coupon-tle * {
  596. color: #f15672;
  597. }
  598. #coupon_box .coupon-tle span {
  599. margin-right: 5px;
  600. font-weight: bold;
  601. font-size: 14px;
  602. }
  603. .coupon_gif {
  604. background: url('https://cdn.gwdang.com/images/extensions/newbar/turn.gif') 0px 0px no-repeat;
  605. float: right;
  606. height: 20px;
  607. width: 56px;
  608. margin-top: 49px;
  609. }
  610. .click2get {
  611. background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_01.png') 0px 0px no-repeat;
  612. float: left;
  613. height: 30px;
  614. width: 96px;
  615. margin-top: 43px;
  616. }
  617. .click2get span {
  618. height: 24px;
  619. float: left;
  620. margin-left: 1px;
  621. }
  622. .click2taobaoget {
  623. float: left;
  624. width: 96px;
  625. }
  626. .c2g-sp1 {
  627. width: 50px;
  628. color: #FF3B5C;
  629. text-align: center;
  630. font-size: 14px;
  631. line-height: 24px!important;
  632. }
  633. .c2g-sp2 {
  634. width: 44px;
  635. line-height: 24px!important;
  636. color: #fff!important;
  637. text-align: center;
  638. }
  639. div#idey_wishlist_div.idey_wishlist_div {
  640. border-bottom-right-radius: 0px;
  641. border-bottom-left-radius: 0px;
  642. }
  643. #qrcode{
  644. float: left;
  645. width: 125px;
  646. margin-top:3px;
  647. }
  648.  
  649.  
  650. .elm_box{
  651. height: 37px;
  652. border: 1px solid #ddd;
  653. width: 460px;
  654. line-height: 37px;
  655. margin-bottom: 3px;
  656. background-color: #ff0036;
  657. font-size: 15px;
  658. }
  659. .elm_box span{
  660. width: 342px;
  661. text-align: center;
  662. display: block;
  663. float: left;
  664. color: red;
  665. color: white;
  666. }`
  667.  
  668.  
  669. const stylecss =
  670. `.downbox {cursor:pointer; position:fixed; top:100px; left:0px; width:0px; z-index:2147483647; font-size:12px; text-align:left;}
  671. .downbox a{cursor:pointer;}
  672. .downbox .box { position: absolute;right: 0; width: 1.375rem;padding: 10px 2px;text-align: center;color: #fff;cursor: auto;user-select: none;border-radius: 0 4px 4px 0;transform: translate3d(100%, 5%, 0);background: deepskyblue;}
  673. `
  674. function trim(str) {
  675. return str.replace(/(^\s*)|(\s*$)/g, "");
  676. }
  677.  
  678. function removeEvent(that, href) {
  679. that.find("a").attr('target', '');
  680. that.find("a").unbind("click");
  681. that.find("a").bind("click", function(e) {
  682. e.preventDefault();
  683. if (href != undefined) {
  684. obj.onclicks(href);
  685. } else {
  686. obj.onclicks($(this).attr('href'));
  687. }
  688.  
  689. })
  690. }
  691. obj.initStyle = function() {
  692. var styles = document.createElement('style')
  693. styles.type = 'text/css'
  694. styles.innerHTML = style;
  695. document.getElementsByTagName('head').item(0).appendChild(styles)
  696. }
  697.  
  698.  
  699. obj.initSearchHtml = function(selectorList) {
  700. setInterval(function() {
  701. selectorList.forEach(function(selector) {
  702. obj.initSearchItemSelector(selector);
  703. });
  704. }, 3000);
  705. };
  706.  
  707. obj.initSearchEvent = function() {
  708. $(document).on("click", ".tb-cool-box-area", function() {
  709. var $this = $(this);
  710. if ($this.hasClass("tb-cool-box-wait")) {
  711. obj.basicQueryItem(this);
  712. } else if ($this.hasClass("tb-cool-box-info-translucent")) {
  713. $this.removeClass("tb-cool-box-info-translucent");
  714. } else {
  715. $this.addClass("tb-cool-box-info-translucent");
  716. }
  717. });
  718. };
  719.  
  720. obj.basicQuery = function() {
  721. setInterval(function() {
  722. $(".tb-cool-box-wait").each(function() {
  723. obj.basicQueryItem(this);
  724. });
  725. }, 3000);
  726. };
  727.  
  728. obj.initSearchItemSelector = function(selector) {
  729. $(selector).each(function() {
  730. obj.initSearchItem(this);
  731. });
  732. };
  733.  
  734. obj.initSearchItem = function(selector) {
  735. var $this = $(selector);
  736. if ($this.hasClass("tb-cool-box-already")) {
  737. return;
  738. } else {
  739. $this.addClass("tb-cool-box-already")
  740. }
  741.  
  742. var nid = $this.attr("data-id");
  743. if (!obj.isVailidItemId(nid)) {
  744. nid = $this.attr("data-itemid");
  745. }
  746.  
  747. if (!obj.isVailidItemId(nid)) {
  748. if ($this.attr("href")) {
  749. nid = location.protocol + $this.attr("href");
  750. } else {
  751. var $a = $this.find("a");
  752. if (!$a.length) {
  753. return;
  754. }
  755.  
  756. nid = $a.attr("data-nid");
  757. if (!obj.isVailidItemId(nid)) {
  758. if ($a.hasClass("j_ReceiveCoupon") && $a.length > 1) {
  759. nid = location.protocol + $($a[1]).attr("href");
  760. } else {
  761. nid = location.protocol + $a.attr("href");
  762. }
  763. }
  764. }
  765. }
  766.  
  767. if (obj.isValidNid(nid)) {
  768. obj.basicQueryItem($this, nid);
  769. }
  770. };
  771.  
  772.  
  773.  
  774. obj.basicQueryItem = function(selector, nid) {
  775. var $this = $(selector);
  776. console.log($this.find('.pic-box .pic-box-inner').html());
  777. $.get('https://s.idey.cn/tb.php?act=recovelink&itemid=' + nid, function(data) {
  778. if (data.type == 'success') {
  779. var vhtml='<div style="position: absolute;top: 18px;right: 5px;"><a href="javascript:void(0);" style="padding:10px;border-radius: 15px;background-color:#f40;color:#FFF;text-decoration:none;" >有劵('+data.data+')</a></div>';
  780. $this.find('.pic-box .pic-box-inner').append(vhtml);
  781. //obj.changeUrl($this, data.data);
  782. } else {
  783. var vhtml='<div style="position: absolute;top: 18px;right: 5px;opacity:0.33" ><a href="javascript:void(0);" style="padding:10px;border-radius: 15px;background-color:#ccc;text-decoration:none;" >暂无优惠劵</a></div>';
  784. $this.find('.pic-box .pic-box-inner').append(vhtml);
  785. }
  786. }, 'json')
  787. };
  788.  
  789. obj.changeUrl = function(selector, data) {
  790.  
  791. }
  792.  
  793.  
  794. obj.isDetailPageTaoBao = function(url) {
  795. if (url.indexOf("//item.taobao.com/item.htm") > 0 || url.indexOf("//detail.tmall.com/item.htm") > 0 ||
  796. url.indexOf("//chaoshi.detail.tmall.com/item.htm") > 0 || url.indexOf(
  797. "//detail.tmall.hk/hk/item.htm") > 0) {
  798. return true;
  799. } else {
  800. return false;
  801. }
  802. };
  803.  
  804. obj.isVailidItemId = function(itemId) {
  805. if (!itemId) {
  806. return false;
  807. }
  808.  
  809. var itemIdInt = parseInt(itemId);
  810. if (itemIdInt == itemId && itemId > 10000) {
  811. return true;
  812. } else {
  813. return false;
  814. }
  815. };
  816.  
  817. obj.isValidNid = function(nid) {
  818. if (!nid) {
  819. return false;
  820. } else if (nid.indexOf('http') >= 0) {
  821. if (obj.isDetailPageTaoBao(nid) || nid.indexOf("//detail.ju.taobao.com/home.htm") > 0) {
  822. return true;
  823. } else {
  824. return false;
  825. }
  826. } else {
  827. return true;
  828. }
  829. };
  830.  
  831. obj.get_page_url_id = function(pagetype, url, type) {
  832. var return_data = '';
  833. if (pagetype == 'taobao_item') {
  834. var params = location.search.split("?")[1].split("&");
  835. for (var index in params) {
  836. if (params[index].split("=")[0] == "id") {
  837. var productId = params[index].split("=")[1];
  838. }
  839. }
  840. return_data = productId;
  841. }
  842. return return_data;
  843. }
  844.  
  845. obj.get_type_url = function(url) {
  846. if (
  847. url.indexOf("//item.taobao.com/item.htm") > 0 ||
  848. url.indexOf("//detail.tmall.com/item.htm") > 0 ||
  849. url.indexOf("//chaoshi.detail.tmall.com/item.htm") > 0 ||
  850. url.indexOf("//detail.tmall.hk/hk/item.htm") > 0 ||
  851. url.indexOf("//world.tmall.com") > 0 ||
  852. url.indexOf("//detail.liangxinyao.com/item.htm") > 0 ||
  853. url.indexOf("//detail.tmall.hk/item.htm") > 0
  854. ) {
  855. return 'taobao_item';
  856. } else if (
  857. url.indexOf("//maiyao.liangxinyao.com/shop/view_shop.htm") > 0 ||
  858. url.indexOf("//list.tmall.com/search_product.htm") > 0 ||
  859. url.indexOf("//s.taobao.com/search") > 0 ||
  860. url.indexOf("//list.tmall.hk/search_product.htm") > 0
  861. ) {
  862. return 'taobao_list';
  863. } else if (
  864. url.indexOf("//search.jd.com/Search") > 0 ||
  865. url.indexOf("//search.jd.com/search") > 0 ||
  866. url.indexOf("//search.jd.hk/search") > 0 ||
  867. url.indexOf("//search.jd.hk/Search") > 0 ||
  868. url.indexOf("//www.jd.com/xinkuan") > 0 ||
  869. url.indexOf("//list.jd.com/list.html") > 0 ||
  870. url.indexOf("//search.jd.hk/Search") > 0 ||
  871. url.indexOf("//coll.jd.com") > 0
  872.  
  873.  
  874. ) {
  875. return 'jd_list';
  876. } else if (
  877. url.indexOf("//item.jd.hk") > 0 ||
  878. url.indexOf("//pcitem.jd.hk") > 0 ||
  879. url.indexOf("//i-item.jd.com") > 0 ||
  880. url.indexOf("//item.jd.com") > 0 ||
  881. url.indexOf("//npcitem.jd.hk") > 0 ||
  882. url.indexOf("//item.yiyaojd.com") > 0 ||
  883. url.indexOf("//item.jkcsjd.com") > 0
  884. ) {
  885. return 'jd_item';
  886. } else if (
  887. url.indexOf("//miaosha.jd.com") > 0
  888. ) {
  889. return 'jd_miaosha';
  890. } else if (
  891. url.indexOf("//www.jd.com") > 0 ||
  892. url.indexOf("//jd.com") > 0
  893. ) {
  894. return 'jd_index';
  895. }else if(
  896. url.indexOf("//jingfen.jd.com") >0
  897. ){
  898. return 'jingfen';
  899. }
  900.  
  901. }
  902.  
  903. var pageurl = location.href;
  904. var pagetype = obj.get_type_url(pageurl);
  905. if (pagetype == 'taobao_item') {
  906. var productId = obj.get_page_url_id(pagetype, pageurl, pageurl);
  907.  
  908. obj.initStyle(style);
  909. // var productId = obj.get_page_url_id(pagetype, pageurl, pageurl);
  910. var couponurl = "https://s.idey.cn/ltb.php?act=items&itemurl=" + encodeURIComponent(location.href) +
  911. '&itemid=' +
  912. productId;
  913. $.getJSON(couponurl, function(res) {
  914. var data = res.data;
  915.  
  916. var couponArea = '<div class="idey-minibar_bg">';
  917. couponArea += '<div id="idey_minibar" class="alisite_page">';
  918. couponArea +=
  919. '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://taobao.idey.cn">';
  920. couponArea += '<em class="setting-bg website_icon"></em></a>';
  921. couponArea += '<div id="mini_price_history" class="minibar-tab">';
  922.  
  923.  
  924.  
  925. couponArea +=
  926. '<span class="blkcolor1">当前价:<span style="color:red" id="now_price">加载中...</span></span>';
  927. couponArea += '<div class="trend-error-info-mini" id="echart-box">';
  928. couponArea += '</div></div>';
  929. couponArea +=
  930. '<div style="flex: 1" id="idey_mini_compare" class="minibar-tab">最低价:<span style="color:red" id="min_price">加载中...</span></div>';
  931. couponArea += '<div style="flex: 1" id="idey_mini_remind" class="minibar-tab">';
  932. couponArea += '劵后价:<span style="color:red" id="coupon_price">加载中...</span>';
  933.  
  934. couponArea += ' </div></div>';
  935. couponArea +=
  936. ' <div class="idey-mini-placeholder idey-price-protect"></div><div id="promo_box"></div>';
  937.  
  938.  
  939.  
  940. if (res.type == 'success') {
  941. couponArea +=
  942. '<a id="coupon_box" title="" class="coupon-box1" href="https://zbhui.cn/coupon.php?itemurl=' +
  943. encodeURIComponent(location.href) + '&itemid='+productId+'">';
  944. couponArea += '<span class="coupon-icon"></span>';
  945. couponArea += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount +
  946. '元</span> <em class="coupon_gif"></em></div>';
  947. couponArea += '<div class="click2taobaoget xbcode"></div>';
  948. couponArea += '</a>';
  949.  
  950. } else {
  951. couponArea +=
  952. '<a id="coupon_box" title="" class="coupon-box1" >';
  953. couponArea += '<span class="coupon-icon"></span>';
  954. couponArea += ' <div class="coupon-tle">此商品暂无红包</div>';
  955. couponArea += '</a>';
  956. }
  957.  
  958.  
  959. couponArea += '</div>';
  960. if (data.alist.length > 0) {
  961. for (let i = 0; i < data.alist.length; i++) {
  962. couponArea +=
  963. '<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' +
  964. data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>'
  965. }
  966. }
  967. setTimeout(function(){
  968. if (location.href.indexOf("//detail.tmall") != -1) {
  969. if ($('div').is('.tm-fcs-panel')) {
  970. $(".tm-fcs-panel").after(couponArea);
  971. }else if($('div').is('.Promotion--root--3qHQal')){
  972. $(".Promotion--root--3qHQalP").after(couponArea);
  973. }else if($('div').is('.Price--root--1CrVGjc')){
  974. $(".Price--root--1CrVGjc").after(couponArea);
  975. }else if($('div').is('.Price--eXtPHNRb')){
  976. $(".Price--eXtPHNRb").after(couponArea);
  977. }else if($('div').is('.Price--root--1X-r-XP')){
  978. $(".Price--root--1X-r-XP").after(couponArea);
  979. }else{
  980. if(data.warptype=='befor'){
  981. $(data.warp).before(couponArea);
  982. }else{
  983. $(data.warp).after(couponArea);
  984. }
  985. }
  986. } else {
  987. if ($('div').is('ul.tb-meta')) {
  988. $("ul.tb-meta").after(couponArea);
  989. }else if($('div').is('.Promotion--root--3qHQal')){
  990. $(".Promotion--root--3qHQalP").after(couponArea);
  991. }else if($('div').is('.Price--root--1CrVGjc')){
  992. $(".Price--root--1CrVGjc").after(couponArea);
  993. }else if($('div').is('.Price--eXtPHNRb')){
  994. $(".Price--eXtPHNRb").after(couponArea);
  995. }else if($('div').is('.Price--root--1X-r-XP')){
  996. $(".Price--root--1X-r-XP").after(couponArea);
  997. }else{
  998. if(data.warptype=='befor'){
  999. $(data.warp).before(couponArea);
  1000. }else{
  1001. $(data.warp).after(couponArea);
  1002. }
  1003. }
  1004. }
  1005. $(".xbcode").qrcode({
  1006. render: "canvas", //也可以替换为table
  1007. width: 130,
  1008. height: 120,
  1009. text: data.shortUrl
  1010. });
  1011. if (data.originalPrice) {
  1012. $("#now_price").html('¥' + data.originalPrice);
  1013. }
  1014. if (data.actualPrice) {
  1015. $("#coupon_price").html('¥' + data.actualPrice);
  1016. }
  1017. }, 1000 )
  1018. if(data.shortUrl){
  1019. let hbm='<div style="position:fixed;width:170px;height:170px;right:28px;bottom:10px;z-index: 99999999;"><h1 style="color:red;font-size: 11px">使用淘宝APP领劵购买此商品</h1><div id="hbcode"></div></div>';
  1020. $("body").append(hbm);
  1021. $("#hbcode").qrcode({
  1022. render: "canvas", //也可以替换为table
  1023. width: 160,
  1024. height: 150,
  1025. text: data.shortUrl
  1026. });
  1027. }
  1028.  
  1029. });
  1030.  
  1031. } else if (pagetype == 'jd_item') {
  1032. obj.initStyle(style);
  1033. var productId = /(\d+)\.html/.exec(window.location.href)[1];
  1034. var couponurl = "https://tbao.idey.cn/jd.php?act=recovelink&itemurl=" + encodeURIComponent(location.href) +
  1035. '&itemid=' + productId;
  1036. $.getJSON(couponurl, function(res) {
  1037. var data = res.data;
  1038. if (!obj.GetQueryString('utm_campaign') && data) {
  1039. window.location.href = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(data);
  1040. }
  1041.  
  1042. });
  1043. var couponurls = "https://s.idey.cn/xjd.php?act=item&itemurl=" + encodeURIComponent(location.href) +
  1044. '&itemid=' + productId;
  1045.  
  1046. $.getJSON(couponurls, function(res) {
  1047. var data = res.data;
  1048.  
  1049. var couponArea = '<div class="idey-minibar_bg">';
  1050. couponArea += '<div id="idey_minibar" class="alisite_page">';
  1051. couponArea +=
  1052. '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://www.idey.cn">';
  1053. couponArea += '<em class="setting-bg website_icon"></em></a>';
  1054. couponArea += '<div id="mini_price_history" class="minibar-tab">';
  1055.  
  1056.  
  1057. couponArea +=
  1058. '<span class="blkcolor1">当前价:<span style="color:red" id="now_price">加载中...</span></span>';
  1059. couponArea += '<div class="trend-error-info-mini" id="echart-box">';
  1060. couponArea += '</div></div>';
  1061. couponArea +=
  1062. '<div style="flex: 1" id="idey_mini_compare" class="minibar-tab">最低价:<span style="color:red" id="min_price">加载中...</span></div>';
  1063. couponArea += '<div style="flex: 1" id="idey_mini_remind" class="minibar-tab">';
  1064. couponArea += '劵后价:<span style="color:red" id="coupon_price">加载中...</span>';
  1065.  
  1066. couponArea += ' </div></div>';
  1067. couponArea +=
  1068. ' <div class="idey-mini-placeholder idey-price-protect"></div><div id="promo_box"></div>';
  1069.  
  1070.  
  1071.  
  1072. if (res.type == 'success') {
  1073. if (data.couponLinkType == 1) {
  1074. couponArea +=
  1075. '<a id="coupon_box" title="" class="coupon-box1" href="' + data.couponLink + '">';
  1076. couponArea += '<span class="coupon-icon"></span>';
  1077. couponArea += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount +
  1078. '元</span> <em class="coupon_gif"></em></div>';
  1079. couponArea += '<div class="click2get"><span class="c2g-sp1">¥' + data.couponAmount +
  1080. '</span><span class="c2g-sp2">领取</span></div>';
  1081. couponArea += '</a>';
  1082. } else {
  1083. couponArea +=
  1084. '<a id="coupon_box" title="" class="coupon-box1" >';
  1085. couponArea += '<span class="coupon-icon"></span>';
  1086. couponArea += ' <div class="coupon-tle"> <span>立减' + data.couponAmount +
  1087. '元(京东扫码领取)</span> <em class="coupon_gif"></em></div>';
  1088. couponArea += '<div id="qrcode"></div>';
  1089. couponArea += '</a>';
  1090. }
  1091.  
  1092. } else {
  1093.  
  1094. couponArea +=
  1095. '<a id="coupon_box" title="" class="coupon-box1" >';
  1096. couponArea += '<span class="coupon-icon"></span>';
  1097. couponArea += ' <div class="coupon-tle">此商品暂无红包</div>';
  1098.  
  1099. couponArea += '</a>';
  1100.  
  1101.  
  1102. }
  1103.  
  1104. couponArea += '</div>';
  1105. if (data.alist.length > 0) {
  1106. for (let i = 0; i < data.alist.length; i++) {
  1107. couponArea +=
  1108. '<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' +
  1109. data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>'
  1110. }
  1111. }
  1112. setTimeout(function(){
  1113.  
  1114. $(".summary-price-wrap").after(couponArea);
  1115. },500)
  1116.  
  1117. if (data.couponLink) {
  1118. $('#qrcode').qrcode({
  1119. render: "canvas", //也可以替换为table
  1120. width: 125,
  1121. height: 120,
  1122. text: data.couponLink
  1123. });
  1124.  
  1125. } else if (data.item_link.shortUrl) {
  1126. $('#qrcode').qrcode({
  1127. render: "canvas", //也可以替换为table
  1128. width: 125,
  1129. height: 120,
  1130. text: data.item_link.shortUrl
  1131. });
  1132. } else {
  1133. $('#qrcode').qrcode({
  1134. render: "canvas", //也可以替换为table
  1135. width: 125,
  1136. height: 120,
  1137. text: data.item_link.longUrl
  1138. });
  1139. }
  1140. if (data.item_link.originalPrice) {
  1141. $("#now_price").html('¥' + data.item_link.originalPrice);
  1142. }
  1143. if (data.item_link.actualPrice) {
  1144. $("#coupon_price").html('¥' + data.item_link.actualPrice);
  1145. }
  1146. if(data.hbcode !=''){
  1147. let hbm='<div style="position:fixed;width:160px;height:160px;right:28px;bottom:50px;z-index:99999"><h1 style="color:red;font-size: 11px">使用京东APP领劵购买此商品</h1><div id="hbcode"></div></div>';
  1148.  
  1149. $(".toolbar-qrcode").hide();
  1150. setInterval(function(){
  1151. $(".toolbar-qrcode").hide();
  1152. },100 )
  1153. $("body").append(hbm);
  1154. $("#hbcode").qrcode({
  1155. render: "canvas", //也可以替换为table
  1156. width: 150,
  1157. height: 140,
  1158. text: data.hbcode
  1159. });
  1160. }
  1161.  
  1162.  
  1163. });
  1164.  
  1165. } else if (pagetype == 'jd_list') {
  1166. setInterval(obj.get_url, 300);
  1167.  
  1168.  
  1169. } else if (pagetype == 'jd_miaosha') {
  1170. $(".seckill_mod_goodslist li").find("a").click(function(e) {
  1171. if ($(this).attr('data-ref')) {
  1172. e.preventDefault();
  1173. obj.onclicks($(this).attr('data-ref'));
  1174. }
  1175. })
  1176.  
  1177. setInterval(obj.get_miaosha, 300);
  1178.  
  1179. } else if (pagetype == 'taobao_list') {
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185. }else if(pagetype=="jingfen"){
  1186. let productId=obj.getUrlParam("sku");
  1187. if(productId){
  1188. var couponurl = "https://s.idey.cn/xjd.php?act=itemcode&itemid=" + productId;
  1189. $.getJSON(couponurl, function(res) {
  1190. var data = res.data;
  1191. if(data !='' && data !=null && data !=undefined){
  1192. $(document).ready(function(){
  1193. setTimeout(function(){
  1194. $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>");
  1195. $(".btn-area").after("<div class='coupon_code'></div>");
  1196. // $(".btn-area").hide();
  1197. $('.coupon_code').qrcode({
  1198. render: "canvas", //也可以替换为table
  1199. width: 200,
  1200. height: 180,
  1201. text: data
  1202. });
  1203. }, 500 )
  1204. });
  1205. }else{
  1206. $(document).ready(function(){
  1207. setTimeout(function(){
  1208. $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>");
  1209. $(".btn-area").after("<div class='coupon_code'></div>");
  1210. // $(".btn-area").hide();
  1211. $('.coupon_code').qrcode({
  1212. render: "canvas", //也可以替换为table
  1213. width: 400,
  1214. height: 380,
  1215. text: location.href
  1216. });
  1217. }, 500 )
  1218. });
  1219. }
  1220.  
  1221.  
  1222.  
  1223. });
  1224. }else{
  1225. $(document).ready(function(){
  1226. setTimeout(function(){
  1227. $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>");
  1228. $(".btn-area").after("<div class='coupon_code'></div>");
  1229. // $(".btn-area").hide();
  1230. $('.coupon_code').qrcode({
  1231. render: "canvas", //也可以替换为table
  1232. width: 400,
  1233. height: 385,
  1234. text: location.href
  1235. });
  1236. }, 500 )
  1237. });
  1238. }
  1239. }
  1240.  
  1241.  
  1242.  
  1243.  
  1244. })();