在您安裝前,Greasy Fork希望您了解本腳本包含“可能不受歡迎的功能”,可能幫助腳本的作者獲利,而不能給你帶來任何收益。
作者從這份腳本獲得佣金, 例如透過重寫連結或提供優惠券代碼以加入推薦或附屬代碼
腳本的作者解釋:
此提示为GreasyFork代码规范要求含有查券功能的脚本必须添加,实际使用无任何强制跳转,代码可查,请知悉。
Greasy Fork is available in English.
⭕自动显示淘宝、天猫、天猫超市、天猫国际、京东、京东国际的隐藏优惠券。⭕淘宝添加勾选仅显示淘宝商品不显示天猫商品等购物增强功能。❌拒绝任何干扰。❌拒绝强制跳转。⭕持续更新。
// ==UserScript== // @name 💯 懒人专用系列 ——— 简洁安全的增强购物省钱助手 // @namespace lr-toolbox-SPHelper // @version 1.1.8 // @description ⭕自动显示淘宝、天猫、天猫超市、天猫国际、京东、京东国际的隐藏优惠券。⭕淘宝添加勾选仅显示淘宝商品不显示天猫商品等购物增强功能。❌拒绝任何干扰。❌拒绝强制跳转。⭕持续更新。 // @author lanhaha // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAQ8ElEQVR4Xu1dCXQURRr+apIQT1wQw6EYBcSErCgKCoQowoocLirKeoAoLD5x2YDu+hTCPnddJeC5Ct6gIBtdlUMQxAPE95gMKkbhoWGCKMgpsPjUoEsIkNr3TadhMumeqe6ungRI8SBAV9fxf/Wf9VeXgIcipczy8PpR/aoQoszNBIWTl6SUvQAMAHAJgFbYsSsdH5e0wiclwMpVwK7dTpo7eupmNAO6dQa6dDJ+tsjYCGALgGIA7woh+FOpKAMi9+27GY0aDcSW7d3xyustECpJw2b22VBqUSCzNZB3yT6MuGkrmmcsR2XlIpGePk+FUkqAyG82/Bmnt7wWz868AC+92lSl4YY6ANIbAbfcsAt3DivBtu/ni3ZtpiWiS1xA5A8/dMe89wag7Vl98eDj52LnrhMTNdjw3IICzU8rx/33rMWGDYsxsO9icdppn9vRyRYQuXv3IKSkDMCkqT2x8IPTIZDeQGwPFJCyA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l75Hdvt7jOBiZeUiXDW0bWTgTku8cDvbSnbymtPx14f6zTMqsOTNlSI19TIj/C7lXDw1rTdenHWK4/HF+0ysmTPluNFj6AV+TW7UrZtx8fmvi26XjDMA2bv3jyjfMxJX3tAJlfudX3sUq0OSlVt7NODWKO0XLJm9DAJPiWbNlh06fyAXLZ2IL1bfhNfeykSg4erupGDNK7yHDi5Dp/NeEf17P8Y+DwNSXp6HA3JU5ILiX/fWjwuKk0KVOuzklMY78U7RAhw48LzIyIjclFnjhI784stb8N2WkSiY2AUB0XCnup9Y8Wa2SX9bjszM6aJTh/lmV7WOTMlnXhqHrduHYsF77QGR5ueYjtm2q+ReDLpqFVq3mCnuHD4tmg61Afn1104QabdhxOhBWBM+45glml8Tl7ICHbPX4tQmReLZR/8V243loUL5U0UfyMqhuP2uPlj7dXO/xnbMtUswcrLKIMRrYvb0R63mb3vKU5aXX4PUtMG4f3JPLFraXOuVesccEhFnby/6X1GGn8rfEC898bAdCeIeu5UVFQOQnt4fyz/uiX88ciZ2/PdEV1daHIsARM85o9kePHDvl1i/cY4YOaSWmIqrQ2JpJ6XsjA0beqNly1w8NzMb04syAHGiceehg2PUxyIovA5v1LAfcMewEmzbtUC0y3wxERmUKSr37++FJcEeyMnqiFmvZ2LFyibYuOVkCBwPiUYIIADJ31JUZ0BGt238nX9GMu+jjbzq/zBr13pu1q3xING86vZ5Zmsgt0sFbr1xM1q3CqKycrFIT5+nMihlQA6RZevWrpg+uwMymmRiUL+WCH6agc9WNcbKL47Dzt1pgEwFBMFJQQACVeBllQJEib8gq38TnMiXCg6DFemEzw8BVhtUlVk5r+OYDjW6aNEc6NoJ6HIh0PUioGXzCgCbUF4eROPGi4UQJapD8jYQ1V4a6ilT4P+GC5Ol+xIKnwAAAABJRU5ErkJggg== // @match *://item.taobao.com/* // @match *://chaoshi.detail.tmall.com/* // @match *://detail.tmall.com/* // @match *://detail.tmall.hk/* // @match *://s.taobao.com/* // @match *://item.jd.com/* // @match *://*.yiyaojd.com/* // @match *://npcitem.jd.hk/* // @match *://*.liangxinyao.com/* // @match *://detail.vip.com/* // @antifeature referral-link 此提示为GreasyFork代码规范要求含有查券功能的脚本必须添加,实际使用无任何强制跳转,代码可查,请知悉。 // @require https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.js // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_listValues // @grant GM_download // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @connect api.typechrome.com // ==/UserScript== /* *********************************************************** 应Greasyfork.org网站规则要求, 懒人脚本将视频解析、音乐下载、视频下载等功能拆分为多个脚本: https://greasyfork.org/zh-CN/scripts/467776 https://greasyfork.org/zh-CN/scripts/469604 https://greasyfork.org/zh-CN/scripts/469689 https://greasyfork.org/zh-CN/scripts/468015 https://greasyfork.org/zh-CN/scripts/469521 可自行分别安装。 *********************************************************** */ (function() { 'use strict'; var Config ={ taobaoCoupon:GM_getValue('taobaoCoupon',22), jingdongCoupon:GM_getValue('jingdongCoupon',22), vipCoupon:GM_getValue('vipCoupon',22), showTaotaoGoods:GM_getValue('showTaotaoGoods',22), } var { taobaoCoupon, jingdongCoupon, vipCoupon, showTaotaoGoods } = Config; var lang = { coupon:'设置', taobaoCoupon:'淘宝查券', jingdongCoupon:'京东查券', showTaotaoGoods:'仅显示淘宝商品', scriptsinstall:'脚本安装', scriptsuse:'使用方法', question:'常见问题', tggroup:'Telegram' }; var couponWeb =[ {funcName:"taobao",match:/item\.taobao\.com/,isOpen:taobaoCoupon}, {funcName:"tmall",match:/^https?:\/\/detail\.tmall\.com/,isOpen:taobaoCoupon}, {funcName:"tmallcaoshi",match:/^https?:\/\/chaoshi\.detail\.tmall\.com\//,isOpen:taobaoCoupon}, {funcName:"tmallhk",match:/^https?:\/\/detail\.tmall\.hk/,isOpen:taobaoCoupon}, {funcName:"jd",match:/item\.jd\.com\/\d{5}/,isOpen:jingdongCoupon}, {funcName:"jd",match:/item\.yiyaojd\.com\/\d{5}/,isOpen:jingdongCoupon}, {funcName:"jd",match:/npcitem\.jd\.hk\/\d{5}/,isOpen:jingdongCoupon}, {funcName:"taobaoSearch",match:/^https?:\/\/s\.taobao\.com\/search\.*/,isOpen:showTaotaoGoods}, {funcName:"vip",match:/detail\.vip\.com\/detail.*/,isOpen:vipCoupon}, ]; var domHead = document.getElementsByTagName('head')[0]; var domStyle = document.createElement('style'); domStyle.type = 'text/css'; domStyle.rel = 'stylesheet'; class BaseClass{ constructor(){ this.className = this.getClassName(); } createElement(dom,domId){ var rootElement = document.body; var newElement = document.createElement(dom); newElement.id = domId; var newElementHtmlContent = document.createTextNode(''); rootElement.appendChild(newElement); newElement.appendChild(newElementHtmlContent); } request(method,url,data,isCookie=''){ let request = new XMLHttpRequest(); return new Promise((resolve,reject)=>{ request.onreadystatechange=function(){ if(request.readyState==4){ if(request.status==200){ resolve(request.responseText); }else{ reject(request.status); } } } request.open(method,url); if(isCookie){ request.withCredentials = true; } request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); request.send(data); }) } setCookie(cname,cvalue,exdays){ var d = new Date(); d.setTime(d.getTime()+(exdays*24*60*60*1000)); var expires = "expires="+d.toGMTString(); document.cookie = cname+"="+cvalue+"; "+expires; } getCookie(cname){ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i<ca.length; i++) { var c = ca[i].trim(); if (c.indexOf(name)==0) { return c.substring(name.length,c.length); } } return ""; } getQueryString(e) { var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)"); var a = window.location.search.substr(1).match(t); if (a != null) return a[2]; return ""; } getUrlParams(url){ let reg = /([^?&+#]+)=([^?&+#]+)/g; let obj={}; url.replace(reg,(res,$1,$2)=>{obj[$1]=$2}); return obj; } static getElement(css,all=''){ return new Promise((resolve,reject)=>{ let num = 0; let timer = setInterval(function(){ num++ let dom; if(all == false){ dom = document.querySelector(css); if(dom){ clearInterval(timer); resolve(dom); } }else{ dom = document.querySelectorAll(css); if(dom.length>0){ clearInterval(timer); resolve(dom); } } if(num==20){ clearInterval(timer); resolve(false); } },300) }) } static toast(msg,duration){ duration=isNaN(duration)?3000:duration; let toastDom = document.createElement('div'); toastDom.innerHTML = msg; toastDom.style.cssText='padding:2px 15px;min-height: 36px;line-height: 36px;text-align: center;transform: translate(-50%);border-radius: 4px;color: rgb(255, 255, 255);position: fixed;top: 50%;left: 50%;z-index: 9999999;background: rgb(0, 0, 0);font-size: 16px;' document.body.appendChild(toastDom); setTimeout(function() { var d = 0.5; toastDom.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; toastDom.style.opacity = '0'; setTimeout(function() { document.body.removeChild(toastDom) }, d * 1000); }, duration); } randomString(e) { e = e || 32; var t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz",a = t.length,n = ""; for (let i = 0; i < e; i++){ n += t.charAt(Math.floor(Math.random() * a)); }; return n; } getClassName(){ let className = [ 'zhm_div_s', 'zhm_coupon', 'zhm_left', 'zhm_img_icon', 'zhm_content', 'zhm_money', 'zhm_amount_money', 'zhm_money_sign', 'zhm_money_num', 'zhm_condition', 'zhm_time', 'zhm_term', 'zhm_date', 'zhm_circle', 'zhm_link_coupon', 'zhm_get_link_text', 'zhm_qrcode', 'itemQR', 'jdCouponLink', 'tbqrcode', 'jdqrcode', 'positionQrcode', 'positionQrcodeHead', 'positionQrcodeBody', 'positionQrcodeImg', 'keywordSearch', 'keywordNav', 'keywordNavLi', 'keywordNavLiIcon', 'keywordNavLiActive', 'keywordGoodsList', 'keywordGoodsUl', 'goodsList', 'goodsListWaiting', 'waitingIcon', 'goodsImg', 'goodsSgin', 'goodsPrice', 'goodsDiscountPrice', 'goodsTitle', 'keywordGoodsListActive', 'keywordCoupon', 'keywordCouponLeft', 'keywordCouponRight' ]; let objClassName = {}; for(let i=0;i<className.length;i++){ let randomLength = Math.floor(Math.random()*(16-8+1)+8); objClassName[className[i]]=this.randomString(randomLength); } return objClassName; } } class CouponClass extends BaseClass{ constructor(){ super(); this.divElement = document.createElement("div"); this.divElement.id = this.className.zhm_div_s; this.goods_id; this.goods_title; this.coupon_info = {}; this.GMSaveData = 'cssData'; GM_registerMenuCommand("设置", () =>this.menuSet()); this.edgeLengthRight = 60; this.couponStyle(); } menuSet(){ var _this = this; let menuSetStyle = ` .zhmMask{ z-index:999999999; background-color:#000; position: fixed;top: 0;right: 0;bottom: 0;left: 0; opacity:0.8; } .wrap-box{ z-index:1000000000; position:fixed;;top: 50%;left: 50%;transform: translate(-50%, -200px); width: 300px; color: #555; background-color: #fff; border-radius: 5px; overflow:hidden; font:16px numFont,PingFangSC-Regular,Tahoma,Microsoft Yahei,sans-serif !important; font-weight:400 !important; } .setWrapHead{ background-color:#f24443;height:40px;color:#fff;text-align:center;line-height:40px; } .setWrapLi{ margin:0px;padding:0px; } .setWrapLi li{ background-color: #fff; border-bottom:1px solid #eee; margin:0px !important; padding:12px 20px; display: flex; justify-content: space-between;align-items: center; list-style: none; } .setWrapLiContent{ display: flex;justify-content: space-between;align-items: center; } .setWrapSave{ position:absolute;top:-2px;right:10px;font-size:24px;cursor:pointer } .iconSetFoot{ position:absolute;bottom:0px;padding:10px 20px;width:100%; z-index:1000000009;background:#fef9ef; } .iconSetFootLi{ margin:0px;padding:0px; } .iconSetFootLi li{ display: inline-flex; padding:0px 2px; justify-content: space-between;align-items: center; font-size: 12px; } .iconSetFootLi li a{ color:#555; } .iconSetFootLi a:hover { color:#fe6d73; } .iconSetPage{ z-index:1000000001; position:absolute;top:0px;left:300px; background:#fff; width:300px; height:100%; } .iconSetUlHead{ padding:0px; margin:0px; } .iconSetPageHead{ border-bottom:1px solid #ccc; height:40px; line-height:40px; display: flex; justify-content: space-between; align-items: center; background-color:#fe6d73; color:#fff; font-size: 15px; } .iconSetPageLi{ margin:0px;padding:0px; } .iconSetPageLi li{ list-style: none; padding:8px 20px; } .zhihuSetPage{ z-index:1000000002;position:absolute;top:0px;left:300px;background:#fff;width:300px;height:100%; } .iconSetPageInput{ display: flex !important;justify-content: space-between;align-items: center; } .zhihuSetPageLi{ margin:0px;padding:0px; } .zhihuSetPageLi li{ border-bottom:1px solid #eee;padding:12px 20px;display:block; } .zhihuSetPageContent{ display: flex !important;justify-content: space-between;align-items: center; } li:last-child{ border-bottom:none; } .circular{ width: 40px;height: 20px;border-radius: 16px;transition: .3s;cursor: pointer;box-shadow: 0 0 3px #999 inset; } .round-button{ width: 20px;height: 20px;;border-radius: 50%;box-shadow: 0 1px 5px rgba(0,0,0,.5);transition: .3s;position: relative; } .back{ border: solid #FFF; border-width: 0 3px 3px 0; display: inline-block; padding: 3px;transform: rotate(135deg); -webkit-transform: rotate(135deg);margin-left:10px;cursor:pointer; } .to-right{ margin-left:20px; display: inline-block; padding: 3px;transform: rotate(-45deg); -webkit-transform: rotate(-45deg);cursor:pointer; } .iconSetSave{ font-size:24px;cursor:pointer;margin-right:5px;margin-bottom:4px;color:#FFF; } .zhm_set_page{ z-index:1000000003; position:absolute; top:0px;left:300px; background:#fff; width:300px; height:100%; } .zhm_set_page_header{ border-bottom:1px solid #ccc; height:40px; line-height:40px; display: flex; justify-content: space-between; align-items: center; background-color:#fe6d73; color:#fff; font-size: 15px; } .zhm_set_page_content{ display: flex !important;justify-content: space-between;align-items: center; } .zhm_set_page_list{ margin:0px;padding:0px; } .zhm_set_page_list li{ /*border-bottom:1px solid #ccc;*/ padding:12px 20px; display:block; border-bottom:1px solid #eee; } /*-form-*/ :root { --base-color: #434a56; --white-color-primary: #f7f8f8; --white-color-secondary: #fefefe; --gray-color-primary: #c2c2c2; --gray-color-secondary: #c2c2c2; --gray-color-tertiary: #676f79; --active-color: #227c9d; --valid-color: #c2c2c2; --invalid-color: #f72f47; --invalid-icon: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M13.41%2012l4.3-4.29a1%201%200%201%200-1.42-1.42L12%2010.59l-4.29-4.3a1%201%200%200%200-1.42%201.42l4.3%204.29-4.3%204.29a1%201%200%200%200%200%201.42%201%201%200%200%200%201.42%200l4.29-4.3%204.29%204.3a1%201%200%200%200%201.42%200%201%201%200%200%200%200-1.42z%22%20fill%3D%22%23f72f47%22%20%2F%3E%3C%2Fsvg%3E"); } .text-input { font-size: 16px; position: relative; right:0px; z-index: 0; } .text-input__body { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 3px; height: 1.7em; line-height: 1.7; overflow: hidden; padding: 2px 1em; text-overflow: ellipsis; transition: background-color 0.3s; width:55%; font-size:14px; } .text-input__body:-ms-input-placeholder { color: var(--gray-color-secondary); } .text-input__body::-moz-placeholder { color: var(--gray-color-secondary); } .text-input__body::placeholder { color: var(--gray-color-secondary); } *, ::after, ::before { box-sizing: initial !important; } .text-input__body[data-is-valid] { padding-right: 1em; } .text-input__body[data-is-valid=true] { border-color: var(--valid-color); } .text-input__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .text-input__body:focus { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .text-input__body:-webkit-autofill { transition-delay: 9999s; -webkit-transition-property: background-color; transition-property: background-color; } .text-input__validator { background-position: right 0.5em center; background-repeat: no-repeat; background-size: 1.5em; display: inline-block; height: 100%; left: 0; position: absolute; top: 0; width: 100%; z-index: -1; } .text-input__body[data-is-valid=false] + .text-input__validator { background-image: var(--invalid-icon); } .select-box { box-sizing: inherit; font-size: 16px; position: relative; transition: background-color 0.5s ease-out; width:90px; } .select-box::after { border-color: var(--gray-color-secondary) transparent transparent transparent; border-style: solid; border-width: 6px 4px 0; bottom: 0; content: ""; display: inline-block; height: 0; margin: auto 0; pointer-events: none; position: absolute; right: -72px; top: 0; width: 0; z-index: 1; } .select-box__body { box-sizing: inherit; -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 3px; cursor: pointer; height: 1.7em; line-height: 1.7; padding-left: 1em; padding-right: calc(1em + 16px); width: 140%; font-size:14px; padding-top:2px; padding-bottom:2px; } .select-box__body[data-is-valid=true] { border-color: var(--valid-color); box-shadow: inset 0 0 0 1px var(--valid-color); } .select-box__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .select-box__body.focus-visible { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .select-box__body:-webkit-autofill { transition-delay: 9999s; -webkit-transition-property: background-color; transition-property: background-color; } .textarea__body { -webkit-appearance: none; -moz-appearance: none; appearance: none; background-color: transparent; border: 1px solid var(--gray-color-primary); border-radius: 0; box-sizing: border-box; font: inherit; left: 0; letter-spacing: inherit; overflow: hidden; padding: 1em; position: absolute; resize: none; top: 0; transition: background-color 0.5s ease-out; width: 100%; } .textarea__body:only-child { position: relative; resize: vertical; } .textarea__body:focus { border-color: var(--active-color); box-shadow: inset 0 0 0 1px var(--active-color); outline: none; } .textarea__body[data-is-valid=true] { border-color: var(--valid-color); box-shadow: inset 0 0 0 1px var(--valid-color); } .textarea__body[data-is-valid=false] { border-color: var(--invalid-color); box-shadow: inset 0 0 0 1px var(--invalid-color); } .textarea ._dummy-box { border: 1px solid; box-sizing: border-box; min-height: 240px; overflow: hidden; overflow-wrap: break-word; padding: 1em; visibility: hidden; white-space: pre-wrap; word-wrap: break-word; } .toLeftMove{ nimation:moveToLeft 0.5s infinite; -webkit-animation:moveToLeft 0.5s infinite; /*Safari and Chrome*/ animation-iteration-count:1; animation-fill-mode: forwards; } @keyframes moveToLeft{ from {left:200px;} to {left:0px;} } @-webkit-keyframes moveToLeft /*Safari and Chrome*/{ from {left:200px;} to {left:0px;} } .toRightMove{ nimation:moveToRight 2s infinite; -webkit-animation:moveToRight 2s infinite; /*Safari and Chrome*/ animation-iteration-count:1; animation-fill-mode: forwards; } @keyframes moveToRight{ from {left:0px;} to {left:2000px;} } @-webkit-keyframes moveToRight /*Safari and Chrome*/{ from {left:0px;} to {left:200px;} } `; domStyle .appendChild(document.createTextNode(menuSetStyle)); domHead.appendChild(domStyle); var setListJson = [ {'optionName':lang.taobaoCoupon,'optionID':'taobaoCoupon','default':taobaoCoupon}, {'optionName':lang.jingdongCoupon,'optionID':'jingdongCoupon','default':jingdongCoupon}, {'optionName':lang.showTaotaoGoods,'optionID':'showTaotaoGoods','default':showTaotaoGoods}, ]; var setHtml = "<div id='setMask' class='zhmMask'></div>"; setHtml +="<div class='wrap-box' id='setWrap'>"; setHtml +="<ul class='iconSetUlHead'><li class='iconSetPageHead'><span></span><span>"+lang.coupon+"</span><span class='iconSetSave'>×</span></li></ul>"; setHtml +="<ul class='setWrapLi'>"; for(var setN=0;setN<setListJson.length;setN++){ var listValue = GM_getValue(setListJson[setN].optionID,'22'); let backColor,arrowColor,switchBackCorlor; if(listValue != 22){ backColor = '#fff'; arrowColor= '#EEE'; switchBackCorlor = '#FFF'; }else{ backColor = '#fe6d73'; arrowColor = '#CCC'; switchBackCorlor = '#FFE5E5'; } if(setListJson[setN].optionID == ''){ arrowColor = '#EEE'; }; setHtml +="<li><span>"+setListJson[setN].optionName+"</span>"; setHtml +="<div class='setWrapLiContent'>"; setHtml +="<div class='circular' id='"+setListJson[setN].optionID+"' style='background-color: "+switchBackCorlor+";'><div class='round-button' style='background: "+backColor+";left: "+listValue+"px'></div></div>"; setHtml +="</div></li>"; } setHtml +="</ul>"; setHtml +="<div style='height:40px;'></div>"; setHtml +="<div class='iconSetFoot' style=''>"; setHtml +="<ul class='iconSetFootLi'>"; setHtml +="<li><a href='https://t.me/+sGo6ZZvy54wzYTll' target='_blank'>"+lang.tggroup+"</a></li>"; setHtml +='</ul>'; setHtml +='</div>'; setHtml += "</div>"; if(document.querySelector('#setMask')) return; this.createElement('div','zhmMenu'); let zhmMenu = document.getElementById('zhmMenu'); zhmMenu.innerHTML = setHtml; let timerZhmIcon = setInterval(function(){ if (document.querySelector('#zhmMenu')){ clearInterval(timerZhmIcon); let circular = document.querySelectorAll('.circular'); circular.forEach(function(item){ item.addEventListener('click', function(e){ let buttonStyle = item.children[0].style; let left = buttonStyle.left; left = parseInt(left); let listLeftValue; if(left==0){ buttonStyle.left = '22px'; buttonStyle.background = '#fe6d73'; item.style.background='#ffE5E5'; if(item.nextSibling && item.nextSibling.getAttribute('data')){ item.nextSibling.setAttribute('style','border: solid #ccc;border-width: 0 3px 3px 0;') } listLeftValue = 22; }else{ buttonStyle.left = '0px'; buttonStyle.background = '#fff'; item.style.background='#fff'; if(item.nextSibling){ item.nextSibling.setAttribute('style','border: solid #EEE;border-width: 0 3px 3px 0;') } listLeftValue = 0; } let setListID = item.id; GM_setValue(setListID,listLeftValue); }) }); document.querySelector('.iconSetSave').addEventListener('click',()=>{ location.reload(); }) } }) } couponStyle(){ var couponStyle =` html{ --right:100%; --left:100%; } .${this.className.zhm_coupon}{ width:fit-content; display: flex; flex-direction:row; justify-content: space-between; align-items:flex-start; font-size:14px; position: relative; margin-bottom:15px; } .${this.className.zhm_left}{ display: flex; flex-direction:row; justify-content:flex-start; align-items: center; font-size:14px; background: radial-gradient(circle at right top, transparent 8px,#fff 0) top left /var(--right) 51% no-repeat, radial-gradient(circle at right bottom, transparent 8px, #fff 0) bottom left /var(--right) 51% no-repeat; filter: drop-shadow(2px 2px 3px #888); height:84px; width:100%; } .${this.className.zhm_img_icon}{ padding:4px 0px 0px 5px; margin-right:5px; } .${this.className.zhm_img_icon} img{ width:47px; } .${this.className.zhm_content}{ display: flex; flex-direction:column; margin-right: 18px; } .${this.className.zhm_money}{ display: flex; flex-direction:row; justify-content: flex-start; align-items: center; } .${this.className.zhm_amount_money}{ display: flex; align-items: flex-start; } .${this.className.zhm_money_sign}{ color:#f23030; font-size: 20px; font-family: Arial; } .${this.className.zhm_money_num}{ color:#f23030; font-size:36px; margin-left: 2px; } .${this.className.zhm_condition}{ color:#fb0f3a; background-color: #fff4ec; margin-top:5px; margin-left: 5px; padding:2px 5px; font-size:12px; } .${this.className.zhm_time}{ display: flex; flex-direction:row; margin-top: -5px; padding:2px 4px; } .${this.className.zhm_term}{ color:#fb0f3a; border: 1px solid #fb0f3a; border-radius:2px; align-items: center; padding:0px 4px; font-size:12px; height: 18px; } .${this.className.zhm_date}{ font-size: 14px; font-weight: 500; padding-left:8px; } .${this.className.zhm_circle}{ background: #fb0f3a url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAAAsSAAALEgHS3X78AAAAzUlEQVQYlS3NMUoDQRiG4Xcmu9lAXBQbq+1CCqucwsbOO3gAS29h4Qm8gRdIMKVglQVBFiSFjYKBqWZ2d/7PIvYPPE6SMCHvcD8HuLzBUsIKDyY8AN4RU+J9/8nH8oLYJ3wWchxBjJHtZkN1fsbp9omvhzv6ccDjQJLatlXXdZIk5awkKVzdKk9W8gBFUVDXNQA2jJTA7GSOmR2LpmkIIWA546spvO5wL29Qz3GSBBCHnnwIzO4f0fMaYoKy/Acm8A6+fxkX15ANqimY8QemCm920r1aUAAAAABJRU5ErkJggg==) repeat-y; margin-top:10px; width: 10px; height:66px; position: absolute; right:97px; z-index:2; filter:none; } .${this.className.zhm_link_coupon}{ display: flex; flex-direction:row; align-items:center; filter: drop-shadow(2px 2px 3px #888); background: radial-gradient(circle at left top, transparent 8px, #fb053a 0) top right /var(--left) 50% no-repeat, radial-gradient(circle at left bottom, transparent 8px, #fb053a 0) bottom right /var(--left) 50% no-repeat; height: 84px; padding:0px 6px 0px 4px; } .${this.className.zhm_get_link_text}{ cursor:pointer; margin-top: 0px; writing-mode:vertical-lr; letter-spacing:0px; color: #fff !important; font-size:14px; font-family:"Microsoft YaHei"; text-decoration:none; background: radial-gradient(circle at left top, transparent 8px, #fb053a 0) top right /var(--left) 50% no-repeat, radial-gradient(circle at left bottom, transparent 8px, #fb053a 0) bottom right /var(--left) 50% no-repeat; } .${this.className.zhm_get_link_text}:hover{ text-decoration:none; font-weight:800; font-family:"Microsoft YaHei"; } .${this.className.zhm_qrcode}{ border:3px solid #fff; } #${this.className.positionQrcode}{ position: fixed; bottom: 0px; z-index: 21474836478; padding: 4px; background-color: #f6f6f6; border-radius: 3px; -webkit-box-shadow: 0px 10px 39px 10px rgba(52, 53, 53, 0.22); -moz-box-shadow: 0px 10px 39px 10px rgba(52, 53, 53, 0.22); box-shadow: 0px 10px 39px 10px rgba(52, 53, 53, 0.22); } .${this.className.positionQrcodeHead}{ font-size:12px; color:#ff0000; font-weight:bold; margin-bottom:4px; margin-bottom:8px; text-align:center; } .${this.className.positionQrcodeBody}{ border:1px solid #f3f3f3; border-radius: 5px; background-color:#fff; padding:5px; margin:0px auto; } .${this.className.keywordSearch}{ position:fixed; bottom:0px; left:0px; font-family: "Microsoft YaHei", tahoma, arial, SimSun; z-index:21474836478; display: flex; /*height:355px;*/ flex-direction:column-reverse } .${this.className.keywordSearch} a:hover{ text-decoration: none; } .${this.className.keywordNav}{ display: flex; border: 1px solid rgb(237, 241, 242); box-shadow: rgb(233, 233, 233) 0px 0px 5px 0px; background-color:#fff; } .${this.className.keywordNavLi}{ list-style: none; text-align: center; border-left:1px solid #eee; display: flex; align-items:center; margin-top:4px; } .${this.className.keywordNavLiIcon}{ width:16px;height:16px; margin-right:5px; margin-bottom:2px; } .${this.className.keywordNavLi} a { display: block; text-decoration: none; font-weight: 400; color: #333333; padding: 12px 20px; font-size:14px; line-height:14px; } .${this.className.keywordNavLi} a.${this.className.keywordNavLiActive} { background-color: #fb053a; color: #fff; text-decoration: none; } .${this.className.keywordGoodsList}{ padding: 10px; position:absolute; bottom:45px; left:0px; z-index: 9; display:none; box-shadow: rgb(233, 233, 233) 0px 0px 8px 0px; border: 3px solid rgb(237, 241, 242); background-color:#FFF; } .${this.className.keywordGoodsUl}{ display: flex; } .${this.className.keywordGoodsUl} a:hover{ text-decoration: none; } .${this.className.goodsList}{ margin:0 10px; width:240px; list-style: none; } .${this.className.goodsListWaiting}{ line-height:50px; padding:40px; font-weight:600; font-size:16px; display:flex; justify-content: center; font-weight:400; font-size:14px; } .${this.className.waitingIcon}{ widht:36px; height:36px; position:relative; top:6px; } .${this.className.goodsImg}{ width: 160px; height:160px; } .${this.className.goodsSgin}{ font-weight: 400; font-size:14px; margin-right:2px; } .${this.className.goodsPrice}{ font-size: 20px; color: #fb053a; font-weight: 700; margin:18px auto 10px; } .${this.className.goodsDiscountPrice}{ margin-left:5px; font-size:12px;color:#999; font-weight: 400; } .${this.className.goodsTitle}{ height:60px; line-height:30px; overflow: hidden; color: rgb(51, 51, 51); font-weight: 700; font-size:14px; } .${this.className.goodsTitle}:hover{ color: #fb053a; } .${this.className.keywordGoodsListActive}{ display:block; } .${this.className.keywordCoupon}{ background: -webkit-linear-gradient(left, #fb053a, #fb053a); background: -o-linear-gradient(left, #fb053a, #fb053a); background: -moz-linear-gradient(left, #fb053a, #fb053a); line-height: 40px; display: flex; flex-direction: row; box-shadow: rgb(233, 233, 233) 0px 0px 8px 0px; border-radius: 5px; border:2px solid #fff; margin-top:4px; } .${this.className.keywordCouponLeft}{ flex: 1; color: white; font-size: 14px; position: relative; padding: 0 20px 0 5px; background-image: radial-gradient(circle at right top, #fff, #fff 3px, transparent 3px), radial-gradient(circle at right bottom, #fff, #fff 3px, transparent 3px); display: flex; } .${this.className.keywordCouponRight}{ color: white; border: none; padding: 0 20px; background-image: radial-gradient(circle at left top, #fff, #fff 3px, transparent 3px), radial-gradient(circle at left bottom, #fff, #fff 3px, transparent 3px); font-size:18px; font-weight:600; } @keyframes zhmloadingcssiconunit { 0% { opacity: 1 } 100% { opacity: 0 } } .zhmloadingcssiconunit div { left: 47px; top: 24px; position: absolute; animation: zhmloadingcssiconunit linear 1s infinite; background: #fe718d; width: 6px; height: 12px; border-radius: 3px / 6px; transform-origin: 3px 26px; }.zhmloadingcssiconunit div:nth-child(1) { transform: rotate(0deg); animation-delay: -0.9166666666666666s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(2) { transform: rotate(30deg); animation-delay: -0.8333333333333334s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(3) { transform: rotate(60deg); animation-delay: -0.75s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(4) { transform: rotate(90deg); animation-delay: -0.6666666666666666s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(5) { transform: rotate(120deg); animation-delay: -0.5833333333333334s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(6) { transform: rotate(150deg); animation-delay: -0.5s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(7) { transform: rotate(180deg); animation-delay: -0.4166666666666667s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(8) { transform: rotate(210deg); animation-delay: -0.3333333333333333s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(9) { transform: rotate(240deg); animation-delay: -0.25s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(10) { transform: rotate(270deg); animation-delay: -0.16666666666666666s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(11) { transform: rotate(300deg); animation-delay: -0.08333333333333333s; background: #fe718d; }.zhmloadingcssiconunit div:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; background: #fe718d; } .zhmLoadingCssIcon { width: 40px; height: 40px; display: inline-block; overflow: hidden; background: #ffffff; } .zhmloadingcssiconunit { width: 100%; height: 100%; position: relative; transform: translateZ(0) scale(0.4); backface-visibility: hidden; transform-origin: 0 0; /* see note above */ } .zhmloadingcssiconunit div { box-sizing: content-box; } `; domStyle .appendChild(document.createTextNode(couponStyle)); domHead.appendChild(domStyle); } taobao(){ this.goods_id = this.getQueryString('id'); this.getTitleShop('taobao'); this.keywordSearch(); } tmall(){ this.goods_id = this.getQueryString('id'); this.getTitleShop('tmall'); this.keywordSearch(); } tmallCaoshi(){ this.goods_id = this.getQueryString('id'); this.getTitleShop('tmallcaoshi'); this.keywordSearch(); } tmallHk(){ this.goods_id = this.getQueryString('id'); this.getTitleShop('tmallhk'); this.keywordSearch(); } jd(){ var _this = this; var jdGoodsId = location.href.match(/jd\.(hk|com)\/(\S*)\.html/); this.goods_id = jdGoodsId[2]; var insertCouponDom; var qrcodeDom; (async function(){ let skuName = await BaseClass.getElement('.sku-name'); _this.goods_title = skuName.innerText; let shopName = document.querySelector('.name>a'); let shop_name = shopName?shopName.innerText:''; let cssObj = await _this.getCssData('jd'); for(let i=0;i<cssObj.insertCoupon.length;i++){ if(document.querySelector(cssObj.insertCoupon[i])){ insertCouponDom = document.querySelector(cssObj.insertCoupon[i]); insertCouponDom.before(_this.divElement); break; } } for(let i=0;i<cssObj.qrcode.length;i++){ if(document.querySelector(cssObj.qrcode[i])){ qrcodeDom = document.querySelector(cssObj.qrcode[i]); break; } } if(!insertCouponDom && !qrcodeDom){ console.log('未获取插入结点和二维码结点'); return; } let couponDataInfo = GM_getValue('couponDataInfo',[]); if(couponDataInfo.length>0){ let dataReally = []; for(let i =0; i < couponDataInfo.length; i++){ if(new Date().getTime()-couponDataInfo[i].addTime < 3600*1000){ dataReally.push(couponDataInfo[i]); } } GM_setValue('couponDataInfo',dataReally); couponDataInfo = dataReally; } let couponDataResult = {data:[],type:1}; if(couponDataInfo.length>0){ for(let i =0;i<couponDataInfo.length;i++){ if(couponDataInfo[i].goodsId == _this.goods_id ){ couponDataResult.data.push(couponDataInfo[i]); } } } if(couponDataResult.data.length == 0){ let apiUrl = `https://api.typechrome.com/goods_title_jd.php?goods_id=${_this.goods_id}&goods_title=${encodeURIComponent(_this.goods_title)}&shop_name=${encodeURIComponent(shop_name)}`; let result = await _this.request('get',apiUrl); if(result){ let jsonObj = JSON.parse(result); if(jsonObj[0]){ couponDataResult.data = jsonObj; couponDataResult.type = 2; }else{ console.log(jsonObj); return; } }else{ console.log('服务端错误'); return; } } console.log(couponDataResult); let couponData = couponDataInfo.length > 0? couponDataInfo:[]; if(couponDataResult.type == 2){ if(couponData.length==0){ couponDataResult.data.forEach(function(item,ikey){ item.goodsId = _this.goods_id; item.addTime = new Date().getTime(); couponData.push(item); }) }else{ for(let a=0;a<couponDataResult.data.length;a++){ for(let i=0;i<couponData.length;i++){ if(couponDataResult.data[a].status == 1 && couponDataResult.data[a].goods_id == couponData[i].goods_id && couponDataResult.data[a].quota == couponData[i].quota && couponDataResult.data[a].discount == couponData[i].discount && couponDataResult.data[a].endTime == couponData[i].endTime){ continue; }else if(couponDataResult.data[a].status > 1 && couponDataResult.data[a].goods_id == couponData[i].goods_id){ continue; }else{ couponDataResult.data[a].goodsId = _this.goods_id; couponDataResult.data[a].addTime = new Date().getTime(); couponData.push(couponDataResult.data[a]); break; } } } } console.log(couponData); GM_setValue('couponDataInfo',couponData); } switch(couponDataResult.data[0].status){ case 1: var max = couponDataResult.data[0].discount; var index = 0; for(let i=0;i<couponDataResult.data.length;i++){ let cur = couponDataResult.data[i].discount; if(cur > max){ max = cur; index = i; }; } _this.coupon_info.amount = couponDataResult.data[index].discount; _this.coupon_info.link = couponDataResult.data[index].coupon_link_short; if(qrcodeDom){ _this.jdQrcode(qrcodeDom,couponDataResult.data[index].coupon_link_short); } if(!insertCouponDom)return; break; case 2: if(qrcodeDom){ _this.jdQrcode(qrcodeDom,couponDataResult.data[0].coupon_link_short); } _this.positionQrcode(couponDataResult.data[0].coupon_link_short,'京东APP扫码更优惠'); return; break; case 3: console.log('no coupon and link'); return; break; default: console.log('无状态或状态不正确'); return; } let html=''; couponDataResult.data.forEach(function(item,ikey){ html += `<a id='${_this.className.jdCouponLink}${ikey}' href="${item.coupon_link_short}" target='_blank' rel='noopener noreferrer nofollow'></a> <div class="${_this.className.zhm_coupon}" style="margin-left:10px;"> <div class="${_this.className.zhm_left}"> <div class="${_this.className.zhm_img_icon}"> <img src="data:image/gif;base64,R0lGODlhZABkAHj/ACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJLAH/ACwAAAAAZABkAKf6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDr6BTr6BTr6B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w4M+8ZA5vpEaCGhSGD9nWRmEoMi5VwZIzEiit2dgkh4esEtQgkkHBBc8h6CCkJG/5mQz6THMO+aNI6ucQd2iwXNAUSj9q9S8eSlJmBylHrtDkwIPcQ2mjGaVA+EG62JiDQNzooEDywbomFY8gSf7bTGe4WRDw8K0z/nAeN6yRDWh5RB3bcBMwtvHIv10zZw6Bx4mcEU+HgDFh+ksaXXrxMMTZbUel6qRBkhkpbvCzn+kgWUJAmTEbEmR83RpLN/SHkHVQKUXO4J0/g6POjjyxSbN8Kf5EIoystMVYuYjZSf/Bs1JZ4x4ouZvHvFgQehpQjA9BC4cwkk2DhMYmwqBkR2RTJRaehU7Gssap9oHOYxnxIT81o0cMI8Cg1lRQavEMQtBhjWQkQ4ZhAx1YmWmwwonuaP0Ek1+z4UmBzAMdltpI7n6JyYj2jzQbuQdkuyoU3ID1GlgChmhHS9rSYqVK2gjohB4yWS25VlcuXf5tQgT72toWsqGyPUgkbeujY9wztwUZJG9dy0HgZjV0ujmGcpfL3OYew1NzXKpxB8LSupDjG+HIrna3m91vlCOU2ZDudP9R3a6cMTC5CO94EVLeviUFvepdr0Haq1eHcCW94p0uff123/jKlyD0Pa/o8mvc9m5DHkt0h4IXzOD8yKNneCMwcNt7IL9a+MIYXhChJJzbeoRyuCny739b9WEQ/1K1IxZIZkxspcikmCDlaCOLv4XFFw+kQtnw1DGuYVrShskm2qCpjclhrWPIizlFPrKNCfIyQkH1IGPjSzmXTOJmcaOJ9dgGalFM5YGUEqzZKAc+RnQPcvBYgD2lsjlW02UN5bY5xIhdMjr699po1LjLBxGHMrW0SzzjslhaUhQv/VwQdoA0RcCg6JQJHRtNKbNFHv1MQAAAIf4VTWFkZSB3aXRoIFNjcmVlblRvR2lmADs=" > </div> <div class="${_this.className.zhm_content}"> <div class="${_this.className.zhm_money}" style='margin-top:7px;'> <div class="${_this.className.zhm_amount_money}"> <div class="${_this.className.zhm_money_sign}" style='margin-top:-10px;'>¥</div> <div class="${_this.className.zhm_money_num}">${item.discount}</div> </div> <div class="${_this.className.zhm_condition}">满${item.quota}元可用</div> </div> <div class="${_this.className.zhm_time}" style='margin-top:10px;'> <div class="${_this.className.zhm_term}">有效期</div> <div class="${_this.className.zhm_date}">${item.endTime}</div> </div> </div> </div> <div class="${_this.className.zhm_circle}" style="right:44px;"></div> <div class="${_this.className.zhm_link_coupon}" style="padding:0px 16px 0px 16px;"> <a class="${_this.className.zhm_get_link_text}" style="letter-spacing: 10px;font-size:16px;margin-top:10px;" style="margin-left:16px;width:34px;">领取</a> </div> </div> ` }); document.getElementById(_this.className.zhm_div_s).innerHTML = html; let couponWidth = document.querySelector('.'+_this.className.zhm_coupon).offsetWidth; for(let i=0;i<couponDataResult.data.length;i++){ let jdCouponLinkDom = document.querySelector('#'+_this.className.jdCouponLink+i); jdCouponLinkDom.style = `position:absolute;left:10px;z-index:${i+1};width:${couponWidth}px;height:80px;`; } let summaryQuan = document.querySelector('#summary-quan'); if(summaryQuan){ summaryQuan.parentNode.removeChild(summaryQuan); } let quanHtml = ` <div class="dt">优 惠 券</div> <div class="dd"> <dl> <dt class="fl"></dt> <dd class="lh"> <div class="J-open-tb" href="javascrit:void(0)" style="margin-top:-10px;"> `; couponDataResult.data.forEach(function(item){ quanHtml +=` <span class="quan-item" style="margin-top:10px"><s></s><b></b> <span class="text"><a href="${item.coupon_link_short}" target='_blank' rel='noopener noreferrer nofollow' style='color:#df3033;'>满${item.quota}减${item.discount}</a></span> </span> `; }) quanHtml += `</div></dd></dl></div>`; let divElement = document.createElement("div"); divElement.id='summary-quan'; divElement.className = 'li p-choose hide'; divElement.setAttribute('clstag','shangpin|keycount|product|lingquan'); divElement.innerHTML = quanHtml; let summaryInfo = document.querySelector('.summary-info'); summaryInfo.after(divElement); _this.edgeLengthRight = 40; _this.positionQrcode(couponDataResult.data[0].coupon_link_short,'京东APP扫码领券'); })() this.keywordSearch(); } vip(){ var _this = this; (async function(){ let skuName = await BaseClass.getElement('.pib-title-detail'); _this.goods_title = skuName.innerText; _this.keywordSearch(); })() } getCouponInfo(titleStr,shopStr,insertCouponDom){ var _this = this; insertCouponDom.before(this.divElement); (async function(){ let url = `https://api.typechrome.com/tb_coupon.php?goods_id=${_this.goods_id}&goods_title=${encodeURIComponent(titleStr)}&shop_name=${encodeURIComponent(shopStr)}`; console.log(url) let GMValuePrefix = 'tbCoupon'; let couponData = await _this.getCouponData(GMValuePrefix,url); if(!couponData)return; switch(couponData.data.status){ case 1: _this.tbCouponHtml(couponData); break; case 2: _this.positionQrcode(couponData.data.code_url,'淘宝/天猫APP扫码更优惠'); return; break; case 3: console.log('no coupon and link'); return; break; default: console.log('无状态或状态不正确'); return; } })() } getTitleShop(website){ var _this = this; (async function(){ let titleStr,shopStr,insertCouponDom; let cssObj = await _this.getCssData(website); if(cssObj){ titleStr = await _this.asyncLoop(cssObj.title); if(!titleStr){ console.log('未获取标题'); return; } _this.goods_title = titleStr; if(cssObj.shop.length>0){ for(let i=0;i<cssObj.shop.length;i++){ if(document.querySelector(cssObj.shop[i])){ shopStr = document.querySelector(cssObj.shop[i]).innerText; if(shopStr === undefined){ shopStr = ''; } break; } } }else{ shopStr = ''; } for(let i=0;i<cssObj.insertCoupon.length;i++){ if(document.querySelector(cssObj.insertCoupon[i])){ insertCouponDom = document.querySelector(cssObj.insertCoupon[i]); break; } } if(!insertCouponDom){ console.log('未获取插入结点'); return; } _this.getCouponInfo(titleStr,shopStr,insertCouponDom); }else{ console.log(cssObj); } })() } taobaoCouponStyle(resp){ let otherDiscount = document.querySelector('#J_OtherDiscount'); if(!otherDiscount){ console.log('没找到在当前页面优惠券区'); return; }; let couponHtml = ` <img class="tb-coupon-icon" src="//img.alicdn.com/tps/TB1xlnONpXXXXa9aXXXXXXXXXXX-80-16.png"> ${resp.youhuiquan}元店铺优惠券,${resp.coupon_info} <a class="J_coupon" href="#" onclick="window.open('https://api.typechrome.com/code.php?link=${resp.code_url}')">领取</a> `; let tbCoupon = otherDiscount.querySelectorAll('.tb-coupon'); if(tbCoupon.length>0){ let tbCouponImgDom = tbCoupon[0].querySelector('img'); let imgSrc = tbCouponImgDom.src?tbCouponImgDom.src:'//img.alicdn.com/tps/TB1xlnONpXXXXa9aXXXXXXXXXXX-80-16.png'; let getCouponDom = tbCoupon[0].cloneNode(true); getCouponDom.innerHTML = couponHtml; getCouponDom.querySelector('img').setAttribute('src',imgSrc); tbCoupon[0].before(getCouponDom); }else{ let otherDiscoun = document.querySelector('#J_OtherDiscount'); if(otherDiscoun){ let tbOtherDiscount = otherDiscoun.querySelector('.tb-other-discount'); tbOtherDiscount.innerHTML = `<div class="tb-other-discount-content tb-other-discount-split"><div class="tb-coupon">${couponHtml}</div></div>`; otherDiscoun.className='tb-clear'; }else{ } } } jdQrcode(qrcodeDom,url){ var _this = this; (async function(){ qrcodeDom.id = _this.className.jdqrcode; let qrcodeDomClassName = qrcodeDom.className.split(' '); console.log(qrcodeDomClassName); let qrcodeImgDom = await BaseClass.getElement('.'+qrcodeDomClassName[0]+' img'); qrcodeImgDom.parentNode.removeChild(qrcodeImgDom); var qrcode = new QRCode(_this.className.jdqrcode, { width: 80, height: 80, colorDark : "#121212", colorLight : "#ffffff", correctLevel : QRCode.CorrectLevel.M }); qrcode.makeCode(url); qrcodeDom.className = qrcodeDomClassName[1]; })() } asyncLoop(data,duration=2000){ return new Promise((resolve,reject)=>{ let n=0; let timer = setInterval(function(){ n++; for(let i=0;i<data.length;i++){ let dom = document.querySelector(data[i]); if(dom && dom.innerText){ clearInterval(timer); resolve(dom.innerText); break; } } if(n == duration){ clearInterval(timer); resolve(false); } },100) }) } getCssData(website){ var _this = this; return new Promise((resolve,reject)=>{ (async function(){ let cssData = GM_getValue(_this.GMSaveData,false); if(cssData && new Date().getTime() - cssData.addTime > 3600*1000){ GM_deleteValue(_this.GMSaveData); cssData = false; } console.log('css数据:',cssData); if(!cssData){ let url = `https://api.typechrome.com/getCss.php`; let result = await _this.request('get',url); let cssDataObj = JSON.parse(result); cssDataObj.addTime = new Date().getTime(); GM_setValue(_this.GMSaveData,cssDataObj); resolve(cssDataObj[website]); }else{ resolve(cssData[website]); } })() }) } taobaoSearch(item){ let timer = setInterval(function(){ let dom = document.querySelector('#selectTb'); if(!dom){ let selectsDom =document.querySelector('.next-checkbox-group'); if(selectsDom){ let labels = selectsDom.querySelectorAll('label'); labels.forEach(function(item){ let itemText = item.querySelector('span:last-child').innerText; if(itemText=='天猫'){ let tbLabels = item.cloneNode(true); tbLabels.setAttribute('id','selectTb'); let inputDom = tbLabels.querySelector('span:first-child > input'); inputDom.value='service:taobao'; tbLabels.querySelector('.next-checkbox-label').innerText='淘宝'; let insertDom = selectsDom.querySelector('label:nth-of-type(2)'); insertDom.before(tbLabels); tbLabels.addEventListener('click',selectTaobao); tbLabels.querySelector('.next-checkbox-label').addEventListener('click',function(e){ e.stopPropagation(); }) } }) } }else{ if(dom.className == 'next-checkbox-wrapper checked '){ showTbPage(); } } }) function selectTaobao(e){ let parentDom = e.target.parentNode; if(parentDom.className =='next-checkbox' && parentDom.parentNode.className == 'next-checkbox-wrapper '){ parentDom.parentNode.className='next-checkbox-wrapper checked '; showTbPage(); return; }else{ parentDom.parentNode.className='next-checkbox-wrapper '; let items = document.querySelectorAll('.Content--contentInner--QVTcU0M > div > a'); items.forEach(function(item){ item.parentNode.style='display:block'; }); } } function showTbPage(){ let items = document.querySelectorAll('.Content--contentInner--QVTcU0M > div > a'); items.forEach(function(item){ if(!item.href.match(/^https:\/\/item\.taobao\.com/)){ item.parentNode.style='display:none'; } }); } } positionQrcode(url,title){ var _this = this; let positionDivDom = document.createElement('div'); positionDivDom.id = this.className.positionQrcode; positionDivDom.style = 'right:'+_this.edgeLengthRight+'px'; let html = `<div class='${this.className.positionQrcodeHead}'>${title}</div>`; html += `<div class='${this.className.positionQrcodeBody}' id='${this.className.positionQrcodeImg}'></div>`; positionDivDom.innerHTML = html; document.body.appendChild(positionDivDom); _this.createQrcode(_this.className.positionQrcodeImg,url,142); let n=0; let timer = setInterval(function(){ let nextDom = positionDivDom?positionDivDom.nextElementSibling:false; let position = nextDom?(nextDom.style?(nextDom.style.position?nextDom.style.position:false):false):false; let bottom = nextDom?(nextDom.style?(nextDom.style.bottom?nextDom.style.bottom:false):false):false; let bottomValue = bottom?(bottom.match(/\d{1,4}/)?bottom.match(/\d{1,4}/):[0]):[0]; if(position && position=='fixed' && bottomValue[0] && parseInt(bottomValue[0]) < 180){ nextDom.style.display ='none'; } positionDivDom = nextDom?nextDom:positionDivDom; if(n==500){ clearInterval(timer); } n++; },10) } createQrcode(id,url,edgeLength){ var qrcode = new QRCode(id,{ width: edgeLength, height: edgeLength, colorDark : "#121212", colorLight : "#ffffff", correctLevel : QRCode.CorrectLevel.M }); qrcode.makeCode(url); } getCouponData(GMPrefix,url){ var _this = this; return new Promise((resolve,reject)=>{ (async function(){ let GMValue = GM_listValues(); if(GMValue.length>0){ GMValue.forEach(function(item){ if(item.startsWith(GMPrefix)){ let info = GM_getValue(item,false); if(info && new Date().getTime() - info.addTime > 3600*1000){ GM_deleteValue(item); } } }) } let GMValueName = GMPrefix+'_'+_this.goods_id; let info = GM_getValue(GMValueName,false); console.log('GM中数据:',info); if(!info){ let result = await _this.request('get',url); let data = JSON.parse(result); if(data.code==200){ data.addTime = new Date().getTime(); GM_setValue(GMValueName,data); resolve(data); }else{ console.log('服务端错误:',data); resolve(false) } }else{ resolve(info); } })() }) } tbCouponHtml(resp){ var _this = this; if(resp.code==200){ _this.coupon_info.amount = resp.data.youhuiquan; _this.coupon_info.link = `https://api.typechrome.com/code.php?link=${resp.data.code_url}`; let html = ` <div class="${_this.className.zhm_coupon}" onclick="window.open('https://api.typechrome.com/code.php?link=${resp.data.code_url}')" style='cursor:pointer'> <div class="${_this.className.zhm_left}"> <div class="${_this.className.zhm_img_icon}"> <img src="data:image/gif;base64,R0lGODlhZABkAHj/ACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJLAH/ACwAAAAAZABkAKf6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDn6BDn6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xB5nGskMzSIOvtmlN98w4M+8ZA5vpEaCGhSGD9nWRmEoMi5VwZIzEiit2dgkh4esEtQgkkHBBc8h6CCkJG/5mQz6THMO+aNI6ucQd2iwXNAUSj9q9S8eSlJmBylHrtDkwIPcQ2mjGaVA+EG62JiDQNzooEDywbomFY8gSf7bTGe4WRDw8K0z/nAeN6yRDWh5RB3bcBMwtvHIv10zZw6Bx4mcEU+HgDFh+ksaXXrxMMTZbUel6qRBkhkpbvCzn+kgWUJAmTEbEmR83RpLN/SHkHVQKUXO4J0/g6POjjyxSbN8Kf5EIoystMVYuYjZSf/Bs1JZ4x4ouZvHvFgQehpQjA9BC4cwkk2DhMYmwqBkR2RTJRaehU7Gssap9oHOYxnxIT81o0cMI8Cg1lRQavEMQtBhjWQkQ4ZhAx1YmWmwwonuaP0Ek1+z4UmBzAMdltpI7n6JyYj2jzQbuQdkuyoU3ID1GlgChmhHS9rSYqVK2gjohB4yWS25VlcuXf5tQgT72toWsqGyPUgkbeujY9wztwUZJG9dy0HgZjV0ujmGcpfL3OYew1NzXKpxB8LSupDjG+HIrna3m91vlCOU2ZDudP9R3a6cMTC5CO94EVLeviUFvepdr0Haq1eHcCW94p0uff123/jKlyD0Pa/o8mvc9m5DHkt0h4IXzOD8yKNneCMwcNt7IL9a+MIYXhChJJzbeoRyuCny739b9WEQ/1K1IxZIZkxspcikmCDlaCOLv4XFFw+kQtnw1DGuYVrShskm2qCpjclhrWPIizlFPrKNCfIyQkH1IGPjSzmXTOJmcaOJ9dgGalFM5YGUEqzZKAc+RnQPcvBYgD2lsjlW02UN5bY5xIhdMjr699po1LjLBxGHMrW0SzzjslhaUhQv/VwQdoA0RcCg6JQJHRtNKbNFHv1MQAAAIf4VTWFkZSB3aXRoIFNjcmVlblRvR2lmADs=" > </div> <div class="${_this.className.zhm_content}"> <div class="${_this.className.zhm_money}"> <div class="${_this.className.zhm_amount_money}"> <div class="${_this.className.zhm_money_sign}">¥</div> <div class="${_this.className.zhm_money_num}">${resp.data.youhuiquan}</div> </div> <div class="${_this.className.zhm_condition}">${resp.data.coupon_info}</div> </div> <div class="${_this.className.zhm_time}"> <div class="${_this.className.zhm_term}">有效期</div> <div class="${_this.className.zhm_date}">${resp.data.coupon_end_time}</div> </div> </div> </div> <div class="${_this.className.zhm_circle}"></div> <div class="${_this.className.zhm_link_coupon}" style="margin-right:"> <a class="${_this.className.zhm_get_link_text}">点击领取</a> <div id="${_this.className.tbqrcode}" class="${_this.className.zhm_qrcode}"></div> </div> </div> `; document.getElementById(_this.className.zhm_div_s).innerHTML=html; _this.createQrcode(_this.className.tbqrcode,resp.data.code_url,67); _this.positionQrcode(resp.data.code_url,'淘宝/天猫APP扫码领券'); if(document.querySelector('.Actions--root--hwEujgc')){ document.querySelector('.Actions--root--hwEujgc').style="position:unset"; } (async function(){ let cssObj = await _this.getCssData(_this.nowName); for(let i=0;i<cssObj.itemQR.length;i++){ if(document.querySelector(cssObj.itemQR[i])){ let itemQRDom = document.querySelector(cssObj.itemQR[i]); itemQRDom.id = _this.className.itemQR; let timer = setInterval(function(){ let nextItemQRDom = itemQRDom.querySelector('img'); if(nextItemQRDom){ clearInterval(timer); nextItemQRDom.parentNode.removeChild(nextItemQRDom); _this.createQrcode(_this.className.itemQR,resp.data.code_url,130); } }) break; } } })() switch(_this.nowName){ case 'tmall': break; case 'tmallCaoshi': break; case 'taobao': _this.taobaoCouponStyle(resp.data); break; case 'jd': break; } } } keywordGoodTitle(){ var _this = this; return new Promise((resolve,reject)=>{ let timer = setInterval(function(){ if(_this.goods_title){ clearInterval(timer); resolve(_this.goods_title); } }) }) } keywordSearch(){ var _this = this; (async function(){ let keywordData = [ { 'indexName':'jd', 'text':'京东', 'icon':'https://www.jd.com/favicon.ico' },{ 'indexName':'pdd', 'text':'拼多多', 'icon':'https://www.pinduoduo.com/homeFavicon.ico' },{ 'indexName':'vip', 'text':'唯品汇', 'icon':'https://www.vip.com/favicon.ico' },{ 'indexName':'tb', 'text':'淘宝', 'icon':'https://gw.alicdn.com/imgextra/i4/O1CN01qOI6vB1zaqrBKbyFr_!!6000000006731-73-tps-64-64.ico' } ]; let html = `<div class="${_this.className.keywordSearch}"><ul class="${_this.className.keywordNav}">`; html +=`<li class="${_this.className.keywordNavLi}" style='padding-left:10px;padding-right:10px;font-size:14px'>找同款</li>`; keywordData.forEach(function(item){ html += `<li class="${_this.className.keywordNavLi}"><a class="${_this.className.keywordNavLiActive}" href="javascript:void(0);" data='${item.indexName}'><img class='${_this.className.keywordNavLiIcon}' src=${item.icon}><span>${item.text}</span></a>`; html += `<div class="${_this.className.keywordGoodsList}"><ul class="${_this.className.keywordGoodsUl}" id='${item.indexName}${_this.className.keywordGoodsUl}'>`; html +=`<li class="${_this.className.goodsList} ${_this.className.goodsListWaiting}">` html += `<div class="zhmLoadingCssIcon ${_this.className.waitingIcon}"><div class="zhmloadingcssiconunit">`; html += `<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>`; html += `</div></div>`; html += `加载中...</li>`; html += `</ul></div>`; html += `</li>`; }) html +=`</ul>`; html +=`</div>`; let n=0; let timer = setInterval(function(){ if(_this.coupon_info.amount){ clearInterval(timer); let html = ''; html +=`<a href="${_this.coupon_info.link}" target="_blank" rel="noopener noreferrer nofollow"><div class="${_this.className.keywordCoupon}">`; html +=`<div class="${_this.className.keywordCouponLeft}"><img style='margin-top:2px;' width="40px" height="40px" src="https://img.chkaja.com/47062fe3bd6cb9f9.gif"><div>当前商品领券立减</div></div> <div class="${_this.className.keywordCouponRight}"><span>¥<span>${_this.coupon_info.amount}</div></div></a>`; let navLiDom = document.createElement("li"); navLiDom.style='list-style: none;'; navLiDom.innerHTML = html; document.querySelector(`.${_this.className.keywordNav}`).appendChild(navLiDom); } if(n++>20){ clearInterval(timer); } },500); let keywordDom = document.createElement('div'); keywordDom.innerHTML = html; document.body.appendChild(keywordDom); let keywordTabList = document.querySelectorAll('.'+_this.className.keywordNavLiActive); keywordTabList.forEach(function(item){ item.className=''; item.addEventListener('mouseenter',function(){ keywordTabList.forEach(function(e){ e.className=''; e.nextElementSibling.className =_this.className.keywordGoodsList; }) item.className=_this.className.keywordNavLiActive; item.nextElementSibling.className=`${_this.className.keywordGoodsList} ${_this.className.keywordGoodsListActive}`; (async function(){ let keyword = await _this.keywordGoodTitle(); if(!keyword){console.log(_this.nowName+':页面商品名称未获取');return;} let platform = item.getAttribute('data'); let itemIcon = item.querySelector('img').src; let goodsListDom = document.querySelector(`#${platform}${_this.className.keywordGoodsUl}`); if(goodsListDom.innerText != '加载中...'){ return true; } let keywordUrl = `https://api.typechrome.com/goods_title_search.php?goods_title=${encodeURIComponent(keyword)}&platform=${platform}`; let resp = await _this.request('get',keywordUrl); let jsonData = JSON.parse(resp); var html = ''; if(jsonData.code==200){ let data = jsonData.data; let vipCurrentLineHeight = _this.nowName=='vip'?'line-height:18px':''; if(data[platform].length>0){ data[platform].forEach(function(e){ html +=`<a href='https://api.typechrome.com/link_goods.php?platform=${platform}&item_id=${e.item_id}&coupon_link=${e.link}&shop_name=${encodeURIComponent(e.shop_name)}&goods_img=${e.goods_img}&goods_title=${encodeURIComponent(e.goods_title)}' target='_blank'>`; html +=`<li class="${_this.className.goodsList}"><img class='${_this.className.goodsImg}' src="${e.goods_img}"><div class="${_this.className.goodsPrice}"><span class='${_this.className.goodsSgin}'>¥</span>${e.goods_price}`; if(e.goods_coupon){ html += `<span class='${_this.className.goodsDiscountPrice}'>券后</span>`; } html += `</div><div class="${_this.className.goodsTitle}" style='${vipCurrentLineHeight}'><img class='${_this.className.keywordNavLiIcon}' src=${itemIcon}>${e.goods_title}<div></div></li></a>`; }) }else{ html +=`<li class="${_this.className.goodsList} ${_this.className.goodsListWaiting}">暂无商品</li>`; } }else{ html +=`<li class="${_this.className.goodsList} ${_this.className.goodsListWaiting}">暂无商品</li>`; } goodsListDom.innerHTML=html; })() }); item.nextElementSibling.addEventListener('mouseleave', function(e) { keywordTabList.forEach(function(e){ e.className=''; e.nextElementSibling.className =_this.className.keywordGoodsList; }) }) }); let keywordSearch = document.querySelector('.'+_this.className.keywordSearch); keywordSearch.addEventListener('mouseleave', function() { keywordTabList.forEach(function(e){ e.className=''; e.nextElementSibling.className =_this.className.keywordGoodsList; }) }); })() } } var couponClass = new CouponClass(); for(let i=0;i<couponWeb.length;i++){ try{ let result = top.location.href.match(couponWeb[i].match); if(result && couponWeb[i].isOpen==22){ couponClass.nowName = couponWeb[i].funcName; couponClass[couponWeb[i].funcName](); break; } }catch(err){ } } })();