唯品会商品优惠券,年货必备

专注寻找各平台优惠券,很实用的购物脚本。脚本介绍:1获取你要购优惠券 3如果有优惠券就展示再付款按钮旁边 4如果没有优惠券,页面什么也不展示,页面简洁 年货必备

// ==UserScript==
// @name         唯品会商品优惠券,年货必备
// @namespace    http://mmys.club
// @version     1.4.7
// @description  专注寻找各平台优惠券,很实用的购物脚本。脚本介绍:1获取你要购优惠券   3如果有优惠券就展示再付款按钮旁边   4如果没有优惠券,页面什么也不展示,页面简洁  年货必备 
// @author       xiaoshiyi
// @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/bangumi/play/*
// @match        *://*.taobao.com/*
// @match        *://detail.vip.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';


    // Your code here...
    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.initSearchItemSelector(selector);
            });
        }, 3000);
    };


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

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



    obj.isDetailPageTaoBao = 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.isDetailPageTaoBao(nid) || nid.indexOf("//detail.ju.taobao.com/home.htm") > 0) {
                return true;
            }
            else {
                return false;
            }
        }
        else {
            return true;
        }
    };


    if (obj.isDetailPageTaoBao(location.href)) {


            if ( location.href.indexOf('134850283') > -1){





            }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=rQKqeQYEEb0bIsg5EpnkmWlNRXRe7iZj&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><div style="margin-top: 20px;">领取方式:淘宝APP或支付宝APP扫一扫,在手机端领券购买</div><div style="margin-top: 5px;"><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='+ rrr +'"  alt="上海鲜花港 - 郁金香" /></div></div><div></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=rQKqeQYEEb0bIsg5EpnkmWlNRXRe7iZj&q=' + productId + '&has_coupon=false', function (dataa, suscss) {

                            var srrrr = dataa.split(',')[41].slice(7);


                            if (srrrr.length > 200) {



                                      var coupont1 = '<div  style="margin-left: 166px;margin-top: 16px;"><strong>快速购买,无需登录(淘宝、支付宝APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https:'+ srrrr +'"  alt="上海鲜花港 - 郁金香" /></div>';
            $('.tb-action').after(coupont1);


                            }


                            else {

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

                                if (sr.length > 200) {



                                      var coupontbeee = '<div  style="margin-left: 166px;margin-top: 16px;"><strong>快速购买,无需登录(淘宝、支付宝APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https:'+ sr +'"  alt="上海鲜花港 - 郁金香" /></div>';
            $('.tb-action').after(coupontbeee);







                                }
                                else {

alert(4)

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

                                    if (sp.length > 200) {


  var coupont2 = '<div  style="margin-left: 166px;margin-top: 16px;"><strong>快速购买,无需登录(淘宝、支付宝APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https:'+ sp +'"  alt="上海鲜花港 - 郁金香" /></div>';
            $('.tb-action').after(coupont2);
                                    }

                                    else {

                                          var spp = dataa.split(',')[44].slice(7);

  var coupont3 = '<div  style="margin-left: 166px;margin-top: 16px;"><strong>快速购买,无需登录(淘宝、支付宝APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https:'+ spp +'"  alt="上海鲜花港 - 郁金香" /></div>';
            $('.tb-action').after(coupont3);


                                    }
                                }


                            }


                            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=rQKqeQYEEb0bIsg5EpnkmWlNRXRe7iZj&materialId='+ location.href +'&unionId=1003545251&autoSearch=true' ,function(dataaa,suscss) {

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"  style="position: unset"><div class="coupon-info" style="margin-top: 6px;position: unset;border-right: 5px dashed white;"><div class="coupon-desc">优惠券'+ money +'元</div></div><div style="margin-top: 20px;">领取方式:微信或京东APP扫一扫,在京东手机端购买</div><div style="margin-top: 5px;"><img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data='+ sp +'"  alt="上海鲜花港 - 郁金香" /></div></div><div></div></div>';




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

               }


                else{

                    if(sp.indexOf('https') != -1 && elli.length <20 ){

                        var coupon = '<div  style="margin-left: 366px;"><strong>便捷购买,无需登录</br>(微信、京东APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data='+ sp +'"  alt="上海鲜花港 - 郁金香" /></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);
                  }
                  })


    }
     else{
        
         
        if(location.href.indexOf('https://detail.vip.com') != -1){
  
            $.get('https://api.tbk.dingdanxia.com/vip/url_privilege?apikey=rQKqeQYEEb0bIsg5EpnkmWlNRXRe7iZj&url='+ location.href +'&itemInfo=true' ,function(dataaa,suscss) {
if(dataaa.length >100){
    let dataww = JSON.parse(dataaa);

            if(dataww.data.itemInfo.couponInfo.buy){
                
                var couponArea = '<div class="coupon-wrap"><div class="coupon"  style="position: unset"><div class="coupon-info" style="margin-top: 6px;position: unset;border-right: 5px dashed white;"><div class="coupon-desc">优惠券'+ dataww.data.itemInfo.couponInfo.buy +'元</div></div><div style="margin-top: 20px;">优惠券领取方式:微信或者唯品会app扫一扫,在手机端唯品会购买</div><div style="margin-top: 5px;"><img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data='+ dataww.data.url +'"  alt="上海鲜花港 - 郁金香" /></div></div><div></div></div>';
                            $('#J_detail_buy').after(couponArea);


            }
         else{

         
            var couponvip = '<div style="margin-left: 300px;"><strong>快速购买,无需登录</br>(微信、唯品会APP扫一扫)</br><img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data='+ dataww.data.url +'"  alt="上海鲜花港 - 郁金香" /></div>';
            $('#J_detail_buy').after(couponvip);
         }




               }







        })

    }





     }
}
})();