// ==UserScript== // @name 雪球调仓时输入小数 // @namespace http://xueqiu.com/ // @version 0.1.3 // @description 雪球调仓时可以输入小数 // @author xiaolin // @match https://xueqiu.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== ;(function() { function blurHandler(event) { let cash = 10000 const trs = $('#cube-stock tr.stock') const length = trs.length SNB.cubeData.forEach(i => i.weight = 0) for (let i = 0; i < length; i++) { const tr = $(trs[i]) const weight = Number(tr.find('input.weight').val().replace('%', '')) const data = SNB.cubeData.find(n => n.stock_id == tr.attr('data-id')) if (data) { data.proactive = true data.weight = weight } cash -= weight * 100 } cash = +(cash / 100).toFixed(2) $('.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) })();