MediaWiki:Gadget-Tooltip.js: Difference between revisions

Kuhlau (talk | contribs)
No edit summary
Kuhlau (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
});
});


// Auto-positioning of floating tooltips, mainly for [[T:tt]]
// Auto-positioning of floating tooltips, on desktop/hoverable only (maybe need to refine by skin so that it matches the css?)
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
const supportsHover = window.matchMedia('(hover: hover)').matches;
mw.hook('wikipage.content').add((contents)=>{ // hydrate any content inserted
mw.hook('wikipage.content').add((contents)=>{ // hydrate any content inserted
if (contents instanceof Element || contents instanceof NodeList) {contents = $(contents);}
if (contents instanceof Element || contents instanceof NodeList) {contents = $(contents);}
Line 36: Line 38:
// T:Extra Effect's hover effect
// T:Extra Effect's hover effect
/* if (isEE) {
if (window.matchMedia('(hover: hover)').matches) {
popup.$element.find('.oo-ui-popupWidget-popup').toggleClass('hnaw-extra-effect', true);
let time;
let time;
$toggle.add(popup.$element).on('mouseover mouseout', (e) => {
$toggle.add(popup.$element).on('mouseover mouseout', (e) => {
Line 45: Line 46:
}, e.type==='mouseout' ? 250 : 0);
}, e.type==='mouseout' ? 250 : 0);
});
});
}*/
}
});
});
});
});
});
});