// ==UserScript== // @name Finviz & SEC Flow // @namespace lekisti // @version 0.5 // @description Add a button next to Finviz screener stock results that opens respective SEC filings on a new tab. Renders SEC filings as plain html to remove annoying clickable items. Optionally, hide market cap amounts on SEC filings. // @author lekisti // @match https://finviz.com/screener.ashx* // @match https://www.sec.gov/* // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @grant GM_addStyle // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/462189/Finviz%20%20SEC%20Flow.user.js // @updateURL https://update.greasyfork.icu/scripts/462189/Finviz%20%20SEC%20Flow.meta.js // ==/UserScript== //* globals ParseXbrl */ var $ = window.jQuery; // ==Options== var showMarketCapAmounts = false; var zoomLevel = '150%'; // ==/Options== var mappings = []; $(function () { var url = window.location.href; if (url.includes('finviz')) { setMappings(); addButtons(); } else { if (url.includes('ix?doc=')) { redirectToPlainHtm(url); } if (!showMarketCapAmounts && url.startsWith('https://www.sec.gov/Archives/edgar/data/')) { hideMarketCapAmounts(); } document.body.style.zoom = zoomLevel; } }); function setMappings() { let headers = new Headers({ "User-Agent": "Lekisti Co lekisti@outlook.com", "Accept-Encoding" : "gzip, deflate", "Host": "www.sec.gov" }); fetch('https://gist.githubusercontent.com/lekisti/a17e75b21c65536f0c9f477b22501f61/raw/56fc1fb6ca8fbe9278dfbcab962ae5f4055298d3/company_tickers.json', { method : 'GET', //headers : headers }).then(function(response) { return response.json(); }).then(function(data) { Object.keys(data).forEach(function(prop) { var obj = data[prop]; mappings[obj.ticker] = obj.cik_str; }); }).catch(function(err) { console.log('Error: ', err); }); } function addButtons() { $('.table-light > tbody > tr:nth-child(1) > td:nth-child(2)').after('