Explorar o código

Add a bit of style to lecture page.

Lee Morgan %!s(int64=5) %!d(string=hai) anos
pai
achega
203b5818be
Modificáronse 2 ficheiros con 25 adicións e 3 borrados
  1. 11 0
      views/learn/index.css
  2. 14 3
      views/learn/lecture.html

+ 11 - 0
views/learn/index.css

@@ -2,6 +2,7 @@
 
 body{
     background: rgb(196, 198, 192);
+    padding: 25px;
 }
 
 h1{
@@ -48,4 +49,14 @@ h1{
         text-align:center;
         width: 75%;
         margin: auto;
+    }
+
+#lectureBody{
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+}
+
+    iframe{
+        margin: 50px;
     }

+ 14 - 3
views/learn/lecture.html

@@ -5,7 +5,7 @@
         <title>Lee Morgan -lecture-</title>
         <link rel="stylesheet" href="/learn/style">
     </head>
-    <body>
+    <body id="lectureBody">
         <h1 id="title"></h1>
 
         <h3 id="course"></h3>
@@ -23,8 +23,18 @@
         <ol id="exercises">
             <h2>Exercises</h2>
         </ol>
-
+        
         <script>
+            let video = document.getElementById("video");
+
+            let sizeIframe = ()=>{
+                let width = document.getElementById("lectureBody").clientWidth;
+                let multiplier = (width * 0.9) / video.contentWindow.document.body.scrollWidth;
+                video.width = video.contentWindow.document.body.scrollWidth * multiplier;
+                video.height = video.contentWindow.document.body.scrollHeight * multiplier;
+            }
+
+            video.onload = sizeIframe();
             let id = window.location.href.split("/");
             id = id[id.length-1];
 
@@ -34,7 +44,8 @@
                     document.getElementById("title").innerText = response.title;
                     document.getElementById("course").innerText = response.course.title;
                     document.getElementById("date").innerText = response.date;
-                    document.getElementById("video").src = response.video;
+                    video.src = response.video;
+                    // video.src = "https://rumble.com/embed/vg8er5/?pub=n4vcr";
                     document.getElementById("description").innerText = response.description;
                     
                     let documents = document.getElementById("documents");