mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 16:51:19 +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
|
// Remove some children (currently just spans) from pre elements to work around a strange clipping issue
|
||||||
var ElementUnwrapper = {
|
var ElementUnwrapper = {
|
||||||
unwrapSelector: "span",
|
unwrapSelector: "span",
|
||||||
@ -120,6 +130,7 @@ function styleLocalFootnotes() {
|
|||||||
function processPage() {
|
function processPage() {
|
||||||
wrapFrames();
|
wrapFrames();
|
||||||
wrapTables();
|
wrapTables();
|
||||||
|
inlineVideos();
|
||||||
stripStyles();
|
stripStyles();
|
||||||
convertImgSrc();
|
convertImgSrc();
|
||||||
flattenPreElements();
|
flattenPreElements();
|
||||||
|
@ -130,19 +130,8 @@ function showClickedImage() {
|
|||||||
window.webkit.messageHandlers.imageWasShown.postMessage("");
|
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() {
|
function postRenderProcessing() {
|
||||||
ImageViewer.init();
|
ImageViewer.init();
|
||||||
inlineVideos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', (event) => {
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user