Szerkesztő:Tgr/irclogin.js
Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
- Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
- Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
- Opera: Nyomj Ctrl–F5-öt
// this script looks for the element with id "irclogon", and replaces its contents
// with a login form that redirects to the wikizine CGI:IRC gateway
( function () {
if ( mw.config.get( 'wgAction' ) in { edit: 1, submit: 1 } ) {
return;
}
function loadLoginForm() {
$( '#irclogin' ).empty().append(
$( '<form>' ).attr( {
method: 'post',
action: '//webchat.freenode.net/',
target: '_blank',
name: 'loginform'
} ).submit( setjs ).append(
$( '<input type="hidden">' ).attr( {
name: 'interface'
} ).val( 'nonjs' ),
$( '<input type="text"> ').attr( {
name: 'Nickname',
size: 25
} ).val( nickify( wgUserName ) ).focus( function () {
clear_text(this);
} ),
$( '<input type="submit"> ').val( 'Belépés' ),
$( '<input type="hidden"> ').attr( 'name', 'Character_set' ).val( 'ISO-8859-' ),
$( '<input type="hidden"> ').attr( 'name', 'Server' ).val( 'irc.freenode.net' ),
$( '<input type="hidden"> ').attr( 'name', 'Channel' ).val( '#wikipedia-hu' )
)
);
}
function nickify( s ) {
if ( s == null ) {
return "anon" + Math.floor( Math.random() * 100 );
}
s = s.toLowerCase();
s = s.replace(" ", "_");
s = s.replace(/á/g, 'a');
s = s.replace(/é/g, 'e');
s = s.replace(/í/g, 'i');
s = s.replace(/[óő]/g, 'o');
s = s.replace(/[úű]/g, 'u');
s = s.replace(/[^a-z0-9_-]/g, '');
return s;
}
var irclogin_cleared = 0;
function clear_text( field ) {
if ( irclogin_cleared === 0 ) {
irclogin_cleared = 1;
field.value = "";
}
}
function setjs() {
if ( navigator.product == 'Gecko' ) {
document.loginform["interface"].value = 'mozilla';
} else if(window.opera && document.childNodes) {
document.loginform["interface"].value = 'opera7';
} else if (
navigator.appName == 'Microsoft Internet Explorer' &&
navigator.userAgent.indexOf("Mac_PowerPC") > 0
) {
document.loginform["interface"].value = 'konqueror';
} else if ( navigator.appName == 'Microsoft Internet Explorer' ) {
document.loginform["interface"].value = 'ie';
} else if ( navigator.appName == 'Konqueror' ) {
document.loginform["interface"].value = 'konqueror';
} else if ( window.opera ) {
document.loginform["interface"].value = 'opera';
}
}
$( loadLoginForm );
} );