מדיה ויקי:Gadget-CiteTooltip.js: הבדלים בין גרסאות בדף

מתוך צפונות ויקי
מ (עיצוב)
שורה 1: שורה 1:
if (wgAction == 'view')
if (wgAction == 'view')
mw.loader.using('jquery.tipsy', function() {
mw.loader.using('jquery.tipsy', function() {
var  
var
createHint = function() {
createHint = function() {
var elem = $($.escapeRE(this.href.replace(/.*#/, '#')));
var elem = $($.escapeRE(this.href.replace(/.*#/, '#'))),
if (elem.css('direction') == 'ltr')
html = elem.html(),
//tipsy forces text-align, so class itself is not enough
ltr = elem.css('direction') == 'ltr',
return '<div class="mw-content-ltr" style="text-align:left">' + elem.html() + '</div>';
divClass = ltr ? 'class="mw-content-ltr"' : '',
else
divCss = 'style="word-wrap:break-word;' + (ltr ? 'text-align:left;' : '') + '"';
return elem.html();
if (html)
return '<div ' + divClass + divCss + '>' + html + '</div>';
return '';
},
},
gravity = function() {
gravity = function() {
var loc =  
var loc =
($(this).offset().top > ($(document).scrollTop() + $(window).height() - 120) ? 's' : 'n') +
($(this).offset().top > ($(document).scrollTop() + $(window).height() - 120) ? 's' : 'n') +
($(this).offset().left > ($(document).scrollLeft() + $(window).width() / 4) ? '' : 'w');
($(this).offset().left > ($(document).scrollLeft() + $(window).width() / 4) ? '' : 'w');
שורה 17: שורה 19:
},
},
tipsyParams = {html: true, delayOut: 1500, delayIn: 300, fade: true, opacity: 1, gravity: gravity, title: createHint};
tipsyParams = {html: true, delayOut: 1500, delayIn: 300, fade: true, opacity: 1, gravity: gravity, title: createHint};
 
$(function() {$('sup.reference a').tipsy(tipsyParams);});
$(function() {$('sup.reference a').tipsy(tipsyParams);});
});
});

גרסה מ־18:28, 19 בפברואר 2012

if (wgAction == 'view')
mw.loader.using('jquery.tipsy', function() {
	var
		createHint = function() {
			var elem = $($.escapeRE(this.href.replace(/.*#/, '#'))),
				html = elem.html(),
				ltr = elem.css('direction') == 'ltr',
				divClass = ltr ? 'class="mw-content-ltr"' : '',
				divCss = 'style="word-wrap:break-word;' + (ltr ? 'text-align:left;' : '') + '"';
			if (html)
				return '<div ' + divClass + divCss + '>' + html + '</div>';
			return '';
		},
		gravity = function() {
			var loc =
				($(this).offset().top > ($(document).scrollTop() + $(window).height() - 120) ? 's' : 'n') +
				($(this).offset().left > ($(document).scrollLeft() + $(window).width() / 4) ? '' : 'w');
			return loc;
		},
		tipsyParams = {html: true, delayOut: 1500, delayIn: 300, fade: true, opacity: 1, gravity: gravity, title: createHint};

	$(function() {$('sup.reference a').tipsy(tipsyParams);});
});