mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-19 13:02:55 +01:00
Inline videos and enable player controls for both Mac and iOS. Issue #1952
This commit is contained in:
parent
9a180bf083
commit
6d085fdacf
@ -45,6 +45,16 @@ function wrapTables() {
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
element.setAttribute("controls", true)
|
||||
});
|
||||
}
|
||||
|
||||
// Remove some children (currently just spans) from pre elements to work around a strange clipping issue
|
||||
var ElementUnwrapper = {
|
||||
unwrapSelector: "span",
|
||||
@ -120,6 +130,7 @@ function styleLocalFootnotes() {
|
||||
function processPage() {
|
||||
wrapFrames();
|
||||
wrapTables();
|
||||
inlineVideos();
|
||||
stripStyles();
|
||||
convertImgSrc();
|
||||
flattenPreElements();
|
||||
|
@ -130,19 +130,8 @@ function showClickedImage() {
|
||||
window.webkit.messageHandlers.imageWasShown.postMessage("");
|
||||
}
|
||||
|
||||
// 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)
|
||||
element.setAttribute("controls", true)
|
||||
});
|
||||
}
|
||||
|
||||
function postRenderProcessing() {
|
||||
ImageViewer.init();
|
||||
inlineVideos();
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
|
Loading…
Reference in New Issue
Block a user