// ==UserScript== // @name 省神优惠券,全网最简单,最实用的淘宝天猫阿里大药房商品优惠券插件,提供商品跨平台优惠券比较! // @namespace https://www.itwashot.com/ // @version 0.3.2 // @description 简单易用的淘宝天猫阿里大药房优惠券。并提供同类商品大额优惠券推荐。脚本将持续更新,后面陆续支持拼多多,京东等平台。 // @author Kevin Lelf // @match *://*.taobao.com/* // @match *://*.tmall.com/* // @match *://*.liangxinyao.com/* // @match *://chaoshi.detail.tmall.com/* // @match *://*.tmall.hk/* // @connect tsr.itwashot.com // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @require https://cdn.bootcss.com/materialize/1.0.0-rc.2/js/materialize.min.js // @require https://code.jquery.com/ui/1.12.1/jquery-ui.js // @resource lelf-materialcss https://cdn.jsdelivr.net/gh/lelf2005/cdn@master/material.css?v=20200630 // @resource lelf-materialcss2 http://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css // @run-at document-end // @grant GM_addStyle // @grant GM_getResourceText // @downloadURL none // ==/UserScript== (function() { 'use strict'; var $ = $ || window.$; var materialcss = GM_getResourceText('lelf-materialcss'); GM_addStyle(materialcss); var materialcss2 = GM_getResourceText('lelf-materialcss2'); GM_addStyle(materialcss2); //var apiUrl = 'http://localhost:8080/'; var apiUrl = 'https://honey-jewelry.com/taobao/' var apiTBQueryById = apiUrl + 'getCoupon/'; var tbDetailUrls = ["//item.taobao.com/item.htm","//detail.tmall.com/item.htm", "//chaoshi.detail.tmall.com/item.htm", "//detail.tmall.hk/hk/item.htm","//detail.tmall.hk/item.htm" ]; var tbPageNo = 1; var pddPageNo = 1; var pageSize = 50; var needQuery = []; needQuery[0] = true; needQuery[1] = true; initCss(); var s = '
'; $("body").append(s); var ss = ' '; $("body").append(ss); $("#btnQuery").click(function(){ if ($("#keywordInput").val().trim() == '') { alert("请输入商品关键词进行优惠券查询!"); return; } var active = $( "#tabs" ).tabs( "option", "active" ); var tabId; pddPageNo = 1; tbPageNo = 1; needQuery[0] = true; needQuery[1] = true; $("#tab-tb").html(""); $("#tab-pdd").html(""); buildMoreCouponHtml(1); }) $("#loadMore").click(function(){ var active = $( "#tabs" ).tabs( "option", "active" ); needQuery[active] = true; buildMoreCouponHtml(1); }) var productId; if (isTBDetailPage(location.href)) { productId = window.location.href.split("id=")[1].split('&')[0]; $.get(apiTBQueryById + productId, function(data) { var htmlCoupon = ''; var htmlSimilarItems = ''; if(data.otherRecommends.length > 0){ for(let i in data.otherRecommends) { htmlSimilarItems += ''+data.otherRecommends[i].coupon_info+'
'; } } if (data.coupon_amount) { htmlCoupon = '' + data.coupon_info + '
剩余:' + data.coupon_remain_count + '
'+topItems[i].title+'
'+ ''); } aHTML.push(' |