淘宝 京东 拼多 优惠券

淘宝 京东 拼多 优惠券 装上插件 买时就是最优惠价格!

  1. // ==UserScript==
  2. // @name 淘宝 京东 拼多 优惠券
  3. // @namespace https://v2ray.aiz5.com/public/tb.js
  4. // @version 0.2.3
  5. // @description 淘宝 京东 拼多 优惠券 装上插件 买时就是最优惠价格!
  6. // @author arno
  7. // @antifeature 淘宝 京东 拼多 优惠券
  8. // @match *://*.tmall.com/*
  9. // @match *://*.taobao.com/*
  10. // @match *://*.jd.com/*
  11. // @match *://*.yangkeduo.com/*
  12. // @grant none
  13. // @antifeature referral-link
  14. // @license
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. (function () {
  19. "use strict";
  20. var host = "https://tk.iyan.club";
  21. var stylestr =
  22. "<style>.wandhi_tab{border:1px solid #f40;border-collapse:collapse;}" +
  23. ".wandhi_tab thead{font-size:14px;text-align:center;}" +
  24. ".wandhi_tab tr th{padding:10px 20px;text-align:center;}" +
  25. ".wandhi_tab tr td{padding:10px 20px;text-align:center;font-size:14px;}" +
  26. ".wandhi_tab tr td a{ text-decoration:none;}" +
  27. ".wandhi_tab_taobao{margin-bottom:15px;}" +
  28. ".wandhi_tab_taobao thead{background-color:#f40;color:#FFF;}" +
  29. ".wandhi_tab_taobao tr td{border:1px solid #e6602d;color:#e6602d;}" +
  30. ".wandhi_tab_taobao tr td a{color:#e6602d;}" +
  31. ".wandhi_tab_tmall {margin-bottom:15px;}" +
  32. ".wandhi_tab_tmall thead{background-color:#ff0036;color:#FFF;}" +
  33. ".wandhi_tab_tmall tr td{border:1px solid #ff0036;color:#ff0036;}" +
  34. ".wandhi_tab_tmall tr td a{color:#ff0036;}</style>";
  35.  
  36. function getCouponsStr(data) {
  37. //var list = [{name:'优惠券',price:'20',effective: '2020-09-09',id:111,url:'1111'}];
  38. var list = data.coupon || [];
  39. var couponsStr = "";
  40. for (var i = 0; i < list.length; i++) {
  41. var item = list[i];
  42. couponsStr +=
  43. "<tr><td>" +
  44. item.name +
  45. "</td><td>" +
  46. item.price +
  47. "</td><td>" +
  48. item.effective +
  49. "</td><td><b onclick=\"window.open('https://tk.iyan.club/public/link.html?url=" +
  50. encodeURIComponent(item.url) +
  51. '\')" style="cursor:pointer" data-spm-anchor-id="' +
  52. item.id +
  53. '">领取</b></td></tr>';
  54. }
  55. if (!couponsStr) {
  56. couponsStr = '<tr><td colspan="4" >没有优惠券</td></tr>';
  57. }
  58. var str =
  59. '<table class="wandhi_tab wandhi_tab_tmall" id="wandhi_table">' +
  60. '<thead><tr><th><b style="cursor:pointer">优惠券</b></th><th>券</th><th>有 效 期</th><th>操作</th></tr></thead>' +
  61. "<tbody>" +
  62. couponsStr +
  63. "</tbody></table>";
  64. if (!data.isme && data.url) {
  65. $(".tb-btn-buy").html(
  66. '<a id="J__LinkBuy" href="#" rel="nofollow" data-addfastbuy="true" title="点击此按钮,到下一步确认购买信息。" role="button">立即购买<span class="ensureText">确认</span></a>'
  67. );
  68. $(".tb-btn-buy").click(function () {
  69. var url='https://tk.iyan.club/public/link.html?url=' + encodeURIComponent(data.url || '')
  70. location.replace(url);
  71. });
  72. $(".tb-btn-basket").html(
  73. '<a href="#" rel="nofollow" id="J__LinkBasket" role="button"><i></i>加入购物车<span class="ensureText">确认</span></a>'
  74. );
  75. $(".tb-btn-basket").click(function () {
  76. var url='https://tk.iyan.club/public/link.html?url=' + encodeURIComponent(data.url || '')
  77. location.replace(url);
  78. });
  79. }
  80. return str;
  81. }
  82. var loadStr =
  83. '<div id="wandhi_div">' +
  84. '<table class="wandhi_tab wandhi_tab_tmall" id="wandhi_table">' +
  85. '<thead><tr><th><b style="cursor:pointer">优惠券加载中。。。</b></th></tr></thead></table></div>';
  86.  
  87. var $ = null;
  88. (function () {
  89. if (typeof window.jQuery == "undefined") {
  90. var GM_Head =
  91. document.getElementsByTagName("head")[0] || document.documentElement,
  92. GM_JQ = document.createElement("script");
  93.  
  94. GM_JQ.src = "https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js";
  95. GM_JQ.type = "text/javascript";
  96. GM_JQ.async = true;
  97.  
  98. GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
  99. }
  100. GM_wait();
  101. })();
  102. // Check if jQuery's loaded
  103. function GM_wait() {
  104. console.log("window.jQuery");
  105. if (typeof window.jQuery == "undefined") {
  106. window.setTimeout(GM_wait, 1000);
  107. } else {
  108. console.log("window.jQuery", window.jQuery);
  109. $ = window.$ || window.jQuery.noConflict(true);
  110. $("head").append(stylestr);
  111. $(".tb-action").prepend(loadStr);
  112. init();
  113. }
  114. }
  115. //获取url中的参数
  116. function getUrlParam(name) {
  117. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  118. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  119. if (r != null) return unescape(r[2]);
  120. return null; //返回参数值
  121. }
  122. function init() {
  123. var url = location.href;
  124. if (
  125. url.indexOf("detail.tmall.com/item.htm") !== -1 ||
  126. url.indexOf("item.taobao.com/item.htm") !== -1
  127. ) {
  128. // 淘宝
  129. var id = getUrlParam("id");
  130. console.log(id);
  131. }
  132. var data = { url: url };
  133. $.ajax({
  134. type: "POST",
  135. url: host + "/coupons",
  136. contentType: "application/json; charset=utf-8",
  137. data: JSON.stringify(data),
  138. // async:false,
  139. cache: false,
  140. success: function (d) {
  141. console.log("up", d);
  142. var data = JSON.parse(d);
  143. if (data.code === 1) {
  144. if (data.type == "jd") {
  145. if (!data.data.isme) {
  146. var url= data.data.url
  147. location.replace(url);
  148. return;
  149. }
  150. var extension_id = getUrlParam("extension_id");
  151. if (!extension_id) {
  152. $("#InitCartUrl").attr("href", data.data.url);
  153. }
  154. } else if (data.type == "taobao") {
  155. var str = getCouponsStr(data.data);
  156. $("#wandhi_div").html(str);
  157. }
  158. } else {
  159. var str = getCouponsStr(data.data);
  160. $("#wandhi_div").html(str);
  161. }
  162. },
  163. error: function (html) {},
  164. });
  165. }
  166.  
  167. // Your code here...
  168. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址