NetNewsWire/Shared/Article Rendering/page.html

36 lines
1.3 KiB
HTML
Raw Normal View History

<html>
<head>
<style>
</style>
<script>
2019-09-19 07:53:25 +02:00
function mouseDidEnterLink(anchor) {
window.webkit.messageHandlers.mouseDidEnter.postMessage(anchor.href);
}
2019-09-19 07:53:25 +02:00
function mouseDidExitLink(anchor) {
window.webkit.messageHandlers.mouseDidExit.postMessage(anchor.href);
}
function render(data) {
2019-09-21 02:28:13 +02:00
document.getElementsByTagName("style")[0].innerHTML = data.style;
document.body.innerHTML = data.body;
2019-09-19 07:53:25 +02:00
window.scrollTo(0, 0);
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
anchors[i].addEventListener("mouseenter", function() { mouseDidEnterLink(this) });
anchors[i].addEventListener("mouseleave", function() { mouseDidExitLink(this) });
}
2019-09-19 07:53:25 +02:00
document.getElementsByTagName("body")[0].querySelectorAll("style, link[rel=stylesheet]").forEach(element => element.remove());
document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => element.removeAttribute("style"));
}
2019-09-19 07:53:25 +02:00
function error() {
document.body.innerHTML = "error";
}
</script>
</head>
<body>
</body>
</html>