Enhanced word highlight

Enhanced keywords highlight for Search Engines and All !

< Feedback on Enhanced word highlight

Review: Good - script works

§
Posted: 13-04-2022

在Edge上使用,滚轮无法切换高亮项目,在Firefox上没问题

YFdyh000Tác giả
§
Posted: 13-04-2022

原作者 @hzhbest

https://developer.mozilla.org/zh-CN/docs/Web/API/MouseScrollEvent 过时了。wheel 我试了试,Firefox中正常,Edge中谷歌上有效果但有画面弹跳,百度上无效果。

  // https://stackoverflow.com/a/32215631/2755602
  var wheelEvt = "onwheel" in document.createElement("div") ? "wheel" : //     Modern browsers support "wheel"
  document.onmousewheel !== undefined ? "mousewheel" : // Webkit and IE support at least "mousewheel"
  "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox

  label.addEventListener(wheelEvt, function(evt){
                evt.preventDefault();
                if (words_off[_i]) return;
                var layers = xp.get();
                ct = (-evt.deltaY);
                ct < 0 ? next(_i+1,layers) : prev(_i+1,layers);
                return false; //?
            }, false);
§
Posted: 01-02-2023

非常让人无语的事情:在Firefox中,阻断滚轮事件的语句对于任意节点是有效的,而在Chorme里,阻断语句不能用于label 节点,我服了……
下一版更新解决这问题

Post reply

Đăng nhập để bình luận