mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Split Mac and iOS specific javascript into individual files.
This commit is contained in:
25
iOS/Resources/main_ios.js
Normal file
25
iOS/Resources/main_ios.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// Used to pop a resizable image view
|
||||
function imageWasClicked(img) {
|
||||
window.webkit.messageHandlers.imageWasClicked.postMessage(img.src);
|
||||
}
|
||||
|
||||
// Add the click listeners for images
|
||||
function imageClicks() {
|
||||
document.querySelectorAll("img").forEach(element => {
|
||||
element.addEventListener("click", function() { imageWasClicked(this) });
|
||||
});
|
||||
}
|
||||
|
||||
// Add the playsinline attribute to any HTML5 videos that don't have it.
|
||||
// Without this attribute videos may autoplay and take over the whole screen
|
||||
// on an iphone when viewing an article.
|
||||
function inlineVideos() {
|
||||
document.querySelectorAll("video").forEach(element => {
|
||||
element.setAttribute("playsinline", true)
|
||||
});
|
||||
}
|
||||
|
||||
function postRenderProcessing() {
|
||||
imageClicks()
|
||||
inlineVideos()
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
}
|
||||
</style>
|
||||
<script src="main.js"></script>
|
||||
<script src="main_ios.js"></script>
|
||||
<script src="newsfoot.js" async="async"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user