MediaWiki:Common.js
Σημείωση: μετά την δημοσίευση, ίσως χρειαστεί να παρακάμψετε την προσωρινή μνήμη του προγράμματος περιήγησής σας για να δείτε τις αλλαγές.
- Firefox / Safari: Κρατήστε πατημένο το Shift κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση ή πιέστε Ctrl-F5 ή Ctrl-R (⌘-R σε Mac)
- Google Chrome: Πιέστε Ctrl-Shift-R (⌘-Shift-R σε Mac)
- Internet Explorer / Edge: Κρατήστε πατημένο το Ctrl κάνοντας ταυτόχρονα κλικ στο κουμπί Ανανέωση, ή πιέστε Ctrl-F5
- Opera: Πιέστε Ctrl-F5.
/* Οποιοσδήποτε κώδικας JavaScript εδώ θα φορτωθεί για όλους τους χρήστες σε κάθε φόρτωση σελίδας. */
importScript( 'MediaWiki:EditToolbar.js' ); // πρόσθετα εργαλεία επεξεργασίας
/* Κώδικας ειδικά για Internet Explorer */
if ( navigator.appName == 'Microsoft Internet Explorer' ) {
/** Internet Explorer bug fix **************************************************
*
* Description: Fixes IE horizontal scrollbar bug
* Maintainers: [[User:Tom-]]?
*/
var oldWidth;
var docEl = document.documentElement;
function fixIEScroll() {
if ( !oldWidth || docEl.clientWidth > oldWidth ) {
doFixIEScroll();
} else {
setTimeout( doFixIEScroll, 1 );
}
oldWidth = docEl.clientWidth;
}
function doFixIEScroll() {
docEl.style.overflowX = ( docEl.scrollWidth - docEl.clientWidth < 4 ) ? 'hidden' : '';
}
document.attachEvent( 'onreadystatechange', fixIEScroll );
document.attachEvent( 'onresize', fixIEScroll );
/**
* Remove need for CSS hacks regarding MSIE and IPA.
*/
if ( document.createStyleSheet ) {
document.createStyleSheet().addRule( '.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";' );
}
}
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Maintainers: [[User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = 'απόκρυψη';
var expandCaption = 'εμφάνιση';
function collapseTable( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( 'table' );
for ( var i = 0; i < Tables.length; i++ ) {
if ( $( Tables[i] ).hasClass( 'collapsible' ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
if ( !HeaderRow ) {
continue;
}
var Header = HeaderRow.getElementsByTagName( 'th' )[0];
if ( !Header ) {
continue;
}
NavigationBoxes[tableIndex] = Tables[i];
Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
var Button = document.createElement( 'span' );
var ButtonLink = document.createElement( 'a' );
var ButtonText = document.createTextNode( collapseCaption );
Button.style.styleFloat = 'right';
Button.style.cssFloat = 'right';
Button.style.fontWeight = 'normal';
Button.style.textAlign = 'right';
Button.style.width = '6em';
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', 'javascript:collapseTable(' + tableIndex + ');' );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if (
$( NavigationBoxes[i] ).hasClass( 'collapsed' ) ||
( tableIndex >= autoCollapse && $( NavigationBoxes[i] ).hasClass( 'autocollapse' ) )
)
{
collapseTable( i );
}
}
}
$( createCollapseButtons );
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// set up the words in your language
var NavigationBarHide = '[ απόκρυψη ]';
var NavigationBarShow = '[ εμφάνιση ]';
var NavigationBarShowDefault = 2;
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar( indexNavigationBar ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
if ( !NavFrame || !NavToggle ) {
return false;
}
// if shown now
if ( NavToggle.firstChild.data == NavigationBarHide ) {
for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
if ( $( NavChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if ( NavToggle.firstChild.data == NavigationBarShow ) {
for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
if ( $( NavChild ).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName( 'div' );
for ( var i = 0; NavFrame = divs[i]; i++ ) {
// if found a navigation bar
if ( $( NavFrame ).hasClass( 'NavFrame' ) ) {
indexNavigationBar++;
var NavToggle = document.createElement( 'a' );
NavToggle.className = 'NavToggle';
NavToggle.setAttribute( 'id', 'NavToggle' + indexNavigationBar );
NavToggle.setAttribute( 'href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');' );
var NavToggleText = document.createTextNode( NavigationBarHide );
for ( var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if (
$( NavChild ).hasClass( 'NavPic' ) ||
$( NavChild ).hasClass( 'NavContent' )
)
{
if ( NavChild.style.display == 'none' ) {
NavToggleText = document.createTextNode( NavigationBarShow );
break;
}
}
}
NavToggle.appendChild( NavToggleText );
// Find the NavHead and attach the toggle link
// (Must be this complicated because Moz's firstChild handling is borked)
for( var j = 0; j < NavFrame.childNodes.length; j++ ) {
if ( $( NavFrame.childNodes[j] ).hasClass( 'NavHead' ) ) {
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
}
// if more Navigation Bars found than Default: hide all
if ( NavigationBarShowDefault < indexNavigationBar ) {
for( var i = 1; i <= indexNavigationBar; i++ ) {
toggleNavigationBar( i );
}
}
}
$( createNavigationBarToggleButton );
// END Dynamic Navigation Bars
// ============================================================
/*== Λίστα ειδικών χαρακτήρων ==
Ajoutez le menu pour choisir des sous-ensembles de caractères spéciaux
Note : L'ordre de cette liste doit correspondre a celui de [[MediaWiki:Edittools]] !
*/
function addCharSubsetMenu() {
var specialchars = document.getElementById( 'specialchars' );
if ( specialchars ) {
var menu = '<select style="display:inline" onChange="chooseCharSubset(selectedIndex)">';
menu += '<option>Βίκι</option>';
menu += '<option>Μαθηματικά</option>';
menu += '<option>Althochdeutsch</option>';
menu += '<option>Navajo & Apache</option>';
menu += '<option>Pinyin</option>';
menu += '<option>Αγγλοσαξονικά</option>';
menu += '<option>Αραβικά</option>';
menu += '<option>Αρχαία Ελληνικά</option>';
menu += '<option>Βιετναμέζικα</option>';
menu += '<option>Γερμανικά</option>';
menu += '<option>Γίντις</option>';
menu += '<option>ΔΦΑ (IPA)</option>';
menu += '<option>Εβραϊκά</option>';
menu += '<option>Εσθονικά</option>';
menu += '<option>Εσπεράντο</option>';
menu += '<option>Ιερογλυφικά</option>';
menu += '<option>Ινδοευρωπαϊκά</option>';
menu += '<option>Ιρλανδικά</option>';
menu += '<option>Ισλανδικά</option>';
menu += '<option>Ιταλικά</option>';
menu += '<option>Ισπανικά</option>';
menu += '<option>Καταλανικά</option>';
menu += '<option>Κροατικά</option>';
menu += '<option>Κυριλλικά</option>';
menu += '<option>Λατινικά</option>';
menu += '<option>Λετονικά</option>';
menu += '<option>Λιθουανικά</option>';
menu += '<option>Μαλτέζικα</option>';
menu += '<option>Ολλανδικά</option>';
menu += '<option>Ουαλικά</option>';
menu += '<option>Ουγγρικά</option>';
menu += '<option>Πολωνικά</option>';
menu += '<option>Πορτογαλλικά</option>';
menu += '<option>Ρομάτζι</option>';
menu += '<option>Ρουμανικά</option>';
menu += '<option>Σερβικά</option>';
menu += '<option>Σκανδιναβικά</option>';
menu += '<option>Τούρκικα</option>';
menu += '<option>Τσέχικα</option>';
menu += '<option>Χαβανέζικα</option>';
menu += '</select>';
specialchars.innerHTML = menu + specialchars.innerHTML;
/* default subset - try to use a cookie some day */
chooseCharSubset( 0 );
}
}
/* select subsection of special characters */
function chooseCharSubset( s ) {
var l = document.getElementById( 'specialchars' ).getElementsByTagName( 'p' );
for ( var i = 0; i < l.length; i++ ) {
l[i].style.display = i == s ? 'inline' : 'none';
l[i].style.visibility = i == s ? 'visible' : 'hidden';
}
}
$( addCharSubsetMenu );
/**
* Copyright 2006, Marc Mongenet. Licence GPL & GFDL.
*
* The function looks for <span class="editsection">, and move them
* at the end of their parent and display them inline in small font.
* var oldEditsectionLinks=true disables the function.
*/
function setModifySectionStyle() {
var process = function( list ) {
list.css({'font-size': 'x-small', 'font-weight': 'normal', 'float': 'none'});
list.before( document.createTextNode( ' ' ) );
}
if ( typeof oldEditsectionLinks != 'undefined' && oldEditsectionLinks != false ) {
return;
}
process( $( 'h2 > .editsection:first-child' ) );
process( $( 'h3 > .editsection:first-child' ) );
process( $( 'h4 > .editsection:first-child' ) );
process( $( 'h5 > .editsection:first-child' ) );
process( $( 'h6 > .editsection:first-child' ) );
}
$( setModifySectionStyle );