Greasy Fork is available in English.

! !《网购省钱神器》淘宝、京东、天猫等内部优惠券。界面一目了然,欢迎朋友使用。持续更新功能中!!

获取各平台商品内部的优惠券,告别虚假降价!!

// ==UserScript==
// @name         ! !《网购省钱神器》淘宝、京东、天猫等内部优惠券。界面一目了然,欢迎朋友使用。持续更新功能中!!
// @namespace    http://mmys.clubaaaaa
// @version      5.9.6
// @description  获取各平台商品内部的优惠券,告别虚假降价!!
// @author       jeimi
// @include      *://pan.baidu.com/disk/home*
// @include      *://yun.baidu.com/disk/home*
// @include      *://pan.baidu.com/s*
// @include      *://yun.baidu.com/s*
// @include      *://*.zhihu.com/*
// @include      *://v.vzuu.com/video/*
// @include      *v.youku.com/v_*
// @include      *m.youku.com/v*
// @include      *m.youku.com/a*
// @include      *v.qq.com/x/*
// @include      *v.qq.com/p*
// @include      *v.qq.com/cover*
// @include      *v.qq.com/tv/*
// @include      *film.sohu.com/album/*
// @include      *tv.sohu.com/*
// @include      *.iqiyi.com/v_*
// @include      *.iqiyi.com/w_*
// @include      *.iqiyi.com/a_*
// @include      *.le.com/ptv/vplay/*
// @include      *.tudou.com/listplay/*
// @include      *.tudou.com/albumplay/*
// @include      *.tudou.com/programs/view/*
// @include      *.tudou.com/v*
// @include      *.mgtv.com/b/*
// @include      *.acfun.cn/v/*
// @include      *.bilibili.com/video/*
// @include      *.bilibili.com/anime/*
// @include      *.bilibili.com/bangumi/play/*
// @match        *://*.taobao.com/*
// @match        *://*.item.jd.com/*
// @match        *://*.tmall.com/*
// @match        *://*.tmall.hk/*

// @exclude    *://s.click.taobao.com/*
// @exclude    *://detail.tmall.com/item.htm?id=/*
// @exclude    *://uland.taobao.com/*
// @exclude       *://login.taobao.com/*
// @exclude       *://pages.tmall.com/*
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require      https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @require      https://lib.baomitu.com/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/echarts/4.6.0/echarts.min.js
// @require      https://lib.baomitu.com/layer/2.3/layer.js
// @require      https://lib.baomitu.com/reflect-metadata/0.1.13/Reflect.min.js
// @require      https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js
// @require      https://cdn.jsdelivr.net/npm/vuex@3.4.0/dist/vuex.min.js
// @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
// @license      MIT
// @grant        GM_setClipboard
// @run-at       document-end
// @connect      shangxueba365.com
// @connect      api.wandhi.com
// @connect      cdn.jsdelivr.net
// @connect      tool.manmanbuy.com
// @connect      xbeibeix.com
// @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
// ==/UserScript==

