// ==UserScript==
// @name 网易BUFF挂刀比例插件---CSGO版
// @namespace http://pronax.wtf/
// @version 1.0.8
// @description try to take over the world! --Written by Pronax
// @copyright 2020, Pronax
// @author Pronax
// @license MIT
// @match https://buff.163.com/market/goods*
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
window.pronax_buff_scale_plugin_load = function (){
// 检测商品是否加载完成
if ($("#market-selling-list").length == 0) {
setTimeout(pronax_buff_scale_plugin_load, 50);
return;
}
// 税后价格
function waxPrice(price,status){
let temp_a = price.innerText.split(" ")[1];
return status?temp_a.substring(0,temp_a.length-2):temp_a;
}
// 保留2位小数
function roundToTwo(num,status){
return status?Math.round((num*100)+0.5)/100:Math.round((num*100))/100;
}
var price_list = $(".f_Strong");
var isLogined = $(".f_Strong").length==12;
var basic_price = roundToTwo(waxPrice(price_list[isLogined?1:0],true)/1.15,true);
for (let i = isLogined?2:1; i < price_list.length; i++) {
let thisEle = price_list[i];
let scale = roundToTwo(waxPrice(thisEle)/basic_price);
if(i==(isLogined?2:1)){
$(".f_Strong .hide-usd")[0].innerText = basic_price;
$(price_list[isLogined?1:0]).append($(""+scale+""));
}
let target_scale = $(thisEle.parentNode).next()[0];
$(target_scale).append($(""+scale+""));
}
}
pronax_buff_scale_plugin_load();
})();