Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Authored by socby19 and with a big help from Kolink at StackOverflow
- // ==UserScript==
- // @name= Hidden HStocks
- // @description De-cluttering of port by hiding certain securities that meet certain criteria based on price, change, and percent change
- // @version 1.0
- // @run-at document-end
- // @include http://*hsx.com/portfolio/*
- // @exclude http://*hsx.com/portfolio/bank*
- // @exclude http://*hsx.com/portfolio/limit*
- // @exclude http://*hsx.com/portfolio/history*
- // @exclude http://*hsx.com/portfolio/chart*
- // ==/UserScript==
- //Column indexes for values array:
- //0 Symbol
- //1 Quantity
- //2 Short or Long
- //3 Avg Price Paid
- //4 Price
- //5 Price Change
- //6 % Price Change
- //7 Total Worth
- //8 Worth Change
- //9 % Worth Change
- // Start
- (function() {
- var tbl = document.getElementById("sortable_MovieStocks"),
- rows = tbl.tBodies[0].children, l = rows.length, i, skip=0,
- filter = function(cells) {
- var values = [
- parseInt(cells[1].firstChild.nodeValue.replace(/,/g,''),10),
- parseFloat(cells[3].firstChild.nodeValue.replace(/[^\d.-]/g,'')),
- parseFloat(cells[4].firstChild.nodeValue.replace(/[^\d.-]/g,''))
- ];
- // THIS IS WHERE YOUR CONDITIONS GO
- if( values[0] > 990000 && values[2] < 1) return false;
- if( values[1] < 1 && (values[2] < 1 && values[2] > 0.01)) return false;
- return true;
- };
- for( i=0; i<l; i++) {
- if( !filter(rows[i].cells)) rows[i].style.display = "none", skip++;
- }
- var hidden = "(" + skip.toString() + " securities are being hidden with the Hide script.)"
- var newRow=tbl.insertRow(1);
- var newCell=newRow.insertCell(0);
- newCell.setAttribute('colspan', 11);
- newCell.innerHTML=hidden;
- })();
Advertisement
Add Comment
Please, Sign In to add comment