മീഡിയവിക്കി:Common.js
ശ്രദ്ധിക്കുക: സേവ് ചെയ്തശേഷം മാറ്റങ്ങൾ കാണാനായി താങ്കൾക്ക് ബ്രൗസറിന്റെ കാഷെ ഒഴിവാക്കേണ്ടി വന്നേക്കാം.
- ഫയർഫോക്സ് / സഫാരി: Reload ബട്ടൺ അമർത്തുമ്പോൾ Shift കീ അമർത്തി പിടിക്കുകയോ, Ctrl-F5 അല്ലെങ്കിൽ Ctrl-R (മാക്കിന്റോഷിൽ ⌘-R ) എന്ന് ഒരുമിച്ച് അമർത്തുകയോ ചെയ്യുക
- ഗൂഗിൾ ക്രോം: Ctrl-Shift-R (മാക്കിന്റോഷിൽ ⌘-Shift-R ) അമർത്തുക
- ഇന്റർനെറ്റ് എക്സ്പ്ലോറർ: Refresh ബട്ടൺ അമർത്തുമ്പോൾ Ctrl കീ അമർത്തിപിടിക്കുക. അല്ലെങ്കിൽ Ctrl-F5 അമർത്തുക
- ഓപ്പറ: Menu → Settings എടുക്കുക (മാക്കിൽ Opera → Preferences) എന്നിട്ട് Privacy & security → Clear browsing data → Cached images and files ചെയ്യുക.
/**
* Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche,
* disponibles dans une boîte déroulante.
* Auteurs : Jakob Voss, Guillaume, importé depuis la Wiki allemande
*
*/
function externalSearchEngines() {
if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return;
var mainNode = document.getElementById("powersearch");
if (!mainNode) mainNode = document.getElementById("search");
if (!mainNode) return;
var beforeNode = document.getElementById("mw-search-top-table");
if (!beforeNode) return;
beforeNode = beforeNode.nextSibling;
if (!beforeNode) return;
var firstEngine = "mediawiki";
var choices = document.createElement("div");
choices.setAttribute("id","searchengineChoices");
choices.style.textAlign = "center";
var lsearchbox = document.getElementById("searchText");
if (lsearchbox === null) {
lsearchbox = document.getElementById("powerSearchText");
}
var initValue = lsearchbox.value;
var space = "";
for (var id in searchEngines) {
var engine = searchEngines[id];
if(engine.ShortName)
{
if (space) choices.appendChild(space);
space = document.createTextNode(" ");
var attr = {
type: "radio",
name: "searchengineselect",
value: id,
onFocus: "changeSearchEngine(this.value)",
id: "searchengineRadio-"+id
};
var html = "<input";
for (var a in attr) html += " " + a + "='" + attr[a] + "'";
html += " />";
var span = document.createElement("span");
span.innerHTML = html;
choices.appendChild( span );
var label;
if (engine.Template.indexOf('http') === 0 || engine.Template.indexOf('//') === 0) {
label = document.createElement("a");
label.href = engine.Template.replace("{searchTerms}", initValue).replace("{language}", "fr");
} else {
label = document.createElement("label");
}
label.appendChild( document.createTextNode( engine.ShortName ) );
choices.appendChild( label );
}
}
mainNode.insertBefore(choices, beforeNode);
var input = document.createElement("input");
input.id = "searchengineextraparam";
input.type = "hidden";
mainNode.insertBefore(input, beforeNode);
changeSearchEngine(firstEngine, initValue);
}
function changeSearchEngine(selectedId, searchTerms) {
var currentId = document.getElementById("searchengineChoices").currentChoice;
if (selectedId == currentId) return;
document.getElementById("searchengineChoices").currentChoice = selectedId;
var radio = document.getElementById('searchengineRadio-' + selectedId);
radio.checked = "checked";
var engine = searchEngines[selectedId];
var p = engine.Template.indexOf('?');
var params = engine.Template.substr(p+1);
var form;
if (document.forms["search"]) {
form = document.forms["search"];
} else {
form = document.getElementById("powersearch");
}
form.setAttribute("action", engine.Template.substr(0,p));
var l = ("" + params).split("&");
for (var idx = 0;idx < l.length;idx++) {
var p1 = l[idx].split("=");
var pValue = p1[1];
if (pValue == "{language}") {
} else if (pValue == "{searchTerms}") {
$('#searchText').attr('name',p1[0]);
} else {
$('#searchengineextraparam').attr('name',p1[0]).val(pValue);
}
}
}
if (mw.config.get('wgCanonicalSpecialPageName') == "Search") {
var searchEngines = {
mediawiki: {
ShortName: "ആഭ്യന്തര അന്വേഷണം",
Template: "/w/index.php?search={searchTerms}"
},
techterms: {
ShortName: "സാങ്കേതികപദസൂചി",
Template: "//ml.wikipedia.org/w/index.php?search={searchTerms} prefix:വിക്കിപീഡിയ:വിക്കിപദ്ധതി/സാങ്കേതികപദാവലി/മേഖലകൾ&fulltext=Search"
},
wikiwix: {
ShortName: "വിക്കിവിക്സ്",
Template: "http://ml.wikiwix.com/index.php?action={searchTerms}&lang={language}"
},
google: {
ShortName: "ഗൂഗിൾ",
Template: "http://www.google.com/search?as_sitesearch=ml.wikipedia.org&hl={language}&q={searchTerms}"
},
wlive: {
ShortName: "വിൻഡോസ് ലൈവ്",
Template: "http://search.live.com/results.aspx?q={searchTerms}&q1=site:http://ml.wikipedia.org"
},
yahoo: {
ShortName: "യാഹൂ!",
Template: "http://search.yahoo.com/search?p={searchTerms}&vs=ml.wikipedia.org"
},
exalead: {
ShortName: "എക്സാലീഡ്",
Template: "http://www.exalead.com/wikipedia/results?q={searchTerms}&language=ml"
},
globalwpsearch: {
ShortName: "ഗ്ലോബൽ ഡബ്ല്യൂപി",
Template: "http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?timeout=120&search={searchTerms}"
}
};
$(externalSearchEngines);
}
/*ടൂൾബാറിൽ അവലംബം ചേർക്കാനുള്ള സൗകര്യം കൂട്ടിച്ചേർക്കുന്നതിനായി */
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
/* scripts specific to editing pages */
mw.loader.load( 'മീഡിയവിക്കി:Common.js/edit.js' );
}
/** Interwiki links to featured articles ***************************************
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:Junaidpv]] (updated to use jQuery)
*/
function LinkFA()
{
$('li', '#p-lang').each(function(){
var idPrefix = '#'+$(this).attr('class');
if($(idPrefix+'-fa').length>0 && !$(this).hasClass('badge-featuredarticle')) {
$(this).addClass('FA');
$(this).attr('title', 'ഈ ഭാഷയിൽ ഈ ലേഖനം തിരഞ്ഞെടുക്കപ്പെട്ടതാണ്.');
}else if($(idPrefix+'-ga').length>0 && !$(this).hasClass('badge-goodarticle')) {
$(this).addClass('GA');
$(this).attr('title', 'ഈ ഭാഷയിൽ ഇതൊരു മികച്ച ലേഖനമാണ്.');
}
});
}
$( LinkFA );
/** Main Page layout fixes *********************************************************
*
* Description: Various layout fixes for the main page, including an
* additional link to the complete list of languages available
* and the renaming of the 'Article' to to 'Main Page'.
* Maintainers: User:AzaToth, User:R. Koot
*/
mw.loader.using(['mediawiki.util']).then(function () {
if (mw.config.get('wgIsMainPage') || mw.config.get('wgPageName') == 'സംവാദം:പ്രധാന_താൾ') {
$(function () {
mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'പൂർണ്ണമായ പട്ടിക', 'interwiki-completelist', 'വിക്കിപീഡിയകളുടെ പൂർണ്ണമായ പട്ടിക');
var nstab = document.getElementById('ca-nstab-main');
if (nstab && mw.config.get('wgUserLanguage')=='ml') {
while (nstab.firstChild) {
nstab = nstab.firstChild;
}
nstab.nodeValue = 'പ്രധാന താൾ';
}else if (nstab) {
while (nstab.firstChild) nstab = nstab.firstChild;
nstab.nodeValue = 'Main Page';
}
});
}
});
/**
* Dynamic Navigation Bars (experimental)
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
/* set up the words in your language */
var NavigationBarHide = 'മറയ്ക്കുക';
var NavigationBarShow = 'പ്രദർശിപ്പിക്കുക';
var indexNavigationBar = 0;
/**
* Shows and hides content and picture (if available) of navigation bars
* Parameters:
* indexNavigationBar: the index of navigation bar to be toggled
**/
window.toggleNavigationBar = function ( indexNavigationBar, event ) {
var NavToggle = document.getElementById( 'NavToggle' + indexNavigationBar );
var NavFrame = document.getElementById( 'NavFrame' + indexNavigationBar );
var NavChild;
if ( !NavFrame || !NavToggle ) {
return false;
}
/* if shown now */
if ( NavToggle.firstChild.data === NavigationBarHide ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
/* if hidden now */
} else if ( NavToggle.firstChild.data === NavigationBarShow ) {
for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
event.preventDefault();
};
/* adds show/hide-button to navigation bars */
function createNavigationBarToggleButton( $content ) {
var NavChild;
/* iterate over all < div >-elements */
var $divs = $content.find( 'div' );
$divs.each( function ( i, NavFrame ) {
/* 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', '#' );
$( NavToggle ).on( 'click', $.proxy( window.toggleNavigationBar, window, 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 ( 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 ( 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' ) ) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild( NavToggle );
}
}
NavFrame.setAttribute( 'id', 'NavFrame' + indexNavigationBar );
}
} );
}
mw.hook( 'wikipage.content' ).add( createNavigationBarToggleButton );
/*END OF NAVIGATION BARS*/
/*
==addCharSubsetMenu==
*/
/* add menu for selecting subsets of secial characters */
/***** must match MediaWiki:Edittools *****/
function addCharSubsetMenu() {
if($('#editpage-specialchars').length>0) {
/* default subset from cookie */
var s = parseInt( $.cookie('edittoolscharsubset') );
if ( isNaN(s) ) s = 0;
var $menu = $('<select />')
.attr('id', 'charSubsetControl')
.css('display', 'inline');
$menu.change(chooseCharSubset)
.data('previousSelectedIndex', s)
.append($('<option />').text('ഫലകങ്ങൾ'))
.append($('<option />').text('വിക്കിവിന്യാസങ്ങൾ'))
.append($('<option />').text('അനുമതിപത്രങ്ങൾ'))
.append($('<option />').text('മലയാളം'))
.append($('<option />').text('കൊറിയൻ'))
.append($('<option />').text('ലത്തീൻ'))
.append($('<option />').text('ഐ.പി.എ.'))
.append($('<option />').text('പലവക'))
.append($('<option />').text('അറബി'))
.append($('<option />').text('ദേവനാഗരി'))
.append($('<option />').text('ഹിബ്രു'))
.append($('<option />').text('പഴയ ഇംഗ്ലീഷ്'));
$('#editpage-specialchars').prepend($menu);
/* update dropdown control to value of cookie */
$('#charSubsetControl')[0].selectedIndex = s;
$('p', '#editpage-specialchars').each(function(index) {
if(index==s) {
$(this).css('display', 'inline');
$(this).css('visibility', 'visible');
} else {
$(this).css('display', 'none');
$(this).css('visibility', 'hidden');
}
});
}
}
/*
===chooseCharSubsetMenu===
*/
/* select subsection of special characters */
function chooseCharSubset() {
var selectedIndex = $(this).find(':selected').index();
$('p', '#editpage-specialchars').each(function(index) {
if(index==selectedIndex) {
$(this).css('display', 'inline');
$(this).css('visibility', 'visible');
}else {
$(this).css('display', 'none');
$(this).css('visibility', 'hidden');
}
});
$.cookie('edittoolscharsubset', selectedIndex);
$(this).data('previousSelectedIndex', selectedIndex);
}
/*
== customizeWikipedia ==
*/
function customizeWikipedia() {
addCharSubsetMenu();
}
$(customizeWikipedia);
/*HERE STARTS THE WORKING-CODE OF "METABOXES"*/
/* Funcionament de la Plantilla:Metacaixa
Implementat per: Usuari:Peleguer.
Actualitzat per Joanjoc seguint les indicacions d'en Martorell
*/
function MetaCaixaInit(){
//S'executa al carregar-se la pàgina, si hi ha metacaixes,
// s'assignen els esdeveniments als botons
//alert("MetaCaixaInit");
var i=0 //Inicialitzem comptador de caixes
for (i=0;i<=9;i++){
var vMc = document.getElementById("mc"+i);
if (!vMc) break;
//alert("MetaCaixaInit, trobada Metacaixa mc"+i);
var j=1 //Inicialitzem comptador de botons dins de la caixa
var vPsIni = 0 //Pestanya visible inicial
for (j=1;j<=9;j++){
var vBt = document.getElementById("mc"+i+"bt"+j);
if (!vBt) break;
//alert("MetaCaixaInit, trobat botó mc"+i+"bt"+j);
vBt.onclick = MetaCaixaMostraPestanya; //A cada botó assignem l'esdeveniment onclick
//alert (vBt.className);
if (vBt.className=="mcBotoSel") vPsIni=j; //Si tenim un botó seleccionat, en guardem l'index
}
//alert ("mc="+i+", ps="+j+", psini="+vPsIni );
if (vPsIni == 0) { //Si no tenim cap botó seleccionat, n'agafem un aleatòriament
vPsIni = 1+Math.floor((j-1)*Math.random()) ;
//alert ("Activant Pestanya a l'atzar; _mc"+i+"bt"+vPsIni +"_");
document.getElementById("mc"+i+"ps"+vPsIni).style.display = "block";
document.getElementById("mc"+i+"ps"+vPsIni).style.visibility = "visible";
document.getElementById("mc"+i+"bt"+vPsIni).className="mcBotoSel";
}
}
}
function MetaCaixaMostraPestanya(){
//S'executa al clicar una pestanya,
//aquella es fa visible i les altres s'oculten
var vMcNom = this.id.substr(0,3); //A partir del nom del botó, deduïm el nom de la caixa
var vIndex = this.id.substr(5,1); //I l'index
var i=1
for (i=1;i<=9;i++){ //busquem totes les pestanyes d'aquella caixa
//alert(vMcNom+"ps"+i);
var vPsElem = document.getElementById(vMcNom+"ps"+i);
if (!vPsElem) break;
if (vIndex==i){ //Si és la pestanya bona la mostrem i canviem la classe de botó
vPsElem.style.display = "block";
vPsElem.style.visibility = "visible";
document.getElementById(vMcNom+"bt"+i).className="mcBotoSel";
} else { //Sinó, l'ocultem i canviem la classe de botó
vPsElem.style.display = "none";
vPsElem.style.visibility = "hidden";
document.getElementById(vMcNom+"bt"+i).className="mcBoto";
}
}
return false; //evitem la recàrrega de la pàgina
}
$(MetaCaixaInit);
/*HERE FINISHES THE WORKING-CODE OF "METABOXES"*/
/** WikiMiniAtlas *******************************************************
*
* Description: WikiMiniAtlas is a popup click and drag world map.
* This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
* The script itself is located on meta because it is used by many projects.
* See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400');
/** 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.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 );
/*Script for Image Annotation follows */
//mw.loader.load('MediaWiki:Gadget-ImageAnnotator.js');
/*Script to get the file count for Malayalam loves Wikimedia - 3 event
mw.loader.load('User:Manojk/MLW3-Update.js');
വിക്കിപീഡിയ:ഓണം വിക്കിമീഡിയയെ സ്നേഹിക്കുന്നു
mw.loader.load('ഉപയോക്താവ്:Sreejithk2000/OnamLove1-Update.js');
*/