Created
April 14, 2021 02:51
-
-
Save t27/5d138a7154320167b21c6764fcf29666 to your computer and use it in GitHub Desktop.
Videos on HTML export not properly exported fix : Notion (from Reddit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks to u/IAmBeardPerson on https://www.reddit.com/r/Notion/comments/elh20k/videos_on_html_export_not_properly_exported_fix/ | |
<script> | |
var videos = document.getElementsByClassName("source"); | |
for (var i = 0; i < videos.length; i++) { | |
var source = videos[i].getElementsByTagName("a"); | |
if (source[0].href.includes("youtube")) { | |
var videoObject = document.createElement('iframe'); | |
videoObject.src = source[0].href.replace("watch?v=", "embed/"); | |
videos[i].style.padding = "0"; | |
videoObject.style.width = "100%"; | |
videos[i].append(videoObject); | |
source[0].remove(); | |
} else { | |
var videoObject = document.createElement('video'); | |
videos[i].style.padding = "0"; | |
videoObject.src = source[0].href; | |
videoObject.controls = true; | |
videoObject.style.width = "100%"; | |
videos[i].append(videoObject); | |
source[0].remove(); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment