1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-08 23:39:46 +01:00

post-hover.js: enable only if the device supports hovering

This commit is contained in:
Zankaria 2025-01-03 16:12:59 +01:00 committed by Zankaria
parent 6b3e578013
commit dffc22ddf3

View File

@ -13,6 +13,12 @@
* *
*/ */
/*
* Unknown media types always return false, so old browsers (css media 3 or prior to css media) which do support
* any-hover or css media queries may return false negatives.
* Handle it by checking if the query is explicitly NOT supported.
*/
if (!window.matchMedia('(any-hover: none)').matches) {
onReady(function() { onReady(function() {
let dontFetchAgain = []; let dontFetchAgain = [];
initHover = function() { initHover = function() {
@ -175,3 +181,4 @@ onReady(function() {
$(post).find('div.body a:not([rel="nofollow"])').each(initHover); $(post).find('div.body a:not([rel="nofollow"])').each(initHover);
}); });
}); });
}