User:Technical 13/Scripts/Teahouse IRC.js
Appearance
< User:Technical 13 | Scripts
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Technical 13/Scripts/Teahouse IRC. |
/**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//*
* IRC Login name changer. wgUserName + "|TH" if registered or "Teahouse_Guest##" otherwise.
* BY: [[User:Technical_13]]
* 1 May 2013
*//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**/
if (mw.config.get( 'wgPageName' ) == "Wikipedia:Teahouse/Questions"){
var StartChatting = $('span#TeahouseIRC-linkText b').text();
if (StartChatting == "Live help chat" && wgUserName != "null"){
var wgUserNamee = wgUserName.replace(' ', '_');
var hrefCurrent= $('div#TeahouseIRC a').attr('href');
// replace Teahouse_Guest.. with username|TH
var hrefReplaced = hrefCurrent.replace('Teahouse_Guest..', wgUserNamee /* + '|TH'*/);
// Inject "#wikipedia-teahouse" to the list of channels
var hrefReplaced = hrefReplaced.replace('&channels=wikipedia-en-help', '&channels=wikipedia-en-help%2Cwikipedia-en-helpers%2Cwikipedia-teahouse');
// turn off prompt for username and channel - captcha still required.
var hrefReplaced = hrefReplaced.replace('&prompt=1', '&prompt=0');
$('div#TeahouseIRC a').attr('href', hrefReplaced);
}
}