Aller au contenu

Utilisateur:Marin M./LSSSLLLS.js

Une page de Wikipédia, l'encyclopédie libre.
Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/* Liste de suivi surgissant au survol du lien vers la liste de suivi, en développement */

var $ = jQuery;

function popupsuivi() {
	var bubble = $('<div></div>').attr('id', 'bubble');
	$('#pt-watchlist > a').hover(function() {
		$(this).css('text-decoration', 'none');
	});

	var bubbleContainer = $('<div></div>')
	.css('position', 'absolute')
	.css('top', '20px')
	.css('left', 0)
	.css('width', '100%')
	.css('z-index', '999999')
	.css('padding-top', '5px')
	.css('text-align', 'left')
	.hide();

	$.ajax({url: mw.config.get('wgArticlePath').replace('$1', 'Spécial:Liste de suivi'), cache: false, type: 'POST', cache: 'false', success: function(content) {
		content = content.split('</fieldset>')[1]
		.split('<div class="printfooter">')[0]
		.replace(/\(<a href="\/wiki\/Sp%C3%A9cial:Journal\/.*?; /g, '')
		.replace(/<h4>.*?<\/h4>/g, '')
		.replace(/ \. \./g, '')
		.replace(/(<\/table>|<\/li>)/g, '<br />')
		.replace(/&#160;/g, '')
		.replace(/; /g, '')
		.replace(/>discuter<\/a> \|/g, '>d</a> ·')
		.replace(/>contributions</g, '>c<')
		.replace(/>(diff|hist|c|d)</g, ' style="color: #477ACF">$1<')
		.replace(/class="mw-userlink">(.+?)</g, 'style="color: #477ACF" class="mw-userlink">$1<')
		.replace(/<(\/|)(table|tbody|tr|td|ul|li|img).*?>/g, '')
		.replace(/\((diff \| |)<a href="\/w\/(.+?)([0-9]{2}:[0-9]{2})/g, '<span style="color: grey" class="startGreySpan">$3 ($1<a href="/w/$2</span>')
		.replace(/a protégé «(.+?)» \[edit=autoconfirmed\]/g, 'a semi-protégé «$1»')
		.replace(' [edit=sysop]', '')
		.replace(/\)<\/span> a (semi-|)protégé « (.+?) »/, ')</span> a $1protégé $2')
		.replace(/ \[move=.+?\)/, '')
		.replace(/\n([0-9]{2}:[0-9]{2}.+?\).+?\))/g, '\n<span style="color: grey" class="startGreySpan">$1</span>')
		.replace(/ <span class=\'mw\-plusminus/g, '<span class=\'mw-plusminus');

		$('#pt-watchlist').append(bubbleContainer);
		$(bubbleContainer).append(bubble);

		bubble.css('background', 'white')
		.css('float', 'right')
		.css('display', 'inline-block')
		.css('box-shadow', '0 0 5px silver')
		.css('-moz-box-shadow', '0 0 5px silver')
		.css('-webkit-box-shadow', '0 0 5px silver')
		.css('font-size', '10px')
		.css('margin-right', '10px')
		.css('max-width', '600px')
		.css('max-height', ($(window).height() / 2.5) + 'px')
		.css('overflow-y', 'hidden')
		.css('white-space', 'normal')
		.html(content);
		
		if(mw.config.get('skin') == 'monobook') {
			bubbleContainer.css('top', '15px');
			$('#p-personal, #p-personal *').css('z-index', '999999');
		}
	}});

	$('#pt-watchlist').mouseover(function() {
		bubbleContainer.fadeIn('fast');
	});

	$('#pt-watchlist').mouseleave(function() {
		bubbleContainer.fadeOut('fast');
	});
}

addOnloadHook(popupsuivi);