最近box-z比价脚本(原脚本地址:Box-z userccript)突然无效了,看了一下,只是box-z网站调整的图片的地址,改为了相对地址导致脚本替换错误,随手改了一下,想用的自己复制后替换即可。
// ==UserScript==
// @name Box-z Price History Image
// @namespace qixinglu.com
// @description 在网上商店产品页面,自动插入一张从 www.box-z.com 里的价格历史波动图片。
// @include http://mvd.360buy.com/*
// @include http://book.360buy.com/*
// @include http://www.360buy.com/product/*
// @include http://www.newegg.com.cn/product/*
// @include http://www.newegg.com.cn/Product/*
// @include http://www.amazon.cn/gp/product/*
// @include http://www.amazon.cn/*/dp/*
// @include http://www.amazon.cn/mn/detailApp*
// @include http://product.dangdang.com/product.aspx?product_id=*
// @include http://product.dangdang.com/Product.aspx?product_id=*
// @include http://item.51buy.com/item-*
// @include http://www.suning.com/emall/prd_10052_10051_-7_*.html*
// @include http://www.suning.com/emall/snupgbpv_10052_10051_*_.html
// @include http://www.suning.com/emall/sngbv_10052_10051_*_.html
// @include http://www.gome.com.cn/ec/homeus/jump/product/*.html*
// @include http://www.lusen.com/product-*
// @include http://www.efeihu.com/Product/*.html*
// @include http://www.tao3c.com/product/*
// @include http://www.coo8.com/product/*.html*
// @include http://www.yihaodian.com/product/detail.do?*
// @include http://www.yihaodian.com/product/*
// @include http://www.ouku.com/goods*
// @include http://www.redbaby.com.cn/*/*.html*
// @include http://www.bookschina.com/*
// @include http://www.wl.cn/*
// @include http://product.china-pub.com/*
// @include http://www.winxuan.com/product/*
// @include http://www.99read.com/product/*
// @include http://www.99read.com/Product/*
// @include http://www.new7.com/product/*
// ==/UserScript==
// 获得价格历史图片
function create_history_image_node(response) {
var temp_document, img_node, img_node_src, image_node;
temp_document = document.createElement('html');
temp_document.innerHTML = response.responseText;
img_node = temp_document.querySelector('div.fNumber img');
if (img_node === null) {
image_node = document.createElement('p');
image_node.innerHTML = '这个产品貌似没有历史价格数据,<a href="' + response.finalUrl + '">查看链接</a>。';
} else {
// 修改样式
img_node_src = "http://www.box-z.com" + img_node.getAttribute('src');
//img_node_src = img_node.src.replace('chs=630x180', 'chs=720x240');
img_node_src = img_node_src.replace('chts=FF0000%2c13', 'chts=FF0000%2c14');
//img_node_src = img_node_src + '&chdls=,14';
img_node.src = img_node_src;
img_node.width = 630;
img_node.height = 180;
//img_node.width = 720;
//img_node.height = 240;
img_node.style.marginTop = "10px";
img_node.style.marginBottom = "10px";
// 加上链接
image_node = document.createElement('a');
image_node.href = response.finalUrl;
image_node.appendChild(img_node);
}
return image_node;
}
function create_product_history_url(prefix, product_uid) {
return "http://www.box-z.com/products/" + prefix + "-