commit e6217bbd87be1d88a1d6c3fe7a0d9239b4cc28aa
parent c2494fa498bd2644ec1d23a3001f95152ce719d4
Author: corndog <cauchyn@firemail.cc>
Date: Tue, 14 May 2019 20:53:50 -0700
Setup iframe only after we're sure its needed.
Minor optimization
Diffstat:
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/in/me/index.md b/in/me/index.md
@@ -5,13 +5,13 @@ tags: prose
<script>
function toggleYT(id) {
const url = "https://www.youtube.com/embed/" + id;
- const iframe = document.createElement('iframe');
- iframe.setAttribute("src", url);
- iframe.setAttribute("allow", "encrypted-media");
- iframe.setAttribute("allow", "fullscreen");
- iframe.setAttribute("allowfullscreen", true);
const div = document.getElementById(id);
if (!div.hasChildNodes()) {
+ const iframe = document.createElement('iframe');
+ iframe.setAttribute("src", url);
+ iframe.setAttribute("allow", "encrypted-media");
+ iframe.setAttribute("allow", "fullscreen");
+ iframe.setAttribute("allowfullscreen", true);
div.appendChild(iframe);
div.style.paddingBottom = "56.25%";
} else {