User:Mike Dillon/Scripts/tabs.js: Difference between revisions

Content deleted Content added
add Spanish localizations
m Maintenance: Fixing deprecated call to addPortletLink (mw:ResourceLoader/Migration_guide_(users)#addPortletLink)
 
(2 intermediate revisions by one other user not shown)
Line 6:
wfAddMsg("en", "purgeTabLabel", "Purge");
wfAddMsg("es", "purgeTabLabel", "Purgar");
wfAddMsg("en", "purgeTabTitle", "PurgarPurge this page from the server cache");
wfAddMsg("es", "purgeTabTitle", "Purgar esta página del cache de servidor");
 
Line 13:
wfAddMsg("en", "lastDiffTabTitle", "Show differences between this revision and the previous");
wfAddMsg("es", "lastDiffTabTitle", "Mostrar las diferencias entre esta revisión y la previa");
 
// Duplicate link tab from the top to the bottom of the content area
addOnloadHook(function () {
// Clone the original tabs and change the id to "mytabs"
var tabs = document.getElementById('p-cactions').cloneNode(true);
tabs.id = 'mytabs';
 
// Find individual tabs with ids and prefix the ids with "mytabs-"
var listitems = tabs.getElementsByTagName('LI');
for (var i=0; i < listitems.length; i++) {
if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
}
 
// Add the cloned tabs at the end of the "column-content" div
document.getElementById('column-content').appendChild(tabs);
});
 
// Add a new list item to the page tabs
function addTab(url, name, id, title, key) {
// Add tab to the top tabs
mw.util.addPortletLink('p-cactions', url, name, id, title, key);
 
// Add tab to the bottom if the tabs have been cloned
mw.util.addPortletLink('mytabs', url, name, 'mytabs-' + id, title, key);
}