Disallow / character in new usernames, as this conflicts with subpages (this was...
[mediawiki.git] / stylesheets / wikibits.js
blobc2b37a8a18490eddf714d582f294eea22c12dea7
1 // Wikipedia JavaScript support functions
3 // for enhanced RecentChanges
4 function toggleVisibility( _levelId, _otherId, _linkId) {
5         var thisLevel = document.getElementById( _levelId );
6         var otherLevel = document.getElementById( _otherId );
7         var linkLevel = document.getElementById( _linkId );
8         if ( thisLevel.style.display == 'none' ) {
9                 thisLevel.style.display = 'block';
10                 otherLevel.style.display = 'none';
11                 linkLevel.style.display = 'inline';
12         } else {
13                 thisLevel.style.display = 'none';
14                 otherLevel.style.display = 'inline';
15                 linkLevel.style.display = 'none';
16                 }
17         }
19 // Timezone stuff
20 // tz in format [+-]HHMM
21 function checkTimezone( tz, msg ) {
22         var localclock = new Date();
23         // returns negative offset from GMT in minutes
24         var tzRaw = localclock.getTimezoneOffset();
25         var tzHour = Math.floor( Math.abs(tzRaw) / 60);
26         var tzMin = Math.abs(tzRaw) % 60;
27         var tzString = ((tzRaw >= 0) ? "-" : "+") + ((tzHour < 10) ? "0" : "") + tzHour + ((tzMin < 10) ? "0" : "") + tzMin;
28         if( tz != tzString ) {
29                 var junk = msg.split( '$1' );
30                 document.write( junk[0] + "UTC" + tzString + junk[1] );
31         }
34 // in [-][H]H format...
35 // won't yet work with non-even tzs
36 function fetchTimezone() {
37         var localclock = new Date();
38         // returns negative offset from GMT in minutes
39         var tzRaw = localclock.getTimezoneOffset();
40         var tzHour = Math.floor( Math.abs(tzRaw) / 60);
41         var tzString = ((tzRaw >= 0) ? "-" : "") + ((tzHour < 10) ? "" : "0") + tzHour;
42         return tzString;
45 function guessTimezone(box) {
46         document.preferences.wpHourDiff.value = fetchTimezone();