您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
for private use
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/408851/837672/for%20private%20use%EF%BC%88new%EF%BC%89.js
// ==UserScript== // @name for private use(new) // @version 7.5 // @description for private use // @author AC // @include https://item.taobao.com/item.htm* // @include https://detail.tmall.com/item.htm* // @include https://s.taobao.com/search* // @include https://cart.taobao.com/* // @include *://uland.taobao.com/coupon/* // @note 2017.10.28-V1.0 第一版本,edit from https://greasyfork.org/zh-TW/scripts/34604 // @icon https://gitee.com/remixAC/GM_script/raw/master/images/head.jpg // @home-url https://greasyfork.org/zh-TW/scripts/34606 // @run-at document-start // @namespace [email protected] // @connect open.lesiclub.cn // @connect gm.ntaow.com // @grant GM_xmlhttpRequest // @license GPL-3.0-only // ==/UserScript== // .tb-detail-hd, .tb-main-title setTimeout(function () { if(typeof(acTB) == "undefined"){ acTB = 1; (function(){ var goodTitle = ""; function addStyle(css) { var pi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"' ); return document.insertBefore(pi, document.documentElement); } function timerDoOnce(node, functionName, checkTime){ var tt = setInterval(function(){ if(document.querySelector(node) != null) { clearInterval(tt); try{ functionName(); }catch (e) {} } }, checkTime); } function loadSC(){ // 搜索的时候增加优惠信息 var allNodes = document.querySelectorAll(".items .J_MouserOnverReq, #content .product"); for(var i = 0; i < allNodes.length; i++){ (function (node) { var gid; try{gid = node.querySelector(".pic>a").getAttribute("data-nid");} catch (e) { } try{gid = gid || node.getAttribute("data-id");} catch (e) { } GM_xmlhttpRequest({ method: "GET", url: "https://open.lesiclub.cn/coupon/get/10005/10001/" + gid, onload: function (res) { res = JSON.parse(res.responseText); if(res.code == 200 && res.data != null && res.data.coupon.is_valid == true){ var insNode = document.createElement("span"); var name; try{name = node.querySelector(".J_IconMoreNew .J_ClickStat").innerText.trim();} catch (e) { } try{name = name || node.querySelector(".productTitle a").getAttribute("title");} catch (e) { } var price = res.data.coupon.coupon_money; insNode.setAttribute("title", "领券减"+price+"元"); insNode.dataset.url = "https://cent.ntaow.com/coupon.html?mQuery=" + encodeURI(name); insNode.setAttribute("onclick", "openUrl(this);"); insNode.className = "copon-search-list"; insNode.innerHTML = "¥"+price+"元优惠券"; try{node.querySelector(".pic-box").appendChild(insNode);}catch (e) {} try{node.querySelector(".productImg-wrap").appendChild(insNode);}catch (e) {} } } }); })(allNodes[i]); } } openUrl = function(node){ if(node.dataset.url.indexOf("javascript:void") < 0) window.open(node.dataset.url); }; addStyle(".ac-btn:hover,.copon-search-list:hover,.ac-btn-cart:hover,.tm-detailGo-btn:hover{color: rgba(255,200,0,30)!important;text-shadow: 0 0px rgba(242,33,49,30),0 0px 0px rgba(242,33,49,30),0 1px 1px rgba(242,33,49,30),1px 0 1px rgba(242,33,49,30),-1px 0 1px rgba(242,33,49,30),0 0 1px rgba(242,33,49,30)!important;}"); addStyle(".ac-btn:hover,.tm-detailGo-btn:hover{color: white!important;}.acMobileQRPanel{display:grid;}.ac-hide{display:none;}.coupon-gobtn:hover{background-color:red!important;}"); if(location.href.indexOf("item.taobao.com") + location.href.indexOf("detail.tmall.com") >= 0) { addStyle(".tm-detailGo-btn{line-height: 16px !important;cursor:pointer;padding: 0px 11px;color:#f95d50;float: right !important;font-weight: bold;border: 1px solid #f95f52;font-size: 1.3em;}"); function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } var goodID = getQueryString("id"); queryData(goodID); function AutoStart(time, cssSelector, dealFunc) { var timerNode = setInterval(function () { try { if (document.querySelector(cssSelector).style.display == "") { clearInterval(timerNode); dealFunc(); } } catch (e) { } }, time); } function acBuyScript(result) { var tt = setInterval(function () { var node = document.querySelector(".acBuyScriptCoupon"); if (node != null) { clearInterval(tt); if (result.retcode == 0 && result.data && result.data.couponAmount != 0) { node.innerHTML = +result.data.couponAmount + "元优惠券"; node.dataset.url = "https://cent.ntaow.com/coupon.html?mQuery=" + encodeURI(goodTitle); } else { node.innerHTML = "无优惠或已领优惠"; node.setAttribute("style", "font-size: 11px;color:#B5621B"); } node.addEventListener("mouseenter", function () { document.querySelector(".acMobileQRPanel").classList.remove("ac-hide"); }); node.addEventListener("mouseleave", function(){ document.querySelector(".acMobileQRPanel").classList.add("ac-hide"); }); document.querySelector(".acMobileQRPanel").addEventListener("mouseenter", function(){ document.querySelector(".acMobileQRPanel").classList.remove("ac-hide"); }); document.querySelector(".acMobileQRPanel").addEventListener("mouseleave", function(){ document.querySelector(".acMobileQRPanel").classList.add("ac-hide"); }); // var q = window.btoa(goodID).replace(/=/g,"-"); // qurl = "https://ntaow.com/details.html?auctionId=" + q; // var imgUrl = "http://api.k780.com:88/?app=qr.get&level=H&size=8&data=" + encodeURIComponent(qurl); var imgUrl = "http://qr.liantu.com/api.php?text=" + encodeURIComponent(result.data.couponUrl); document.querySelector("img.acMobileQRCode").src = imgUrl; } }, 120); } function queryData(goodID) { var cgoodTitle = document.title+""; var ret = GM_xmlhttpRequest({ method: "GET", url: "http://gm.ntaow.com/?op=66&iid=" + goodID, onload: function (res) { res = JSON.parse(res.responseText); acBuyScript(res); } }); } AutoStart(100, ".tb-sku, .tb-action", function () { var TitleNode = document.querySelector("div#J_Title h3, div.tb-detail-hd h1"); goodTitle = TitleNode.firstChild.nodeValue.trim(); if(goodTitle == ""){ goodTitle = TitleNode.childNodes[1].innerHTML.trim(); } var querySimilar = "https://cent.ntaow.com/coupon.html?mQuery=" + encodeURI(goodTitle); var queryInSite = "https://s.taobao.com/search?q=" + 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: 32px;font-weight: bold;font-family:microsoft yahei;position:relative;"; var htmlText = "<span class='acBuyScriptCoupon ac-btn' data-url='javascript:void(0);' onclick='openUrl(this);' style='color: #f95f52;cursor:pointer;'>=查找中=</span>"; // htmlText += "<span><img class='acMobileQRCode' src='data:image/jpg;base64,/9j/4QMZR'></span>"; htmlText += " <span class='ac-btn' data-url=" + queryInSite + " onclick='openUrl(this);' style='color: #f95f52;cursor:pointer;'>[站内搜]</span>"; htmlText += " <span class='ac-btn' data-url=" + querySimilar + " onclick='openUrl(this);' style='color: #f95f52;cursor:pointer;'>[找相似]</span>"; insNode.innerHTML = htmlText; faNode.appendChild(insNode); var htmlTB = "<span class='ac-btn coupon-gobtn' title='获取优惠券' style='padding: 6px 12px;line-height:26px;text-align: center;display: inline-block;margin-bottom: 0;font-size: 16px;font-weight: normal;height:26px;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: #DF231C;margin-left:10px' data-url='https://cent.ntaow.com/coupon.html?mQuery="+encodeURI(goodTitle)+"' onclick='openUrl(this);'>获取优惠券</span>"; var htmlTMALL = "<div class='ac-btn coupon-gobtn' title='获取优惠券' class='tb-action' style='margin-top:10px;margin-left: 66px;'><span style='display: inline-block;border-radius:2px;color: #fff;background-color: #DF231C;padding: 6px 12px;margin-bottom: 0;font-size: 16px;font-weight: normal;height:26px;line-height:26px;width:156px;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;' data-url='https://cent.ntaow.com/coupon.html?mQuery="+encodeURI(goodTitle)+"' onclick='openUrl(this);'>获取优惠券</span></div>"; var anoInsNode = document.createElement("div"); anoInsNode.style = "font-weight: bold;font-family:microsoft yahei;"; if(location.host.indexOf('taobao') > 0){ anoInsNode.innerHTML = htmlTB; document.querySelector('.tb-action').append(anoInsNode); }else{ anoInsNode.innerHTML = htmlTMALL; document.querySelector('.tb-sku').append(anoInsNode); } }); }else if(location.href.indexOf("s.taobao.com/search") > 0 || location.href.indexOf("list.tmall.com/search_product") > 0){ var ttcounter = 0, ttmax = 10; var gwcounter = 0, gwmax = 100; var tt = setInterval(function () { var nodes = document.querySelectorAll(".items .item-ad"); var allNodes = document.querySelectorAll(".items .J_MouserOnverReq, #content .product"); if(allNodes != null && (nodes.length > 0 || allNodes.length > 0)){ clearInterval(tt); if(document.querySelector("script[src*='gwd']") == null){ loadSC(); } for(var i = 0; i<nodes.length; i++){ nodes[i].className = "item J_MouserOnverReq "; } } ttcounter++; if(ttcounter >= ttmax){ clearInterval(tt); } }, 100); } else if(location.host.indexOf("uland") >= 0){ addStyle("#J_MMREDBOX_MASK{display:none !important;}"); } else if(location.href.indexOf("cart.taobao.com") >= 0) { setInterval(function(){ if(document.querySelector("#J_OrderList .item-basic-info") != null){ var htmlCart = "<span class='ac-btn-cart' data-url='https://cent.ntaow.com/coupon.html?mQuery=AAAAAAAAAA' onclick='openUrl(this);' style='cursor:pointer;22px !important;color:#f95f52;font-size:16px;border-radius:1px;padding:2px;border-color:#fea356;border-style: dashed;'>查找优惠信息</span>"; var nodes = document.querySelectorAll(".order-content .item-basic-info"); for(i = 0; i < nodes.length; i++){ var title = nodes[i].querySelector("a").getAttribute("title"); if(title != null){ var addHTMLText = htmlCart.replace("AAAAAAAAAA", encodeURI(title)); var insNode = document.createElement("div"); insNode.className = "ac-tb-add"; insNode.style = "display: inline-block"; insNode.innerHTML = addHTMLText; if(nodes[i].parentNode.querySelector(".item-icons") && nodes[i].parentNode.querySelector(".item-icons").querySelector(".ac-tb-add") == null){ nodes[i].parentNode.querySelector(".item-icons").appendChild(insNode); } } } } }, 1000); } })(); } }, 50);