Skip to content
This repository was archived by the owner on Jun 13, 2022. It is now read-only.

Commit ea1d582

Browse files
authored
Merge pull request #48 from karx1/dev
#46 - FIX: Wrap images in video-container
2 parents 8b58e3a + da20e08 commit ea1d582

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

notes/static/js/resources.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ if (!String.prototype.includes) {
2323
// Polyfill HTMLCollection.forEach from Array.forEach
2424
if (!HTMLCollection.prototype.forEach) HTMLCollection.prototype.forEach = Array.prototype.forEach;
2525

26-
// Gather all video frames
27-
const frames = document.getElementsByTagName("IFRAME");
2826

29-
// Loop over each frame we got
27+
// List of elements to work on. To add new types of elements, just add mroe tag names to this array.
28+
const elements = ["IFRAME", "IMG"];
29+
let frames = [];
30+
31+
// Grab all the elements
32+
elements.forEach((element) => {
33+
frames = frames.concat(Array.from(document.getElementsByTagName(element)));
34+
});
35+
36+
// Apply our modifications
3037
frames.forEach((frame) => {
3138
// Get the frame's parent
3239
let parent = frame.parentNode;

0 commit comments

Comments
 (0)