MediaWiki:Common.js
Σημείωση: Μετά την αποθήκευση πρέπει να καθαρίσετε την προσωρινή μνήμη του browser σας για να δείτε τις αλλαγές: Mozilla: πατήστε Reload (ή Ctrl-R), IE / Opera: Ctrl-F5, Safari: Cmd-R, Konqueror Ctrl-R.
mw.loader.using(['mediawiki.util', 'mediawiki.cookie']).then(function () {
// Crudely widen the sitenotice message to 100% page width and hide the dismiss link.
// NB: This one is better left commented out when not specifically needed.
/*
$(function(){
var siteNoticeText = document.getElementById('mw-dismissable-notice').childNodes[0].childNodes[0].childNodes[0];
var siteNoticeDismiss = document.getElementById('mw-dismissable-notice').childNodes[0].childNodes[0].childNodes[2];
siteNoticeDismiss.setAttribute('style', 'display:none;');
siteNoticeText.setAttribute('width', '100%');
});
*/
/**********************
*** Allow descriptive labels next to sidebar language links using {{interwiki-info}}
*** by [[user:ThomasV]]
**********************/
function interwikiExtra() {
// iterate over all <span>-elements
for(var i=0; a=document.getElementsByTagName('span')[i]; i++) {
// if found a linkInfo span
if(a.className == 'interwiki-info') {
// iterate over all <li>-elements
var count=0;
for(var j=0; b=document.getElementsByTagName('li')[j]; j++) {
if(b.className == 'interwiki-' + a.id) {
b.innerHTML = b.innerHTML + ' ' + a.title;
if(a.title == '(vo)') {
b.title = 'Texte original';
}
}
else if(b.className == 'interwiki-' + a.id.substr(0, a.id.length-1)) {
count++;
if(a.id.charAt(a.id.length-1) == count) {
b.innerHTML = b.innerHTML + ' ' + a.title;
}
}
}
}
}
}
$(interwikiExtra);
//add link to the extension [[user:sanbeg]]
function pr_add_quality_buttons_link(){
if(typeof proofreadPageMessageStatus == 'undefined') return;
if( self.proofreadpage_no_quality_buttons ) return;
var ig = document.getElementById("wpWatchthis");
if( !ig ) return;
var f = document.createElement("span");
f.innerHTML = ' (<a href="/wiki/Help:Page Status">help</a>)';
ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling.nextSibling);
}
$(pr_add_quality_buttons_link);
/****************
*** Allows extra script to run in Special:Watchlist — addition of announcements
*** script allows users to dismiss Mediawiki:watchlist-announcements, as per sitenotice
*** [[user:billinghurst]] 20100522, as hacked from WP script
*****************/
/*if (mw.config.get('wgPageName') == "Special:Watchlist") //watchlist scripts
{
importScript("MediaWiki:Common.js/watchlist.js")
}*/
/**********************
*** add menu on edit page /for selecting subsets of special characters
*** by [[user:Pathoschild]]
*** - note: must match MediaWiki:Edittools
**********************/
function addCharSubsetMenu() {
var specialchars = document.getElementById('specialchars');
if (specialchars) {
var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">";
menu += "<option>Select</option>";
menu += "<option>Ligatures and symbols</option>";
menu += "<option>Accents</option>";
menu += "<option>Tildes</option>";
menu += "<option>Cedillas</option>";
menu += "<option>Diereses</option>";
menu += "<option>Circumflexes</option>";
menu += "<option>Macrons</option>";
menu += "<option>Other diacritics</option>";
menu += "<option>Greek</option>";
menu += "<option>Hebrew</option>";
menu += "<option>Cyrillic</option>";
menu += "<option>IPA</option>";
menu += "</select>";
specialchars.innerHTML = menu + specialchars.innerHTML.replace(/_newline_/gm, "\n");
/* 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);
/**
* Imports JaveScript for the current page when the URL contains a &usejs parameter.
* @see https://meta.wikimedia.org/wiki/UseJS
* @update-token [[File:pathoschild/usejs.js]]
*/
mw.loader.load('//el.wikisource.org/w/index.php?title=MediaWiki:Usejs.js&action=raw&ctype=text/javascript');
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[w:Wikipedia:NavFrame]].
* Maintainers: [[w: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"; // REMOVE THESE LINES
Button.style.fontWeight = "normal"; // ON 10 FEBRUARY 2009
Button.style.textAlign = "right"; //
Button.style.width = "6em"; //
Button.className = "collapseButton"; //Styles are declared in Common.css
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 );
}
else if ( $(NavigationBoxes[i]).hasClass( "innercollapse" ) ) {
var element = NavigationBoxes[i];
while (element = element.parentNode) {
if ( $(element).hasClass( "outercollapse" ) ) {
collapseTable ( i );
break;
}
}
}
}
}
$( createCollapseButtons );
/** Dynamic Navigation Bars (experimental) *************************************
*
* Description: See [[w:Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
// 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 isCollapsed = $(NavFrame).hasClass( "collapsed" );
/*
* Check if any children are already hidden. This loop is here for backwards compatibility:
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
* to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
* the content visible without JavaScript support), the new recommended way is to add the class
* "collapsed" to the NavFrame itself, just like with collapsible tables.
*/
for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
if ( NavChild.style.display == 'none' ) {
isCollapsed = true;
}
}
}
if (isCollapsed) {
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if ( $(NavChild).hasClass( 'NavPic' ) || $(NavChild).hasClass( 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
}
var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
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);
}
}
}
$( createNavigationBarToggleButton );
/*
* port from [[:he:mediawiki:common.js]] for [[mediawiki:edittools]] -Steve
*/
/* פונקציה שמשמשת לאיפשור ניקוד ב[[מדיה ויקי:edittools]] */
function nikud(){
if (document.getElementById('edit-templates')!=null){
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
if(a.className == "nikud") {
a.onclick=function(){mw.util.insertTags('', this.title, '');return false;};
}
}
}
}
$(nikud);
/*scripts imported from wikisource.org*/
/* messages are configurable here */
self.ws_messages = {
'optlist':'Επιλογές εμφάνισης',
'hide_page_numbers':'Απόκρυψη συνδ. σελίδας',
'show_page_numbers':'Εμφάνιση συνδ. σελίδας',
'layout':'Διάταξη',
'author':'Συγγραφέας',
'translator':'Μεταφραστής',
'editor':'Επιμελητής',
'publisher':'Εκδότης',
'place':'Τόπος',
'volume':'Τόμος',
'school':'Σχολή',
'book':'Βιβλίο',
'collection':'Συλλογή',
'journal':'Εφημερίδα ή περιοδικό',
'phdthesis':'Διατριβή',
'dictionary':'Λεξικό',
'progress':'Πρόοδος',
'progress_T':'Έγινε',
'progress_V':'Χρειάζεται επιβεβαίωση',
'progress_C':'Χρειάζεται διόρθωση',
'progress_MS':'Έτοιμα για σύγκριση και διαχωρισμό',
'progress_OCR':'Χρειάζεται στρώμα κειμένου OCR',
'progress_X':'Το αρχείο πηγής είναι απόσπασμα μεγαλίτερου τόμου ή μίγμα διαφόρων πηγών',
'progress_L':'Το αρχείο πηγής είναι λανθασμένο (λείπουν σελίδες, οι σελίδες είναι ανακατεμένες, κτλ.)',
'▲':'Επαναφορά στην αρχή της σελίδας.',
'matching':'γίνεται σύγκριση ',
'splitting':'γίνεται διαχωρισμός',
'corr_list':"Κατάλογος διορθώσεων αυτής της σελίδας" ,
'corr_link':"Διορθώσεις" ,
'corr_one':"Ένα λάθος </a> διορθώθηκε." ,
'corr_many':"Λάθη</a> διορθώθηκαν." ,
'corr_close':"Κλείσιμο." ,
'iwtrans':'Το κείμενό της προέρχεται από',
'iwtrans2':'Το κείμενό της προέρχεται από άλλες υποπεριοχές Wikisource.'
}
/* dynamic layouts */
self.ws_layouts = {
'Διάταξη 1':{'text-wrap':"",
'#text-container':"" ,
'#text':"",
'.sidenote-right':"float:right;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.sidenote-left':"float:left;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"" },
'Διάταξη 2':{'text-wrap':"position:relative;margin-left:3em;margin-right:3em;",
'#text-container':"width:36em;margin:0px auto;" ,
'#text':"text-align:justify;",
'.sidenote-right':"position:absolute; left:37em;width:16em;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:37em;width:16em;text-indent:0em;text-align:right;",
'.editsection':"display:none",
'#headertemplate':"" },
'Διάταξη 3':{'text-wrap':"margin-left:3em",
'#text-container':"position:relative; min-width:60em; float:left; width:100%; margin-right:-23em;" ,
'#text':"text-align:justify;margin-right:23em; text-indent:0em; padding-left:0px; padding-right:0px;width:auto;",
'.sidenote-right':"position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.sidenote-left': "position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"position:absolute; top:0em; right:-23em; width:21em;float:right; text-align:left;" }
}
self.proofreadpage_add_container = true;
mw.loader.load('//el.wikisource.org/w/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Dictionary.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:DoubleWiki.js&action=raw&ctype=text/javascript');
/*
Disabling mouse wheel until the problem is fixed.
Users that have a configurations where zoom wheel works can override this,
by adding "self.proofreadpage_disable_wheelzoom=false;" to their javascript.
*/
self.proofreadpage_disable_wheelzoom=true;
//Απόκρυψη του namespace Συγγραφέας από τις κατηγορίες Συγγραφέων, πρέπει να έχουν το πρότυπο Κατηγορία συγγραφέων για να δουλέψει
function catprefix() {
if(!document.getElementById('catnoprefix')) return
var anchors = document.getElementById('mw-pages').getElementsByTagName('a');
for(var i=0;i < anchors.length;i++) {
if(anchors[i].firstChild.nodeValue.indexOf(':') != -1) {
anchors[i].firstChild.nodeValue = anchors[i].firstChild.nodeValue.substring(anchors[i].firstChild.nodeValue.indexOf(':')+1);
}
}
}
$(catprefix)
});