מדיה ויקי:Gadget-CiteTooltip.js: הבדלים בין גרסאות בדף
מ (עיצוב) |
(←using [[mw:CodeEditor|CodeEditor]]: force break.) |
||
שורה 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(/.*#/, '#'))), | ||
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() { | 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);});
});