Greasy Fork

Greasy Fork is available in English.

查看历史价格

这个脚本帮助你跳转到"慢慢买"网站查看历史价格.它会在商品名称后显示[历史价格]按钮,点击后打开"慢慢买"网站,并自动输入要查询的商品页url.目前支持京东,淘宝,天猫,亚马逊,当当,苏宁,网易严选,网易考拉.还支持一键打开"什么值得买"网站.查询这个商品的评价和促销信息.(测试中),目前仅支持京东.

当前为 2019-07-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name 查看历史价格
// @namespace win.somereason.web.utils
// @version 2019.07.16.1
// @description 这个脚本帮助你跳转到"慢慢买"网站查看历史价格.它会在商品名称后显示[历史价格]按钮,点击后打开"慢慢买"网站,并自动输入要查询的商品页url.目前支持京东,淘宝,天猫,亚马逊,当当,苏宁,网易严选,网易考拉.还支持一键打开"什么值得买"网站.查询这个商品的评价和促销信息.(测试中),目前仅支持京东.
// @author somereason
// @license MIT
// @date 2018-09-06
// @match *://item.jd.com/*.html*
// @match *://item.taobao.com/item.htm*
// @match *://detail.tmall.com/item.htm*
// @match *://www.amazon.cn/dp/*
// @match *://product.dangdang.com/*.html*
// @match *://product.suning.com/*/*.html*
// @match *://item.yhd.com/*.html*
// @match *://you.163.com/item/detail*
// @match *://goods.kaola.com/product/*.html*
// @grant none
// ==/UserScript==
// 

(function () {
    var titleElement = null;
    var productTitle = null;
    if (window.location.href.indexOf("jd.com") > -1) {
        titleElement = document.querySelector(".sku-name");
        productTitle = document.querySelector(".parameter2.p-parameter-list li").title;
    } else if (window.location.href.indexOf("taobao.com") > -1) {
        titleElement = document.querySelector(".tb-main-title");
    } else if (window.location.href.indexOf("tmall.com") > -1) {
        titleElement = document.querySelector(".tb-detail-hd");
    } else if (window.location.href.indexOf("amazon.cn") > -1) {
        titleElement = document.querySelector("#productTitle");
    } else if (window.location.href.indexOf("dangdang.com") > -1) {
        titleElement = document.querySelector(".name_info");
    } else if (window.location.href.indexOf("suning.com") > -1) {
        titleElement = document.querySelector(".proinfo-title");
    } else if (window.location.href.indexOf("yhd.com") > -1) {
        titleElement = document.querySelector("#detail_sku_main");
    } else if (window.location.href.indexOf("you.163.com") > -1) {
        //由于网易严选用的是react,页面初始化的时候元素没有渲染,找不到.所以设置延时1秒,然后在找到 title并添加按钮.
        setTimeout(function () {
            setButton(document.querySelector(".intro .name"));
        }, 1000);
    } else if (window.location.href.indexOf("goods.kaola.com") > -1) {
        //网易家的都是后渲染的?延时1秒,简单粗暴,解决问题.
        setTimeout(function () {
            setButton(document.querySelector(".product-title"));
        }, 1000);
    }
    if (titleElement !== null) {
        setManManBuyButton();
    }
    function setManManBuyButton() {
        titleElement.innerHTML += '<button id="openHistoryPricePage">历史价格</button>';
        document.getElementById("openHistoryPricePage").style.cssText = "width: 90px;height: 32px;background:linear-gradient(#00b79e, #002bffcc);border: 1px solid white;cursor: pointer;color: white;";
        document.getElementById("openHistoryPricePage").onclick = openSiteManManBuy;
    }
    function openSiteManManBuy() {
        window.open("http://tool.manmanbuy.com/historyLowest.aspx?url=" + encodeURIComponent(window.location.href) + "");
    }
    //=================================================
    console.log(productTitle);
    if (productTitle !== null) {
        set3DMButton();
    }
    function set3DMButton() {
        titleElement.innerHTML += '<button id="btnOpen3DMpage">什么值得买</button>';
        document.getElementById("btnOpen3DMpage").style.cssText = "width: 100px;height: 32px;background:linear-gradient(#00b79e, #281256);border: 1px solid white;cursor: pointer;color: white;";
        document.getElementById("btnOpen3DMpage").onclick = openSite3DM;
    }
    function openSite3DM() {
        window.open("https://search.smzdm.com/?s="+encodeURIComponent(productTitle) +"&v=b");
    }
})();