Greasy Fork

来自缓存

Greasy Fork is available in English.

淘宝天猫内部优惠券.现在开始帮您省钱

淘宝天猫内部优惠券,一件查找优惠券,简单快速

当前为 2018-10-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         淘宝天猫内部优惠券.现在开始帮您省钱
// @namespace    https://www.ishtq.com
// @version      3.36
// @description  淘宝天猫内部优惠券,一件查找优惠券,简单快速
// @author       淘宝天猫内部优惠券
// @include      http*://item.taobao.com/*
// @include      http*://detail.tmall.com/*
// @include      http*://s.taobao.com/*
// @include      http*://list.tmall.com/*
// @include      http*://list.tmall.hk/*
// @include      http*://chaoshi.tmall.com/*
// @require      https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js
// @grant        none
// ==/UserScript==
////////////////////////////////////////////////////////////////////////
(function() {
    'use strict';
    // 淘宝天猫优惠券,一件查找优惠券,简单快速为您省钱!!!
    var location = window.location.host;
	var num = -1;
    if(location.indexOf("item.taobao.com")>=0){
		num = 0;
	}else if(location.indexOf("detail.tmall") != -1){
		num = 1;
	}else if(location.indexOf("s.taobao.com") != -1){
		num = 2;
	}else if(location.indexOf("list.tmall.com") != -1){
		num = 3;
	}else if(location.indexOf("ai.taobao.com") != -1){
        num = 4;
    }else if(location.indexOf("list.tmall.hk") != -1){
        num = 5;
    }else if(location.indexOf("chaoshi.tmall.com") != -1){
        num = -1;
    }
        //alert(num)
        if(num != -1){
setInterval(function(){
		getTaoBao(num);
},500);
        }
    })();

     function getTaoBao(num){
        var name;
        var html;
		switch(num){
						  case 0:
                          if($('.tb-main-title').hasClass("tm")){
                          }else{
                          $('.tb-main-title').addClass("tm");
                              name = $('.tb-main-title').text();
                              html = '<div class="tb-btn-buy" style="padding-top:10px;"><a href="https://www.ishtq.com/?m=search&a=index&k='+ encodeURI($.trim(name))  + '&type=1" target="_blank">查优惠券</a></div><div class="tb-btn-add" style="padding-top:10px;"><a href="https://s.click.taobao.com/3IfuLLw" target="_blank">双十一超级红包</a></div>';
                         $('.tb-action').append(html);
                          }
						  break;
						  case 1:
                          if($('meta[name=keywords]').hasClass("ishtq")){
                          }else{
                          $('meta[name=keywords]').addClass("ishtq");
                             name = $('meta[name=keywords]').attr('content');
                             html = '<div class="tb-btn-buy tb-btn-sku" style="padding-top:10px;"><a href="https://www.ishtq.com/?m=search&a=index&k='+ encodeURI($.trim(name))  + '&type=1" target="_blank">查优惠券</a></div><div class="tb-btn-basket tb-btn-sku" style="padding-top:10px;"><a href="https://s.click.taobao.com/3IfuLLw" target="_blank">双十一超级红包</a></div>';
                             $('.tb-action').append(html);
                             }
						  break;
						  case 2:
		for(var i=0;i<$(".price").length;i++){
            if($(".price").eq(i).hasClass("jia")){
                          }else{
                              $(".price").eq(i).addClass("jia");
			if($(".J_U2IStat .img").eq(i).attr("alt")){
				$(".price").eq(i).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".J_U2IStat .img").eq(i).attr("alt"))+"&type=1' target='_blank'><strong style='border-left:2px solid;padding-left:4px;font-size:16px;'>查优惠券</strong></a>")
			}else{
				$(".price").eq(i).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".J_ItemPic").eq(i).attr("alt"))+"&type=1' target='_blank'><strong style='border-left:2px solid;padding-left:4px;font-size:16px;'>查优惠券</strong></a>")
            }
			}
		}
						  break;
						  case 3:
                          if($(".productPrice")){
			for(var q=0;q<$(".productPrice").length;q++){
                if($(".productPrice").eq(q).hasClass("jia")){

		                       }else{
			                       $(".productPrice").eq(q).addClass("jia");
				$(".productPrice").eq(q).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".productTitle a").eq(q).text())+"&type=1'  target='_blank'><em style='border-left:2px solid;height:17px;line-height:20px;padding:4px;margin-left:4px;font-size:18px;'>查优惠券</em></a>")
			}
            }
		}
		for(var j=0;j<$(".ui-price").length;j++){
            if($(".ui-price").eq(j).hasClass("jia")){
		                       }else{
			                       $(".ui-price").eq(j).addClass("jia");
				$(".ui-price").eq(j).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".product-title a").eq(j).text())+"&type=1'  target='_blank'><span style='border-left:2px solid;height:10px;line-height:13px;padding:4px;margin-left:4px;font-size:13px;'>查优惠券</span</a>")
                               }
        }
						  break;
                          case 4:
                          $(".title").each(function(){
		                       if($(this).hasClass("jia")){

		                       }else{
			                       $(this).addClass("jia");
                                   name = $(this).children("a:first").text();
                                   $(this).after("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($.trim(name))+"&type=1'  target='_blank'><em style='border-left:2px solid;height:17px;line-height:20px;padding:4px;margin-left:4px;font-size:14px;color:#7d41df;'>查优惠券</em></a>");

                               }
	                            });
                          break;
						  case 5:
		if($(".productPrice")){
			for(var e=0;e<$(".productPrice").length;e++){
                if($(".productPrice").eq(e).hasClass("jia")){
                          }else{
                              $(".productPrice").eq(e).addClass("jia");
				$(".productPrice").eq(e).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".productTitle a").eq(e).text())+"&type=1'  target='_blank'><em style='border-left:2px solid;height:17px;line-height:20px;padding:4px;margin-left:4px;font-size:14px;color:#7d41df;'>查优惠券</em></a>")
			}
            }
		}
		for(var w=0;w<$(".ui-price").length;w++){
            if($(".ui-price").eq(w).hasClass("jia")){
                          }else{
                              $(".ui-price").eq(w).addClass("jia");
				$(".ui-price").eq(w).append("<a href='https://www.ishtq.com/?m=search&a=index&k="+encodeURI($(".product-title a").eq(w).text())+"&type=1'  target='_blank'><span style='border-left:2px solid;height:10px;line-height:13px;padding:4px;margin-left:4px;font-size:13px;color:#7d41df;'>查优惠券</span></a>")
		}
        }
						  break;
            case 6:
                //if($(".wrap").length == 0) break;
                //alert($(".wrap"));
                break;
					  }
    }