Last active
August 29, 2015 14:13
-
-
Save RRvW/fd58841de9570ab1b545 to your computer and use it in GitHub Desktop.
Tnet commends fixer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Tweakers comments fixer | |
// @namespace tnet.fixer | |
// @description Forces time ascending comments layout and hides all moderations | |
// @include *tweakers.net* | |
// @version 0.2.2-beta | |
// @grant none | |
// @downloadURL https://gist.github.com/RRvW/fd58841de9570ab1b545/raw/tnetcommendsfix.user.js | |
// ==/UserScript== | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head') [0]; | |
if (!head) { | |
return; | |
} | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} | |
addGlobalStyle('.reactieBody.informative{ background: inherit !important; border-color: #DDDEDE !important;}'); | |
addGlobalStyle('.reactieBody.spotlight{ background: inherit !important; border-color: #DDDEDE !important;}'); | |
function hideElem(element) { | |
var a; | |
a = document.getElementsByClassName(element); | |
for (i = 0; i < a.length; i++) { | |
a[i].style.display = 'none'; | |
} | |
} | |
hideElem('scoreButton'); | |
hideElem('filterBox'); | |
hideElem('tweakersBadge'); | |
var a; | |
//Replace karma cards | |
a = document.getElementsByClassName('karmaCards'); | |
for (i = 0; i < a.length; i++) { | |
a[i].innerHTML = '<span style="font-size: 13px;">' +" (̅_̅_̅_̅((_̅_̲̅м̲̅a̲̅я̲̅i̲̅j̲̅u̲̅a̲̅n̲̅a̲̅̅_̅_̅_̅() ڪے"+'</span>' | |
} | |
a = document.getElementsByTagName('a'); | |
for (i = 0; i < a.length; i++) { | |
if (a[i].href && a[i].href.match(/nieuws|reviews|downloads|geek/i)) { | |
var c = a[i].href.split('#'); | |
add = '' | |
if (c[1]) { | |
add = '#' + c[1]; | |
} | |
if (a[i].href.match(/\?/i)) { | |
// link already contains other parameters | |
a[i].href = c[0] + '&mode=nested&niv=-1&order=asc&orderBy=time' + add; | |
} else { | |
// link does not contain any parameters | |
a[i].href = c[0] + '?mode=nested&niv=-1&order=asc&orderBy=time' + add; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment