පරිශීලක:බිඟුවා/monobook.js

Wikibooks වෙතින්

සටහන: සුරැකීමෙන් පසුව, වෙනස් කම් දැකගැනුමට ඔබගේ බ්‍රවුසරයෙහි කෑෂය මගහැරයෑමට ඔබට සිදුවිය හැක.

  • ෆයර්ෆොක්ස්/ සෆාරි: Reload ඔබන අතරතුර Shift ඔබන්න, නැතහොත් Ctrl-F5 හෝCtrl-R (මැක්හීදී Command-R ) ඔබන්න
  • ගූගල් ක්‍රෝම්: Ctrl-Shift-R ඔබන්න(මැක්හී Command-Shift-R )
  • ඉන්ටර්නෙට් එක්ස්ප්ලෝර: Refresh ඔබන අතරතුර Ctrl ඔබන්න, නැතහොත් Ctrl-F5 ඔබන්න
  • ඔපෙරා: Tools → Preferences හි කෑෂය හිස් කරන්න
/* <source lang=javascript> */
/* Any JavaScript here will be loaded for users using the MonoBook skin */

/** Topbar content fix with sitenotice / CentralNotice **************************
  *
  *  Description: This fixes the location of topbar content (e.g., featured
  *               content star) when the sitenotice or CentralNotice is active.
  *  Maintainers: [[User:TheDJ]], [[User:MZMcBride]]
  */

if((navigator.userAgent.indexOf("MSIE 6")==-1) && (wgAction == 'submit' || wgAction == 'view')) addOnloadHook(function() {
    var cnote = document.getElementById('centralNotice');
    if( !document.getElementById('mw-dismissible-notice') && !(cnote)) return; // fundraiser:  && hasClass(cnote, 'expanded'))) return;
    appendCSS('#bodyContent { position:relative; } \n.topicon { position:absolute; top:-2em !important;}\n#coordinates{ position:absolute; top:1px !important; right:0px !important;}');
})
/* </source> */

importScript('User:බිඟුවා/Gadget-HotCat.js');

/* <source lang=javascript> */
/* Any JavaScript here will be loaded for users using the MonoBook skin */

/** Topbar content fix with sitenotice / CentralNotice **************************
  *
  *  Description: This fixes the location of topbar content (e.g., featured
  *               content star) when the sitenotice or CentralNotice is active.
  *  Maintainers: [[User:TheDJ]], [[User:MZMcBride]]
  */

if((navigator.userAgent.indexOf("MSIE 6")==-1) && (wgAction == 'submit' || wgAction == 'view')) addOnloadHook(function() {
    var cnote = document.getElementById('centralNotice');
    if( !document.getElementById('mw-dismissible-notice') && !(cnote)) return; // fundraiser:  && hasClass(cnote, 'expanded'))) return;
    appendCSS('#bodyContent { position:relative; } \n.topicon { position:absolute; top:-2em !important;}\n#coordinates{ position:absolute; top:1px !important; right:0px !important;}');
})
/* </source> */

/* tooltips and access keys */  
ta = new Object();
ta['pt-userpage'] = new Array('.','My user page');
ta['pt-anonuserpage'] = new Array('.','The user page for the ip you\'re editing as');
ta['pt-mytalk'] = new Array('n','My talk page');
ta['pt-anontalk'] = new Array('n','Discussion about edits from this ip address');
ta['pt-preferences'] = new Array('','My preferences');
ta['pt-watchlist'] = new Array('l','The list of pages you\'re monitoring for changes.');
ta['pt-mycontris'] = new Array('y','List of my contributions');
ta['pt-login'] = new Array('o','You are encouraged to log in, it is not mandatory however.');
ta['pt-anonlogin'] = new Array('o','You are encouraged to log in, it is not mandatory however.');
ta['pt-logout'] = new Array('o','Log out');
ta['ca-talk'] = new Array('t','Discussion about the content page');
ta['ca-edit'] = new Array('e','You can edit this page. Please use the preview button before saving.');
ta['ca-addsection'] = new Array('+','Add a comment to this discussion.');
ta['ca-viewsource'] = new Array('e','This page is protected. You can view its source.');
ta['ca-history'] = new Array('h','Past versions of this page.');
ta['ca-protect'] = new Array('=','Protect this page');
ta['ca-delete'] = new Array('d','Delete this page');
ta['ca-undelete'] = new Array('d','Restore the edits done to this page before it was deleted');
ta['ca-move'] = new Array('m','Move this page');
ta['ca-watch'] = new Array('w','Add this page to your watchlist');
ta['ca-unwatch'] = new Array('w','Remove this page from your watchlist');
ta['search'] = new Array('f','Search this wiki');
ta['p-logo'] = new Array('','Main Page');
ta['n-mainpage'] = new Array('z','Visit the Main Page');
ta['n-portal'] = new Array('','About the project, what you can do, where to find things');
ta['n-currentevents'] = new Array('','Find background information on current events');
ta['n-recentchanges'] = new Array('r','The list of recent changes in the wiki.');
ta['n-randompage'] = new Array('x','Load a random page');
ta['n-help'] = new Array('','The place to find out.');
ta['n-sitesupport'] = new Array('','Support us');
ta['t-whatlinkshere'] = new Array('j','List of all wiki pages that link here');
ta['t-recentchangeslinked'] = new Array('k','Recent changes in pages linked from this page');
ta['feed-rss'] = new Array('','RSS feed for this page');
ta['feed-atom'] = new Array('','Atom feed for this page');
ta['t-contributions'] = new Array('','View the list of contributions of this user');
ta['t-emailuser'] = new Array('','Send a mail to this user');
ta['t-upload'] = new Array('u','Upload images or media files');
ta['t-specialpages'] = new Array('q','List of all special pages');
ta['ca-nstab-main'] = new Array('c','View the content page');
ta['ca-nstab-user'] = new Array('c','View the user page');
ta['ca-nstab-media'] = new Array('c','View the media page');
ta['ca-nstab-special'] = new Array('','This is a special page, you can\'t edit the page itself.');
ta['ca-nstab-project'] = new Array('a','View the project page');
ta['ca-nstab-image'] = new Array('c','View the image page');
ta['ca-nstab-mediawiki'] = new Array('c','View the system message');
ta['ca-nstab-template'] = new Array('c','View the template');
ta['ca-nstab-help'] = new Array('c','View the help page');
ta['ca-nstab-category'] = new Array('c','View the category page');

