滑呗上传百分比

upload display percent

// ==UserScript==
// @name         滑呗上传百分比
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  upload display percent
// @license MIT
// @author       Zszen
// @include      https://huabei.fenxuekeji.com/photographer/uploadranch*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setInterval(loop, 1000);
    function loop(){
        var n1=xp("/html/body/div[3]/div/div[2]/div/div[2]/div[2]/span/span[1]/text()").textContent;
        var n2=xp("/html/body/div[3]/div/div[2]/div/div[2]/div[2]/span/span[2]/text()").textContent;
        if(n1!=null && n2!=null){
            percent = Math.round(n1/n2*100)+"%";
        }
        console.log(percent)
    }
    // Your code here...
    function xp(xpath){
        return document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null).iterateNext();
    }
})();