Greasy Fork is available in English.

淘宝天猫领券脚本

淘宝天猫领券专用库

Цей скрипт не слід встановлювати безпосередньо. Це - бібліотека для інших скриптів для включення в мета директиву // @require https://update.greasyfork.org/scripts/462750/1167464/%E6%B7%98%E5%AE%9D%E5%A4%A9%E7%8C%AB%E9%A2%86%E5%88%B8%E8%84%9A%E6%9C%AC.js

// ==UserScript==
// @exclude       *
// @author        max
// @icon https://www.taobao.com/favicon.ico
// ==UserLibrary==
// @name          淘宝天猫领券脚本
// @description   淘宝天猫领券专用库
// @copyright     max
// @license MIT

// ==/UserScript==

// ==/UserLibrary==

function max_get_json(data) {
	var n1 = data.indexOf("goodsItem");
	if (n1 < 0) return 0;
	var tmp_str = data.substr(n1);
	var n2 = tmp_str.indexOf(";");
	tmp_str=data.substr(n1+11,n2-11);

	return tmp_str;
}

function max_get_coupon(data) {
    //var html=$(data).find("ul .goods-list .clear li:first  div h3").text();
	var $html=$(data).find("ul.goods-list.clear li:first  div div.good-price");
	return $html;
}

function max_get_huodong(data) {
	var n1 = data.indexOf("huodongStr");
	if (n1 < 0) return 0;
	var tmp_str = data.substr(n1+10);
	return tmp_str;
}

function TINT(name) {
    var reTaoBao = /taobao.com/i;
    var reTmall = /tmall/i;
    var currentUrl = window.location.href;
    $('head').append($('<link rel="stylesheet" href="https://youhuicity.com/zkq4tb2.css">'));
    var h = 'https://www.youhuicity.com/?m=search&a=index&k=' + encodeURI(name);
    var init = "<div id='max-test'><div id='zkq_nr' style='position: relative;'><table class='zkq_tab' id='zkq_table'><thead><tr><th><b onclick=window.open('https://link.zhihu.com/?target=https://www.youhuicity.com') style='cursor:pointer'>\u4f18\u60e0\u5238</b></th><th>\u539f\u4ef7</th><th>\u5238\u540e\u4ef7</th><th>\u64cd\u4f5c\u261f</th></tr></thead><tbody><tr><td colspan='4'>\u6b63\u5728\u67e5\u8be2\u4f18\u60e0\u4fe1\u606f\uff0c\u8bf7\u7a0d\u5019...</td></tr></tbody></table></div></div>";
    //0110015
    $('div#root').children().eq(0).children().eq(1).children().eq(1).children().eq(0).children().eq(0).children().eq(1).children().eq(5).prepend(init);
	$('#J_LinkBasket').parent().parent().prepend(init);
    $('.J_LinkAdd').parent().parent().prepend(init);
    if (reTaoBao.test(currentUrl)) {
        $('#zkq_table').addClass('zkq_tab_taobao');
    } else {
        $('#zkq_table').addClass('zkq_tab_tmall');
    }
    $.get(h,
    function(d, status) {
        $("#zkq_table tbody tr").remove();
		var reTaoBao = /taobao.com/i;
		var reTmall = /tmall/i;
		var reChaoShi = /chaoshi/i;
		var currentUrl = window.location.href;
		var name='';
		if (reTaoBao.test(currentUrl)) {
		name = $('.tb-main-title').attr('data-title');
		} else if(reChaoShi.test(currentUrl)){
            name=$('div#detail h1').text();
		} else {
            name=$('div#root h1').text();
        }
        var h= 'https://www.youhuicity.com/?m=search&a=index&k=' + encodeURI(name);

		/*
		var jso=max_get_json(d);
		var s =  JSON.parse(jso);
		if (s.length >0) {
			row += "<tr><td>" + s[0].quan_jine + "元</td><td>¥" + s[0].yuanjia + "</td><td>¥" + s[0].jiage + "</td><td><a style='display: inline-block;padding: 6px 9px;margin-bottom: 0;font-size: 16px;font-weight: normal;height:16px;line-height:16px;width:100px;text-align: center;white-space: nowrap;vertical-align: middle;-ms-touch-action: manipulation;touch-action: manipulation;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;background-image: none;border: 1px solid transparent;border-radius:2px;color: #fff;background-color: red;' href='" + h +  "' target='_blank'>领取</a></td></tr>";
		} else {
        var row = "<tr><td colspan='4'>\u8fd9\u4e2a\u5546\u54c1\u6ca1\u6709\u8d85\u503c\u4f18\u60e0\u5238</td></tr>";
		}
		*/
		var coupon = max_get_coupon(d);
		if (coupon != null) {
			row += "<tr><td>" + coupon.find("span.num").text() + "元</td><td>" + coupon.find("span.price-old").text() + "</td><td>" + coupon.find("span.price-current").text() + "</td><td><img style='width:30px;height:30px' src='data:image/gif;base64,R0lGODlhZABkAHj/ACH/C05FVFNDQVBF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-weight: normal;height:16px;line-height:16px;width:100px;text-align: center;white-space: nowrap;vertical-align: middle;-ms-touch-action: manipulation;touch-action: manipulation;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;background-image: none;border: 1px solid transparent;border-radius:2px;color: #fff;background-color: red;' href='" + h +  "' target='_blank'>领取</a></td></tr>";
		} else {
			var row = "<tr><td colspan='4'>\u8fd9\u4e2a\u5546\u54c1\u6ca1\u6709\u8d85\u503c\u4f18\u60e0\u5238</td></tr>";
		}
        $("#zkq_table tbody").append(row);
		h='https://www.youhuicity.com/huodong.php?t='+Math.random();
		$.get(h,
		function(d, status) {
			var s = max_get_huodong(d);
			$("#zkq_table tbody").append(s);
		});
    });
}
(function() {
    'use strict';
    
	$.holdReady(true);
    var setTime = setTimeout(function () {
        $.holdReady(false);
    }, 2000);
    $(document).ready(function() {
        var name = ''; //$(document).attr('title');
        var host = window.location.host;
        if ($('#max-test').length <= 0) {
            if (host == 'detail.tmall.com') {
                name = $('div#root h1').text();
                TINT(name);
            } else if (host == 'item.taobao.com') {
                name = $('.tb-main-title').attr('data-title');
                TINT(name);
            } else if (host == 'detail.tmall.hk') {
                name = $('meta[name=keywords]').attr('content');
				TINT(name);
            } else if (host == 'chaoshi.detail.tmall.com') {
                name = $('input[name=title]').attr('value');
                TINT(name);
            }
        }
    });
})();