document.write('<script type="text/javascript" src="' + 'http://si.wiktionary.org/w/index.php?title=MediaWiki:translit.js&action=raw&ctype=text/javascript&dontcountme=s"' + '&action="raw"></script>');

 function addLoadEvent(func)
 {
   if (window.addEventListener) 
     window.addEventListener("load", func, false);
   else if (window.attachEvent) 
     window.attachEvent("onload", func);
 }
 
 function addTranslit(editForm, textBox)
 {
   checkrt(editForm);
   if (textBox.addEventListener)
     textBox.addEventListener("keypress", processKeys, false);
   else if (textBox .attachEvent) 
     textBox.attachEvent("onkeypress", processKeys);
 }
 
 function addTextEvent() {
   //cookie for remembering transliteration choice
   if(new_getCookie('newWikiTranslit')!=null && new_getCookie('newWikiTranslit')!="")  
   realTime=(new_getCookie('newWikiTranslit')=="true")?true:false; 
 

   // add transliteration feature to main edit box 
   var editForm =document.getElementById('editform');
   if(editForm != null) {
      var textBox=document.getElementById('wpTextbox1');
      var textSummary = document.getElementById('wpSummary');
 
      addTranslit(editForm,textBox);
      addCheckbox(editForm,textBox );
      if(textSummary) { addTranslit(editForm,textSummary); }
   }

   // add transliteration feature to search form
   var searchForm = document.getElementById('searchform');
   if( searchForm != null ) {
			try {
				var searchBox = document.getElementById('searchInput');
				 // add IME checkbox control to searchForm
				if (searchBox != null || searchForm != null) {
					var element = document.createElement("input");
					element.setAttribute("type","checkbox");
					element.setAttribute("id","sbrealtime");
					if (element.addEventListener) 
						element.addEventListener("click", rtClick, false);
					else if (element.attachEvent) 
						element.attachEvent("onclick", rtClick);
					
					// var labelcheckBox = document.createTextNode('සිංග්ලිෂ්');					
					var chkSpan = document.createElement("span");
					chkSpan.setAttribute("id","spnRealtime");
					var searchBody = document.getElementById('searchBody');
					searchBody.appendChild(element);
					searchBody.appendChild(chkSpan);
						
					// searchForm.insertBefore(element,searchBox);
					document.getElementById("sbrealtime").checked = realTime;
					document.getElementById('spnRealtime').innerHTML = '<a href="http://si.wiktionary.org/wiki/වික්ෂනරි:සිංග්ලිෂ්_ලියන_ආකාරය" title="Switches keyboard between සිංග්ලිෂ් and English">සිංග්ලිෂ්</a>';
					// searchForm.insertBefore(chkSpan,searchBox);
					// var p = document.createElement("p");
					// p.setAttribute("style","width:100%;height:1px;");
					// searchForm.insertBefore(p,searchBox);
				}
			 }
			 catch(ex)
			 {
			  //.
			 }
				 
			 if(searchBox) { addTranslit(searchForm,searchBox); }
		}             
   
   // add transliteration feature to power search
   var powerSearchForm = document.getElementById('search');
   if( powerSearchForm != null) { 
      var powerSearchBox = document.getElementById('lsearchbox');
      if( powerSearchBox ) { addTranslit(powerSearchForm, powerSearchBox );}
   }
   
   // add transliteration feature to move page
   var movePageForm = document.getElementById('movepage');
   if( movePageForm != null ) {
      var newTitleBox = document.getElementById('wpNewTitle');
      var reasonBox = document.getElementById('wpReason');
      if( newTitleBox ) {addTranslit(movePageForm, newTitleBox);}
      if( reasonBox ) {addTranslit(movePageForm, reasonBox ); }
   }
 
   // add transliteration feature to upload feature page
   var upForm=document.getElementById('upload');
   if(upForm)
   {
      var upName=document.getElementById('wpDestFile');
      var upComment=document.getElementById('wpUploadDescription');
      if(upName) addTranslit(upForm,upName);
      if(upComment) addTranslit(upForm,upComment);
   }

   // add transliteration feature to create inputbox
   var crForm=document.getElementById('createbox');
   if(crForm)
   {
      var crName=crForm.title;
      if(crName) addTranslit(crForm,crName);
   }
 }
 
 function addCheckbox(editform,textBox )
 {
   var element = document.createElement("input");
   element.setAttribute("type","checkbox");
   element.setAttribute("id","realtime");
 
   if (element.addEventListener)
     element.addEventListener("click", rtClick, false);
   else if (element.attachEvent)
     element.attachEvent("onclick", rtClick);
   
   var ellabel = document.createElement("label");
   //ellabel.setAttribute("for","realtime"); 
   ellabel.setAttribute("id","labelrealtime"); 
  
   ellabel.innerHTML = 'සිංග්ලිෂ්වලින්(In Singlish), Use ESC to Toggle the keyboard'; 
 
     editform.insertBefore(element,textBox);
   document.getElementById("realtime").checked = realTime;
   //editform.insertBefore(labelcheckBox,textBox);
   editform.insertBefore(ellabel,textBox);
   document.getElementById("labelrealtime").htmlFor = "realtime"; 
 }
 
 function processKeys(event)
 {
   if (rtsupported)
   {
     if (event.keyCode == 27) // ESC  - for ie, Press ctrl+z after pressing ESC
     { 
       //escape to toggle
       realTime = !realTime;
       new_setCookie('newWikiTranslit',realTime,1);//save status in a cookie 
       var chk = document.getElementById('realtime'); 
       if (chk) { chk.checked = realTime; } 
       return false; 
     }
     else if (realTime)
     {
       translitonkey(event);
     }
   }
 }
 
 var realTime = true;
 function rtClick(event)
 {
   realTime = !realTime;
   new_setCookie('newWikiTranslit',realTime,1);//save status in a cookie
 }
 
 var rtsupported = false; var error;
 function checkrt(editform)
 {
   try
   {
     /* var nav = navigator.userAgent.toUpperCase();
     rtsupported = (nav.indexOf("GECKO") >= 0 || nav.indexOf("OPERA") >= 0 || nav.indexOf("SAFARI") >= 0);
     */
 
     rtsupported = (document.selection != undefined)
 
     if (!rtsupported)
     {
       var element = document.createElement("TEXTAREA");
       editform.appendChild(element);
       if(element.selectionStart != undefined)
         rtsupported = true;
       editform.removeChild(element);
     }
   }
   catch (error)
   {}
 }
 
