User:Dendodge/vector.js

//import superportal system - user:Bawolff/Sandbox/superportal var url = "http://en.wikinews.org/w/index.php?title=user:Bawolff/superPortal.js&action=raw&ctype=text/javascript&dontcountme=s"; var scriptElem = document.createElement( 'script' ); scriptElem.setAttribute( 'src', url ); scriptElem.setAttribute( 'type', 'text/javascript' ); document.getElementsByTagName( 'head' )[0].appendChild( scriptElem );

function dieWhitespaceDie { try { //this is for us low res folks //hides some of the members of the dpl list on main page, if list too long. //this is not cross browser (yet). IE uses different method names for height if (wgPageName !== "Main_Page" || wgAction !== "view") {return;} var firstLead = document.getElementById('l_table_numb1'); var excessWS = (firstLead.parentNode.offsetHeight - firstLead.offsetHeight) * 3; var DPLList = document.getElementById('MainPage_latest_news_text'); var DPL = DPLList.getElementsByTagName('li'); //10 is just emergancy cut off. should stop way before that. if (DPL.length < 10) {throw new Error("Latest news should have more items...");} var curItem; var itemsToKill = document.createDocumentFragment; for (var i = 1; i < 10;i++) { //note, start at 1. curItem = DPL[DPL.length - i]; excessWS -= curItem.offsetHeight; if (excessWS < 0) { break;} itemsToKill.appendChild(curItem); } DPLList.removeChild(itemsToKill); } catch (e) {} } $(dieWhitespaceDie);