购物党比价工具【精简优化版】

【精简版】购物党,优化了页面的部分元素,减少页面弹窗和显示,保留菜单栏。购物党提供淘宝/京东/亚马逊/当当/苏宁/等百家商城的比价系统,能让你以较优惠的方式购买到你称心如意的商品,提供商品的历史价格情况,多种相似商品推荐,同款购买,降价提醒。PS:带有推广,介意勿装

  1. // ==UserScript==
  2. // @name 购物党比价工具【精简优化版】
  3. // @namespace none
  4. // @version 2.2
  5. // @description 【精简版】购物党,优化了页面的部分元素,减少页面弹窗和显示,保留菜单栏。购物党提供淘宝/京东/亚马逊/当当/苏宁/等百家商城的比价系统,能让你以较优惠的方式购买到你称心如意的商品,提供商品的历史价格情况,多种相似商品推荐,同款购买,降价提醒。PS:带有推广,介意勿装
  6. // @author AC
  7. // @antifeature referral-link 含有返利链接
  8. // @include http*://item.taobao.com/*
  9. // @include http*://cart.taobao.com/*
  10. // @include http*://s.taobao.com/*
  11. // @include http*://detail.tmall.com/item.htm*
  12. // @include http*://detail.liangxinyao.com/item.htm*
  13. // @include http*://chaoshi.detail.tmall.com/item.htm*
  14. // @include http*://item.jd.com/*
  15. // @include https://item.jd.hk/*
  16. // @include https://detail.tmall.hk/*
  17. // @include https://*.suning.com/*
  18. // @note V2.2 修复可用性 & 替换地址
  19. // @note V1.6 更换源地址为StaticFile
  20. // @note V1.4 更换源地址为75团地址
  21. // @note V1.2 修复部分多余的隐藏无效的问题 修复之前忘了【新增自己的附加脚本 如果介意的可以删除本脚本】【新增自己的附加脚本 如果介意的可以删除本脚本】【新增自己的附加脚本 如果介意的可以删除本脚本】
  22. // @grant GM_xmlhttpRequest
  23. // @connect open.lesiclub.cn
  24. // @connect api.ntaow.com
  25. // @connect gwdang.com
  26. // @connect alicdn.com
  27. // @run-at document-start
  28. // @license GPL-3.0-only
  29. // @require https://gf.qytechs.cn/scripts/34606-ac-%E7%8B%AC%E5%AE%B6-%E6%B7%98%E5%AE%9D%E5%A4%A9%E7%8C%AB%E4%BC%98%E6%83%A0%E5%88%B8%E6%9F%A5%E8%AF%A2%E9%A2%86%E5%8F%96-%E5%A4%A7%E9%A2%9D%E4%BC%98%E6%83%A0%E5%88%B8-100%E5%85%83%E8%B4%AD%E7%89%A9%E7%A5%9E%E5%88%B8-%E7%9C%81%E9%92%B1%E8%B4%AD%E7%89%A9-%E9%A2%86%E5%88%B8%E8%B4%AD%E4%B9%B0%E6%9B%B4%E4%BC%98%E6%83%A0-%E5%B9%B3%E5%9D%87%E4%BC%98%E6%83%A020/code/AC-%E7%8B%AC%E5%AE%B6-%E6%B7%98%E5%AE%9D%E5%A4%A9%E7%8C%AB%E4%BC%98%E6%83%A0%E5%88%B8%E6%9F%A5%E8%AF%A2%E9%A2%86%E5%8F%96,%E5%A4%A7%E9%A2%9D%E4%BC%98%E6%83%A0%E5%88%B8,%E3%80%90100%E5%85%83%E8%B4%AD%E7%89%A9%E7%A5%9E%E5%88%B8%E3%80%91,%E7%9C%81%E9%92%B1%E8%B4%AD%E7%89%A9,%E9%A2%86%E5%88%B8%E8%B4%AD%E4%B9%B0%E6%9B%B4%E4%BC%98%E6%83%A0,%E5%B9%B3%E5%9D%87%E4%BC%98%E6%83%A020%25.user.js
  30. // ==/UserScript==
  31. (function () {
  32. const goodId = getUrlAttribute("id")
  33. // 提取url中的参数
  34. function getUrlAttribute(attribute, needDecode) {
  35. const searchValue = (window.location.search.substr(1) + "").split("&");
  36. for (let i = 0; i < searchValue.length; i++) {
  37. const key_value = searchValue[i].split("=");
  38. const reg = new RegExp("^" + attribute + "$");
  39. if (reg.test(key_value[0])) {
  40. const searchWords = key_value[1];
  41. return needDecode ? decodeURIComponent(searchWords) : searchWords;
  42. }
  43. }
  44. }
  45. function safeWaitFunc(selector, callbackFunc, time, notClear) {
  46. time = time || 200;
  47. notClear = notClear || false;
  48. const doClear = !notClear;
  49. const id = setInterval(function () {
  50. let selectRes = document.querySelectorAll(selector);
  51. if ((typeof (selector) == "string" && selectRes.length > 0)) {
  52. if (doClear) clearInterval(id);
  53. if (selectRes.length === 1) selectRes = selectRes[0];
  54. callbackFunc(selectRes);
  55. } else if ((typeof (selector) == "function" && selector().length > 0)) {
  56. if (doClear) clearInterval(id);
  57. callbackFunc(selector()[0]);
  58. }
  59. }, time);
  60. }
  61. function addStyle(css) { //添加CSS的代码--copy的--注意里面必须是双引号
  62. var pi = document.createProcessingInstruction(
  63. 'xml-stylesheet',
  64. 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"'
  65. );
  66. return document.insertBefore(pi, document.documentElement);
  67. }
  68. function addScript(src) {
  69. let node = document.createElement("script");
  70. node.src = src;
  71. node.charset = "UTF-8";
  72. document.head.appendChild(node);
  73. }
  74.  
  75. function initGWD() {
  76. let extName = "gwdv1.js";
  77. let hideStyle = "";
  78. if (location.host === "jd.com") {
  79. extName = "gwdv2.js";
  80. hideStyle = ".gwd-minibar-bg, #favor_box{display:none !important;}" +
  81. "#gwdang_main > a.gwd-topbar-logo, #gwdang_main > div.gwd-topbar-right{display:none !important;}";
  82. } else {
  83. hideStyle = "#gwdang-main>div.logo, #gwdang-feed-close, #gwdang-history, #coupon_box, #bjd_yifenqian_detail{display:none !important}" +
  84. "#favor_box{display:none !important;}#tb-amount .tb-count{font-weight:bold;margin:0 5px;}";
  85. }
  86. // addScript("https://cdn.jsdelivr.net/gh/chenzelin01/wechatproxy/public/" + extName);
  87. addScript("https://browser.gwdang.com/get.js?f=/js/gwdang_extension.js");
  88. addStyle(hideStyle);
  89. }
  90.  
  91. function realTimeShowTBTitle(){
  92. addStyle(".tshop-psm-shop-header,.ac-tophide{position: absolute;top: -500px;}.ac-topshow{position:relative;transition: all 1s cubic-bezier(0.4, 0, 1, 1);transform: translateY(500px);}");
  93. let timer = setInterval(function(){
  94. let node = document.querySelector(".tshop-psm-shop-header");
  95. let addClassName = "ac-tophide";
  96. if(node == null) return;
  97. // 如果大于200,说明样式未加载
  98. if(node.offsetHeight > 200 && !node.classList.contains(addClassName)){
  99. node.classList.add(addClassName);
  100. }
  101. if(node.offsetHeight <= 200){
  102. if(node.classList.contains(addClassName)){
  103. node.classList.add("ac-topshow");
  104. clearInterval(timer);
  105. }else{
  106. clearInterval(timer);
  107. // 清空附加样式
  108. addStyle(".tshop-psm-shop-header{position: relative;top: unset;}");
  109. }
  110. }
  111. },150);
  112. }
  113.  
  114. function init() {
  115. function dealRes(json){
  116. var allHide = "";
  117. var yearHide = "";
  118. var monthHide = "";
  119. if (json.store[0].all_line == null) {
  120. allHide = "style='display: none;'";
  121. }
  122. if (json.store[0].year_line == null) {
  123. yearHide = "style='display: none;'";
  124. }
  125. if (json.store[0].month_line == null) {
  126. monthHide = "style='display: none;'";
  127. }
  128. var ddata;
  129. if (json.store.length > 1) {
  130. ddata = json.store[1].all_line;
  131. }
  132.  
  133. var ddata;
  134. if (json.store.length > 1) {
  135. ddata = json.store[1].all_line;
  136. }
  137.  
  138. let pdata = json.store[0].all_line;
  139. let pbeginTime = json.store[0].all_line_begin_time;
  140. let picdata = ddata;
  141.  
  142. var hml = "<div style='margin-left:50px;margin-top:20px;display: block;'><a class='active-plot type-plot' " + allHide + " id='plotAll'>全部</a><a class='type-plot' " + yearHide + " id='plotYear'>年线</a><a class='type-plot' " + monthHide + " id='plotMonth'>月线</a>";
  143. hml = hml + "<div id='hisprice' style='width: 720px;height:350px;margin: 0;padding: 0'></div>";
  144.  
  145. return `
  146. <script src="https://cdn.staticfile.org/echarts/4.8.0/echarts.min.js"></script>
  147. ${hml}
  148. <script>
  149. var pChart = echarts.init(document.getElementById('hisprice'));
  150. showPrice();
  151. function showPrice() {
  152. var data =[${pdata}];
  153. var beginTime =${pbeginTime};
  154. var picdata =[${picdata}];
  155. var dt = [];
  156. for (var i = 0; i < data.length; i++) {
  157. var d = new Date(beginTime);
  158. d.setDate(d.getDate() + i);
  159. dt.push(d.toLocaleDateString());
  160. }
  161. // 指定图表的配置项和数据
  162. var option = {
  163. tooltip: {
  164. enterable: true,
  165. trigger: 'axis',
  166. formatter: function (params) {
  167. return params[0].axisValue + "<br/>" + params[0].data;
  168. },
  169. axisPointer: {
  170. animation: false
  171. }
  172. },
  173. legend: {
  174. data: ['页面价', '到手价'],
  175. selected: {
  176. '页面价': true,
  177. '到手价': true
  178. }
  179. },
  180. xAxis: {
  181. data: dt,
  182. splitArea: { show: false },
  183. boundaryGap: false,
  184. splitLine: {
  185. show: true,
  186. },
  187. axisLabel: {
  188. interval: parseInt((data.length) / 10),
  189. formatter: function (value) {
  190. return value.substring(5);
  191. }
  192. },
  193. },
  194. yAxis: {
  195. splitArea: { show: false },
  196. splitLine: {
  197. show: true,
  198. }
  199. },
  200. series: [{
  201. name: '页面价',
  202. type: 'line',
  203. data: data,
  204. showSymbol: false,
  205. hoverAnimation: false,
  206. markPoint: {
  207. symbol: 'pin',
  208. data: [
  209. { type: 'max', name: '最大值' },
  210. { type: 'min', name: '最小值' }
  211. ]
  212. },
  213. markLine: {
  214. data: [
  215. { type: 'average', name: '平均值' }
  216. ]
  217. }
  218. },
  219. {
  220. name: '到手价',
  221. type: 'line',
  222. data: picdata,
  223. showSymbol: false,
  224. hoverAnimation: false,
  225. markPoint: {
  226. symbol: 'pin',
  227. data: [
  228. { type: 'max', name: '最大值' },
  229. { type: 'min', name: '最小值' }
  230. ]
  231. },
  232. markLine: {
  233. data: [
  234. { type: 'average', name: '平均值' }
  235. ]
  236. }
  237. }
  238. ]
  239. };
  240. pChart.setOption(option);
  241. };
  242. </script>
  243. `
  244. }
  245. function opWind(purl, pisweb, pname, phml) {
  246. var url = purl;
  247. var name = pname;
  248. var iWidth = 800;
  249. var iHeight = 450;
  250. var iTop = (window.screen.height - 30 - iHeight) / 2;
  251. var iLeft = (window.screen.width - 10 - iWidth) / 2;
  252. // var OpenWindow = window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
  253. // if (pisweb == 0) {
  254. // OpenWindow.document.write(phml);
  255. // OpenWindow.document.close();
  256. // OpenWindow.focus();
  257. // }
  258. var insWind = document.createElement("iframe");
  259. // insWind.src = "javascript:(function(){document.write("+insWind+")})()";
  260. insWind.innerHTML = phml;
  261. document.body.appendChild(insWind);
  262. }
  263. // localStorage.getItem("gwdang-fp") == null
  264. if(true){
  265. // 首次加载数据
  266. initGWD();
  267. }else{
  268. // TODO 待完成,似乎这里不好处理
  269. let qdata = "fp="+localStorage.getItem("gwdang-fp")+"&dfp="+localStorage.getItem("gwdang-dfp");
  270. GM_xmlhttpRequest({
  271. url: "https://browser.gwdang.com/extension/price_towards?ver=1&format=jsonp&&url=" + encodeURIComponent(location.href),
  272. method: 'GET',
  273. timeout: 10000,
  274. headers: {
  275. 'Content-Type': 'application/json',
  276. 'Accept': 'application/json',
  277. 'Cache-Control': 'public'
  278. },
  279. onload: function (res) {
  280. const json = JSON.parse(res.responseText)
  281. if (json.is_ban == null) {
  282. console.log(json);
  283.  
  284. let data = dealRes(json);
  285. opWind('', 0, '比价', data);
  286. } else {
  287. console.log(json.action.to);
  288. opWind(json.action.to, '1', '请验证后刷新页面!', '');
  289. }
  290. }
  291. });
  292. }
  293. }
  294. init();
  295. realTimeShowTBTitle();
  296. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址