// function to handle cookies
function new_getCookie(cookieName)
  {
    if (document.cookie.length>0)
     { 
       cookieStart=document.cookie.indexOf(cookieName + "=");
       if (cookieStart!=-1)
          { 
            cookieStart=cookieStart + cookieName.length+1;
            cookieEnd=document.cookie.indexOf(";",cookieStart);
            if (cookieEnd==-1) cookieEnd=document.cookie.length;
               return unescape(document.cookie.substring(cookieStart,cookieEnd));
          } 
     }
    return "";
  }

function new_setCookie(cookieName,value,expiredays)
 {
   var exdate=new Date();
   exdate.setDate(exdate.getDate()+expiredays);
   document.cookie=cookieName+ "=" +escape(value)+"; path=/"+
   ((expiredays==null) ? "" : "; expires="+exdate.toGMTString());
 }

 addLoadEvent(addTextEvent)
/*
</pre>
*/


// Suppression du titre sur la page d'accueil et changement de l'onglet
function mainPageTransform()
{
 if(wgPageName != 'මුල්_පිටුව' && wgPageName != 'සාකච්ඡාව:මුල්_පිටුව') return;
 document.getElementById('ca-nstab-main').firstChild.innerHTML = 'මුල්_පිටුව';

 if(wgPageName != 'මුල්_පිටුව') return;
 if (location.search.search(/action=(edit|history|protect|unprotect|delete|watch|unwatch)/) != -1) return;
 document.write('<style type="text/css">/*<![CDATA[*/ h1.firstHeading { display: none !important; } /*]]>*/</style>');
}
$(mainPageTransform);

/**
$(LienUpload);

/*
 * OtherLanguages
 * Lien vers la liste complète des Wikipédias depuis l'accueil
 * Dernière révision : 4 mars 2006
 */
function otherLanguages(){
    if (wgPageName != 'මුල්_පිටුව') return;
    mw.util.addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias', 'සම්පූර්ණ ලැයිස්තුව');
}
addLoadEvent(otherLanguages);

//
"https://si.wikibooks.org/w/index.php?title=පරිශීලක:බිඟුවා/monobook.js&oldid=13415" වෙතින් සම්ප්‍රවේශනය කෙරිණි