Greasy Fork

Greasy Fork is available in English.

淘宝卖家评价助手

淘宝卖家自动评价助手

目前为 2019-01-22 提交的版本,查看 最新版本

// ==UserScript==
// @author            alpha
// @name              淘宝卖家评价助手
// @description       淘宝卖家自动评价助手
// @include             *//trade.taobao.com/trade/itemlist/list_sold_items.htm?action=itemlist/SoldQueryAction&event_submit_do_query=1&*
// @include            *//rate.taobao.com/remarkBuyer.jhtml*
// @include            *//rate.taobao.com/remarkBuyer.htm
// @version           0.1
// @grant        none
// @namespace         http://tampermonkey.net/
// ==/UserScript==

(function(){
    if(location.pathname == '/trade/itemlist/list_sold_items.htm'){
        getRateHref();
    }else if(location.pathname == '/remarkBuyer.jhtml'){
        autorate();
    }else if(location.pathname == '/remarkBuyer.htm'){
        location.href = 'https://trade.taobao.com/trade/itemlist/list_sold_items.htm?action=itemlist/SoldQueryAction&event_submit_do_query=1&commentStatus=I_HAS_NOT_COMMENT&tabCode=waitRate';
}
})();
//获取第一个待评价的链接
function getRateHref(){
    var listrate = document.querySelectorAll('a');
    for (var i=0; i<listrate.length; i++){
        if(listrate[i].text == '评价'){
            location.href = listrate[i].href;
        }
        
    }
    
}

// 进入评价页面自动评价
function autorate(){
    //提取商品id
    var localhref = location.href;
    var id = /\d{10,20}/g.exec(localhref);
    id = '#rate-good-' + id[0];
    alert(id)
    // 选中好评
    document.querySelector('#rate-good-all').checked=true;
    document.querySelector(id).checked=true;
    // 设置评价内容
    var comment = '感谢您的光临,希望您每天都有一个好心情'
    document.querySelector('textarea').value = comment;
    // 提交
    document.querySelectorAll('button')[2].click();
    
}