മീഡിയവിക്കി:Common.js (മൂലരൂപം കാണുക)
22:16, 25 ഒക്ടോബർ 2009-നു നിലവിലുണ്ടായിരുന്ന രൂപം
, 25 ഒക്ടോബർ 2009തിരുത്തലിനു സംഗ്രഹമില്ല
No edit summary |
No edit summary |
||
| വരി 1: | വരി 1: | ||
/** | /** | ||
* Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche, | * Modifie Special:Search pour pouvoir utiliser différents moteurs de recherche, | ||
| വരി 20: | വരി 5: | ||
* <pre><nowiki> | * <pre><nowiki> | ||
*/ | */ | ||
function externalSearchEngines() { | function externalSearchEngines() { | ||
if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return; | if (typeof SpecialSearchEnhanced2Disabled != 'undefined') return; | ||
var mainNode = document.getElementById("powersearch"); | var mainNode = document.getElementById("powersearch"); | ||
if (!mainNode) mainNode = document.getElementById("search"); | if (!mainNode) mainNode = document.getElementById("search"); | ||
if (!mainNode) return; | if (!mainNode) return; | ||
var beforeNode = document.getElementById("mw-search-top-table"); | var beforeNode = document.getElementById("mw-search-top-table"); | ||
if (!beforeNode) return; | if (!beforeNode) return; | ||
| വരി 45: | വരി 30: | ||
var space = ""; | var space = ""; | ||
for (var id in searchEngines) { | for (var id in searchEngines) { | ||
var engine = searchEngines[id]; | var engine = searchEngines[id]; | ||
| വരി 75: | വരി 60: | ||
label = document.createElement("label"); | label = document.createElement("label"); | ||
} | } | ||
label.appendChild( document.createTextNode( engine.ShortName ) ); | label.appendChild( document.createTextNode( engine.ShortName ) ); | ||
choices.appendChild( label ); | choices.appendChild( label ); | ||
| വരി 87: | വരി 72: | ||
mainNode.insertBefore(input, beforeNode); | mainNode.insertBefore(input, beforeNode); | ||
changeSearchEngine(firstEngine, initValue); | changeSearchEngine(firstEngine, initValue); | ||
} | } | ||
function changeSearchEngine(selectedId, searchTerms) { | function changeSearchEngine(selectedId, searchTerms) { | ||
var currentId = document.getElementById("searchengineChoices").currentChoice; | var currentId = document.getElementById("searchengineChoices").currentChoice; | ||
if (selectedId == currentId) return; | if (selectedId == currentId) return; | ||
| വരി 131: | വരി 116: | ||
} | } | ||
} | } | ||
if (wgCanonicalSpecialPageName == "Search") { | if (wgCanonicalSpecialPageName == "Search") { | ||
var searchEngines = { | var searchEngines = { | ||
| വരി 165: | വരി 150: | ||
addOnloadHook(externalSearchEngines); | addOnloadHook(externalSearchEngines); | ||
} | } | ||
/**തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാന്************** | /**തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാന്************** | ||
* തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാനായി ഈ സ്ക്രിപ്റ്റ് ഉപയോഗിയ്ക്കാം മറ്റു ഭാഷകളില് എന്നു | * തിരഞ്ഞെടുത്ത ലേഖനങ്ങളിലേയ്ക്ക് ഇന്റര് വിക്കി ലിങ്കുകള് നല്കാനായി ഈ സ്ക്രിപ്റ്റ് ഉപയോഗിയ്ക്കാം മറ്റു ഭാഷകളില് എന്നു | ||
| വരി 185: | വരി 170: | ||
addOnloadHook( LinkFA ); | addOnloadHook( LinkFA ); | ||
/** Main Page layout fixes ********************************************************* | /** Main Page layout fixes ********************************************************* | ||
* | * | ||
| വരി 193: | വരി 178: | ||
* Maintainers: User:AzaToth, User:R. Koot | * Maintainers: User:AzaToth, User:R. Koot | ||
*/ | */ | ||
function mainPageRenameNamespaceTab() { | function mainPageRenameNamespaceTab() { | ||
try { | try { | ||
| വരി 208: | വരി 193: | ||
} | } | ||
} | } | ||
function mainPageAppendCompleteListLink() { | function mainPageAppendCompleteListLink() { | ||
try { | try { | ||
| വരി 214: | വരി 199: | ||
.getElementsByTagName('div')[0] | .getElementsByTagName('div')[0] | ||
.getElementsByTagName('ul')[0]; | .getElementsByTagName('ul')[0]; | ||
var aNode = document.createElement( 'a' ); | var aNode = document.createElement( 'a' ); | ||
var liNode = document.createElement( 'li' ); | var liNode = document.createElement( 'li' ); | ||
aNode.appendChild( document.createTextNode( 'Complete list' ) ); | aNode.appendChild( document.createTextNode( 'Complete list' ) ); | ||
aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/List_of_Wikipedias ' ); | aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/List_of_Wikipedias ' ); | ||
| വരി 228: | വരി 213: | ||
} | } | ||
} | } | ||
if ( wgTitle == 'പ്രധാന താള്' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) { | if ( wgTitle == 'പ്രധാന താള്' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) { | ||
addOnloadHook( mainPageRenameNamespaceTab ); | addOnloadHook( mainPageRenameNamespaceTab ); | ||
} | } | ||
if ( wgTitle == 'പ്രധാന താള്' && wgNamespaceNumber == 0 ) { | if ( wgTitle == 'പ്രധാന താള്' && wgNamespaceNumber == 0 ) { | ||
addOnloadHook( mainPageAppendCompleteListLink ); | addOnloadHook( mainPageAppendCompleteListLink ); | ||
} | } | ||
/**<pre><nowiki>*/ | /**<pre><nowiki>*/ | ||
/** Extra toolbar options ****************************************************** | /** Extra toolbar options ****************************************************** | ||
| വരി 318: | വരി 303: | ||
"tagClose": "\n|}", | "tagClose": "\n|}", | ||
"sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"}; | "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"}; | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
"imageFile": "http://upload.wikimedia.org/wikipedia/ml/2/20/Button_subst.png", | "imageFile": "http://upload.wikimedia.org/wikipedia/ml/2/20/Button_subst.png", | ||
| വരി 325: | വരി 310: | ||
"tagClose": "}}", | "tagClose": "}}", | ||
"sampleText": "സ്വാഗതം"}; | "sampleText": "സ്വാഗതം"}; | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png", | "imageFile": "http://upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png", | ||
| വരി 332: | വരി 317: | ||
"tagClose": "\n</ref>", | "tagClose": "\n</ref>", | ||
"sampleText": "References"}; | "sampleText": "References"}; | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png", | "imageFile": "http://upload.wikimedia.org/wikipedia/commons/e/ef/Button_cite_book.png", | ||
| വരി 339: | വരി 324: | ||
"tagClose": "\n| last= \n| first= \n| authorlink= \n| coauthors= \n| editor= \n| others= \n| title= \n| origdate= \n| origyear= \n| origmonth= \n| url= \n| format= \n| accessdate= \n| accessyear= \n| accessmonth= \n| edition= \n| series= \n| date= \n| year= \n| month= \n| publisher= \n| location= \n| language= \n| isbn= \n| oclc= \n| doi= \n| id= \n| pages= \n| chapter= \n| chapterurl= \n| quote= \n}}", | "tagClose": "\n| last= \n| first= \n| authorlink= \n| coauthors= \n| editor= \n| others= \n| title= \n| origdate= \n| origyear= \n| origmonth= \n| url= \n| format= \n| accessdate= \n| accessyear= \n| accessmonth= \n| edition= \n| series= \n| date= \n| year= \n| month= \n| publisher= \n| location= \n| language= \n| isbn= \n| oclc= \n| doi= \n| id= \n| pages= \n| chapter= \n| chapterurl= \n| quote= \n}}", | ||
"sampleText": ""}; | "sampleText": ""}; | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/2c/Button_cite_news.png", | "imageFile": "http://upload.wikimedia.org/wikipedia/commons/2/2c/Button_cite_news.png", | ||
| വരി 346: | വരി 331: | ||
"tagClose": "\n| first = \n| last = \n| authorlink = \n| author = \n| coauthors = \n| title = \n| url = \n| format = \n| work = \n| publisher = \n| pages = \n| page = \n| date = \n| accessdate = \n| language = \n}}", | "tagClose": "\n| first = \n| last = \n| authorlink = \n| author = \n| coauthors = \n| title = \n| url = \n| format = \n| work = \n| publisher = \n| pages = \n| page = \n| date = \n| accessdate = \n| language = \n}}", | ||
"sampleText": ""}; | "sampleText": ""}; | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
"imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png", | "imageFile": "http://upload.wikimedia.org/wikipedia/commons/9/91/Button_cite_web.png", | ||
"speedTip": "വെബ്ബ്സ്രോതസ്സ്", | "speedTip": "വെബ്ബ്സ്രോതസ്സ്", | ||
"tagOpen": "{{cite | "tagOpen": "{{cite web ", | ||
"tagClose": "\n| url = \n| title = \n| accessdate = \n| accessmonthday = \n| accessyear = \n| author = \n| last = \n| first = \n| authorlink = \n| coauthors = \n| date = \n| year = \n| month = \n| format = \n| work = \n| publisher = \n| pages = \n| language = \n| archiveurl = \n| archivedate = \n| quote = \n}}", | "tagClose": "\n| url = \n| title = \n| accessdate = \n| accessmonthday = \n| accessyear = \n| author = \n| last = \n| first = \n| authorlink = \n| coauthors = \n| date = \n| year = \n| month = \n| format = \n| work = \n| publisher = \n| pages = \n| language = \n| archiveurl = \n| archivedate = \n| quote = \n}}", | ||
"sampleText": ""}; | "sampleText": ""}; | ||
} | } | ||
/*</nowiki></pre>*/ | /*</nowiki></pre>*/ | ||
/*<pre><nowiki> | /*<pre><nowiki> | ||
ടൂള് ബാര് ബട്ടണുകള് അടുക്കിപ്പെറുക്കി വയ്ക്കാനുള്ള സ്ക്രിപ്റ്റ് | ടൂള് ബാര് ബട്ടണുകള് അടുക്കിപ്പെറുക്കി വയ്ക്കാനുള്ള സ്ക്രിപ്റ്റ് | ||
| വരി 365: | വരി 350: | ||
if(mwEditButtons) | if(mwEditButtons) | ||
def=mwEditButtons; | def=mwEditButtons; | ||
if(mwCustomEditButtons) | if(mwCustomEditButtons) | ||
ext=mwCustomEditButtons; | ext=mwCustomEditButtons; | ||
if(def!=null && ext!=null) | if(def!=null && ext!=null) | ||
{ | { | ||
| വരി 403: | വരി 388: | ||
"sampleText": "ഉള്ളടക്കം"}; | "sampleText": "ഉള്ളടക്കം"}; | ||
ext[0]=defc[2]; | ext[0]=defc[2]; | ||
ext[1]=defc[3]; | ext[1]=defc[3]; | ||
| വരി 422: | വരി 407: | ||
} | } | ||
} | } | ||
} | } | ||
addOnloadHook(lija_rearrange); | addOnloadHook(lija_rearrange); | ||
//**************************************************************************************************************** | //**************************************************************************************************************** | ||
| വരി 431: | വരി 416: | ||
//**************************************************************************************************************** | //**************************************************************************************************************** | ||
/*</nowiki></pre>*/ | /*</nowiki></pre>*/ | ||
/* | /* | ||
<nowiki><pre> | <nowiki><pre> | ||
This script is a modified version of Alex benenson's cyrillic translitarator and this version was created by [[User:Peringz|Peringz]] | This script is a modified version of Alex benenson's cyrillic translitarator and this version was created by [[User:Peringz|Peringz]] | ||
*/ | */ | ||
var consonants = {"ക":"ക","ഖ":"ഖ","ഗ":"ഗ","ഘ":"ഘ","ങ":"ങ","ച":"ച","ഛ":"ഛ","ജ":"ജ","ഝ":"ഝ","ഞ":"ഞ","ട":"ട","ഠ":"ഠ","ഡ":"ഡ","ഢ":"ഢ","ണ":"ണ","ത":"ത","ഥ":"ഥ","ദ":"ദ","ധ":"ധ","ന":"ന","പ":"പ","ഫ":"ഫ","ബ":"ബ","ഭ":"ഭ","മ":"മ","യ":"യ","ര":"ര","ല":"ല","വ":"വ","ശ":"ശ","ഷ":"ഷ","സ":"സ","ഹ":"ഹ","ള":"ള","ഴ":"ഴ","റ":"റ","റ്റ":"റ്റ"}; | var consonants = {"ക":"ക","ഖ":"ഖ","ഗ":"ഗ","ഘ":"ഘ","ങ":"ങ","ച":"ച","ഛ":"ഛ","ജ":"ജ","ഝ":"ഝ","ഞ":"ഞ","ട":"ട","ഠ":"ഠ","ഡ":"ഡ","ഢ":"ഢ","ണ":"ണ","ത":"ത","ഥ":"ഥ","ദ":"ദ","ധ":"ധ","ന":"ന","പ":"പ","ഫ":"ഫ","ബ":"ബ","ഭ":"ഭ","മ":"മ","യ":"യ","ര":"ര","ല":"ല","വ":"വ","ശ":"ശ","ഷ":"ഷ","സ":"സ","ഹ":"ഹ","ള":"ള","ഴ":"ഴ","റ":"റ","റ്റ":"റ്റ"}; | ||
var chillaksharam = {"ണ്":"ണ","ന്":"ന","ം":"മ","ര്":"ര","ല്":"ല","ള്":"ള","്\\u200D":""}; | var chillaksharam = {"ണ്":"ണ","ന്":"ന","ം":"മ","ര്":"ര","ല്":"ല","ള്":"ള","്\\u200D":""}; | ||
var vowels = '"്a":"","്e":"െ","്i":"ി","്o":"ൊ","്u":"ു","്A":"ാ","്E":"േ","്I":"ീ","്O":"ോ","്U":"ൂ","്Y":"ൈ","െe":"ീ","ൊo":"ൂ","ിi":"ീ","ിe":"ീ","ുu":"ൂ","ുo":"ൂ","്r":"്ര്",'; | var vowels = '"്a":"","്e":"െ","്i":"ി","്o":"ൊ","്u":"ു","്A":"ാ","്E":"േ","്I":"ീ","്O":"ോ","്U":"ൂ","്Y":"ൈ","െe":"ീ","ൊo":"ൂ","ിi":"ീ","ിe":"ീ","ുu":"ൂ","ുo":"ൂ","്r":"്ര്",'; | ||
var roman = '"k":"ക്","ക്h":"ഖ്","g":"ഗ്","ഗ്h":"ഘ്","ന്g":"ങ്","c":"ക്\\u200D","ക്\\u200Dh":"ച്","ച്h":"ഛ്","j":"ജ്","ജ്h":"ഝ്","ന്j":"ഞ്","ന്h":"ഞ്","T":"ട്","ട്h":"ഠ്","D":"ഡ്","ഡ്h":"ഢ്","റ്റ്h":"ത്","ത്h":"ഥ്","d":"ദ്","ദ്h":"ധ്","p":"പ്","പ്h":"ഫ്","f":"ഫ്","b":"ബ്","ബ്h":"ഭ്","y":"യ്","v":"വ്","w":"വ്","z":"ശ്","S":"ശ്","സ്h":"ഷ്","s":"സ്","h":"ഹ്","ശ്h":"ഴ്","x":"ക്ഷ്","R":"റ്","t":"റ്റ്",'; | var roman = '"k":"ക്","ക്h":"ഖ്","g":"ഗ്","ഗ്h":"ഘ്","ന്g":"ങ്","c":"ക്\\u200D","ക്\\u200Dh":"ച്","ച്h":"ഛ്","j":"ജ്","ജ്h":"ഝ്","ന്j":"ഞ്","ന്h":"ഞ്","T":"ട്","ട്h":"ഠ്","D":"ഡ്","ഡ്h":"ഢ്","റ്റ്h":"ത്","ത്h":"ഥ്","d":"ദ്","ദ്h":"ധ്","p":"പ്","പ്h":"ഫ്","f":"ഫ്","b":"ബ്","ബ്h":"ഭ്","y":"യ്","v":"വ്","w":"വ്","z":"ശ്","S":"ശ്","സ്h":"ഷ്","s":"സ്","h":"ഹ്","ശ്h":"ഴ്","x":"ക്ഷ്","R":"റ്","t":"റ്റ്",'; | ||
| വരി 451: | വരി 436: | ||
var caps = '"B":"ബ്ബ്","C":"ക്ക്\\u200D","F":"ഫ്","G":"ഗ്ഗ്","J":"ജ്ജ്","K":"ക്ക്","M":"മ്മ്","P":"പ്പ്","Q":"ക്യൂ","V":"വ്വ്","W":"വ്വ്","X":"ക്ഷ്","Y":"യ്യ്","Z":"ശ്ശ്",'; | var caps = '"B":"ബ്ബ്","C":"ക്ക്\\u200D","F":"ഫ്","G":"ഗ്ഗ്","J":"ജ്ജ്","K":"ക്ക്","M":"മ്മ്","P":"പ്പ്","Q":"ക്യൂ","V":"വ്വ്","W":"വ്വ്","X":"ക്ഷ്","Y":"യ്യ്","Z":"ശ്ശ്",'; | ||
var ZWNJ = '"_":"\\u200C"'; | var ZWNJ = '"_":"\\u200C"'; | ||
// for compatibility with bookmarklets | // for compatibility with bookmarklets | ||
function cyr_translit(src) { | function cyr_translit(src) { | ||
return to_cyrillic(src); | return to_cyrillic(src); | ||
} | } | ||
var conversionHash = undefined; | var conversionHash = undefined; | ||
var maxcyrlength = 0; | var maxcyrlength = 0; | ||
function getConversionHash() { | function getConversionHash() { | ||
if (conversionHash == undefined) { | if (conversionHash == undefined) { | ||
| വരി 471: | വരി 456: | ||
opr += '"' + consonant + 'u":"' + consonant + 'ൗ",'; | opr += '"' + consonant + 'u":"' + consonant + 'ൗ",'; | ||
} | } | ||
for (var chk in chillaksharam) { | for (var chk in chillaksharam) { | ||
opr += '"' + chk + 'a":"' + chillaksharam[chk] + '",'; | opr += '"' + chk + 'a":"' + chillaksharam[chk] + '",'; | ||
| വരി 490: | വരി 475: | ||
opr += '"' + chk + '~":"' + chillaksharam[chk] + '്\\u200C",'; | opr += '"' + chk + '~":"' + chillaksharam[chk] + '്\\u200C",'; | ||
} | } | ||
opr += ZWNJ + "}"; | opr += ZWNJ + "}"; | ||
// var tb = document.getElementById('wpTextbox1'); | // var tb = document.getElementById('wpTextbox1'); | ||
| വരി 497: | വരി 482: | ||
maxcyrlength=6; | maxcyrlength=6; | ||
} | } | ||
return conversionHash; | return conversionHash; | ||
} | } | ||
function to_cyrillic(src, output, chunks) { | function to_cyrillic(src, output, chunks) { | ||
if (src == undefined || src == "" || src == null) | if (src == undefined || src == "" || src == null) | ||
| വരി 506: | വരി 491: | ||
if (output == undefined) | if (output == undefined) | ||
output = new String(); | output = new String(); | ||
var hash = getConversionHash(); | var hash = getConversionHash(); | ||
var location = 0; | var location = 0; | ||
while (location < src.length) { | while (location < src.length) { | ||
var len = Math.min(maxcyrlength, src.length - location); | var len = Math.min(maxcyrlength, src.length - location); | ||
| വരി 523: | വരി 508: | ||
len--; | len--; | ||
} | } | ||
// need this for translit on the fly | // need this for translit on the fly | ||
if (chunks != undefined) | if (chunks != undefined) | ||
chunks[chunks.length] = sub; | chunks[chunks.length] = sub; | ||
if (arr == undefined) { | if (arr == undefined) { | ||
output += sub; | output += sub; | ||
| വരി 533: | വരി 518: | ||
} | } | ||
else { | else { | ||
// case analysis | // case analysis | ||
var newChar = arr; | var newChar = arr; | ||
if (sub.toLowerCase() == sub.toUpperCase() && arr.length > 1 && arr[1] && (newChar.toUpperCase() != newChar.toLowerCase())) { | if (sub.toLowerCase() == sub.toUpperCase() && arr.length > 1 && arr[1] && (newChar.toUpperCase() != newChar.toLowerCase())) { | ||
// need translit hash to determine if previous character (and possibly the one before it) | // need translit hash to determine if previous character (and possibly the one before it) | ||
// were converted and are in upper case | // were converted and are in upper case | ||
// set prevDud to true previous is not a translated character or simply a blank | // set prevDud to true previous is not a translated character or simply a blank | ||
// set prevCap to true if previous was translated and was upper case | // set prevCap to true if previous was translated and was upper case | ||
var prevCh = output.length == 0 ? null : output.substr(output.length - 1, 1); | var prevCh = output.length == 0 ? null : output.substr(output.length - 1, 1); | ||
var prevDud = !prevCh || !getTranslitString(prevCh); | var prevDud = !prevCh || !getTranslitString(prevCh); | ||
var prevCap = (!prevDud && prevCh == prevCh.toUpperCase()); | var prevCap = (!prevDud && prevCh == prevCh.toUpperCase()); | ||
// sub is caseless but result isn't. case will depend on lookbehind and lookahead | // sub is caseless but result isn't. case will depend on lookbehind and lookahead | ||
if (prevDud || !prevCap) { | if (prevDud || !prevCap) { | ||
| വരി 558: | വരി 543: | ||
if (location + len < src.length) | if (location + len < src.length) | ||
next = src.substr(location + len, 1); | next = src.substr(location + len, 1); | ||
if (next != next.toUpperCase() && next == next.toLowerCase() ) { | if (next != next.toUpperCase() && next == next.toLowerCase() ) { | ||
//next is lowercase (and not caseless) | //next is lowercase (and not caseless) | ||
| വരി 578: | വരി 563: | ||
output += newChar.toLowerCase(); | output += newChar.toLowerCase(); | ||
} | } | ||
} | } | ||
} | } | ||
} | } | ||
else if ((sub.toLowerCase() == sub.toUpperCase()) && (arr.length < 2 || !arr[1])) { | else if ((sub.toLowerCase() == sub.toUpperCase()) && (arr.length < 2 || !arr[1])) { | ||
// literal treatment of newChar | // literal treatment of newChar | ||
output += newChar; | output += newChar; | ||
} | } | ||
else if (sub != sub.toLowerCase()) { | else if (sub != sub.toLowerCase()) { | ||
// sub not all-lowercase | // sub not all-lowercase | ||
output += newChar.toUpperCase(); | output += newChar.toUpperCase(); | ||
} | } | ||
else { | else { | ||
// sub is lowercase | // sub is lowercase | ||
output += newChar.toLowerCase(); | output += newChar.toLowerCase(); | ||
| വരി 604: | വരി 589: | ||
} | } | ||
} | } | ||
return output; | return output; | ||
} | } | ||
function convertIt(src,converter){ | function convertIt(src,converter){ | ||
var resultbuffer=""; | var resultbuffer=""; | ||
| വരി 616: | വരി 601: | ||
} | } | ||
return converter(resultbuffer); | return converter(resultbuffer); | ||
} | } | ||
var translitHash = undefined; | var translitHash = undefined; | ||
function initTranslit() { | function initTranslit() { | ||
if (translitHash == undefined) { | if (translitHash == undefined) { | ||
translitHash = new Array(); | translitHash = new Array(); | ||
for (var i = 0; i < conversionHash.length; i++) { | for (var i = 0; i < conversionHash.length; i++) { | ||
var ch = conversionHash[i][1]; | var ch = conversionHash[i][1]; | ||
| വരി 633: | വരി 618: | ||
if (conversionHash[i][0].toUpperCase() != conversionHash[i][0].toLowerCase()) | if (conversionHash[i][0].toUpperCase() != conversionHash[i][0].toLowerCase()) | ||
ch = ch.toUpperCase(); | ch = ch.toUpperCase(); | ||
if (translitHash[ch] == undefined) | if (translitHash[ch] == undefined) | ||
translitHash[ch] = conversionHash[i][0]; | translitHash[ch] = conversionHash[i][0]; | ||
| വരി 639: | വരി 624: | ||
} | } | ||
} | } | ||
//-- translit on-the-fly -- | //-- translit on-the-fly -- | ||
function replaceValue(node, value, stepback) { | function replaceValue(node, value, stepback) { | ||
if (stepback == undefined) | if (stepback == undefined) | ||
stepback = 0; | stepback = 0; | ||
if (isExplorer()) { | if (isExplorer()) { | ||
var range = document.selection.createRange(); | var range = document.selection.createRange(); | ||
| വരി 666: | വരി 651: | ||
} | } | ||
} | } | ||
// compare positions | // compare positions | ||
function positionIsEqual(other) { | function positionIsEqual(other) { | ||
| വരി 674: | വരി 659: | ||
else | else | ||
return this.position == other.position; | return this.position == other.position; | ||
} | } | ||
function Position(node) { | function Position(node) { | ||
if (node.selectionStart != undefined) | if (node.selectionStart != undefined) | ||
| വരി 682: | വരി 667: | ||
else if (document.selection && document.selection.createRange()) | else if (document.selection && document.selection.createRange()) | ||
this.position = document.selection.createRange(); | this.position = document.selection.createRange(); | ||
this.isEqual = positionIsEqual; | this.isEqual = positionIsEqual; | ||
} | } | ||
function resetState() { | function resetState() { | ||
this.position = new Position(this.node); | this.position = new Position(this.node); | ||
| വരി 691: | വരി 676: | ||
this.cyrBuffer = ""; | this.cyrBuffer = ""; | ||
} | } | ||
function StateObject(node) { | function StateObject(node) { | ||
this.node = node; | this.node = node; | ||
| വരി 699: | വരി 684: | ||
this.position = new Position(node); | this.position = new Position(node); | ||
} | } | ||
var stateHash = new Array(); | var stateHash = new Array(); | ||
function isExplorer() { | function isExplorer() { | ||
return (document.selection != undefined && document.selection.createRange().isEqual != undefined); | return (document.selection != undefined && document.selection.createRange().isEqual != undefined); | ||
} | } | ||
function pressedKey(event) { | function pressedKey(event) { | ||
if (isExplorer()) | if (isExplorer()) | ||
| വരി 713: | വരി 698: | ||
return event.which; | return event.which; | ||
} | } | ||
function transliterateKey(event) { | function transliterateKey(event) { | ||
/* | /* | ||
| വരി 720: | വരി 705: | ||
} | } | ||
*/ | */ | ||
if (event == undefined) | if (event == undefined) | ||
event = window.event; | event = window.event; | ||
var node = null; | var node = null; | ||
if (event.target) { | if (event.target) { | ||
| വരി 731: | വരി 716: | ||
node = event.srcElement; | node = event.srcElement; | ||
} | } | ||
// initialize state | // initialize state | ||
var state = stateHash[node]; | var state = stateHash[node]; | ||
| വരി 740: | വരി 725: | ||
} | } | ||
if ( (pressedKey(event) > 20) && !event.ctrlKey && !event.altKey && !event.metaKey) { | if ( (pressedKey(event) > 20) && !event.ctrlKey && !event.altKey && !event.metaKey) { | ||
var c = String.fromCharCode(pressedKey(event)); | var c = String.fromCharCode(pressedKey(event)); | ||
// process input | // process input | ||
var result = process_translit(state, c); | var result = process_translit(state, c); | ||
| വരി 751: | വരി 736: | ||
else | else | ||
event.preventDefault(); | event.preventDefault(); | ||
replaceValue(node, result.out, result.replace); | replaceValue(node, result.out, result.replace); | ||
state.position = new Position(node); | state.position = new Position(node); | ||
} | } | ||
} | } | ||
} | } | ||
function TranslitResult() { | function TranslitResult() { | ||
this.out = ""; | this.out = ""; | ||
this.replace = 0; | this.replace = 0; | ||
} | } | ||
function process_translit(state, c) { | function process_translit(state, c) { | ||
// reset state if position changed | // reset state if position changed | ||
if (!state.position.isEqual(new Position(state.node))) | if (!state.position.isEqual(new Position(state.node))) | ||
state.reset(); | state.reset(); | ||
var result = new TranslitResult(); | var result = new TranslitResult(); | ||
// initial backbuffer. Add to it as characters are converted | // initial backbuffer. Add to it as characters are converted | ||
var backbuffer = getBackBuffer(state.node, state.cyrBuffer.length, 2); | var backbuffer = getBackBuffer(state.node, state.cyrBuffer.length, 2); | ||
var chunks = new Array(); | var chunks = new Array(); | ||
state.transBuffer = state.transBuffer+ c | state.transBuffer = state.transBuffer+ c | ||
var str = to_cyrillic(state.cyrBuffer+c, backbuffer, chunks); | var str = to_cyrillic(state.cyrBuffer+c, backbuffer, chunks); | ||
// remove backbuffer from output | // remove backbuffer from output | ||
str = str.substr(backbuffer.length); | str = str.substr(backbuffer.length); | ||
| വരി 787: | വരി 772: | ||
will be used to reinitialize backbuffers, along with chunks and state.transBuffer | will be used to reinitialize backbuffers, along with chunks and state.transBuffer | ||
*/ | */ | ||
// get the difference between state.cyrBuffer and output | // get the difference between state.cyrBuffer and output | ||
for (var i = 0; i < Math.min(state.cyrBuffer.length, result.out.length); i++) { | for (var i = 0; i < Math.min(state.cyrBuffer.length, result.out.length); i++) { | ||
| വരി 800: | വരി 785: | ||
result.replace=state.cyrBuffer.length- result.out.length; | result.replace=state.cyrBuffer.length- result.out.length; | ||
result.out = result.out.substr(Math.min(state.cyrBuffer.length, result.out.length)); | result.out = result.out.substr(Math.min(state.cyrBuffer.length, result.out.length)); | ||
// result.out+="\u0008" | // result.out+="\u0008" | ||
} | } | ||
// update state: backbuffer, bufferArray | // update state: backbuffer, bufferArray | ||
if (chunks.length > 0 && chunks[chunks.length - 1] == result.out.substr(result.out.length - 1)) { | if (chunks.length > 0 && chunks[chunks.length - 1] == result.out.substr(result.out.length - 1)) { | ||
| വരി 820: | വരി 805: | ||
return result; | return result; | ||
} | } | ||
function getBackBuffer(node, offset, count) { | function getBackBuffer(node, offset, count) { | ||
if (isExplorer()) { //.tagName.toUpperCase() == "EDITOR") { | if (isExplorer()) { //.tagName.toUpperCase() == "EDITOR") { | ||
var range = document.selection.createRange(); | var range = document.selection.createRange(); | ||
range.moveStart("character", -offset); | range.moveStart("character", -offset); | ||
| വരി 830: | വരി 815: | ||
if (!result) | if (!result) | ||
result = ""; | result = ""; | ||
return result; | return result; | ||
} else { | } else { | ||
return node.value.substring(0, node.selectionStart - offset).substr(-count); | return node.value.substring(0, node.selectionStart - offset).substr(-count); | ||
} | } | ||
} | } | ||
// need this for bookmarklets | // need this for bookmarklets | ||
function getSelectedNode() { | function getSelectedNode() { | ||
| വരി 850: | വരി 835: | ||
return null; | return null; | ||
} | } | ||
function toggleCyrMode() { | function toggleCyrMode() { | ||
var node = getSelectedNode(); | var node = getSelectedNode(); | ||
| വരി 864: | വരി 849: | ||
} | } | ||
} | } | ||
function addKeyEventListener(node) { | function addKeyEventListener(node) { | ||
if (node.addEventListener) | if (node.addEventListener) | ||
| വരി 881: | വരി 866: | ||
return true; | return true; | ||
} | } | ||
function getSelectedText() { | function getSelectedText() { | ||
if (isExplorer()) { | if (isExplorer()) { | ||
| വരി 893: | വരി 878: | ||
return ""; | return ""; | ||
} | } | ||
/* calling functions */ | /* calling functions */ | ||
function addLoadEvent(func) { | function addLoadEvent(func) { | ||
if (window.addEventListener) | if (window.addEventListener) | ||
window.addEventListener("load", func, false); | window.addEventListener("load", func, false); | ||
| വരി 904: | വരി 889: | ||
window.attachEvent("onload", func); | window.attachEvent("onload", func); | ||
} | } | ||
function addTranslit(editForm,textBox) { | function addTranslit(editForm,textBox) { | ||
checkrt(editForm); // check for translit support | checkrt(editForm); // check for translit support | ||
if (textBox.addEventListener) | if (textBox.addEventListener) | ||
textBox.addEventListener("keypress", processKeys, false); | textBox.addEventListener("keypress", processKeys, false); | ||
| വരി 913: | വരി 898: | ||
textBox.attachEvent("onkeypress", processKeys); | textBox.attachEvent("onkeypress", processKeys); | ||
} | } | ||
function addTextEvent() { | function addTextEvent() { | ||
/////// | /////// | ||
if(lija_getCookie('mlWikiTranslit')!=null && lija_getCookie('mlWikiTranslit')!="") | if(lija_getCookie('mlWikiTranslit')!=null && lija_getCookie('mlWikiTranslit')!="") | ||
realTime=(lija_getCookie('mlWikiTranslit')=="true")?true:false; | realTime=(lija_getCookie('mlWikiTranslit')=="true")?true:false; | ||
////// | ////// | ||
var editForm =document.getElementById('editform'); | var editForm =document.getElementById('editform'); | ||
if(editForm != null) { | if(editForm != null) { | ||
| വരി 929: | വരി 914: | ||
if(textSummary) { addTranslit(editForm,textSummary); } | if(textSummary) { addTranslit(editForm,textSummary); } | ||
} | } | ||
// add transliteration feature to search form also | // add transliteration feature to search form also | ||
var searchForm = document.getElementById('searchform'); | var searchForm = document.getElementById('searchform'); | ||
| വരി 944: | വരി 929: | ||
else if (element.attachEvent) | else if (element.attachEvent) | ||
element.attachEvent("onclick", rtClick); | element.attachEvent("onclick", rtClick); | ||
// var labelcheckBox = document.createTextNode('മലയാളത്തിലെഴുതുക'); | // var labelcheckBox = document.createTextNode('മലയാളത്തിലെഴുതുക'); | ||
var chkSpan = document.createElement("span"); | var chkSpan = document.createElement("span"); | ||
| വരി 951: | വരി 936: | ||
searchBody.appendChild(element); | searchBody.appendChild(element); | ||
searchBody.appendChild(chkSpan); | searchBody.appendChild(chkSpan); | ||
// searchForm.insertBefore(element,searchBox); | // searchForm.insertBefore(element,searchBox); | ||
document.getElementById("sbrealtime").checked = realTime; | document.getElementById("sbrealtime").checked = realTime; | ||
| വരി 965: | വരി 950: | ||
//എററിനെ ഓടിക്കുക. | //എററിനെ ഓടിക്കുക. | ||
} | } | ||
if(searchBox) { addTranslit(searchForm,searchBox); } | if(searchBox) { addTranslit(searchForm,searchBox); } | ||
} | } | ||
//മലയാളം ടൈപ്പിങ് താളുകളിൽ സാധ്യമാക്കാനുള്ള സ്ക്രിപ്റ്റുകൾ | scripts to avail Malayalam transliteration | //മലയാളം ടൈപ്പിങ് താളുകളിൽ സാധ്യമാക്കാനുള്ള സ്ക്രിപ്റ്റുകൾ | scripts to avail Malayalam transliteration | ||
//തിരയല് താള് | Search page | //തിരയല് താള് | Search page | ||
var simpleSearchForm = document.getElementById('search'); | var simpleSearchForm = document.getElementById('search'); | ||
if( simpleSearchForm != null) { | if( simpleSearchForm != null) { | ||
| വരി 977: | വരി 962: | ||
if( simpleSearchBox ) { addTranslit(simpleSearchForm, simpleSearchBox );} | if( simpleSearchBox ) { addTranslit(simpleSearchForm, simpleSearchBox );} | ||
} | } | ||
var powerSearchForm = document.getElementById('powersearch'); | var powerSearchForm = document.getElementById('powersearch'); | ||
if( powerSearchForm != null) { | if( powerSearchForm != null) { | ||
| വരി 983: | വരി 968: | ||
if( powerSearchBox ) { addTranslit(powerSearchForm, powerSearchBox );} | if( powerSearchBox ) { addTranslit(powerSearchForm, powerSearchBox );} | ||
} | } | ||
// തലക്കെട്ട് മാറ്റല് താള്. | Move page | // തലക്കെട്ട് മാറ്റല് താള്. | Move page | ||
var movePageForm = document.getElementById('movepage'); | var movePageForm = document.getElementById('movepage'); | ||
if( movePageForm != null ) { | if( movePageForm != null ) { | ||
| വരി 992: | വരി 977: | ||
var reasonBox = document.getElementById('wpReason'); | var reasonBox = document.getElementById('wpReason'); | ||
if( reasonBox ) {addTranslit(movePageForm, reasonBox ); } | if( reasonBox ) {addTranslit(movePageForm, reasonBox ); } | ||
} | } | ||
//വിക്കിപീഡിയ:കളരി | //വിക്കിപീഡിയ:കളരി | ||
var kalariForm = document.getElementById('createbox'); | var kalariForm = document.getElementById('createbox'); | ||
if( kalariForm != null ) { | if( kalariForm != null ) { | ||
var kalariText = document.getElementsByName('title')[0]; | var kalariText = document.getElementsByName('title')[0]; | ||
if( kalariText ) {addTranslit(kalariForm, kalariText);} | if( kalariText ) {addTranslit(kalariForm, kalariText);} | ||
} | } | ||
//അപ്ലോഡ് താള് | //അപ്ലോഡ് താള് | ||
//******************** | //******************** | ||
| വരി 1,015: | വരി 1,000: | ||
//************** | //************** | ||
} | } | ||
function addCheckbox(editform,textBox) { | function addCheckbox(editform,textBox) { | ||
if(editform==null||textBox==null) return; | if(editform==null||textBox==null) return; | ||
try | try | ||
{ | { | ||
| വരി 1,026: | വരി 1,011: | ||
element.setAttribute("type","checkbox"); | element.setAttribute("type","checkbox"); | ||
element.setAttribute("id","realtime"); | element.setAttribute("id","realtime"); | ||
if (element.addEventListener) | if (element.addEventListener) | ||
element.addEventListener("click", rtClick, false); | element.addEventListener("click", rtClick, false); | ||
else if (element.attachEvent) | else if (element.attachEvent) | ||
element.attachEvent("onclick", rtClick); | element.attachEvent("onclick", rtClick); | ||
var labelcheckBox = document.createTextNode(' മലയാളം എഴുതുവാന് ഈ ഉപാധി സ്വീകരിക്കുക - Use Ctrl + M to Toggle.'); | var labelcheckBox = document.createTextNode(' മലയാളം എഴുതുവാന് ഈ ഉപാധി സ്വീകരിക്കുക - Use Ctrl + M to Toggle.'); | ||
editform.insertBefore(element,textBox); | editform.insertBefore(element,textBox); | ||
| വരി 1,045: | വരി 1,030: | ||
} | } | ||
} | } | ||
var imeStatus = false; | var imeStatus = false; | ||
function processKeys(event) { | function processKeys(event) { | ||
if (rtsupported) { | if (rtsupported) { | ||
e = event || window.event; | e = event || window.event; | ||
var myKeyCode = 0; | var myKeyCode = 0; | ||
var myShiftKey = false; | var myShiftKey = false; | ||
| വരി 1,061: | വരി 1,046: | ||
myShiftKey = (myKeyCode == 16)?true:false; | myShiftKey = (myKeyCode == 16)?true:false; | ||
} | } | ||
if ((e.keyCode == 13 && e.ctrlKey) || (e.which == 109 && e.ctrlKey)) | if ((e.keyCode == 13 && e.ctrlKey) || (e.which == 109 && e.ctrlKey)) | ||
{ | { | ||
| വരി 1,073: | വരി 1,058: | ||
return false; | return false; | ||
} | } | ||
else if ((e.keyCode >= 3328 && e.keyCode <= 3455) || (e.which >= 3328 && e.which <= 3455)) { | else if ((e.keyCode >= 3328 && e.keyCode <= 3455) || (e.which >= 3328 && e.which <= 3455)) { | ||
var chk = document.getElementById('realtime'); | var chk = document.getElementById('realtime'); | ||
| വരി 1,087: | വരി 1,072: | ||
} | } | ||
} | } | ||
else if (realTime) { | else if (realTime) { | ||
imeStatus = false; | imeStatus = false; | ||
| വരി 1,095: | വരി 1,080: | ||
} | } | ||
var realTime=false; | var realTime=false; | ||
function rtClick(event) { | function rtClick(event) { | ||
realTime = !realTime; | realTime = !realTime; | ||
lija_setCookie('mlWikiTranslit',realTime,1);//save in cookie | lija_setCookie('mlWikiTranslit',realTime,1);//save in cookie | ||
} | } | ||
var rtsupported = false; | var rtsupported = false; | ||
var error; | var error; | ||
function checkrt(editform) { | function checkrt(editform) { | ||
try { | try { | ||
/* | /* | ||
var nav = navigator.userAgent.toUpperCase(); | var nav = navigator.userAgent.toUpperCase(); | ||
rtsupported = (nav.indexOf("GECKO") >= 0 || nav.indexOf("OPERA") >= 0 || nav.indexOf("SAFARI") >= 0); | rtsupported = (nav.indexOf("GECKO") >= 0 || nav.indexOf("OPERA") >= 0 || nav.indexOf("SAFARI") >= 0); | ||
*/ | */ | ||
rtsupported = (document.selection != undefined) | rtsupported = (document.selection != undefined) | ||
if (!rtsupported) { | if (!rtsupported) { | ||
var element = document.createElement("TEXTAREA"); | var element = document.createElement("TEXTAREA"); | ||
editform.appendChild(element); | editform.appendChild(element); | ||
if (element.selectionStart != undefined) | if (element.selectionStart != undefined) | ||
rtsupported = true; | rtsupported = true; | ||
editform.removeChild(element); | editform.removeChild(element); | ||
} | } | ||
} catch (error) {} | } catch (error) {} | ||
} | } | ||
//************************************ | //************************************ | ||
// ട്രാന്സ്ലിറ്ററേഷന് സ്ക്രിപ്റ്റില് കൂക്കി സപ്പോര്ട്ട് ചേര്ക്കാനുള്ള ശ്രമം | // ട്രാന്സ്ലിറ്ററേഷന് സ്ക്രിപ്റ്റില് കൂക്കി സപ്പോര്ട്ട് ചേര്ക്കാനുള്ള ശ്രമം | ||
function lija_getCookie(cookieName) | function lija_getCookie(cookieName) | ||
{ | { | ||
| വരി 1,144: | വരി 1,129: | ||
return ""; | return ""; | ||
} | } | ||
function lija_setCookie(cookieName,value,expiredays) | function lija_setCookie(cookieName,value,expiredays) | ||
{ | { | ||
| വരി 1,152: | വരി 1,137: | ||
((expiredays==null) ? "" : "; expires="+exdate.toGMTString()); | ((expiredays==null) ? "" : "; expires="+exdate.toGMTString()); | ||
} | } | ||
//************************************ | //************************************ | ||
// add this line to your monobook.js to disable in-built transliteration - thanks to Sadik Khalid for this quick tip | // add this line to your monobook.js to disable in-built transliteration - thanks to Sadik Khalid for this quick tip | ||
// var userIMEEnabled = false; // paste this line to user monobook.js and remove // from the begining of this line | // var userIMEEnabled = false; // paste this line to user monobook.js and remove // from the begining of this line | ||
// check for user preference and load in-built transliteration tool | // check for user preference and load in-built transliteration tool | ||
if(typeof(window.userIMEEnabled) == 'undefined') { addLoadEvent(addTextEvent); } | if(typeof(window.userIMEEnabled) == 'undefined') { addLoadEvent(addTextEvent); } | ||
| വരി 1,164: | വരി 1,149: | ||
</pre></nowiki> | </pre></nowiki> | ||
*/ | */ | ||
/* | /* | ||
==addLoadEvent== | ==addLoadEvent== | ||
| വരി 1,172: | വരി 1,157: | ||
addOnloadHook( func ); | addOnloadHook( func ); | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
== Dynamic Navigation Bars (experimental) == | == Dynamic Navigation Bars (experimental) == | ||
| വരി 1,199: | വരി 1,184: | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
=== toggleNavigationBar ===* | === toggleNavigationBar ===* | ||
| വരി 1,250: | വരി 1,235: | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
=== createNavigationBarToggleButton === | === createNavigationBarToggleButton === | ||
| വരി 1,273: | വരി 1,258: | ||
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | ||
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | ||
var NavToggleText = document.createTextNode(NavigationBarHide); | var NavToggleText = document.createTextNode(NavigationBarHide); | ||
NavToggle.appendChild(NavToggleText); | NavToggle.appendChild(NavToggleText); | ||
| വരി 1,307: | വരി 1,292: | ||
// ====================== | // ====================== | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
==Cookies== | ==Cookies== | ||
| വരി 1,326: | വരി 1,311: | ||
+ ";expires="+expire.toGMTString(); | + ";expires="+expire.toGMTString(); | ||
} | } | ||
function getCookie(cookieName) { | function getCookie(cookieName) { | ||
var start = document.cookie.indexOf( cookieName + "=" ); | var start = document.cookie.indexOf( cookieName + "=" ); | ||
| വരി 1,340: | വരി 1,325: | ||
return unescape( document.cookie.substring( len, end ) ); | return unescape( document.cookie.substring( len, end ) ); | ||
} | } | ||
function deleteCookie(cookieName) { | function deleteCookie(cookieName) { | ||
if ( getCookie(cookieName) ) { | if ( getCookie(cookieName) ) { | ||
| വരി 1,350: | വരി 1,335: | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
== Interproject links == | == Interproject links == | ||
| വരി 1,358: | വരി 1,343: | ||
var elements = new Array(); | var elements = new Array(); | ||
var spans = document.getElementsByTagName('span'); | var spans = document.getElementsByTagName('span'); | ||
// filter for projectlinks | // filter for projectlinks | ||
for (var i=0, j=0; i<spans.length; i++) { | for (var i=0, j=0; i<spans.length; i++) { | ||
| വരി 1,366: | വരി 1,351: | ||
} | } | ||
} | } | ||
if (j) { | if (j) { | ||
// create navbox | // create navbox | ||
| വരി 1,376: | വരി 1,361: | ||
plbox.setAttribute('style','margin-top:0.7em;'); | plbox.setAttribute('style','margin-top:0.7em;'); | ||
var pllist = document.createElement('ul'); | var pllist = document.createElement('ul'); | ||
// append | // append | ||
for (var i=0; i<elements.length; i++) { | for (var i=0; i<elements.length; i++) { | ||
| വരി 1,388: | വരി 1,373: | ||
} | } | ||
} | } | ||
addLoadEvent(Projectlinks); | addLoadEvent(Projectlinks); | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
==addCharSubsetMenu== | ==addCharSubsetMenu== | ||
<pre> */ | <pre> */ | ||
/* add menu for selecting subsets of secial characters */ | /* add menu for selecting subsets of secial characters */ | ||
/***** must match MediaWiki:Edittools *****/ | /***** must match MediaWiki:Edittools *****/ | ||
function addCharSubsetMenu() { | function addCharSubsetMenu() { | ||
var edittools = document.getElementById('editpage-specialchars'); | var edittools = document.getElementById('editpage-specialchars'); | ||
if (edittools) { | if (edittools) { | ||
var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">"; | var menu = "<select id=\"charSubsetControl\" style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">"; | ||
| വരി 1,418: | വരി 1,403: | ||
menu += "</select>"; | menu += "</select>"; | ||
edittools.innerHTML = menu + edittools.innerHTML; | edittools.innerHTML = menu + edittools.innerHTML; | ||
/* default subset from cookie */ | /* default subset from cookie */ | ||
var s = parseInt( getCookie('edittoolscharsubset') ); | var s = parseInt( getCookie('edittoolscharsubset') ); | ||
if ( isNaN(s) ) s = 0; | if ( isNaN(s) ) s = 0; | ||
/* update dropdown control to value of cookie */ | /* update dropdown control to value of cookie */ | ||
document.getElementById('charSubsetControl').selectedIndex = s; | document.getElementById('charSubsetControl').selectedIndex = s; | ||
/* display the subset indicated by the cookie */ | /* display the subset indicated by the cookie */ | ||
chooseCharSubset( s ); | chooseCharSubset( s ); | ||
| വരി 1,431: | വരി 1,416: | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
===chooseCharSubsetMenu=== | ===chooseCharSubsetMenu=== | ||
| വരി 1,444: | വരി 1,429: | ||
setCookie('edittoolscharsubset', s); | setCookie('edittoolscharsubset', s); | ||
} | } | ||
/* </pre> */ | /* </pre> */ | ||
/* | /* | ||
== customizeWikipedia == | == customizeWikipedia == | ||
<pre> */ | <pre> */ | ||
function customizeWikipedia() { | function customizeWikipedia() { | ||
addCharSubsetMenu(); | addCharSubsetMenu(); | ||
| വരി 1,457: | വരി 1,442: | ||
addLoadEvent(customizeWikipedia); | addLoadEvent(customizeWikipedia); | ||
/* </pre> */ | /* </pre> */ | ||
/*HERE STARTS THE WORKING-CODE OF "METABOXES"*/ | /*HERE STARTS THE WORKING-CODE OF "METABOXES"*/ | ||
/* Funcionament de la Plantilla:Metacaixa | /* Funcionament de la Plantilla:Metacaixa | ||
Implementat per: Usuari:Peleguer. | Implementat per: Usuari:Peleguer. | ||
Actualitzat per Joanjoc seguint les indicacions d'en Martorell | Actualitzat per Joanjoc seguint les indicacions d'en Martorell | ||
*/ | */ | ||
function MetaCaixaInit(){ | function MetaCaixaInit(){ | ||
//S'executa al carregar-se la pàgina, si hi ha metacaixes, | //S'executa al carregar-se la pàgina, si hi ha metacaixes, | ||
// s'assignen els esdeveniments als botons | // s'assignen els esdeveniments als botons | ||
//alert("MetaCaixaInit"); | //alert("MetaCaixaInit"); | ||
var i=0 //Inicialitzem comptador de caixes | var i=0 //Inicialitzem comptador de caixes | ||
for (i=0;i<=9;i++){ | for (i=0;i<=9;i++){ | ||
| വരി 1,478: | വരി 1,463: | ||
if (!vMc) break; | if (!vMc) break; | ||
//alert("MetaCaixaInit, trobada Metacaixa mc"+i); | //alert("MetaCaixaInit, trobada Metacaixa mc"+i); | ||
var j=1 //Inicialitzem comptador de botons dins de la caixa | var j=1 //Inicialitzem comptador de botons dins de la caixa | ||
var vPsIni = 0 //Pestanya visible inicial | var vPsIni = 0 //Pestanya visible inicial | ||
| വരി 1,499: | വരി 1,484: | ||
} | } | ||
} | } | ||
function MetaCaixaMostraPestanya(){ | function MetaCaixaMostraPestanya(){ | ||
//S'executa al clicar una pestanya, | //S'executa al clicar una pestanya, | ||
| വരി 1,505: | വരി 1,490: | ||
var vMcNom = this.id.substr(0,3); //A partir del nom del botó, deduïm el nom de la caixa | 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 vIndex = this.id.substr(5,1); //I l'index | ||
var i=1 | var i=1 | ||
for (i=1;i<=9;i++){ //busquem totes les pestanyes d'aquella caixa | for (i=1;i<=9;i++){ //busquem totes les pestanyes d'aquella caixa | ||
| വരി 1,525: | വരി 1,510: | ||
addOnloadHook(MetaCaixaInit); | addOnloadHook(MetaCaixaInit); | ||
/*HERE FINISHES THE WORKING-CODE OF "METABOXES"*/ | /*HERE FINISHES THE WORKING-CODE OF "METABOXES"*/ | ||
/** WikiMiniAtlas ******************************************************* | /** WikiMiniAtlas ******************************************************* | ||
* | * | ||
| വരി 1,536: | വരി 1,521: | ||
* Maintainers: [[User:Dschwen]] | * Maintainers: [[User:Dschwen]] | ||
*/ | */ | ||
if (wgServer == "https://secure.wikimedia.org") { | if (wgServer == "https://secure.wikimedia.org") { | ||
var metaBase = "https://secure.wikimedia.org/wikipedia/meta"; | var metaBase = "https://secure.wikimedia.org/wikipedia/meta"; | ||
| വരി 1,543: | വരി 1,528: | ||
} | } | ||
importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400") | importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400") | ||
/** Collapsible tables ********************************************************* | /** Collapsible tables ********************************************************* | ||
* | * | ||
| വരി 1,634: | വരി 1,619: | ||
addOnloadHook( createCollapseButtons ); | addOnloadHook( createCollapseButtons ); | ||
var hasClass = (function () { | var hasClass = (function () { | ||
var reCache = {}; | var reCache = {}; | ||
| വരി 1,641: | വരി 1,626: | ||
}; | }; | ||
})(); | })(); | ||