Split Mac and iOS specific javascript into individual files.

This commit is contained in:
Maurice Parker
2019-10-13 15:47:11 -05:00
parent bb31c913e4
commit a1f26898c8
6 changed files with 56 additions and 41 deletions

View File

@@ -0,0 +1,19 @@
// These mouse functions are used by NetNewsWire for Mac to display link previews
function mouseDidEnterLink(anchor) {
window.webkit.messageHandlers.mouseDidEnter.postMessage(anchor.href);
}
function mouseDidExitLink(anchor) {
window.webkit.messageHandlers.mouseDidExit.postMessage(anchor.href);
}
// Add the mouse listeners for the above functions
function linkHover() {
document.querySelectorAll("a").forEach(element => {
element.addEventListener("mouseenter", function() { mouseDidEnterLink(this) });
element.addEventListener("mouseleave", function() { mouseDidExitLink(this) });
});
}
function postRenderProcessing() {
linkHover()
}