MediaWiki:Gadget-Tooltip.js: Difference between revisions
No edit summary Tags: Mobile edit Mobile web edit |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
}); | }); | ||
// Auto-positioning of floating tooltips, on desktop | // Auto-positioning of floating tooltips, on desktop only | ||
if (mw.config.get('skin') !== 'minerva') { | if (mw.config.get('skin') !== 'minerva') { | ||
mw.loader.using('oojs-ui-widgets').then(() => { // make sure the PopupWidget library is loaded | mw.loader.using('oojs-ui-widgets').then(() => { // make sure the PopupWidget library is loaded | ||
| Line 24: | Line 24: | ||
popup = new OO.ui.PopupWidget({ | popup = new OO.ui.PopupWidget({ | ||
$content: $('<div>', { html: $content.html() }), | $content: $('<div>', { html: $content.html() }), | ||
$container: $(' | $container: $('body'), | ||
$floatableContainer: $toggle, | |||
anchor: true, // !isEE | anchor: true, // !isEE | ||
}); | }); | ||
| Line 34: | Line 35: | ||
// [[T:Tt]]'s toggle effect | // [[T:Tt]]'s toggle effect | ||
$ | $(document.body).append(popup.$element); | ||
$toggle.on('click', ()=> { popup.toggle() }); | $toggle.on('click', ()=> { popup.toggle() }); | ||
// T:Extra Effect's hover effect | // T:Extra Effect's hover effect | ||
let time; | let time; | ||
$ | $wrapper.add(popup.$element).on('mouseover mouseout', (e) => { | ||
if (time) { clearTimeout(time); } | if (time) { clearTimeout(time); } | ||
time = setTimeout(()=>{ | time = setTimeout(()=>{ | ||