Greasy Fork

Greasy Fork is available in English.

AC-淘宝天猫商品优惠信息查询

淘宝天猫商品查询是否具有优惠券

当前为 2017-11-01 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AC-淘宝天猫商品优惠信息查询
// @version      2.1
// @description  淘宝天猫商品查询是否具有优惠券
// @author       AC
// @include      https://item.taobao.com/item.htm*
// @include      https://detail.tmall.com/item.htm*
// @note         2017.11.1-V2.1 切换为include规则,而非match规则,避免GreaseMonkey上无法使用的问题
// @note         2017.10.30-V2.0 修复在某些页面上,标题获取不正确的问题
// @note         2017.10.28-V1.0 第一版本,edit from http://greasyfork.icu/zh-TW/scripts/34604
// @run-at       document-start
// @namespace [email protected]
// ==/UserScript==
// .tb-detail-hd, .tb-main-title
var actaobaoT = setInterval(function(){
    if(document.querySelectorAll(".tb-detail-hd, .tb-main-title").length > 0){
        clearInterval(actaobaoT);
        var TitleNode = document.querySelector("div#J_Title h3, div.tb-detail-hd h1");
        var goodTitle = TitleNode.lastChild.nodeValue.trim();
        var queryUrl = "https://ntaow.com/coupon.jsp?mQuery=" +encodeURI(goodTitle);
        var faNode = document.querySelector("div#J_Title p.tb-subtitle, div.tb-detail-hd h1");
        var insNode = document.createElement("div");
        insNode.style = "font-size: xx-large;font-weight: bold;font-family:microsoft yahei;";
        insNode.innerHTML = "<a href="+queryUrl+" target='_blank' style='color: red;'>===查找优惠===</a><br/>";
        faNode.appendChild(insNode);
    }
}, 200);