Created
July 26, 2012 10:02
-
-
Save that4chanwolf/3181320 to your computer and use it in GitHub Desktop.
techchan+
This file contains 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 TechChan+ | |
// @author that4chanwolf | |
// @namespace techchan+ | |
// @description Adds things to techchan.org | |
// @include http://techchan.org/* | |
// @version 0.0.1a | |
// @delay 1 | |
// ==/UserScript== | |
var Config = { | |
'Custom Titles': true, | |
'Anonymize': false, | |
}; | |
var Conf = {}; | |
// Configuration | |
for( i in Config ) { | |
if(GM_getValue(i, null) === null || GM_getValue(i, null) === '') { | |
GM_setValue(i, Config[i]); | |
} | |
Conf[i] = GM_getValue(i, Config[i]); | |
} | |
var SetTitle = { | |
init: function() { | |
var optext = document.querySelector("div.op p.body").textContent.replace(/\n/,' '); | |
var bname = document.location.pathname.split('/').splice(1)[0]; | |
if(document.location.pathname.split('/').splice(1)[1] === 'res') { | |
document.title = '/' + bname + '/ - ' + optext; | |
} | |
} | |
}; | |
var Anonymize = { | |
init: function() { | |
var names = document.querySelectorAll('p.intro span.name'), | |
trips = document.querySelectorAll('p.intro span.trip'); | |
for( var i = 0; i < names.length; i++ ) { | |
names[i].textContent = 'Anonymous'; | |
} | |
for( var i = 0; i < trips.length; i++) { | |
trips[i].textContent = ''; | |
} | |
} | |
}; | |
var Main = { | |
init: function() { | |
if(Conf['Custom Titles']) | |
SetTitle.init(); | |
if(Conf['Anonymize']) | |
Anonymize.init() | |
} | |
}; | |
Main.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment