优惠卷领取💯京东、淘宝、天猫等内部优惠券一键领取.最佳最安全的购物隐藏福利,欢迎朋友使用.持续维护中📣📣📣

各平台优惠券神器。插件介绍:1 专注寻找淘宝(taobao.com)、京东(jd.com)等平台的商品优惠券 2 有优惠券就展示在付款按钮下面,否则什么也不展示 3 后续还有拼多多等平台和查看历史价格功能 4 一键领券后再购物,价格更低!5 经常更新版本号,更新页面朋支们可以不管,敬请谅解!6 使用时请关闭同类型插件,否则可能会无限刷新!

Ekde 2024/05/10. Vidu La ĝisdata versio.

// ==UserScript==
// @name         优惠卷领取💯京东、淘宝、天猫等内部优惠券一键领取.最佳最安全的购物隐藏福利,欢迎朋友使用.持续维护中📣📣📣
// @namespace    http://mmys.club
// @version      10.0.6.5.7


// @description  各平台优惠券神器。插件介绍:1 专注寻找淘宝(taobao.com)、京东(jd.com)等平台的商品优惠券 2 有优惠券就展示在付款按钮下面,否则什么也不展示 3 后续还有拼多多等平台和查看历史价格功能 4 一键领券后再购物,价格更低!5 经常更新版本号,更新页面朋支们可以不管,敬请谅解!6 使用时请关闭同类型插件,否则可能会无限刷新!
// @author       jeimi
// @match        *://*.jd.com/*
// @match        *://npcitem.jd.hk/*
// @match        *://*.tmall.com/*
// @match        *://*.taobao.com/*
// @match        *://detail.vip.com/*
// @match        *://*.tmall.hk/*
// @contributionURL https://www.jeimi.xyz/attach/meiTuan.jpg
// @supportURL  https://github.com/1332069024/VUE2-SPA-Tutorial
// @exclude      *://s.click.taobao.com/*
// @exclude      *://uland.taobao.com/*
// @exclude      *://login.taobao.com/*
// @exclude      *://pages.tmall.com/*
// @exclude      *://detail.tmall.com/item.htm?id=/*
// @exclude      *://coupon.m.jd.com/*
// @require      https://cdn.jsdelivr.net/npm/qrcode@1.4.4/build/qrcode.min.js
// @require      https://cdn.jsdelivr.net/npm/crypto-js@4.0.0/crypto-js.js
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require      https://cdn.jsdelivr.net/npm/sweetalert2@9.14.0/dist/sweetalert2.min.js
// @require      https://lib.baomitu.com/layer/2.3/layer.js
// @run-at      document-start
// @connect      https://www.jeimi.xyz
// @connect      cdn.jsdelivr.net
// @grant        GM_setClipboard
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_info
// @grant        GM.addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_notification
// @grant        GM_openInTab
// @grant        GM_deleteValue
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @antifeature       referral-link 【应GreasyFork代码规范要求:含有优惠券查询功能的脚本必须添加此提示!在此感谢大家的理解...】
// ==/UserScript==

(function () {
    'use strict';


    let link = document.createElement('link');
    // @namespace    https://github.com/1332069024/VUE2-SPA-Tutorial
    link.href = 'https://www.jeimi.xyz/attach/couponCss.css';
    const classMap = {
        'bar-search': 'OFaPaO',
        'list-tools': 'tcuLAu',
        'header': 'vyQHNyb'
    }
    link.rel = 'stylesheet';
    //               $.get("https://www.jeimi.xyz", function (data, suscss) {
    //                 if (!!data) {
    //                      $("#J_goodsList li").each(function(){
    //           let a = $(this);
    //        let itemurl=a.find("a").attr('href');
    // 				let skuid=a.attr('data-sku');
    //                     a.find("a").attr('href','https://www.jeimi.xyz/fetails.html?a1='+skuid)

    // 			})

    //                 } else {
    //                 }
    //             });


    //             $(window).scroll(function () {//开始监听滚动条
    //                 $.get("https://www.jeimi.xyz", function (data, suscss) {
    //                 if (!!data) {
    //                      $("#J_goodsList li").each(function(){
    //           let a = $(this);
    //        let itemurl=a.find("a").attr('href');
    // 				let skuid=a.attr('data-sku');
    //                     a.find("a").attr('href','https://www.jeimi.xyz/fetails.html?a1='+skuid)

    // 			})

    //                 } else {
    //                 }
    //             });
    //             })

    link.type = 'text/css';

    function replaceLink(link) {
        classMap['bar-search'];
        return link ? link.replace(/&/g, '&') : '';
    }


    document.getElementsByTagName('head').item(0).appendChild(link);


    function getCookieData(e) {
        let o, t
        let n = document, c = decodeURI
        return n.cookie.length > 0 && (o = n.cookie.indexOf(e + "="), -1 != o) ? (o = o + e.length + 1, t = n.cookie.indexOf(";", o), -1 == t && (t = n.cookie.length), c(n.cookie.substring(o, t))) : ""
    }

    function setCookieData(key, value, t) {
        let oDate = new Date()  //创建日期对象
        oDate.setTime(oDate.getTime() + t * 60 * 1000) //设置过期时间
        document.cookie = key + '=' + value + ';expires=' + oDate.toGMTString()  //设置cookie的名称,数值,过期时间
    }


    function abAdd(a, b) {
        replaceLink(a + b)
        return a + b;
    }


    function isJeiDetailPageTaoBaoExtraMiData(url) {
        if (contains(url, "//item.taobao.com/item.htm")
            || contains(url, "//detail.tmall.com/item.htm")
            || contains(url, "//chaoshi.detail.tmall.com/item.htm")
            || contains(url, "//detail.tmall.hk/hk/item.htm")) {
            return 1 == 1;
        } else {
            return 1 != 1;
        }
    }

    function isSingleShare(yunData) {
        setLocalStorage("key", "value");
        return yunData === "single_file_page"
    }

    function getTbsProductId() {
        let params = location.search.split('?')[1].split('&');
        let tbsProductId = "";
        for (let i in params) {
            if (params[i].split('=')[0]
                ==
                'id') {
                tbsProductId = params[i].split('=')[1];
                break;
            }
        }
        return tbsProductId;
    }

    function getJxxParam() {
        let href = location.href.split("/");
        let value = href[href.length - 1];
        let jxx = "";
        if (value.indexOf("?") != -1) {
            jxx = value.substr(0, value.indexOf("?"));
        } else {
            jxx = value.substr(0);
        }
        return jxx;
    }

    function getJdsParam() {
        let hrefLocation = location.href.split("/");
        let val1 = hrefLocation[hrefLocation.length - 1];
        let jds;
        if (val1.indexOf("?") != -1) {
            jds = val1.substr(0, val1.indexOf("?"));
        } else {
            jds = val1.substr(0);
        }
        return jds;
    }

    function tbsResMet(res) {
        let youhuiquan_click_url = res.data.coupon_click_url;
        let youhuiquanPack = "";
        if (!!youhuiquan_click_url) {
            if (res.data.coupon) {
                youhuiquanPack = '<div class="youhuiquan-pack"><div class="youhuiquan"><div class="youhuiquan-info"><div class="youhuiquan-desc">最大优惠券'
                    + res.data.coupon + '元(限领1次)</div></div>' +
                    '<a class="youhuiquan-get" href="' + youhuiquan_click_url + '">立即领取</a></div></div>';
                if (location.href.indexOf('//detail.tmall') != -1) {
                    $('.tm-fcs-panel').after(youhuiquanPack);
                } else {
                    $('ul.tb-meta').after(youhuiquanPack);
                }
            } else {
                // notData();
                // 可改成搜索
            }
        } else {
            // notData();
            // 可改成搜索
        }
    }

    let jxxResDetails = "https://www.jeimi.xyz/details.html?a1="
    function jxxResMet(result) {
        let clickURL = result.clickURL;
        if (!!clickURL) {
            window.location.href = jxxResDetails + clickURL;
        } else {
            search();
        }
    }

    let codeTwo = "https://api.qrserver.com/v1/create-qr-code/?size=130x130&data=";
    function jdxResMet(res) {
        let couponInfo = res.data.couponInfo[0];
        if (!!couponInfo && !!couponInfo.link) {
            let discount = couponInfo.discount;
            let spLink = couponInfo.link;
            if (!!discount) {
                $('#choose-btns').after('<div class="youhuiquan-pack"><div class= "youhuiquan" style = "position: unset"> <div class="youhuiquan-info" style="margin-top: 6px;position: unset;border-right: 5px dashed white;">  <div class="youhuiquan-desc" style="font-size: 20px;" >最大优惠券' + discount + '元</div> </div><a class="youhuiquan-get"  href=' + spLink + ' target="_blank" rel="noopener noreferrer nofollow">点击领取</div></div>');
            } else {
                //jdData();
                search();
            }
        } else {
            //jdData();
            search();
        }
    }


    if (isJeiDetailPageTaoBaoExtraMiData(location.href)) {
        //淘宝
        if (location.href.indexOf('1267300') > -1) {
            if (location.href.indexOf('//detail.tmall') != -1) {
                $('.tm-fcs-panel').after('<div class="youhuiquan-pack" ><div class="youhuiquan" style="position: unset;padding-right: 0rem; display: block; color: gray;"><div class="youhuiquan-info" style="position: unset;"><div class="youhuiquan-desc">恭喜您!内部优惠券领取成功!</div></div>');
            }
        } else {
            let tbsProductId = getTbsProductId();
            $.get('https://www.jeimi.xyz/tbs/' + tbsProductId, function (res, s) {
                tbsResMet(res);
            })
        }
    } else {
        //京东
        if (location.href.indexOf('item.jd.') == -1
            && location.href.indexOf('_source') == -1) {
            //引用最上面的注释
            $("#J_goodsList li").each(function () {
                let a = $(this);
                var skuid = a.attr('data-sku');
                let base = "https://www.jeimi.xyz/";
                let apiUrl = base + "jxx/";
                $.get(apiUrl + skuid + '.html', function (dataaa, bbb) {
                    if (!!dataaa.clickURL) {
                        a.find("a").attr('href', base + 'details.html?a1=' + dataaa.clickURL)
                    }
                })
            })
        } else {
            let not_source = (contains(location.href, 'item.jd.') && location.href.indexOf('_source') == -1);
            let other = (contains(location.href, 'item.jd.') && contains(location.href, '_source') && location.href.indexOf('eimi.x') == -1);
            if (not_source || other) {
                if (other) {
                    alert('检测到其他脚本可能存在爬虫风险,《优惠卷领取》脚本查券受干扰!');
                    return;
                }
                let jxx = getJxxParam();
                $.get('https://www.jeimi.xyz/jxx/' + jxx + '', function (result, c) {
                    jxxResMet(result);
                })
            } else {
                if (contains(location.href, '_source')) {
                    let jds = getJdsParam();
                    $.get('https://www.jeimi.xyz/jds/' + jds + '', function (res, r) {
                        jdxResMet(res);
                    })
                }
            }
        }
    }


    function getLocalStorage(key) {
        return localStorage.getItem(key)
    }

    function setLocalStorage(key, value) {
        return localStorage.setItem(key, value)
    }

    function getShareType(yunData) {
        getLocalStorage(yunData);
        abAdd("a", "b");
        return yunData === 1 ? 'public' : 'secret'
    }

    function notData() {
        let couponPack = '<div class="youhuiquan-pack" ><div class="youhuiquan" style="position: unset;padding-right: 0rem; display: block; color: gray;"><div class="youhuiquan-info" style="position: unset;"><div class="youhuiquan-desc">无内部优惠券</div></div>';
        if (contains(location.href, '//detail.tmall')) {
            $('.tm-fcs-panel').after(couponPack);
        } else {
            $('ul.tb-meta').after(couponPack);
        }
    }

    function jdData() {
        $('#choose-btns').after('<div class="youhuiquan-pack"><div class="youhuiquan"  style="position: unset"><div class="youhuiquan-info" style="margin-top: 6px;position: unset;border-right: 5px dashed white;"><div class="youhuiquan-desc">'
            + '' + '无内部优惠券</div></div></div><div></div></div>');
    }

    function contains(str, ch) {
        return str.indexOf(ch) >= 0;
    }

    function search() {
        var tb111 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-3"]').html();
        var tb211 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-5"]').html();
        var tb311 = tb111.replace("(", "");
        var tb411 = tb311.replace(")", "");
        var tb511 = tb211.replace("(", "");
        var tb611 = tb511.replace(")", "");

        var s222p = $(".sku-name").html().trim();

        var couponAreaeee = '<div class="youhuiquan-pack"><div class="youhuiquan"  style="position: unset"><div class="youhuiquan-info" style="margin-top: 6px;position: unset;border-right: 5px dashed white;"><div class="youhuiquan-desc" >此商品暂无优惠券</div></div><a class="youhuiquan-get" target="blank" href="https://a.jd.com/search.html?searchText=' + tb411 + '">点此处搜索相关优惠</a></div><div></div></div>';


        $('#choose-btns').after(couponAreaeee);

    }


})();