Diferencia entre revisiones de «MediaWiki:Common.js»
Línea 13: | Línea 13: | ||
reva = /oldid=(\d+)/.exec($('#mw-revision-nav').find('a').attr('href')); | reva = /oldid=(\d+)/.exec($('#mw-revision-nav').find('a').attr('href')); | ||
var oldid = reva ? reva[1] : ''; | var oldid = reva ? reva[1] : ''; | ||
− | var removals = ['mw-page-base', 'mw-head-base', 'mw-navigation', 'mw-head', 'mw-panel', 'column-one', 'siteNotice', 'contentSub', 'siteSub', 'catlinks', 'page-base', 'head-base', 'head', 'panel', 'firstHeading', 'footer-info-lastmod', 'footer-info-viewcount', 'footer-places', 'footer-icons', 'footer-icon-poweredby', 'f-poweredbyico', 'lastmod', 'viewcount', 'privacy', 'about', 'disclaimer', 'notiframe | + | var removals = ['mw-page-base', 'mw-head-base', 'mw-navigation', 'mw-head', 'mw-panel', 'column-one', 'siteNotice', 'contentSub', 'siteSub', 'catlinks', 'page-base', 'head-base', 'head', 'panel', 'firstHeading', 'p-cactions', 'footer-info-lastmod', 'footer-info-viewcount', 'footer-places', 'footer-icons', 'footer-icon-poweredby', 'f-poweredbyico', 'lastmod', 'viewcount', 'privacy', 'about', 'disclaimer', 'notiframe']; |
for (var i=0; i<removals.length; i++) { | for (var i=0; i<removals.length; i++) { | ||
g = document.getElementById(removals[i]); | g = document.getElementById(removals[i]); |
Revisión del 09:24 17 dic 2015
/* Eliminar cabecera y otros objetos cuando se ve la página desde un iframe */
$(function() {
var g;
/* hide some navigation and other unnecessary elements if displayed in an iFrame */
if (window.self != window.top) {
var content = document.getElementById('content');
if (content) {
content.style.margin = 0;
content.style.borderStyle = 'none';
}
var reva = /(\d+:\d+, \d+ \w+ \d+)/.exec($('#mw-revision-info').text());
var revinfo = reva ? reva[0] : '';
reva = /oldid=(\d+)/.exec($('#mw-revision-nav').find('a').attr('href'));
var oldid = reva ? reva[1] : '';
var removals = ['mw-page-base', 'mw-head-base', 'mw-navigation', 'mw-head', 'mw-panel', 'column-one', 'siteNotice', 'contentSub', 'siteSub', 'catlinks', 'page-base', 'head-base', 'head', 'panel', 'firstHeading', 'p-cactions', 'footer-info-lastmod', 'footer-info-viewcount', 'footer-places', 'footer-icons', 'footer-icon-poweredby', 'f-poweredbyico', 'lastmod', 'viewcount', 'privacy', 'about', 'disclaimer', 'notiframe'];
for (var i=0; i<removals.length; i++) {
g = document.getElementById(removals[i]);
if (g) {
g.style.display = 'none';
}
}
$('.editsection,.mw-editsection').css('visibility', 'hidden');
$('#content, #footer').css('background-image', 'none');
document.body.style.background='none';
$('.iframeonly').removeClass('iframeonly');
var q = {};
var qs = document.location.search;
qs = qs.substring(1).toLowerCase().split('&');
for (i=0; i<qs.length; i++) {
g = qs[i].split('=');
q[g[0]] = (g.length === 1) ? true : g[1];
}
if (q.nonav) {
var divs = document.getElementsByTagName('div');
for (i=0; i<divs.length; i++) {
if (divs[i].className.match(/navigation/i)) {
divs[i].style.display = 'none';
}
}
}
g = document.getElementById('footer');
if (g) {
g.style.marginLeft = 0;
/* g.style.position = 'absolute';
g.style.bottom = 0;
g.style.width = "98%"; */
}
var foot = document.getElementById('f-list') || document.getElementById('footer-info');
if (foot) {
var li = document.createElement('li');
var wgServer = window.self.location.origin + '/';
g = wgServer + 'index.php/' + wgPageName;
var footerfrom;
if (revinfo) {
footerfrom = 'Revisión ' + revinfo + ' obtenida de <a href="' + g + '?oldid=' + oldid;
} else {
footerfrom = 'Obtenida de <a href="' + g;
}
li.innerHTML = footerfrom + '">' + g + '</a>';
li.style.display = 'block';
foot.insertBefore(li, document.getElementById('copyright') || document.getElementById('footer-info-copyright'));
}
if ((wgCanonicalNamespace == 'Special') && (wgCanonicalSpecialPageName == 'Userlogin')) {
$('#footer-icon-copyright').hide();
}
if (q.links) {
var largs = q.links.split('|');
for (var j=0; j<largs.length; j++) {
q[largs[j]] = true;
}
var hilight = q.highlight ? ' background: yellow;' : '';
var hover = q.hover ? ' background: yellow;' : '';
if (q.none || q.highlight || q.hover) {
WEAddStyles('a.link {text-decoration: none; padding: 0px; background: none; ' + hilight + '} a.visited {text-decoration: none;' + hilight +'} a:active {text-decoration: none;' + hilight + '} a:hover {text-decoration: none;' + hilight + hover + '}');
}
var as = document.getElementsByTagName('a');
for (j=0; j<as.length; j++) {
var href = as[j].getAttribute('href');
if (href) {
if (q.none || q.show || q.hover || q.highlight) {
as[j].setAttribute('onclick', 'return false;');
}
if (q.window) {
as[j].setAttribute('target', '_VL');
}
}
}
}
if (q.editable) {
$('.editsection,.mw-editsection').css('visibility', 'visible');
}
if (q.noheading) {
$('#firstHeading').css('display', 'none');
}
// if postMessage is supported, try to let the parent know our size
if (parent.postMessage) {
var ht = content.offsetHeight;
var ftr = document.getElementById('footer');
if (ftr) { ht = ht + ftr.offsetHeight; }
var loc = document.location.href;
parent.postMessage('height^' + ht + '^' + loc, "*");
}
}
});