MediaWiki:Common.js: Diferență între versiuni
Jump to navigation
mFără descriere a modificării |
mFără descriere a modificării |
||
Linia 1: | Linia 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/* | |||
//////////////////////////////////////////////////////////////// | |||
// =-=-=- HELPER FUNCTIONS -=-=-=- | |||
function addlilink(tabs, url, name, id, title, key){ | |||
var na = document.createElement('a'); | |||
na.href = url; | |||
na.appendChild(document.createTextNode(name)); | |||
var li = document.createElement('li'); | |||
if(id) li.id = id; | |||
li.appendChild(na); | |||
tabs.appendChild(li); | |||
if(id) | |||
{ | |||
if(key && title) | |||
{ | |||
ta[id] = [key, title]; | |||
} | |||
else if(key) | |||
{ | |||
ta[id] = [key, '']; | |||
} | |||
else if(title) | |||
{ | |||
ta[id] = ['', title]; | |||
} | |||
} | |||
// re-render the title and accesskeys from existing code in wikibits.js | |||
akeytt(); | |||
return li; | |||
} | |||
function addToolboxLink(url, name, id, title){ | |||
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; | |||
addlilink(tb, url, name, id, title); | |||
} | |||
function addTab(url, name, id, title, key) { | |||
return addPortletLink('p-cactions', url, name, id, title, key); | |||
} | |||
function addLink(where, url, name, id, title, key, after){ | |||
var na = document.createElement('a'); | |||
na.href = url; | |||
na.appendChild(document.createTextNode(name)); | |||
var li = document.createElement('li'); | |||
if(id) li.id = id; | |||
li.appendChild(na); | |||
var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; | |||
if(after) { | |||
tabs.insertBefore(li,document.getElementById(after)); | |||
} else { | |||
tabs.appendChild(li); | |||
} | |||
if(id) { | |||
if(key && title) { ta[id] = [key, title]; } | |||
else if(key) { ta[id] = [key, '']; } | |||
else if(title) { ta[id] = ['', title];} | |||
} | |||
// re-render the title and accesskeys from existing code in wikibits.js | |||
akeytt(); | |||
return li; | |||
} | |||
function addlimenu(tabs, name, id) | |||
{ | |||
var na = document.createElement('a'); | |||
na.href = '#'; | |||
var mn = document.createElement('ul'); | |||
na.appendChild(document.createTextNode(name)); | |||
var li = document.createElement('li'); | |||
li.id = id; | |||
li.className = 'tabmenu'; | |||
li.appendChild(na); | |||
li.appendChild(mn); | |||
tabs.appendChild(li); | |||
return li; | |||
} | |||
function addnavbox_link(URL,Name,ID) | |||
{ | |||
var portlet = document.getElementById('p-navigation'); | |||
var links = portlet.getElementsByTagName('ul')[0]; | |||
links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>'; | |||
} | |||
///////////////////////////////////////////// | |||
*/ |
Versiunea de la data 4 decembrie 2010 12:25
/* Any JavaScript here will be loaded for all users on every page load. */ /* //////////////////////////////////////////////////////////////// // =-=-=- HELPER FUNCTIONS -=-=-=- function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title]; } } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } function addToolboxLink(url, name, id, title){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; addlilink(tb, url, name, id, title); } function addTab(url, name, id, title, key) { return addPortletLink('p-cactions', url, name, id, title, key); } function addLink(where, url, name, id, title, key, after){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); } if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } function addlimenu(tabs, name, id) { var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabs.appendChild(li); return li; } function addnavbox_link(URL,Name,ID) { var portlet = document.getElementById('p-navigation'); var links = portlet.getElementsByTagName('ul')[0]; links.innerHTML += '<li id="' + ID + '"><a href="' + URL + '">' + Name + '</a></li>'; } ///////////////////////////////////////////// */