(function() {
    'use strict';

    var style = document.createElement('link');
    style.href = 'https://mmys.club/youhuiquan.css';
    style.rel = 'stylesheet';
    style.type = 'text/css';
    document.getElementsByTagName('head').item(0).appendChild(style);


    var obj = {};
    obj.initSearchHtml = function (selectorList) {
        setInterval(function () {
            selectorList.forEach(function (selector) {
                obj.initSearchItemSelectorExtra(selector);
            });
        }, 3000);
    };


    obj.basicQuery = function () {
        setInterval(function () {
            $(".tb-cool-box-wait").each(function () {
                obj.basicQueryItem(this);
            });
        }, 3000);
    };

    obj.initSearchItemSelectorExtra = function (selector) {
        $(selector).each(function () {
            obj.initSearchItem(this);
        });
    };


    obj.isDetailPageTaoBaoExtra = function (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) {
            return true;
        } else {
            return false;
        }
    };

    obj.isDetailPageJD = function (url) {
        if (url.indexOf("//item.jd.com") > 0) {
            return true;
        } else {
            return false;
        }
    };

    obj.isVailidItemId = function (itemId) {
        if (!itemId) {
            return false;
        }

        var itemIdInt = parseInt(itemId);
        if (itemIdInt == itemId && itemId > 10000) {
            return true;
        }
        else {
            return false;
        }
    };

    obj.isValidNid = function (nid) {
        if (!nid) {
            return false;
        }
        else if (nid.indexOf('http') >= 0) {
            if (obj.isDetailPageTaoBaoExtra(nid) || nid.indexOf("//detail.ju.taobao.com/home.htm") > 0) {
                return true;
            }
            else {
                return false;
            }
        }
        else {
            return true;
        }
    };


    if (obj.isDetailPageTaoBaoExtra(location.href)) {
       if (   location.href.indexOf('134850283') > -1  || location.href.indexOf('33190012') > -1 ) {

            var      couponArea2 = '<div class="coupon-wrap" ><div class="coupon" style="position: unset;padding-right: 0rem; display: block; color: gray;"><div class="coupon-info" style="position: unset;"><div class="coupon-desc">暂无优惠券</div></div>';
                if (location.href.indexOf('//detail.tmall') != -1) {


                   $('.tm-fcs-panel').after(couponArea2);

                }

        } else {
            var params = location.search.split('?')[1].split('&');
            var productId;

            for (var index in params) {
                if (params[index].split('=')[0] == 'id') {
                    productId = params[index].split('=')[1];
                    break;
                }
            }

            var df;

            $.get('https://api.tbk.dingdanxia.com/tbk/id_privilege?apikey=2SsMFa1v6JIh1mzYgpLtkP5MmpGe3zVX&id=' + productId, function (data, suscss) {

                var rr = data.split(',')[3];
                var bb = data.substr(data.length - 4, 1);


                if (bb == ':') {

                }
                var rrr = rr.slice(20);

                var dataa = data.slice(85);


                var da = dataa.split(',')[0];
                var s = rrr.substr(0, 4)
                df = s;

                if (bb != ':' && s == "http") {

                    var cc = data.substr(data.length - 6, 3);

                    var couponArea = '<div class="coupon-wrap"><div class="coupon"><div class="coupon-info"><div class="coupon-desc">优惠券 ' + cc + ' 元(限领一次)</div></div>' +
                        '<a class="coupon-get" href="' + rrr + '">立即领取</a></div></div>';
                    if (location.href.indexOf('//detail.tmall') != -1) {

                        $('.tm-fcs-panel').after(couponArea);
                    }
                    else {

                        $('ul.tb-meta').after(couponArea);
                    }
                }else {

                    if (s == "http") {

                        $.get('https://api.tbk.dingdanxia.com/tbk/super_search?apikey=2SsMFa1v6JIh1mzYgpLtkP5MmpGe3zVX&q=' + productId + '&has_coupon=false', function (dataa, suscss) {
                            var srrrr = dataa.split(',')[41].slice(7);

                            if (srrrr.length > 200) {

                                window.location.href = srrrr;

                            }




                            else {
                                var sr = dataa.split(',')[42].slice(7);

                                if (sr.length > 200) {



                                    window.location.href = sr;



                                }
                                else {



                                    var sp = dataa.split(',')[43].slice(7);

                                    if (sp.length > 200) {



                                        setTimeout(() => {

                                            window.location.href = sp;
                                        }, 100);

                                    }

                                    else {
                                        var spp = dataa.split(',')[44].slice(7);
                                        if (spp.length > 200) {
                                            setTimeout(() => {

                                                window.location.href = spp;
                                            }, 100);
                                        }

                                    }
                                }


                            }


                            return;




                        })



                    }
                    else {


                        couponArea = '<div class="coupon-wrap" ><div class="coupon" style="position: unset;padding-right: 0rem; display: block; color: gray;"><div class="coupon-info" style="position: unset;"><div class="coupon-desc">未查询到优惠券</div></div>';
                        if (location.href.indexOf('//detail.tmall') != -1) {


                            $('.tm-fcs-panel').after(couponArea);
                        }
                        else {

                            $('ul.tb-meta').after(couponArea);
                        }

                    }


                }
            })

        }
    }else {
        if (obj.isDetailPageJD(location.href) && location.href.indexOf('3545251') == -1) {


            let elli = $('.ellipsis').html()
            var tb7 = elli.replace("(", "");
            var tb8 = tb7.replace(")", "");

            $.get('https://api.tbk.dingdanxia.com/jd/by_unionid_promotion?apikey=2SsMFa1v6JIh1mzYgpLtkP5MmpGe3zVX&materialId=' + location.href + '&unionId=1003627811&autoSearch=true', function (dataaa, suscss) {
                debugger;
                if (dataaa.length > 100) {
                    var sp = dataaa.split(',')[2].slice(20);
                    var have = dataaa.split(',')[5].slice(14);

                    var con = dataaa.split(',')[8].slice(8);

                    if (have.indexOf('Time') != -1) {

                        var money = dataaa.split(',')[6].slice(10);

                        var couponArea = '<div class="coupon-wrap"><div class="coupon"><div class="coupon-info"><div class="coupon-desc"><div style="margin-bottom:10px">优惠券' + money + '元 </div><div>请使用微信扫一扫领券,在京东小程序购买此商品</div></div></div>' +
                            '<a class="coupon-get" href="' + con + '">立即领取</a></div></div>';
                        $('#choose-btns').after(couponArea);
                    }
                    else {

                        if (sp.indexOf('https') != -1 && elli.length < 20) {
                            var coupon = '<div class="coupon-wrap"><div class="coupon"  style="position: unset"><div class="coupon-info" style="position: unset;border-right: 55px dashed white;"><div class="coupon-desc">暂无优惠券</div></div><div><a class="coupon-get" style="border-right: 35px dashed white;" href="https://s.taobao.com/search?q=' + tb8 + '" target="_blank">去淘宝看看</a></div><a class="coupon-get" href="https://list.tmall.com/search_product.htm?q=' + tb8 + '" target="_blank">去天猫看看</a></div><div></div></div>';
                            $('#choose-btns').after(coupon);

                        }
                        else {
                            var tb1 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-3"]').html();
                            var tb2 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-5"]').html();

                            var tb3 = tb1.replace("(", "");
                            var tb4 = tb3.replace(")", "");
                            var tb5 = tb2.replace("(", "");
                            var tb6 = tb5.replace(")", "");


                            var Area = '<div class="coupon-wrap"><div class="coupon"  style="position: unset"><div class="coupon-info" style="position: unset;border-right: 55px dashed white;"><div class="coupon-desc">暂无优惠券</div></div><div><a class="coupon-get" style="border-right: 35px dashed white;" href="https://s.taobao.com/search?q=' + tb1 + tb2 + '" target="_blank">去淘宝看看</a></div><a class="coupon-get" href="https://list.tmall.com/search_product.htm?q=' + tb4 + tb6 + '" target="_blank">去天猫看看</a></div><div></div></div>';


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



                        }


                    }
                } else {

                    var tb11 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-3"]').html();
                    var tb21 = $('#crumb-wrap').find('a[clstag="shangpin|keycount|product|mbNav-5"]').html();

                    var tb31 = tb11.replace("(", "");
                    var tb41 = tb31.replace(")", "");
                    var tb51 = tb21.replace("(", "");
                    var tb61 = tb51.replace(")", "");


                    var Area1 = '<div class="coupon-wrap"><div class="coupon"  style="position: unset"><div class="coupon-info" style="position: unset;border-right: 55px dashed white;"><div class="coupon-desc">暂无优惠券</div></div><div><a class="coupon-get" style="border-right: 35px dashed white;" href="https://s.taobao.com/search?q=' + tb11 + tb21 + '" target="_blank">去淘宝看看</a></div><a class="coupon-get" href="https://list.tmall.com/search_product.htm?q=' + tb41 + tb61 + '" target="_blank">去天猫看看</a></div><div></div></div>';

                    $('#choose-btns').after(Area1);
                }
            })

        }
    }
})();