Anonymous

Changes

From SMC Wiki

User:Atjesse/monobook.js

8,884 bytes added, 05:22, 1 April 2009
no edit summary
/** Extra toolbar options ******************************************************
*
* Description: UNDOCUMENTED
* Maintainers: [[User:MarkS]]?, [[User:Voice of All]], [[User:R. Koot]]
*/
//This is a modified copy of a script by User:MarkS for extra features added by User:Voice of All.
// This is based on the original code on Wikipedia:Tools/Editing tools
"sampleText": "References"};
}
/*</=========nowiki></pre>*/
/*<pre><nowiki>
ടൂള്‍ ബാര്‍ ബട്ടണുകള്‍ അടുക്കിപ്പെറുക്കി വയ്ക്കാനുള്ള സ്ക്രിപ്റ്റ്‌
//****************************************************************************************************************
/*</nowiki></pre>*/
/*
//മലയാളം ടൈപ്പിങ് താളുകളിൽ സാധ്യമാക്കാനുള്ള സ്ക്രിപ്റ്റുകൾ | scripts to avail Malayalam transliteration
//തിരയല്‍ താള്‍ | Search page
var simpleSearchForm = document.getElementById('search');
if( simpleSearchForm != null) {
var simpleSearchBox = document.getElementById('searchText');
if( simpleSearchBox ) { addTranslit(simpleSearchForm, simpleSearchBox );}
}
var powerSearchForm = document.getElementById('powersearch');
if( powerSearchForm != null) {
var powerSearchBox = document.getElementById('powerSearchText');
if( powerSearchBox ) { addTranslit(powerSearchForm, powerSearchBox );}
}
// തലക്കെട്ട് മാറ്റല്‍ താള്‍. | Move page
var movePageForm = document.getElementById('movepage');
if( movePageForm != null ) {
var newTitleBox = document.getElementById('wpNewTitle');
if( newTitleBox ) {addTranslit(movePageForm, newTitleBox);}
var reasonBox = document.getElementById('wpReason');
if( reasonBox ) {addTranslit(movePageForm, reasonBox ); }
}
//വിക്കിപീഡിയ:കളരി
var kalariForm = document.getElementById('createbox');
if( kalariForm != null ) {
var kalariText = document.getElementsByName('title')[0];
if( kalariText ) {addTranslit(kalariForm, kalariText);}
}
//അപ്‌ലോഡ് താള്‍
//********************
var upForm=document.getElementById('mw-upload-form');
if(upForm)//ഈ ഫോം ഇല്ലെങ്കില്‍ പിന്നെ മുന്നോട്ട് പോകണ്ട.
{
var upName=document.getElementById('wpDestFile');
var upComment=document.getElementById('wpUploadDescription');
if(upName) addTranslit(upForm,upName);
if(upComment) addTranslit(upForm,upComment);
}
//**************
}
}
/* </pre> */
/*
== Dynamic Navigation Bars (experimental) ==
<pre> */
// BEGIN Dynamic Navigation Bars (experimental)
// FIXME: currently only works for one nav bar on a page at a time
// ===============================================
// set up the words in your language
var NavigationBarHide = '[മറയ്ക്കുക]';
var NavigationBarShow = '[പ്രദര്‍ശിപ്പിക്കുക]';
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
var NavigationBarShowDefault = 1;
//Honor the User Preferences
if ( getCookie('WikipediaPreferencesShowNav') != 'true' ) {
NavigationBarShowDefault = 0;
} else {
if ( wgNamespaceNumber == 0 ) NavigationBarShowDefault = 999 ;
}
/* </pre> */
/*
=== toggleNavigationBar ===*
<pre> */
// 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;
NavChild = NavChild.nextSibling
) {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'none';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (
var NavChild = NavFrame.firstChild;
NavChild;
NavChild = NavChild.nextSibling
) {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'block';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
/* </pre> */
/*
=== createNavigationBarToggleButton ===
<pre> */
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
var indexNavigationBar = 0;
// iterate over all < div >-elements
for(
var i=0;
NavFrame = document.getElementsByTagName("div")[i];
i++
) {
// if found a navigation bar
if (NavFrame.className == "NavFrame") {
indexNavigationBar++;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
var NavToggleText = document.createTextNode(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].className == "NavHead") {
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
// if more Navigation Bars found than Default: hide all
if (NavigationBarShowDefault < indexNavigationBar) {
for(
var i=1;
i<=indexNavigationBar;
i++
) {
toggleNavigationBar(i);
}
}
}
addLoadEvent(createNavigationBarToggleButton);
// END Dynamic Navigation Bars
// ======================
/* </pre> */
/*
==Cookies==
<pre> */
//Cookie helpers
//===========
function setCookie(cookieName, cookieValue) {
var today = new Date();
var expire = new Date();
var nDays = 30;
expire.setTime( today.getTime() + (3600000 * 24 * nDays) );
document.cookie = cookieName + "=" + escape(cookieValue)
+ ";path=/w"
+ ";expires="+expire.toGMTString();
document.cookie = cookieName + "=" + escape(cookieValue)
+ ";path=/wiki"
+ ";expires="+expire.toGMTString();
}
function getCookie(cookieName) {
var start = document.cookie.indexOf( cookieName + "=" );
if ( start == -1 ) return "";
var len = start + cookieName.length + 1;
if ( ( !start ) &&
( cookieName != document.cookie.substring( 0, cookieName.length ) ) )
{
return "";
}
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function deleteCookie(cookieName) {
if ( getCookie(cookieName) ) {
document.cookie = cookieName + "=" + ";path=/w" +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
document.cookie = cookieName + "=" + ";path=/wiki" +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}
/* </pre> */
/*
== Interproject links ==
<pre> */
function Projectlinks() {
var elements = new Array();
var spans = document.getElementsByTagName('span');
// filter for projectlinks
for (var i=0, j=0; i<spans.length; i++) {
if (spans[i].className == 'interProject') {
elements[j] = spans[i].getElementsByTagName('a')[0];
j++;
}
}
if (j) {
// create navbox
var plheader = document.createElement('h5');
plheader.appendChild(document.createTextNode('In other projects'));
var plbox = document.createElement('div');
plbox.setAttribute('class','pBody');
plbox.setAttribute('style','margin-top:0.7em;');
var pllist = document.createElement('ul');
// append
for (var i=0; i<elements.length; i++) {
var plitem = document.createElement('li');
plitem.appendChild(elements[i]);
pllist.appendChild(plitem);
}
plbox.appendChild(plheader);
plbox.appendChild(pllist);
document.getElementById("p-tb").appendChild(plbox);
}
}
addLoadEvent(Projectlinks);
/* </pre> */
6

edits