IEXcloser

IEX Forum Filter

Jul 11th, 2017 (edited)
18,688
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name IEX Forum Filter
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.1.4
  5. // @description If you ignore it, it'll go away!
  6. // @author IEXcloser
  7. // @noframes
  8. // @include https://www.iex.nl/*
  9. // @include https://www.iex.be/*
  10. // @exclude https://www.iex.nl/forum/upload/*
  11. // @exclude https://www.iex.be/forum/upload/*
  12. // @downloadURL https://pastebin.com/raw/rvR538eC
  13. // @supportURL https://www.iex.nl/forum/post/10147511.aspx
  14. // @grant GM_setValue
  15. // @grant GM_getValue
  16. // @grant GM_addStyle
  17. // @run-at document-start
  18. // ==/UserScript==
  19. (function(){'use strict';GM_addStyle("body{display:none;}.postlist__item{padding:.5em 0 0 0;border:2px solid #bfd1e1;border-width:0 0 2px 0}.postlist__item:first-child{border-width:2px 0 2px 0;border-color:#bfd1e1}.forumpost__user{display:flex;align-items:center;justify-content:flex-start;padding:0;position:static}.forumpost__header{margin:0 0 .8em 0;padding:0}.ignored .forumpost__header{margin:0;background-color:#fff}.subtle .forumpost__header{background:0 0}.noUserLinks .topiclist__datelarge>a,.noUserLinks .topiclist__lastposter>a{pointer-events:none;cursor:default}.postactions{margin:1em 0 .7em;color:#aaa}.postlist__item{padding:0}.popbutton__wrapper,button.popbutton{background:0 0;width:36px;height:36px;outline:0}.popbutton__target{top:100%}.forumpost__wrapper{padding:0 0 0 36px}.noBtn{width:36px}.mBtn{user-select:none;display:none;position:absolute;cursor:pointer;width:calc(64.5%);height:3em;background-color:#fff;opacity:.5;color:#000;margin:0;text-align:left;padding:0 0 0 330px;line-height:3em;z-index:5}.uBtn{margin:0 11px;width:14px;height:14px;border-radius:50%;box-shadow:inset 0 0 1px 0 #bbb,0 1px 1px 1px #888;background:url(data:image/gif;base64,R0lGODlhAgACAIAAAGbMAGb/ACH5BAAAAAAALAAAAAACAAIAAAICDF4AOw==) 50% 50% no-repeat,linear-gradient(#fff,#eee);cursor:pointer;z-index:10}.PostDate{color:#999;margin:0 0 0 .7em;cursor:pointer;text-decoration:none}.PostDate:hover{color:#004788;text-decoration:none}.comment__textarea{font-size:1.16667rem;line-height:1.5}.ignored .mBtn{display:block}.ignored .forumpost__wrapper{display:none}.ignored.open .forumpost__wrapper{display:block}.ignored .forumpost__maintext,.ignored .forumpost__maintext *{color:#aaa!important}.ignored .forumpost__header :not(.mBtn){color:#888;background-color:#fff}.forumpost img.forumpost__levelicon{position:relative;margin:0 0 0 .5em;top:auto;left:auto}.ignored .forumpost__header img{filter:grayscale(1)}.ignored .uBtn{box-shadow:inset 0 1px 1px 1px #eee,0 -1px 2px 1px #777,0 2px 2px 1px #fff;background:url(data:image/gif;base64,R0lGODlhAgACAIAAAP8AAP+ZACH5BAAAAAAALAAAAAACAAIAAAICDF4AOw==) 50% 50% no-repeat,linear-gradient(#fff,#eee)}.forumpost__username{color:#4176a6;margin:0}.forumpost .PostHeader>div.Dummy{width:0;height:0}.ExpandableButton{float:right}.forumpost blockquote{margin:0}.SubHead{font-size:12px}.QuoteHeader{display:none}.QuotePost{position:relative;width:100%;background:#f3f3f3}.shortQuotes .QuotePost{height:3em;overflow:hidden}.long .QuotePost{height:auto;overflow:visible}.qBtn{display:none;position:absolute;left:0;top:0;width:100%;height:3em;cursor:pointer}.shortQuotes .qBtn{display:block;background:transparent url(data:image/gif;base64,R0lGODlhCQAGAIABAJmZmQAAACH5BAEAAAEALAAAAAAJAAYAAAINDIJ4wMnbnnsnmWaVLQA7) right 11px center no-repeat}.shortQuotes .long .qBtn{background-image:url(data:image/gif;base64,R0lGODlhCQAGAIABAJmZmQAAACH5BAEAAAEALAAAAAAJAAYAAAINjAOnwIrcDHxpypZWKAA7)}.hideBadges .forumpost img.forumpost__levelicon{display:none}.fullHide:not(.tempShow) .ignored{display:none}.fullHide:not(.tempShow) .ignored:first-child{display:block;height:0;padding:0;border-width:2px 0 0}.fullHide:not(.tempShow) .ignored:first-child *{display:none}#ignBox{display:none;user-select:none;color:#787878;font-weight:700;text-align:center;padding:0;line-height:3em;border-top:2px solid #bfd1e1;cursor:pointer}.fullHide.showBox #ignBox{display:block}.fullHide.showBox.tempShow #ignBox:after{content:' (tijdelijk zichtbaar)'} #HeaderMenu.noBoldMenu *{font-weight:normal;}.topiclist tbody{vertical-align:top}.forumoverview .topiclist tbody{vertical-align:middle}.hideBadges .topiclist img.topiclist__levelicon{display:none}#PrefPanel *{margin:0;padding:0;font:12px/18px Arial;color:#000}#PrefPanel{display:none;float:right;position:relative;right:0;color:#444;width:34px;z-index:250}#PrefPanel>div{height:34px;width:34px;cursor:pointer;background:url(data:image/gif;base64,R0lGODlhDAAMAJEAAOvr62ZmZszMzJmZmSH5BAAAAAAALAAAAAAMAAwAAAIrhD1zJyMSwnMopHiFabFbDXCOqA0dCGFmhHaj+X4a533VZZnok/LgkvgBCgA7) center center no-repeat}#PrefPanel>ul{overflow:hidden;position:absolute;right:0;display:none;list-style-type:none;width:170px;border-top:1px solid #d0d0d0}#PrefPanel li{width:100%;border-bottom:1px solid #d0d0d0;background-color:#f2f2f2;cursor:pointer;padding:7px 10px;line-height:18px}#PrefPanel li:first-child{font-weight:700}#PrefPanel li span{color:red}#PrefPanel:hover>ul{display:block}#PrefPanel input{margin:0 10px 0 0;cursor:pointer}#PrefPanel label{color:#444;width:120px;display:inline-block;vertical-align:top;cursor:pointer;user-select:none}#PrefPanel #MeerInfo{color:#444;text-decoration:underline;margin:0 2px}#InfoBox{display:none;z-index:300}#InfoBox *{margin:0;padding:0;font:13px/1.5 Arial;color:#000}#InfoBox>div{z-index:300}#InfoBackground{width:100%;height:100%;background-color:#fff;opacity:.5;position:fixed;left:0;top:0}#InfoWindowContainer{width:500px;border:1px solid #ddd;height:80%;background-color:#fff;position:fixed;left:50%;margin-left:-250px;top:10%;box-shadow:0 0 15px 0 rgba(30,30,30,.5)}#InfoWindow{height:100%;overflow-y:scroll;padding:5px 40px}#InfoWindow p{font-size:15px;line-height:1.4;margin:12px 0}#InfoWindow h3{font-size:20px;line-height:25px;font-weight:400;margin:1.5em 0 0 0;color:#000}#InfoWindow a{color:#00f;font:inherit}#InfoWindow b{font:inherit;font-weight:700}#InfoWindow h5{font-weight:700;margin:10px 0 0 0;border:none}#InfoWindow ul{padding:0 0 0 20px}#CloseBtn{position:absolute;width:12px;height:12px;right:0;top:-22px;background:url(data:image/gif;base64,R0lGODlhDAAMAIAAAAAAAAAAACH5BAEAAAEALAAAAAAMAAwAAAIcDIKJB63r2kmSOnOtnG8/zSlbBk1VKUYkGopBAQA7) left top no-repeat;cursor:pointer}#InfoBox.visible{display:block}.topiclist__lastpost .topiclist__levelicon{margin:0 5px}");const r=document.createElement("div"),b=document.createElement("div"),c=document.createElement("div"),d=document.createElement("div"),e=document.createElement("div"),a={fullHide:{label:"Gefilterde posts volledig verbergen",default:!1},shortQuotes:{label:"Verkorte quotes",default:!0},hideBadges:{label:"Geen forumbadges",default:!1},subtle:{label:"Minder grijze balken",default:!0},noBoldMenu:{label:"Menutekst niet vet",default:!0}};let f=GM_getValue("ignored")||[],g=GM_info.script.version,i=GM_getValue("checked")||[],s=0;if(0===i.length){for(var h in a)a[h].default&&i.push(h);GM_setValue("checked",i)}document.addEventListener("DOMContentLoaded",function(){const f=document.body,gg=document.getElementById("HeaderMenu"),h=document.getElementById("ContentContainer"),j=document.getElementsByClassName("postlist")[0],k=GM_info.script.version,v=GM_getValue("ignored")||[],l=h.querySelectorAll(".topiclist"),m=document.querySelectorAll("li.postlist__item"),n=function(){h.classList.toggle("tempShow")},o=function(b){b.parentNode.insertBefore(b.nextElementSibling,b)},q=function(){let b="";0<s?(h.classList.add("showBox"),b=1===s?"1 gefilterd bericht":s+" gefilterde berichten"):h.classList.remove("showBox","tempShow"),e.innerHTML=b},p=function(d,b){var a=d.indexOf(b);-1===a?d.push(b):d.splice(a,1)},t=function(d){const a=d.target.id;switch(p(i,a),GM_setValue("checked",i),a){case"shortQuotes":if(!h.classList.toggle(a))for(var b=0;b<m.length;b+=1)m[b].classList.remove("long","open");break;case"fullHide":h.classList.toggle(a),h.classList.remove("tempShow"),q();break;case"hideBadges":h.classList.toggle(a);break;case"subtle":h.classList.toggle(a);case"noBoldMenu":gg.classList.toggle(a);}},u=function(){document.querySelector("#InfoBox").classList.toggle("visible")},w=function(d){let a=d.target.closest("li"),b=window.scrollY;d.target.textContent=a.classList.toggle("open")?"Verberg bericht":"Lees bericht",window.scrollTo(window.scrollX,b)},x=function(b){b.target.closest("li").classList.toggle("long")},y=function(g){let h,i=g.target.closest("li"),a=window.scrollY,c=0;p(v,i.uid),GM_setValue("ignored",v);for(var j=0;j<m.length;j+=1){let e=m[j],a=e.clientHeight;if(e.uid===i.uid&&(e.id===i.id&&(h=1),e.classList.toggle("ignored")?(s+=1,q()):(s-=1,q(),e.classList.remove("open","long"),e.querySelector(".mBtn").textContent="Lees bericht"),!h)){let d=e.clientHeight;c-=a-d}}window.scrollTo(window.scrollX,a+c)},z=function(e){const f=e.firstElementChild.firstElementChild.name,g=e.querySelector(".QuotePost"),h=e.querySelector(".forumpost__user"),i=h.querySelector(".forumpost__username"),j=i.getAttribute("href")?i.getAttribute("href").match(/Leden\/(\d+)\//)[1]:0,k=h.querySelector(".forumpost__userdate"),l="<a class=\"PostDate\" href=\"/Forum/Post/"+f+".aspx\" title=\"/Forum/Post/"+f+".aspx\">"+k.textContent+"</a>";let m=document.createRange().createContextualFragment(l),a=h.querySelector(".forumpost__levelicon");a&&o(a),k.parentNode.replaceChild(m,k),e.id=f,e.uid=j,g&&g.appendChild(c.cloneNode(!1)).addEventListener("click",x),0<j?(-1<v.indexOf(j)&&(s+=1,q(),e.classList.add("ignored")),h.insertBefore(b.cloneNode(!0),h.firstChild).addEventListener("click",w),h.insertBefore(r.cloneNode(!0),h.firstChild).addEventListener("click",y)):h.insertBefore(d.cloneNode(!0),h.firstChild)},A=function(c){if(!c.closest(".forumoverview")){let a=c.querySelectorAll(".topiclist__levelicon");a.forEach(function(b){o(b)})}};["shortQuotes","fullHide","hideBadges","subtle"].forEach(function(b){-1<i.indexOf(b)&&h.classList.add(b)}),-1<i.indexOf("noBoldMenu")&&gg.classList.add("noBoldMenu"),0<m.length&&(function(){e.id="ignBox",e.addEventListener("click",n),j.parentNode.insertBefore(e,j),q()}(),function(){r.className="uBtn",c.className="qBtn",b.className="mBtn",b.textContent="Lees bericht",d.className="noBtn";for(var e=0;e<m.length;e+=1)z(m[e])}()),0<l.length&&l.forEach(function(b){A(b)}),function(){let d="<li id=\"PrefPanel\"><div></div><ul><li>Forum Filter Instellingen</li>";for(let c in a)d+="<li><input name=\""+c+"\" id=\""+c+"\" type=\"checkbox\""+(i.includes(c)?" checked":"")+"><label for=\""+c+"\">"+a[c].label+"</label></li>";d+="<li>Versie "+k+" (<span id=\"MeerInfo\">toon info</span>)</li></ul></li>";let e=document.createRange().createContextualFragment(d),b=e.querySelectorAll("input");for(let c=0;c<b.length;c+=1)b[c].addEventListener("change",t,!1);e.querySelector("#MeerInfo").addEventListener("click",u),document.getElementById("HeaderMenu").querySelector(".navigation__list").appendChild(e),GM_addStyle("#PrefPanel{display:block}")}(),function(){const b=document.createRange().createContextualFragment("<div id=\"InfoBox\"><div id=\"InfoBackground\"></div><div id=\"InfoWindowContainer\"><div id=\"CloseBtn\"></div><div id=\"InfoWindow\"><h3>IEX Forum Filter "+k+"</h3><div><p>Dit userscript manipuleert html in de browser voor een betere gebruikservaring:</p><p>- Verwijder irritante posters.<br>- Verberg forumbadges.<br>- Minder scrollen dankzij ingeklapte quotes.</p><p>Ben je blij met dit script? Geef me dan een duimpje in het <a href=\"https://www.iex.nl/Forum/Post/12461472.aspx\" target=\"_blank\">topic</a> in de Koffiekamer.</p><p>Helaas werken userscripts niet op tablets en telefoons.</p><p>N.B. Wordt bij verversen de pagina steeds twee keer geladen? Dan kan het blokkeren van \"https://cdn.blueconic.net/iex.js\" helpen.</p><h3>Changelog</h3><h5>2.1.4</h5><ul><li>Optie: menuteksten niet vet.</li></ul><h5>2.1.3</h5><ul><li>Update i.v.m. nieuwe IEX menubalk.</li><li>Optie uitschakelen menuvertraging eindelijk overbodig!</li><li>Tandwielmenu iets verplaatst.</li><li>Bugfix: pagina's met verwijderde users liepen vast.</li></ul><h5>2.1.1</h5><ul><li>Bugfix: foutje in auto-download URL.</li></ul><h5>2.1</h5><ul><li>Update i.v.m. IEX stijlwijzigingen</li><li>Verborgen posts kunnen tijdelijk getoond worden.</li><li>Forumbadges in forumoverzichten aangepakt.</li><li>Code gecompressed (30% winst).</li></ul><h5>2.0.2</h5><ul><li>Nogmaals bugfix uitschakelbare menu-vertraging.</li></ul><h5>2.0.1</h5><ul><li>Bugfix uitschakelbare menu-vertraging.</li></ul><h5>2.0</h5><ul><li>Code aangepast vanwege IEX-wijzigingen.</li><li>Optie: gefilterde berichten volledig verbergen.</li><li>Optie: verbergen forumbadges.</li><li>Optie: uitschakelen vertraging in menubalk.</li><li>Stijlaanpassingen: iets compacter, grotere letters, enkele tint- en kleurwijzigingen, forumbadges achter de username.</li><li>'Tandwiel-menu' verplaatst naar rechts.</li><li>De rechtstreekse link naar een specifiek bericht is nu weer kopieerbaar (klik met rechtermuisknop op de datum).</li><li>Verwijderd: optie rustig laden (nu altijd actief).</li><li>Verwijderd: optie aangepaste menubalk voor Safari.</li></ul><h5>1.0.1</h5><ul><li>Correctie edit- en delete-knoppen.</li></ul><h5>1.0</h5><ul><li>Veel code herschreven/opgeschoond.</li><li>Werkt nu in alle IEX-tabs.</li><li>Toevoeging infovenster.</li><li>Kleine aanpassing knoppen.</li><li>Grotere marge tussen berichten.</li><li>Forum dropdown steekt niet meer uit.</li><li>Irritante vertraging in de grijze menubalk opgeheven.</li><li>Optie: fix voor weergave grijze menubalk in Safari.</li><li>Volgen-knop rechtslijnend.</ul><h5>0.9.3</h5><ul><li>Aanpassing vanwege gewijzigde paginastructuur.</li></ul><h5>0.9.2</h5><ul><li>Toevoeging iex.be.</li></ul><h5>0.9.1</h5><ul><li>Aanpassing vanwege gewijzigde paginastructuur.</li><li>URL's niet langer hoofdlettergevoelig (waardoor bijv. de Koffiekamer niet goed werkte).</li><li>Attachments in posts zijn nu eindelijk zichtbaar. :-)</li><li>Voortaan waarschuwt Tampermonkey bij nieuwe script-updates (schakel dit niet uit in de settings!). Handmatig updaten kan, maar is niet meer nodig. Gebruik de \"Check for userscript updates\"-functie in het Tampermonkey panel, dan blijven voorkeuren en geblokkeerde posters bewaard.</li></ul><h5>0.9</h5><ul><li>Voorkeuren panel.</li></ul><h5>0.8</h5><ul><li>Datum/tijd is link naar bericht.</li></ul><h5>0.7</h5><ul><li>Opties: korte quotes, rustiger pageload.</li></ul><h5>0.6</h5><ul><li>Filterknop op plek van usericon.</li></ul><h5>0.5</h5><ul><li>Scrollpositie blijft bewaard.</li></ul><h5>0.4</h5><ul><li>Pagina real-time aangepast.</li></ul><h5>0.3 door closer</h5><ul><li>Met knop blokkeren/toestaan users.</li></ul><h5>0.2 door NielsjeB</h5><ul><li>Filteren op userid.</li></ul><h5>0.1 door Desmi</h5><ul><li>Filteren op username.</li></ul></div></div></div></div>");GM_getValue("current_version")!==k&&(b.querySelector("#InfoBox").classList.add("visible"),GM_setValue("current_version",k)),b.querySelector("#InfoBackground").addEventListener("click",u),b.querySelector("#CloseBtn").addEventListener("click",u),document.body.appendChild(b)}(),GM_addStyle("body{display:block}")})})();
RAW Paste Data