在您安装前,Greasy Fork 希望您知道此脚本包含可能不受欢迎的功能,也许会帮助脚本作者获利,而不能给你带来任何收益。
作者从这份脚本获得佣金,例如透过改写链接或提供优惠券代码以包含推荐或附属代码。
脚本作者的说明:
内部隐藏优惠卷
解除网站不允许复制的限制,文本选中后点击复制按钮即可复制,各大文库网站都可以复制(也可以复制任何网站,看描述设置:// @match *://*/*)
// ==UserScript== // @name 所有网站免费复制 // @description 解除网站不允许复制的限制,文本选中后点击复制按钮即可复制,各大文库网站都可以复制(也可以复制任何网站,看描述设置:// @match *://*/*) // @namespace zbhui.cn // @version 1.2.8 // @author zbhui.cn // @match *://*/* // @match *://*.jd.com/* // @match *://*.jd.hk/* // @match *://*.jkcsjd.com/* // @match *://*.taobao.com/* // @match *://*.taobao.hk/* // @match *://*.tmall.com/* // @match *://*.tmall.hk/* // @match *://chaoshi.detail.tmall.com/* // @match *://*.liangxinyao.com/* // @match *://*.yiyaojd.com/* // @exclude *://login.taobao.com/* // @exclude *://pages.tmall.com/* // @exclude *://uland.taobao.com/* // @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js // @require https://cdn.bootcdn.net/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js // @license GPL License // @run-at document-start // @connect res3.doc88.com // @grant unsafeWindow // @grant GM_xmlhttpRequest // @antifeature referral-link 内部隐藏优惠卷 // ==/UserScript== (function () { 'use strict'; var index_num = 0, item = [], urls = []; const tools = { sleep: (time) => { return new Promise((resolve) => setTimeout(resolve, time)); }, trim: (str) => { return str.replace(/(^\s*)|(\s*$)/g, ""); }, GetQueryString: (name) => { let reg = eval("/" + name + "/g"); let r = window.location.search.substr(1); let flag = reg.test(r); if (flag) { return true; } else { return false; } }, getUrlParam:(name)=> { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if(pair[0] == name){return pair[1];} } return(false); } }; const coupon = { isClose: false, isRun: () => { var urls = ["tmall.com", "taobao.com", "tmall.hk", "liangxinyao.com", "jd.com", "jd.hk", "yiyaojd.com"]; for (var i = 0; i < urls.length; i++) { if (window.location.host.indexOf(urls[i]) != -1) { return true; } } return false; }, initCss: () => { let css = ` .gwd_taobao .gwd-minibar-bg, .gwd_tmall .gwd-minibar-bg { display: block; } .idey-minibar_bg{ position: relative; min-height: 40px; display: inline-block; } #idey_minibar{ width: 525px; background-color: #fff; position: relative; border: 1px solid #e8e8e8; display: block; line-height: 36px; font-family: 'Microsoft YaHei',Arial,SimSun!important; height: 36px; float: left; } #idey_minibar .idey_website { width: 48px; float: left; height: 36px; } #idey_minibar .minibar-tab { float: left; height: 36px; border-left: 1px solid #edf1f2!important; padding: 0; margin: 0; text-align: center; } #idey_minibar .idey_website em { background-position: -10px -28px; height: 36px; width: 25px; float: left; margin-left: 12px; } .setting-bg { background: url(https://cdn.gwdang.com/images/extensions/xbt/new_wishlist_pg5_2.png) no-repeat; } #idey_minibar .minibar-tab { float: left; height: 36px; border-left: 1px solid #edf1f2!important; padding: 0; margin: 0; width: 134px; } #idey_price_history span { float: left; width: 100%; text-align: center; line-height: 36px; color: #666; font-size: 14px; } #mini_price_history .trend-error-info-mini { position: absolute; top: 37px; left: 0px; width: 100%; background: #fff; z-index: 99999999; height: 268px; box-shadow: 0px 5px 15px 0 rgb(23 25 27 / 15%); border-radius: 0 0 4px 4px; width:559px; border: 1px solid #ddd; border-top: none; display:none; } .minibar-btn-box { display: inline-block; margin: 0 auto; float: none; } #mini_price_history .error-p { width: 95px; margin: 110px auto; height: 20px; line-height: 20px; text-align: center; color: #000!important; border: 1px solid #333; border-radius: 5px; display: block; text-decoration: none!important; } #mini_price_history:hover .trend-error-info-mini { display: block; } .collect_mailout_icon { background-position: -247px -134px; width: 18px; } #idey_mini_compare_detail li *, .mini-compare-icon, .minibar-btn-box * { float: left; } .panel-wrap{ width: 100%; height: 100%; } .collect_mailout_icon, .mini-compare-icon { height: 18px; margin-right: 8px; margin-top: 9px; } .all-products ul li { float: left; width: 138px; height: 262px; overflow: hidden; text-align: center; } .all-products ul li .small-img { text-align: center; display: table-cell; vertical-align: middle; line-height: 90px; width: 100%; height: 100px; position: relative; float: left; margin-top: 23px; } .all-products ul li a img { vertical-align: middle; display: inline-block; width: auto; height: auto; max-height: 100px; max-width: 100px; float: none; } .all-products ul li a.b2c-other-info { text-align: center; float: left; height: 16px; line-height: 16px; margin-top: 13px; } .b2c-other-info .gwd-price { height: 17px; line-height: 17px; font-size: 16px; color: #E4393C; font-weight: 700; width: 100%; display: block; } .b2c-other-info .b2c-tle { height: 38px; line-height: 19px; margin-top: 8px; font-size: 12px; width: 138px; margin-left: 29px; } .bjgext-mini-trend span { float: left; /*width: 100%;*/ text-align: center; line-height: 36px; color: #666; font-size: 14px; } .bjgext-mini-trend .trend-error-info-mini { position: absolute; top: 37px; left: 0px; width: 100%; background: #fff; z-index: 99999999; height: 268px; display: none; box-shadow: 0px 5px 15px 0 rgba(23,25,27,0.15); border-radius: 0 0 4px 4px; width: 460px; border: 1px solid #ddd; border-top: none; } .bjgext-mini-trend .error-p { width: 100%; float: left; text-align: center; margin-top: 45px; font-size: 14px; color: #666; } .bjgext-mini-trend .error-sp { width: 95px; margin: 110px auto; height: 20px; line-height: 20px; text-align: center; color: #000!important; border: 1px solid #333; border-radius: 5px; display: block; text-decoration: none!important; } .bjgext-mini-trend:hover .trend-error-info-mini { display: block; } #coupon_box.coupon-box1 { width: 525px; height: 125px; background-color: #fff; border: 1px solid #e8e8e8; border-top: none; position: relative; margin: 0px; padding: 0px; float: left; display: block; } #coupon_box:after { display: block; content: ""; clear: both; } .idey_tmall #idey_minibar { float: none; } .minicoupon_detail { position: absolute; top: 35px; right: -1px; height: 150px; width: 132px; display: none; z-index: 99999999999; background: #FFF7F8; border: 1px solid #F95774; } #coupon_box:hover .minicoupon_detail { display: block; } .minicoupon_detail img { width: 114px; height: 114px; float: left; margin-left: 9px; margin-top: 9px; } .minicoupon_detail span { font-size: 14px; color: #F95572; letter-spacing: 0; font-weight: bold; float: left; height: 12px; line-height: 14px; width: 100%; margin-top: 6px; text-align: center; } .coupon-box1 * { font-family: 'Microsoft YaHei',Arial,SimSun; } .coupon-icon { float: left; width: 20px; height: 20px; background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_icon.png') 0px 0px no-repeat; margin: 50px 8px 9px 12px; } #coupon_box .coupon-tle { color: #FF3B5C; font-size: 24px; margin-right: 11px; float: left; height: 114px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 375px; line-height: 114px; text-decoration: none!important; } #coupon_box .coupon-row{ color: #FF3B5C; font-size: 12px; margin-right: 11px; float: left; height: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; line-height: 60px; text-decoration: none!important; text-align: center; } #coupon_box .coupon-tle * { color: #f15672; } #coupon_box .coupon-tle span { margin-right: 5px; font-weight: bold; font-size: 14px; } .coupon_gif { background: url('https://cdn.gwdang.com/images/extensions/newbar/turn.gif') 0px 0px no-repeat; float: right; height: 20px; width: 56px; margin-top: 49px; } .click2get { background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_01.png') 0px 0px no-repeat; float: left; height: 30px; width: 96px; margin-top: 43px; } .click2get span { height: 24px; float: left; margin-left: 1px; } .c2g-sp1 { width: 50px; color: #FF3B5C; text-align: center; font-size: 14px; line-height: 24px!important; } .c2g-sp2 { width: 44px; line-height: 24px!important; color: #fff!important; text-align: center; } div#idey_wishlist_div.idey_wishlist_div { border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; } #qrcode{ float: left; width: 125px; margin-top:3px; } .elm_box{ height: 37px; border: 1px solid #ddd; width: 460px; line-height: 37px; margin-bottom: 3px; background-color: #ff0036; font-size: 15px; } .elm_box span{ width: 342px; text-align: center; display: block; float: left; color: red; color: white; } `; let styles = document.createElement('style') styles.type = 'text/css' styles.innerHTML = css; document.getElementsByTagName('head').item(0).appendChild(styles) }, onclicks: (link) => { if (document.getElementById('redirect_form')) { var form = document.getElementById('redirect_form'); form.action = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(link); } else { var form = document.createElement('form'); form.action = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(link); form.target = '_blank'; form.method = 'POST'; form.setAttribute("id", 'redirect_form'); document.body.appendChild(form); } form.submit(); form.action = ""; form.parentNode.removeChild(form); }, getUrlType: (url) => { if ( url.indexOf("//item.taobao.com/item.htm") > 0 || url.indexOf("//detail.tmall.com/item.htm") > 0 || url.indexOf("//chaoshi.detail.tmall.com/item.htm") > 0 || url.indexOf("//detail.tmall.hk/hk/item.htm") > 0 || url.indexOf("//world.tmall.com") > 0 || url.indexOf("//detail.liangxinyao.com/item.htm") > 0 || url.indexOf("//detail.tmall.hk/item.htm") > 0 ) { return 'taobao_item'; } else if ( url.indexOf("//maiyao.liangxinyao.com/shop/view_shop.htm") > 0 || url.indexOf("//list.tmall.com/search_product.htm") > 0 || url.indexOf("//s.taobao.com/search") > 0 || url.indexOf("//list.tmall.hk/search_product.htm") > 0 ) { return 'taobao_list'; } else if ( url.indexOf("//search.jd.com/Search") > 0 || url.indexOf("//search.jd.com/search") > 0 || url.indexOf("//search.jd.hk/search") > 0 || url.indexOf("//search.jd.hk/Search") > 0 || url.indexOf("//www.jd.com/xinkuan") > 0 || url.indexOf("//list.jd.com/list.html") > 0 || url.indexOf("//search.jd.hk/Search") > 0 || url.indexOf("//coll.jd.com") > 0 ) { return 'jd_list'; } else if ( url.indexOf("//item.jd.hk") > 0 || url.indexOf("//pcitem.jd.hk") > 0 || url.indexOf("//i-item.jd.com") > 0 || url.indexOf("//item.jd.com") > 0 || url.indexOf("//npcitem.jd.hk") > 0 || url.indexOf("//item.yiyaojd.com") > 0 ) { return 'jd_item'; } else if ( url.indexOf("//miaosha.jd.com") > 0 ) { return 'jd_miaosha'; } else if ( url.indexOf("//www.jd.com") > 0 || url.indexOf("//jd.com") > 0 ) { return 'jd_index'; } else if ( url.indexOf("//jingfen.jd.com") > 0 ) { return 'jingfen'; } }, get_url: () => { item[index_num] = []; urls[index_num] = []; $("#J_goodsList li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var skuid = $(this).attr('data-sku'); var itemurl = '//item.jd.com/' + skuid + '.html'; if (skuid != undefined) { if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) $("#plist li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var skuid = $(this).find('.j-sku-item').attr('data-sku'); var itemurl = '//item.jd.com/' + skuid + '.html'; if (skuid != undefined) { if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) $(".m-aside .aside-bar li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var itemurl = $(this).find("a").attr('href'); if (itemurl != '') { if (itemurl.indexOf("//ccc-x.jd.com") != -1) { var sku_c = $(this).attr('sku_c'); if (sku_c == undefined) { var arr = []; var str = $(this).attr('onclick'); arr = str.split(","); sku_c = tools.trim(arr[6].replace(/\"/g, "")); itemurl = '//item.jd.com/' + sku_c + '.html'; } } if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) $(".goods-chosen-list li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var itemurl = $(this).find("a").attr('href'); if (itemurl != '') { if (itemurl.indexOf("//ccc-x.jd.com") != -1) { var arr = []; var str = $(this).attr('onclick'); arr = str.split(","); var sku_c = tools.trim(arr[6].replace(/\"/g, "")); itemurl = '//item.jd.com/' + sku_c + '.html'; } if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) $(".may-like-list li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var itemurl = $(this).find("a").attr('href'); if (itemurl != '') { if (itemurl.indexOf("//ccc-x.jd.com") != -1) { var arr = []; var str = $(this).attr('onclick'); arr = str.split(","); var sku_c = tools.trim(arr[6].replace(/\"/g, "")); itemurl = '//item.jd.com/' + sku_c + '.html'; } if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) { var u = urls[index_num].join(','); $.getJSON('https://tbao.idey.cn/coupon.php', { act: 'itemlink', itemurl: u, num: index_num }, function(res) { if (res.type == 'success') { for (var i = 0; i < res.data.length; i++) { item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl); item[res.num][i].find("a").attr('target', ''); item[res.num][i].find("a").unbind("click"); item[res.num][i].find("a").bind("click", function(e) { if ($(this).attr('data-ref')) { e.preventDefault(); coupon.onclicks($(this).attr('data-ref')); } }) } } }) } index_num += 1; }, get_taobao_id:(pagetype, url)=>{ var return_data = ''; if (pagetype == 'taobao_item') { var params = location.search.split("?")[1].split("&"); for (var index in params) { if (params[index].split("=")[0] == "id") { var productId = params[index].split("=")[1]; } } return_data = productId; } return return_data; }, show: () => { var pagetype = coupon.getUrlType(location.href); if (pagetype == 'taobao_item') { coupon.initCss(); var productId = coupon.get_taobao_id(pagetype, location.href); var couponurl = "https://s.idey.cn/ltb.php?act=items&itemurl=" + encodeURIComponent(location.href) + '&itemid=' + productId; $.getJSON(couponurl, function(res) { var data = res.data; var couponArea = '<div class="idey-minibar_bg">'; couponArea += '<div id="idey_minibar" class="alisite_page">'; couponArea += '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://taobao.idey.cn">'; couponArea += '<em class="setting-bg website_icon"></em></a>'; couponArea += '<div id="mini_price_history" class="minibar-tab">'; couponArea += '<span class="blkcolor1">当前价:<span style="color:red" id="now_price">加载中...</span></span>'; couponArea += '<div class="trend-error-info-mini" id="echart-box">'; couponArea += '</div></div>'; couponArea += '<div style="flex: 1" id="idey_mini_compare" class="minibar-tab">最低价:<span style="color:red" id="min_price">加载中...</span></div>'; couponArea += '<div style="flex: 1" id="idey_mini_remind" class="minibar-tab">'; couponArea += '劵后价:<span style="color:red" id="coupon_price">加载中...</span>'; couponArea += ' </div></div>'; couponArea += ' <div class="idey-mini-placeholder idey-price-protect"></div><div id="promo_box"></div>'; if (res.type == 'success') { couponArea += '<a id="coupon_box" title="" class="coupon-box1" href="https://zbhui.cn/coupon.php?itemurl=' + encodeURIComponent(location.href) + '&itemid='+productId+'">'; couponArea += '<span class="coupon-icon"></span>'; couponArea += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount + '元</span> <em class="coupon_gif"></em></div>'; couponArea += '<div class="click2get"><span class="c2g-sp1">¥' + data.couponAmount + '</span><span class="c2g-sp2">领取</span></div>'; couponArea += '</a>'; } else { couponArea += '<a id="coupon_box" title="" class="coupon-box1" >'; couponArea += '<span class="coupon-icon"></span>'; couponArea += ' <div class="coupon-tle">此商品暂无红包</div>'; couponArea += '</a>'; } couponArea += '</div>'; if (data.alist.length > 0) { for (let i = 0; i < data.alist.length; i++) { couponArea += '<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' + data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>' } } setTimeout(function(){ if (location.href.indexOf("//detail.tmall") != -1) { $(".tm-fcs-panel").after(couponArea); $(".Promotion--root--3qHQalP").after(couponArea); } else { $("ul.tb-meta").after(couponArea); } if (data.originalPrice) { $("#now_price").html('¥' + data.originalPrice); } if (data.actualPrice) { $("#coupon_price").html('¥' + data.actualPrice); } }, 1800 ) if(data.shortUrl){ 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>'; $("body").append(hbm); $("#hbcode").qrcode({ render: "canvas", //也可以替换为table width: 160, height: 150, text: data.shortUrl }); } }); } else if (pagetype == 'jd_item') { coupon.initCss(); var productId = /(\d+)\.html/.exec(window.location.href)[1]; var couponurl = "https://tbao.idey.cn/jd.php?act=recovelink&itemurl=" + encodeURIComponent(location.href) + '&itemid=' + productId; $.getJSON(couponurl, function(res) { var data = res.data; if (!tools.GetQueryString('utm_campaign') && data) { window.location.href = 'https://wk.idey.cn/red.html?url=' + encodeURIComponent(data); } }); var couponurls = "https://s.idey.cn/xjd.php?act=item&itemurl=" + encodeURIComponent(location.href) + '&itemid=' + productId; $.getJSON(couponurls, function(res) { var data = res.data; var couponArea = '<div class="idey-minibar_bg">'; couponArea += '<div id="idey_minibar" class="alisite_page">'; couponArea += '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://www.idey.cn">'; couponArea += '<em class="setting-bg website_icon"></em></a>'; couponArea += '<div id="mini_price_history" class="minibar-tab">'; couponArea += '<span class="blkcolor1">当前价:<span style="color:red" id="now_price">加载中...</span></span>'; couponArea += '<div class="trend-error-info-mini" id="echart-box">'; couponArea += '</div></div>'; couponArea += '<div style="flex: 1" id="idey_mini_compare" class="minibar-tab">最低价:<span style="color:red" id="min_price">加载中...</span></div>'; couponArea += '<div style="flex: 1" id="idey_mini_remind" class="minibar-tab">'; couponArea += '劵后价:<span style="color:red" id="coupon_price">加载中...</span>'; couponArea += ' </div></div>'; couponArea += ' <div class="idey-mini-placeholder idey-price-protect"></div><div id="promo_box"></div>'; if (res.type == 'success') { if (data.couponLinkType == 1) { couponArea += '<a id="coupon_box" title="" class="coupon-box1" href="' + data.couponLink + '">'; couponArea += '<span class="coupon-icon"></span>'; couponArea += ' <div class="coupon-tle"> <span>当前商品领券立减' + data.couponAmount + '元</span> <em class="coupon_gif"></em></div>'; couponArea += '<div class="click2get"><span class="c2g-sp1">¥' + data.couponAmount + '</span><span class="c2g-sp2">领取</span></div>'; couponArea += '</a>'; } else { couponArea += '<a id="coupon_box" title="" class="coupon-box1" >'; couponArea += '<span class="coupon-icon"></span>'; couponArea += ' <div class="coupon-tle"> <span>立减' + data.couponAmount + '元(京东扫码领取)</span> <em class="coupon_gif"></em></div>'; couponArea += '<div id="qrcode"></div>'; couponArea += '</a>'; } } else { couponArea += '<a id="coupon_box" title="" class="coupon-box1" >'; couponArea += '<span class="coupon-icon"></span>'; couponArea += ' <div class="coupon-tle">此商品暂无红包</div>'; couponArea += '</a>'; } couponArea += '</div>'; if (data.alist.length > 0) { for (let i = 0; i < data.alist.length; i++) { couponArea += '<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:525px"><a href="' + data.alist[i].url + '" target="_blank">' + data.alist[i].name + '</a></div>' } } setTimeout(function(){ $(".summary-price-wrap").after(couponArea); },500) if (data.couponLink) { $('#qrcode').qrcode({ render: "canvas", //也可以替换为table width: 125, height: 120, text: data.couponLink }); } else if (data.item_link.shortUrl) { $('#qrcode').qrcode({ render: "canvas", //也可以替换为table width: 125, height: 120, text: data.item_link.shortUrl }); } else { $('#qrcode').qrcode({ render: "canvas", //也可以替换为table width: 125, height: 120, text: data.item_link.longUrl }); } if (data.item_link.originalPrice) { $("#now_price").html('¥' + data.item_link.originalPrice); } if (data.item_link.actualPrice) { $("#coupon_price").html('¥' + data.item_link.actualPrice); } if(data.hbcode !=''){ let hbm='<div style="position:fixed;width:160px;height:160px;right:28px;bottom:50px;z-index:999"><h1 style="color:red;font-size: 11px">使用京东APP领劵购买此商品</h1><div id="hbcode"></div></div>'; $(".toolbar-qrcode").hide(); setInterval(function(){ $(".toolbar-qrcode").hide(); },100 ) $("body").append(hbm); $("#hbcode").qrcode({ render: "canvas", //也可以替换为table width: 150, height: 140, text: data.hbcode }); } }); } else if (pagetype == 'jd_list') { setInterval(coupon.get_url, 300); } else if (pagetype == 'jd_miaosha') { $(".seckill_mod_goodslist li").find("a").click(function(e) { if ($(this).attr('data-ref')) { e.preventDefault(); coupon.onclicks($(this).attr('data-ref')); } }) setInterval(coupon.get_miaosha, 300); }else if(pagetype=="jingfen"){ let productId=tools.getUrlParam("sku"); if(productId){ var couponurl = "https://s.idey.cn/xjd.php?act=itemcode&itemid=" + productId; $.getJSON(couponurl, function(res) { var data = res.data; if(data !='' && data !=null && data !=undefined){ $(document).ready(function(){ setTimeout(function(){ $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>"); $(".btn-area").after("<div class='coupon_code'></div>"); // $(".btn-area").hide(); $('.coupon_code').qrcode({ render: "canvas", //也可以替换为table width: 200, height: 180, text: data }); }, 500 ) }); }else{ $(document).ready(function(){ setTimeout(function(){ $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>"); $(".btn-area").after("<div class='coupon_code'></div>"); // $(".btn-area").hide(); $('.coupon_code').qrcode({ render: "canvas", //也可以替换为table width: 400, height: 380, text: location.href }); }, 500 ) }); } }); }else{ $(document).ready(function(){ setTimeout(function(){ $(".btn-area").after("<div class='coupon_info' style='color: wheat;font-size: 24px;'>使用微信或者京东APP扫码更便捷</div>"); $(".btn-area").after("<div class='coupon_code'></div>"); // $(".btn-area").hide(); $('.coupon_code').qrcode({ render: "canvas", //也可以替换为table width: 400, height: 380, text: location.href }); }, 500 ) }); } } }, get_miaosha: () => { item[index_num] = []; urls[index_num] = []; $(".seckill_mod_goodslist li").each(function(index) { if ($(this).attr('data-type') != 'yes') { var itemurl = $(this).find("a").attr('href'); var skuid = $(this).attr('data-sku'); var that = $(this); if (itemurl != '') { if (urls[index_num].length < 4) { item[index_num].push($(this)); urls[index_num].push(itemurl); $(this).attr('data-type', 'yes'); } } } }) if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) { var u = urls[index_num].join(','); $.getJSON('https://tbao.idey.cn/coupon.php', { act: 'itemlink', itemurl: u, num: index_num }, function(res) { if (res.type == 'success') { for (var i = 0; i < res.data.length; i++) { item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl); item[res.num][i].find("a").attr('href', "javascript:void(0);"); item[res.num][i].find("a").attr('target', ''); // item[res.num][i].find("a").unbind("click"); item[res.num][i].find("a").click(function(e) { e.preventDefault(); coupon.onclicks($(this).attr('data-ref')); }) } } }) } index_num += 1; }, }; if(coupon.isRun()){ coupon.show(); }else{ var css_248z$1 = ".__copy-button{align-items:center;background:#4c98f7;border-radius:3px;color:#fff;cursor:pointer;display:flex;font-size:13px;height:30px;justify-content:center;opacity:0;position:absolute;transition:opacity .3s;width:60px;z-index:-1000}"; var css_248z = "#select-tooltip,#sfModal,.modal-backdrop,div[id^=reader-helper]{display:none!important}.modal-open{overflow:auto!important}._sf_adjust_body{padding-right:0!important}"; var DOM_STAGE = { START: "document-start", END: "document-end", }; var DOM_READY = "DOMContentLoaded"; var PAGE_LOADED = "load"; var COPY = "copy"; var SELECT_START = "selectstart"; var CONTEXT_MENU = "contextmenu"; var KEY_DOWN = "keydown"; var opt = Object.prototype.toString; function isString(value) { return opt.call(value) === "[object String]"; } var dom$1 = { query: function (selector) { return document.querySelector(selector); }, attr: function (selector, attr, value) { var dom = document.querySelector(selector); dom && dom.setAttribute(attr, value); }, append: function (selector, content) { var container = document.createElement("div"); if (isString(content)) { container.innerHTML = content; } else { container.appendChild(content); } var targetDOM = document.querySelector(selector); targetDOM && targetDOM.append(container); return container; }, remove: function (selector) { var targetDOM = document.querySelector(selector); targetDOM && targetDOM.remove(); }, }; var initBaseEvent = function (websiteConfig) { document.addEventListener(DOM_READY, function () { if (websiteConfig.initCopyEvent) { document.oncopy = function (e) { return e.stopPropagation(); }; document.body.oncopy = function (e) { return e.stopPropagation(); }; document.addEventListener(COPY, function (e) { return e.stopPropagation(); }); document.body.addEventListener(COPY, function (e) { return e.stopPropagation(); }); } }); }; var initBaseStyle = function () { document.addEventListener(DOM_READY, function () { dom$1.append("head", "<style>".concat(css_248z$1, "</style>")); dom$1.append("head", "<style>".concat(css_248z, "</style>")); }); }; /** * 外部引用`static.doc88.com`声明 * 此部分是在处理`doc88.com`才会加载的资源文件,此资源文件由该网站加载时提供 */ var path = ""; var website$r = { regexp: /.*doc88\.com\/.+/, init: function () { // GM_xmlhttpRequest({ // method: "GET", // url: "https://res.doc88.com/assets/js/v2.js", // onload: function(response) { // var view = new Function("var view = " + response.responseText.replace("eval", "") + "; return view;"); // path = /<textarea[\s\S]*?Viewer.([\S]*?)\+[\S]*?\/textarea>/.exec(view())[1]; // } // }) dom$1.append("body", "<style id=\"copy-element-hide\">#left-menu{display: none !important;}</style>"); GM_xmlhttpRequest({ method: "GET", url: "https://res3.doc88.com/resources/js/modules/main-v2.min.js?v=2.56", onload: function (response) { var result = /\("#cp_textarea"\).val\(([\S]*?)\);/.exec(response.responseText); if (result) path = result[1]; }, }); window.addEventListener("load", function () { var cpFn = unsafeWindow.copyText.toString(); var fnResult = /<textarea[\s\S]*?>'\+([\S]*?)\+"<\/textarea>/.exec(cpFn); if (fnResult) path = fnResult[1]; }); }, getSelectedText: function () { var select = unsafeWindow; path.split(".").forEach(function (v) { select = select[v]; }); if (!select) { unsafeWindow.Config.vip = 1; unsafeWindow.Config.logined = 1; dom$1.remove("#copy-element-hide"); } return select; }, }; var website$q = { regexp: /.*segmentfault\.com\/.+/, init: function () { var body = dom$1.query("body"); body.classList.add("_sf_adjust_body"); body.onclick = function () { body.style.paddingRight = "0"; }; }, }; var TEXT_PLAIN = "text/plain"; var TEXT_HTML = "text/html"; var downgradeCopy = function (data) { var textarea = document.createElement("textarea"); textarea.addEventListener(COPY, function (event) { for (var _i = 0, _a = Object.entries(data); _i < _a.length; _i++) { var _b = _a[_i], key = _b[0], value = _b[1]; event.clipboardData.setData(key, value); } event.stopPropagation(); event.preventDefault(); }, true); textarea.style.position = "fixed"; textarea.style.left = "-999px"; textarea.style.top = "-999px"; textarea.value = data[TEXT_PLAIN]; document.body.appendChild(textarea); textarea.select(); document.execCommand("copy"); document.body.removeChild(textarea); }; var isEmptyContent = function (data) { return isString(data) ? !data : !data[TEXT_PLAIN]; }; var copy = function (data) { var _a; var params = isString(data) ? (_a = {}, _a[TEXT_PLAIN] = data, _a) : data; var plainText = params[TEXT_PLAIN]; if (!plainText) return false; if (navigator.clipboard && window.ClipboardItem) { var dataItems = {}; for (var _i = 0, _b = Object.entries(params); _i < _b.length; _i++) { var _c = _b[_i], key = _c[0], value = _c[1]; var blob = new Blob([value], { type: key }); dataItems[key] = blob; } navigator.clipboard.write([new ClipboardItem(dataItems)]).catch(function () { downgradeCopy(params); }); } else { downgradeCopy(params); } return true; }; var dom = null; var isReadyToHidden = false; var instance = { id: "__copy", className: "__copy-button", getInstance: function () { if (dom === null) { var container = document.createElement("div"); container.id = this.id; container.className = this.className; container.innerText = "复制"; container.addEventListener("mouseup", function (e) { return e.stopPropagation(); }, true); container.addEventListener("mousedown", function (e) { return e.stopPropagation(); }, true); dom = container; document.body.appendChild(dom); } return dom; }, show: function (event) { if (isReadyToHidden) return void 0; var dom = this.getInstance(); dom.style.left = "".concat(event.pageX + 30, "px"); dom.style.top = "".concat(event.pageY, "px"); dom.style.opacity = "1"; dom.style.zIndex = "1000"; }, hide: function () { var dom = this.getInstance(); dom.style.opacity = "0"; isReadyToHidden = true; setTimeout(function () { dom.style.zIndex = "-10000"; isReadyToHidden = false; }, 350); }, onCopy: function (content, event) { var _this = this; var dom = this.getInstance(); this.show(event); dom.onclick = function () { copy(content); _this.hide(); }; }, enable: function () { var dom = this.getInstance(); dom.style.display = "flex"; }, disable: function () { var dom = this.getInstance(); dom.style.display = "none"; }, }; var stopNativePropagation = function (event) { // event.stopImmediatePropagation(); // 即停且阻止该元素在此事件绑定之后的`on`同类事件触发 event.stopPropagation(); // 阻止该元素继续冒泡后的`on`同类事件触发 }; var utils = { hideButton: function () { instance.disable(); }, showButton: function () { instance.enable(); }, removeAttributes: function (selector, attr) { if (attr === void 0) { attr = []; } var dom = isString(selector) ? document.querySelector(selector) : selector; dom && attr.forEach(function (item) { return dom.removeAttribute(item); }); }, enableUserSelectByCSS: function () { var css = "*{user-select: auto !important;-webkit-user-select: auto !important;}"; var style = document.createElement("style"); style.innerText = css; var head = document.getElementsByTagName("head")[0]; if (head) { head.appendChild(style); } else { window.addEventListener(PAGE_LOADED, function () { return document.getElementsByTagName("head")[0].appendChild(style); }); } }, enableOnSelectStart: function (selector) { var dom = document.querySelector(selector); dom && dom.addEventListener(SELECT_START, stopNativePropagation); }, enableOnContextMenu: function (selector) { var dom = document.querySelector(selector); dom && dom.addEventListener(CONTEXT_MENU, stopNativePropagation); }, enableOnCopy: function (selector) { var dom = document.querySelector(selector); dom && dom.addEventListener(COPY, stopNativePropagation); }, enableOnKeyDown: function (selector) { var dom = document.querySelector(selector); dom && dom.addEventListener(KEY_DOWN, function (e) { if (e.key === "c" && e.ctrlKey) return e.stopPropagation(); }); }, enableOnSelectStartByCapture: function () { window.addEventListener(SELECT_START, stopNativePropagation, true); document.addEventListener(SELECT_START, stopNativePropagation, true); }, enableOnContextMenuByCapture: function () { window.addEventListener(CONTEXT_MENU, stopNativePropagation, true); document.addEventListener(CONTEXT_MENU, stopNativePropagation, true); }, enableOnCopyByCapture: function () { window.addEventListener("copy", stopNativePropagation, true); document.addEventListener("copy", stopNativePropagation, true); }, enableOnKeyDownByCapture: function () { document.addEventListener(KEY_DOWN, function (e) { return e.ctrlKey && e.key.toLocaleUpperCase() === "C" && e.stopPropagation(); }, true); }, }; var website$p = { regexp: /.*wk\.baidu\.com\/view\/.+/, init: function () { utils.hideButton(); utils.enableOnSelectStartByCapture(); window.onload = function () { dom$1.attr(".sf-edu-wenku-vw-container", "style", ""); }; }, }; var website$o = { regexp: /.*zhihu\.com\/.*/, init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnCopyByCapture(); }, }; var website$n = { regexp: /.*30edu\.com\.cn\/.+/, init: function () { window.onload = function () { var iframes = document.getElementsByTagName("iframe"); if (iframes.length === 2) { var body = iframes[1].contentWindow.document.querySelector("body"); utils.removeAttributes(body, ["oncopy", "oncontextmenu", "onselectstart"]); } }; }, }; var website$m = { regexp: /.*docs\.qq\.com\/.+/, config: { initCopyEvent: false, }, init: function () { window.onload = function () { utils.hideButton(); }; }, getSelectedText: function () { var _a; if (unsafeWindow.pad && unsafeWindow.pad.editor && !unsafeWindow.pad.editor.isCopyable()) { utils.showButton(); var editor = unsafeWindow.pad.editor; editor._docEnv.copyable = true; editor.clipboardManager.copy(); var plainText = editor.clipboardManager.customClipboard.plain; var htmlText = editor.clipboardManager.customClipboard.html; editor._docEnv.copyable = false; return _a = {}, _a[TEXT_PLAIN] = plainText, _a[TEXT_HTML] = htmlText, _a; } return ""; }, }; var website$l = { regexp: new RegExp(".+://boke112.com/post/.+"), init: function () { utils.enableOnCopyByCapture(); var template = "\n <style>\n :not(input):not(textarea)::selection {\n background-color: #2440B3 !important;\n color: #fff !important;\n }\n\n :not(input):not(textarea)::-moz-selection {\n background-color: #2440B3 !important;\n color: #fff !important;\n }\n </style>\n "; dom$1.append("head", template); }, }; var website$k = { regexp: /diyifanwen/, init: function () { utils.hideButton(); utils.enableOnCopyByCapture(); utils.enableOnKeyDownByCapture(); }, }; var website$j = { regexp: /mbalib/, init: function () { window.onload = function () { utils.removeAttributes("fullScreenContainer", [ "oncopy", "oncontextmenu", "onselectstart", ]); }; }, }; var website$i = { regexp: /cnitpm/, init: function () { utils.hideButton(); window.onload = function () { utils.removeAttributes("body", ["oncopy", "oncontextmenu", "onselectstart"]); }; }, }; var website$h = { regexp: new RegExp(".+bbs.mihoyo.com/.+"), init: function () { utils.hideButton(); utils.enableOnCopyByCapture(); utils.enableOnSelectStartByCapture(); utils.enableUserSelectByCSS(); }, }; var website$g = { regexp: new RegExp(".+www.uemeds.cn/.+"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); }, }; var website$f = { regexp: new RegExp(".+aiyuke.com/news/.+"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); }, }; var website$e = { regexp: new RegExp("qidian"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnCopy(".main-read-container"); utils.enableOnContextMenu(".main-read-container"); }, }; var website$d = { regexp: new RegExp("zongheng"), init: function () { utils.removeAttributes(".reader_box", ["style", "unselectable", "onselectstart"]); utils.removeAttributes(".reader_main", ["style", "unselectable", "onselectstart"]); utils.hideButton(); utils.enableOnKeyDown("body"); utils.enableUserSelectByCSS(); utils.enableOnCopy(".content"); utils.enableOnContextMenu("body"); utils.enableOnSelectStart(".content"); }, }; var website$c = { regexp: new RegExp("17k"), init: function () { utils.hideButton(); utils.enableOnCopy(".readAreaBox .p"); }, }; var website$b = { regexp: new RegExp("ciweimao"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnCopy("#J_BookCnt"); utils.enableOnContextMenu("body"); utils.enableOnSelectStart("#J_BookCnt"); }, }; var website$a = { regexp: new RegExp("book\\.qq"), init: function () { utils.hideButton(); utils.enableOnCopy("body"); utils.enableUserSelectByCSS(); utils.enableOnContextMenu("body"); utils.enableOnSelectStart("body"); }, }; var website$9 = { regexp: new RegExp("utaten"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnSelectStartByCapture(); }, }; var website$8 = { config: { runAt: "document-start", }, regexp: new RegExp("wenku.baidu.com/(view|link).*"), init: function () { dom$1.append("head", "<style>@media print { body{ display:block; } }</style>"); var canvasDataGroup = []; var originObject = { context2DPrototype: unsafeWindow.document.createElement("canvas").getContext("2d") .__proto__, }; document.createElement = new Proxy(document.createElement, { apply: function (target, thisArg, argumentsList) { var element = Reflect.apply(target, thisArg, argumentsList); if (argumentsList[0] === "canvas") { var tmpData_1 = { canvas: element, data: [], }; element.getContext("2d").fillText = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } tmpData_1.data.push(args); originObject.context2DPrototype.fillText.apply(this, args); }; canvasDataGroup.push(tmpData_1); } return element; }, }); var pageData = {}; Object.defineProperty(unsafeWindow, "pageData", { set: function (v) { return (pageData = v); }, get: function () { if (!pageData.vipInfo) return (pageData.vipInfo = {}); pageData.vipInfo.global_svip_status = 1; pageData.vipInfo.global_vip_status = 1; pageData.vipInfo.isVip = 1; pageData.vipInfo.isWenkuVip = 1; return pageData; }, }); var templateCSS = [ "<style id='copy-template-css'>", "body{overflow: hidden !important}", "#copy-template-html{position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center;z-index: 999999; background: rgba(0,0,0,0.5);}", "#copy-template-html > .template-container{height: 80%; width: 80%; background: #fff; }", ".template-container > .title-container{display: flex; align-items: center; justify-content: space-between;padding: 10px;border-bottom: 1px solid #eee;}", "#copy-template-text{height: 100%; width: 100%;position: relative; overflow: auto;background: #fff;}", "#copy-template-html #template-close{cursor: pointer;}", "</style>", ].join(""); var render = function () { canvasDataGroup = canvasDataGroup.filter(function (item) { return item.canvas.id; }); var templateText = canvasDataGroup.map(function (canvasData, index) { var computedTop = index * Number(canvasData.canvas.clientHeight); var textItem = canvasData.data.map(function (item) { return "<div style=\"position: absolute; left: ".concat(item[1], "px; top: ").concat(item[2] + computedTop, "px\">").concat(item[0], "</div>"); }); return textItem.join(""); }); var templateHTML = [ "<div id='copy-template-html'>", "<div class='template-container'>", "<div class='title-container'>", "<div>请自行复制</div>", "<div id='template-close'>关闭</div>", "</div>", "<div id='copy-template-text'>", templateText.join(""), "</div>", "</div>", "</div>", ].join(""); dom$1.append("body", templateHTML); dom$1.append("body", templateCSS); var closeButton = document.querySelector("#copy-template-html #template-close"); var close = function () { dom$1.remove("#copy-template-html"); dom$1.remove("#copy-template-css"); closeButton.removeEventListener("click", close); }; closeButton.addEventListener("click", close); }; document.addEventListener("DOMContentLoaded", function () { dom$1.append("head", "<style>#copy-btn-wk{padding: 10px; background: rgba(0,0,0,0.5);position: fixed; left:0; top: 40%;cursor: pointer;color: #fff; z-index: 99999;}</style>"); dom$1.append("body", "<div id='copy-btn-wk'>复制</div>"); var btn = dom$1.query("#copy-btn-wk"); btn && (btn.onclick = render); }); }, getSelectedText: function () { if (window.getSelection && window.getSelection().toString()) { return window.getSelection().toString(); } var result = /查看全部包含“([\s\S]*?)”的文档/.exec(document.body.innerHTML); if (result) return result[1]; return ""; }, }; var website$7 = { regexp: new RegExp("xiaohongshu"), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnKeyDownByCapture(); }, }; var website$6 = { regexp: new RegExp("leetcode"), init: function () { utils.hideButton(); utils.enableOnCopy("#lc-home"); }, }; var website$5 = { regexp: /csdn/, init: function () { utils.hideButton(); utils.enableOnCopyByCapture(); utils.enableUserSelectByCSS(); }, }; var website$4 = { regexp: new RegExp("bilibili"), init: function () { utils.hideButton(); utils.enableOnCopyByCapture(); }, }; var website$3 = { regexp: new RegExp("cnki"), init: function () { utils.hideButton(); utils.enableOnContextMenuByCapture(); utils.enableOnKeyDownByCapture(); utils.enableOnCopyByCapture(); }, }; var website$2 = { regexp: new RegExp("docin.com/.*"), config: { initCopyEvent: false, captureInstance: true, delay: 100, }, init: function () { window.addEventListener(PAGE_LOADED, function () { var _a; return (_a = dom$1.query("#j_select")) === null || _a === void 0 ? void 0 : _a.click(); }); dom$1.append("head", "<style>#reader-copy-el{display: none;}</style>"); }, getSelectedText: function () { if (unsafeWindow.docinReader && unsafeWindow.docinReader.searchTextStr) { return unsafeWindow.docinReader.searchTextStr; } return ""; }, }; var website$1 = { regexp: new RegExp([ "commandlinux", "cnki", "ruiwen", "oh100", "fwsir", "wenxm", "unjs", "ahsrst", "yjbys", "360doc", "850500", "jianbiaoku", "kt250", "kejudati", "baibeike", "yuque", "cnrencai", "kodiplayer", "tongxiehui", "ndPureView", "jianshu", "linovelib", "chazidian", "juejin", "zgbk", "wenmi", "yuedu\\.baidu", "inrrp", "shubaoc", "51cto", "ximalaya", "xiexiebang", ].join("|")), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnCopyByCapture(); }, }; var website = { regexp: new RegExp(["wjx", "fanyi\\.baidu", "tianqi"].join("|")), init: function () { utils.hideButton(); utils.enableUserSelectByCSS(); utils.enableOnCopyByCapture(); utils.enableOnKeyDownByCapture(); utils.enableOnSelectStartByCapture(); utils.enableOnContextMenuByCapture(); }, }; var websites = [ website$q, website$p, website$o, website$n, website$m, website$l, website$k, website$j, website$i, website$h, website$g, website$f, website$e, website$d, website$c, website$b, website$a, website$9, website$8, website$7, website$r, website$6, website$5, website$4, website$3, website$2, website$1, website, ]; var siteGetSelectedText = null; var initWebsite = function () { var websiteConfig = { initCopyEvent: true, runAt: DOM_STAGE.END, captureInstance: false, delay: 0, }; var mather = function (regex, website) { if (regex.test(window.location.href)) { if (website.config) websiteConfig = Object.assign(websiteConfig, website.config); if (websiteConfig.runAt === DOM_STAGE.END) { document.addEventListener(DOM_READY, function () { return website.init(); }); } else { website.init(); } if (website.getSelectedText) siteGetSelectedText = website.getSelectedText; return true; } return false; }; websites.some(function (website) { return mather(website.regexp, website); }); return websiteConfig; }; var getSelectedText = function () { if (siteGetSelectedText) return siteGetSelectedText(); if (window.getSelection) return window.getSelection().toString(); if (document.getSelection) return document.getSelection().toString(); if (document.selection) return document.selection.createRange().text; return ""; }; (function () { var websiteConfig = initWebsite(); initBaseEvent(websiteConfig); initBaseStyle(); document.addEventListener("mouseup", function (e) { var handler = function () { var content = getSelectedText(); if (isEmptyContent(content)) { instance.hide(); return ""; } instance.onCopy(content, e); }; websiteConfig.delay ? setTimeout(handler, websiteConfig.delay) : handler(); }, websiteConfig.captureInstance); })(); } })();