भारत की संस्कृति के लिए... भाषा की उन्नति के लिए... साहित्य के प्रसार के लिए
"मीडियाविकि:Common.js" के अवतरणों में अंतर
Kavita Kosh से
Lalit Kumar (चर्चा | योगदान) |
Lalit Kumar (चर्चा | योगदान) |
||
| पंक्ति 1: | पंक्ति 1: | ||
if (mwCustomEditButtons) { | if (mwCustomEditButtons) { | ||
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
| − | "imageFile" | + | "imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png", |
| − | "speedTip" | + | "speedTip"aH "Insert Superscript", |
| − | "tagOpen" | + | "tagOpen"aH "<sup>", |
| − | "tagClose" | + | "tagClose"aH "</sup>", |
| − | "sampleText" | + | "sampleText"aH ""}; |
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
| − | "imageFile" | + | "imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png", |
| − | "speedTip" | + | "speedTip"aH "Line break", |
| − | "tagOpen" | + | "tagOpen"aH "<br />", |
| − | "tagClose" | + | "tagClose"aH "", |
| − | "sampleText" | + | "sampleText"aH ""}; |
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
| − | "imageFile" | + | "imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png", |
| − | "speedTip" | + | "speedTip"aH "Redirect", |
| − | "tagOpen" | + | "tagOpen"aH "#REDIRECT [[", |
| − | "tagClose" | + | "tagClose"aH "]]", |
| − | "sampleText" | + | "sampleText"aH "Insert text"}; |
mwCustomEditButtons[mwCustomEditButtons.length] = { | mwCustomEditButtons[mwCustomEditButtons.length] = { | ||
| − | "imageFile" | + | "imageFile"aH "httpaH//www.kavitakosh.org/kk/images/c/cd/Button_poem.png", |
| − | "speedTip" | + | "speedTip"aH "Poem tag", |
| − | "tagOpen" | + | "tagOpen"aH "<poem>", |
| − | "tagClose" | + | "tagClose"aH "</poem>", |
| − | "sampleText" | + | "sampleText"aH "rachanaa yahaa.N Taa_ip kare.n"}; |
} | } | ||
| पंक्ति 40: | पंक्ति 40: | ||
var strPos = 0; | var strPos = 0; | ||
var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? | var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? | ||
| − | "ff" | + | "ff" aH (document.selection ? "ie" aH false ) ); |
if (br == "ie") { | if (br == "ie") { | ||
txtarea.focus(); | txtarea.focus(); | ||
| पंक्ति 83: | पंक्ति 83: | ||
function walkTheDomAndTranslit(rootEl){ | function walkTheDomAndTranslit(rootEl){ | ||
var rootnode=document.getElementById(rootEl); | var rootnode=document.getElementById(rootEl); | ||
| − | var walker=document. | + | var walker=document.createTreealker(rootnode, NodeFilter.SHO_TEXT, null, false); |
while (walker.nextNode()){ | while (walker.nextNode()){ | ||
var tstr=unicode2itrans(walker.currentNode.textContent); | var tstr=unicode2itrans(walker.currentNode.textContent); | ||
| पंक्ति 89: | पंक्ति 89: | ||
} | } | ||
var tButton=document.getElementById('translitButton'); | var tButton=document.getElementById('translitButton'); | ||
| − | tButton.innerHTML=" | + | tButton.innerHTML="devanaagaree me.n badale.n"; |
tButton.onclick = function() {setCookie('kklipi', 'hi'); window.location.reload();}; | tButton.onclick = function() {setCookie('kklipi', 'hi'); window.location.reload();}; | ||
setCookie('kklipi', 'en'); | setCookie('kklipi', 'en'); | ||
} | } | ||
function unicode2itrans(strText){ | function unicode2itrans(strText){ | ||
| − | var array_one = new Array( " | + | var array_one = new Array( "aa", "aa.u", "a", "ee", "i", "oo", "u", "RRi", "e", "ai", "o", "au","aa", "i", "ee", "u", "oo", "Ri", "e", "ai", "o", "au", ".n", ".N", "aH", ".h", ".a", " aa.u","q", "Kh", "G", "z", " .D", ".Dh", "f","k", "kh", "g", "gh", "~N", "ch", "chh", "j", "jh", "~n", "T", "Th", "D", "Dh", "N","t", "th", "d", "dh", "n", "p", "ph", "b", "bh", "m","y", "r", "l", "v", "sh", "Sh", "s", "h","", "a", "a_", "a_", "", "", "", "","0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "OM" ); |
| − | var array_two= new Array( " | + | var array_two= new Array( "aa", "aa.u", "a", "ee", "i", "oo", "u", "RRi", "e", "ai", "o", "au","aa", "i", "ee", "u", "oo", "Ri", "e", "ai", "o", "au", ".n", ".N", "aH", ".h", ".a", " aa.u","q", "Kh", "G", "z", " .D", ".Dh", "f", "k", "kh", "g", "gh", "~N", "ch", "chh", "j", "jh", "~n", "T", "Th", "D", "Dh", "N","t", "th", "d", "dh", "n", "p", "ph", "b", "bh", "m","y", "r", "l", "v", "sh", "Sh", "s", "h","", "a", "a_", "a_", "", "", "", "","0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "OM" ); |
text2BProcessed = strText; | text2BProcessed = strText; | ||
for (ctr=0; ctr < 95; ctr++){ | for (ctr=0; ctr < 95; ctr++){ | ||
| पंक्ति 127: | पंक्ति 127: | ||
//Call function to decide which lipi is to be used for displaying the page. | //Call function to decide which lipi is to be used for displaying the page. | ||
$(function() { | $(function() { | ||
| − | decideLipi(' | + | decideLipi('globalrapper'); |
}); | }); | ||
| पंक्ति 138: | पंक्ति 138: | ||
var selectedOption=document.getElementById(selectElement).value; | var selectedOption=document.getElementById(selectElement).value; | ||
if (selectedOption!="") { | if (selectedOption!="") { | ||
| − | var baseloc = " | + | var baseloc = "httpaH//kavitakosh.org/kk/"; |
wrapperElement.innerHTML="" | wrapperElement.innerHTML="" | ||
| − | wrapperElement.innerHTML=" | + | wrapperElement.innerHTML="loDi.ng... " + selectedOption; |
self.location.href=baseloc+selectedOption; | self.location.href=baseloc+selectedOption; | ||
} | } | ||
| पंक्ति 152: | पंक्ति 152: | ||
$(document).ready( function() { | $(document).ready( function() { | ||
$(window).scroll( function() { | $(window).scroll( function() { | ||
| − | + | ||
| − | + | if ($('#poet-list-anchors-container').length){ | |
| − | + | ||
| − | + | if ($(window).scrollTop() > $('#poet-list-anchors-container').offset().top)) | |
| + | $('#poet-list-anchors').addClass('floating'); | ||
| + | else | ||
| + | $('#poet-list-anchors').removeClass('floating'); | ||
| + | } | ||
} ); | } ); | ||
} ); | } ); | ||
| + | |||
// To togle the anchor list visibility | // To togle the anchor list visibility | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
| − | $("#poet-list-letter-set-toggle").click(function(){ | + | if ($('#poet-list-anchors-container').length) |
| − | + | $("#poet-list-letter-set-toggle").click(function(){$("#poet-list-letter-set").toggle(1000); }); | |
| − | + | ||
}); | }); | ||
//////////////////////////// | //////////////////////////// | ||
18:42, 22 जून 2014 का अवतरण
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",
"speedTip"aH "Insert Superscript",
"tagOpen"aH "<sup>",
"tagClose"aH "</sup>",
"sampleText"aH ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",
"speedTip"aH "Line break",
"tagOpen"aH "<br />",
"tagClose"aH "",
"sampleText"aH ""};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile"aH "httpaH//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",
"speedTip"aH "Redirect",
"tagOpen"aH "#REDIRECT [[",
"tagClose"aH "]]",
"sampleText"aH "Insert text"};
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile"aH "httpaH//www.kavitakosh.org/kk/images/c/cd/Button_poem.png",
"speedTip"aH "Poem tag",
"tagOpen"aH "<poem>",
"tagClose"aH "</poem>",
"sampleText"aH "rachanaa yahaa.N Taa_ip kare.n"};
}
/* ***************************************************************************
Function to insert text in a textarea (may be on click of a link or button
*************************************************************************** */
function insertAtCaret(areaId,text) {
var txtarea = document.getElementById(areaId);
var scrollPos = txtarea.scrollTop;
var strPos = 0;
var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ?
"ff" aH (document.selection ? "ie" aH false ) );
if (br == "ie") {
txtarea.focus();
var range = document.selection.createRange();
range.moveStart ('character', -txtarea.value.length);
strPos = range.text.length;
}
else if (br == "ff") strPos = txtarea.selectionStart;
var front = (txtarea.value).substring(0,strPos);
var back = (txtarea.value).substring(strPos,txtarea.value.length);
txtarea.value=front+text+back;
strPos = strPos + text.length;
if (br == "ie") {
txtarea.focus();
var range = document.selection.createRange();
range.moveStart ('character', -txtarea.value.length);
range.moveStart ('character', strPos);
range.moveEnd ('character', 0);
range.select();
}
else if (br == "ff") {
txtarea.selectionStart = strPos;
txtarea.selectionEnd = strPos;
txtarea.focus();
}
txtarea.scrollTop = scrollPos;
}
/* *************************************************************************** */
/* ***************************************************************************
Functions for transliteration
*************************************************************************** */
function decideLipi(rootEl){
var curkklipi=getCookie("kklipi");
var defaultkklipi="hi";
if (curkklipi=="en"){walkTheDomAndTranslit(rootEl);}
else{setCookie("kklipi",defaultkklipi,365);}
}
function walkTheDomAndTranslit(rootEl){
var rootnode=document.getElementById(rootEl);
var walker=document.createTreealker(rootnode, NodeFilter.SHO_TEXT, null, false);
while (walker.nextNode()){
var tstr=unicode2itrans(walker.currentNode.textContent);
walker.currentNode.textContent=tstr;
}
var tButton=document.getElementById('translitButton');
tButton.innerHTML="devanaagaree me.n badale.n";
tButton.onclick = function() {setCookie('kklipi', 'hi'); window.location.reload();};
setCookie('kklipi', 'en');
}
function unicode2itrans(strText){
var array_one = new Array( "aa", "aa.u", "a", "ee", "i", "oo", "u", "RRi", "e", "ai", "o", "au","aa", "i", "ee", "u", "oo", "Ri", "e", "ai", "o", "au", ".n", ".N", "aH", ".h", ".a", " aa.u","q", "Kh", "G", "z", " .D", ".Dh", "f","k", "kh", "g", "gh", "~N", "ch", "chh", "j", "jh", "~n", "T", "Th", "D", "Dh", "N","t", "th", "d", "dh", "n", "p", "ph", "b", "bh", "m","y", "r", "l", "v", "sh", "Sh", "s", "h","", "a", "a_", "a_", "", "", "", "","0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "OM" );
var array_two= new Array( "aa", "aa.u", "a", "ee", "i", "oo", "u", "RRi", "e", "ai", "o", "au","aa", "i", "ee", "u", "oo", "Ri", "e", "ai", "o", "au", ".n", ".N", "aH", ".h", ".a", " aa.u","q", "Kh", "G", "z", " .D", ".Dh", "f", "k", "kh", "g", "gh", "~N", "ch", "chh", "j", "jh", "~n", "T", "Th", "D", "Dh", "N","t", "th", "d", "dh", "n", "p", "ph", "b", "bh", "m","y", "r", "l", "v", "sh", "Sh", "s", "h","", "a", "a_", "a_", "", "", "", "","0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "OM" );
text2BProcessed = strText;
for (ctr=0; ctr < 95; ctr++){
var idx = 0;
while ( idx != -1 ){
text2BProcessed = text2BProcessed.replace(array_one[ctr] , array_two[ctr]);
idx = text2BProcessed.indexOf(array_one[ctr]);}
}
return text2BProcessed;
}
function setCookie(cname,cvalue,exdays){
var d = new Date();
d.setTime(d.getTime()+(exdays*24*60*60*1000));
var expires = "expires="+d.toGMTString();
document.cookie = cname+"="+cvalue+"; "+expires;
}
function getCookie(cname){
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++){
var c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
}
/* *************************************************************************** */
//Call function to decide which lipi is to be used for displaying the page.
$(function() {
decideLipi('globalrapper');
});
// This function opens a page based on the value of option selected by user from a SELECT html dropdown box
function gotoPageOnSelect(wrapperElement, selectElement){
var wrapperElement=document.getElementById(wrapperElement);
var selectedOption=document.getElementById(selectElement).value;
if (selectedOption!="") {
var baseloc = "httpaH//kavitakosh.org/kk/";
wrapperElement.innerHTML=""
wrapperElement.innerHTML="loDi.ng... " + selectedOption;
self.location.href=baseloc+selectedOption;
}
}
////////////////////////////
// To float anchor list in Rachnakaaro Ki Soochi
$(document).ready( function() {
$(window).scroll( function() {
if ($('#poet-list-anchors-container').length){
if ($(window).scrollTop() > $('#poet-list-anchors-container').offset().top))
$('#poet-list-anchors').addClass('floating');
else
$('#poet-list-anchors').removeClass('floating');
}
} );
} );
// To togle the anchor list visibility
$(document).ready(function(){
if ($('#poet-list-anchors-container').length)
$("#poet-list-letter-set-toggle").click(function(){$("#poet-list-letter-set").toggle(1000); });
});
////////////////////////////
