Greasy Fork is available in English.
雪球调仓时可以输入小数
当前为
// ==UserScript==
// @name 雪球调仓时输入小数
// @namespace http://xueqiu.com/
// @version 0.1.1
// @description 雪球调仓时可以输入小数
// @author xiaolin
// @match https://xueqiu.com/*
// @grant none
// @license MIT
// ==/UserScript==
;(function() {
function blurHandler(event) {
const length = $('input.weight').length
let cash = 10000
for (let i = 0; i < length; i++) {
const weight = Number($($('input.weight')[i]).val().replace('%', ''))
if (SNB.cubeData[i].weight != weight) {
SNB.cubeData[i].proactive = true
SNB.cubeData[i].weight = weight
}
cash -= weight * 100
}
cash /= 100
$('.cash .stock-weight input').val(cash)
$('.cash .stock-weight span.weight').text(cash + '%')
SNB.cashWeight = cash
event.stopPropagation()
return false
}
setInterval(function(){
$('input.weight').off('blur').blur(blurHandler)
}, 50)
})();