User:Technical 13/Scripts/Teahouse IRC.js

/**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//**//* * 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); } }