├── LICENSE ├── assets ├── Video.mp4 ├── previewImgs │ ├── preview1.jpg │ ├── preview10.jpg │ ├── preview11.jpg │ ├── preview12.jpg │ ├── preview13.jpg │ ├── preview14.jpg │ ├── preview15.jpg │ ├── preview16.jpg │ ├── preview17.jpg │ ├── preview2.jpg │ ├── preview3.jpg │ ├── preview4.jpg │ ├── preview5.jpg │ ├── preview6.jpg │ ├── preview7.jpg │ ├── preview8.jpg │ └── preview9.jpg └── subtitles.vtt ├── index.html ├── script.js └── styles.css /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 WebDevSimplified 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /assets/Video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/Video.mp4 -------------------------------------------------------------------------------- /assets/previewImgs/preview1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview1.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview10.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview11.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview12.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview13.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview14.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview15.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview16.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview17.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview2.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview3.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview4.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview5.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview6.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview7.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview8.jpg -------------------------------------------------------------------------------- /assets/previewImgs/preview9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebDevSimplified/youtube-video-player-clone/be07cce284a9f1ad59730fe55ade558372659a61/assets/previewImgs/preview9.jpg -------------------------------------------------------------------------------- /assets/subtitles.vtt: -------------------------------------------------------------------------------- 1 | WEBVTT 2 | 3 | 1 4 | 00:00:00.000 --> 00:00:00.970 5 | - In the last video, 6 | 7 | 2 8 | 00:00:00.970 --> 00:00:02.660 9 | I talked all about the window object 10 | 11 | 3 12 | 00:00:02.660 --> 00:00:04.680 13 | and how you can pretty much 14 | just ignore it completely. 15 | 16 | 4 17 | 00:00:04.680 --> 00:00:05.520 18 | And in this video, 19 | 20 | 5 21 | 00:00:05.520 --> 00:00:07.220 22 | we wanna talk about the document object, 23 | 24 | 6 25 | 00:00:07.220 --> 00:00:10.060 26 | which is incredibly useful 27 | all across programming 28 | 29 | 7 30 | 00:00:10.060 --> 00:00:11.230 31 | in the browser. 32 | 33 | 8 34 | 00:00:11.230 --> 00:00:13.313 35 | So to see exactly what 36 | this document object is, 37 | 38 | 9 39 | 00:00:13.313 --> 00:00:16.017 40 | let's just console.log out document, 41 | 42 | 10 43 | 00:00:16.017 --> 00:00:17.820 44 | and we just type in document. 45 | 46 | 11 47 | 00:00:17.820 --> 00:00:20.824 48 | This is exactly the same as 49 | if we typed window.document. 50 | 51 | 12 52 | 00:00:20.824 --> 00:00:23.950 53 | They're both the same thing we 54 | can just use document though, 55 | 56 | 13 57 | 00:00:23.950 --> 00:00:26.510 58 | or window.document it's going 59 | to print the same thing. 60 | 61 | 14 62 | 00:00:26.510 --> 00:00:27.343 63 | As you can see, 64 | 65 | 15 66 | 00:00:27.343 --> 00:00:29.298 67 | it prints out this weird 68 | like hashtag document. 69 | 70 | 16 71 | 00:00:29.298 --> 00:00:30.311 72 | And when we open this up, 73 | 74 | 17 75 | 00:00:30.311 --> 00:00:31.630 76 | you're gonna see document 77 | 78 | 18 79 | 00:00:31.630 --> 00:00:34.370 80 | is essentially just all 81 | of the html for our page. 82 | 83 | 19 84 | 00:00:34.370 --> 00:00:36.800 85 | You can see this is the exact HTML 86 | 87 | 20 88 | 00:00:36.800 --> 00:00:39.860 89 | of our entire page from 90 | this index.html here. 91 | 92 | 21 93 | 00:00:39.860 --> 00:00:42.463 94 | So it's printing out the HML of our page 95 | 96 | 22 97 | 00:00:42.463 --> 00:00:43.479 98 | and that's really useful 99 | 100 | 23 101 | 00:00:43.479 --> 00:00:45.900 102 | because the document 103 | allows us to get elements 104 | 105 | 24 106 | 00:00:45.900 --> 00:00:46.733 107 | from our HTML. 108 | 109 | 25 110 | 00:00:46.733 --> 00:00:48.660 111 | It allows us to modify our HTML, 112 | 113 | 26 114 | 00:00:48.660 --> 00:00:50.658 115 | create new elements to add into our HTML. 116 | 117 | 27 118 | 00:00:50.658 --> 00:00:54.375 119 | It's really the way you interact 120 | with the HTML of your page. 121 | 122 | 28 123 | 00:00:54.375 --> 00:00:56.450 124 | So for example, if we wanna get the body, 125 | 126 | 29 127 | 00:00:56.450 --> 00:00:58.157 128 | we could say document.body, 129 | 130 | 30 131 | 00:00:58.157 --> 00:00:59.620 132 | and this is going to give us 133 | 134 | 31 135 | 00:00:59.620 --> 00:01:01.493 136 | that body element of our document. 137 | 138 | 32 139 | 00:01:01.493 --> 00:01:04.620 140 | We could also get for 141 | example, document element, 142 | 143 | 33 144 | 00:01:04.620 --> 00:01:06.925 145 | and this is going to give 146 | us just the HTML portion 147 | 148 | 34 149 | 00:01:06.925 --> 00:01:08.047 150 | of our document. 151 | 152 | 35 153 | 00:01:08.047 --> 00:01:10.990 154 | You can notice when we 155 | had just document here, 156 | 157 | 36 158 | 00:01:10.990 --> 00:01:12.586 159 | it also gave us this doc type at the top, 160 | 161 | 37 162 | 00:01:12.586 --> 00:01:14.728 163 | but if we just wanna get the HTML element 164 | 165 | 38 166 | 00:01:14.728 --> 00:01:16.530 167 | and everything inside of it, 168 | 169 | 39 170 | 00:01:16.530 --> 00:01:18.774 171 | that's what document 172 | element is used for it. 173 | 174 | 40 175 | 00:01:18.774 --> 00:01:21.350 176 | Now, I also mentioned that 177 | you can create elements 178 | 179 | 41 180 | 00:01:21.350 --> 00:01:23.730 181 | with document.create element. 182 | 183 | 42 184 | 00:01:23.730 --> 00:01:24.563 185 | So let's just come in here 186 | 187 | 43 188 | 00:01:24.563 --> 00:01:26.035 189 | and we're gonna create a new element 190 | 191 | 44 192 | 00:01:26.035 --> 00:01:29.101 193 | and we're gonna set it equal 194 | to document.create element. 195 | 196 | 45 197 | 00:01:29.101 --> 00:01:30.410 198 | And this is a function. 199 | 200 | 46 201 | 00:01:30.410 --> 00:01:31.709 202 | And all you do is pass 203 | the name of the tag. 204 | 205 | 47 206 | 00:01:31.709 --> 00:01:33.777 207 | So you can create, for example, a div 208 | 209 | 48 210 | 00:01:33.777 --> 00:01:35.738 211 | or you can create a span, 212 | whatever you want to create. 213 | 214 | 49 215 | 00:01:35.738 --> 00:01:37.883 216 | We'll just create a 217 | span here, for example. 218 | 219 | 50 220 | 00:01:37.883 --> 00:01:39.862 221 | And then we can take our element. 222 | 223 | 51 224 | 00:01:39.862 --> 00:01:42.130 225 | And if we wanna put some 226 | text inside of this, 227 | 228 | 52 229 | 00:01:42.130 --> 00:01:43.569 230 | we'll say dot innertext, 231 | 232 | 53 233 | 00:01:43.569 --> 00:01:45.568 234 | 'cause now we have access to an element 235 | 236 | 54 237 | 00:01:45.568 --> 00:01:47.363 238 | and to specify the 239 | texts we say, innertext, 240 | 241 | 55 242 | 00:01:47.363 --> 00:01:50.570 243 | and we'll just set it 244 | equal to Hello World. 245 | 246 | 56 247 | 00:01:50.570 --> 00:01:53.140 248 | And now we just wanna add 249 | that to our document body. 250 | 251 | 57 252 | 00:01:53.140 --> 00:01:55.489 253 | So we can say document.body, 254 | 255 | 58 256 | 00:01:55.489 --> 00:01:57.330 257 | 'cause this is where 258 | we're gonna add this too. 259 | 260 | 59 261 | 00:01:57.330 --> 00:01:58.880 262 | We could say dot appendchild 263 | 264 | 60 265 | 00:01:58.880 --> 00:02:01.810 266 | and we pass in the element we want to add, 267 | 268 | 61 269 | 00:02:01.810 --> 00:02:03.397 270 | which in our case is this 271 | element we just created. 272 | 273 | 62 274 | 00:02:03.397 --> 00:02:06.350 275 | We're going to append it 276 | to the end of the body 277 | 278 | 63 279 | 00:02:06.350 --> 00:02:07.480 280 | of our document. 281 | 282 | 64 283 | 00:02:07.480 --> 00:02:08.312 284 | We click save. 285 | 286 | 65 287 | 00:02:08.312 --> 00:02:09.458 288 | You'll notice nothing gets printed out, 289 | 290 | 66 291 | 00:02:09.458 --> 00:02:11.410 292 | but if I pull over the page, 293 | 294 | 67 295 | 00:02:11.410 --> 00:02:12.820 296 | you'll see that Hello 297 | World has been appended 298 | 299 | 68 300 | 00:02:12.820 --> 00:02:14.930 301 | to the end of our document. 302 | 303 | 69 304 | 00:02:14.930 --> 00:02:15.763 305 | If I just shrink this down, 306 | 307 | 70 308 | 00:02:15.763 --> 00:02:16.930 309 | so it's on the right side of our screen. 310 | 311 | 71 312 | 00:02:16.930 --> 00:02:19.216 313 | And I changed this to like, 314 | Hello World 2 and save. 315 | 316 | 72 317 | 00:02:19.216 --> 00:02:21.643 318 | You can now see it reruns 319 | and re-adds this element 320 | 321 | 73 322 | 00:02:21.643 --> 00:02:23.523 323 | with the text, Hello World 2. 324 | 325 | 74 326 | 00:02:23.523 --> 00:02:25.173 327 | So this document is super powerful 328 | 329 | 75 330 | 00:02:25.173 --> 00:02:27.730 331 | and is really the gateway into interacting 332 | 333 | 76 334 | 00:02:27.730 --> 00:02:29.660 335 | with everything inside of our browser, 336 | 337 | 77 338 | 00:02:29.660 --> 00:02:31.530 339 | creating elements, selecting elements, 340 | 341 | 78 342 | 00:02:31.530 --> 00:02:33.360 343 | adding events, modifying things, 344 | 345 | 79 346 | 00:02:33.360 --> 00:02:35.582 347 | it's all done through 348 | this document object here. 349 | 350 | 80 351 | 00:02:35.582 --> 00:02:37.010 352 | And in the next few videos, 353 | 354 | 81 355 | 00:02:37.010 --> 00:02:38.450 356 | I'm gonna explore all the different ways 357 | 358 | 82 359 | 00:02:38.450 --> 00:02:40.670 360 | you can use this document 361 | object in more depth, 362 | 363 | 83 364 | 00:02:40.670 --> 00:02:41.824 365 | but this video was really just a precursor 366 | 367 | 84 368 | 00:02:41.824 --> 00:02:43.639 369 | to what the document object is 370 | 371 | 85 372 | 00:02:43.639 --> 00:02:46.870 373 | and how you can use it to 374 | just create a simple element. 375 | 376 | 86 377 | 00:02:46.870 --> 00:02:47.703 378 | So in the next video, 379 | 380 | 87 381 | 00:02:47.703 --> 00:02:49.410 382 | I'm gonna show you how you 383 | can select elements using 384 | 385 | 88 386 | 00:02:49.410 --> 00:02:52.220 387 | their ID and their class 388 | with this document object. 389 | 390 | 89 391 | 00:02:52.220 --> 00:02:54.320 392 | And I can't wait to see you in that video. 393 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 |