Usuario:Nadir1984/title.js
Apariencia
Nota: Después de publicar, quizás necesite actualizar la caché de su navegador para ver los cambios.
- Firefox/Safari: Mantenga presionada la tecla Shift mientras pulsa el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
- Google Chrome: presione Ctrl+Shift+R (⌘+Shift+R en Mac)
- Edge: mantenga presionada Ctrl mientras pulsa Actualizar, o presione Ctrl+F5
//<pre><nowiki>
//*****************Titulos de articulos******************************/
// Gets the article lemma with the namespace
function get_title()
{
// get the article link from the label 'ca-edit' out of the document text.
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&" from the end
// Note if the page has & in its title, that is represented here as %26, so it
// doesn't cause a problem
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.indexOf('&'));
return editlk;
}
// Gets the article lemma, with the namespace but without sub pages.
function get_tidy_title()
{
var editlk = get_title()
editlk = editlk.replace(/\/.*$/, ''); //removing subpages from the link
return editlk;
}
// Gets the subpage lemma, with the namespace but without sub pages.
function get_subpage_title()
{
var editlk = get_title()
editlk = editlk.substring(editlk.indexOf('/') + 1); // strip off
return editlk;
}
//</nowiki></pre>