// ==UserScript==
// @name 获取淘宝评论图片
// @namespace http://tampermonkey.net/
// @version 0.1.20170113
// @description Get TAOBAO Comment Pic
// @author sbdx
// @match https://item.taobao.com/item.htm?*
// @grant none
// @require http://libs.useso.com/js/jquery/1.9.1/jquery.min.js
// @downloadURL none
// ==/UserScript==
/*
Target URL: https://item.taobao.com/item.htm?id=528857970664
*/
(function() {
// 'use strict';
var page=1;
var url,PageTotal;
var itemid,sellerid;
var targetElement='div.tb-revbd';
itemid=g_config.itemId;
sellerid=g_config.sellerId;
function getJSON()
{
$('#J_IdsSegments').css('z-index',100);//降低右侧div的层级
url="https://rate.taobao.com/feedRateList.htm?auctionNumId=" + itemid + "&userNumId=" + sellerid + "¤tPageNum=" + page + "&rateType=3&orderType=sort_weight&attribute=&sku=&hasSku=false&folded=0&_ksTS="+(new Date().getTime()) + "&callback=?";
console.log(url);
$.getJSON(url,function(d){
console.log(d);
if(page==1) PageTotal=d.maxPage;
ProcessJSON(d);
page++;
if(page<=Math.min(10,PageTotal))getJSON();//最多取10页数据
});
}
function ProcessJSON(d)
{
var ImgList=[];
$.each(d.comments,function(i,v){
img='';
if(v.photos)
{
$.each(v.photos,function(pi,pv){
img+="
\r\n";
});
}
if(v.appendList.photos)
{
$.each(v.appendList.photos,function(pi,pv){
img+="
\r\n";
});
}
ImgList.push(img);
});
//$('.detail-eval.J_DetailEval').append('