diff --git a/package-lock.json b/package-lock.json index b22c27a..7b58211 100644 --- a/package-lock.json +++ b/package-lock.json @@ -589,6 +589,11 @@ "unpipe": "~1.0.0" } }, + "foreachasync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", + "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=" + }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -658,6 +663,18 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, + "handlebars": { + "version": "4.7.6", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", + "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "requires": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4", + "wordwrap": "^1.0.0" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -670,6 +687,15 @@ "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "dev": true }, + "hbs": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/hbs/-/hbs-4.1.1.tgz", + "integrity": "sha512-6QsbB4RwbpL4cb4DNyjEEPF+suwp+3yZqFVlhILEn92ScC0U4cDCR+FDX53jkfKJPhutcqhAvs+rOLZw5sQrDA==", + "requires": { + "handlebars": "4.7.6", + "walk": "2.3.14" + } + }, "http-cache-semantics": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", @@ -913,8 +939,7 @@ "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "ms": { "version": "2.0.0", @@ -926,6 +951,11 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, "nodemon": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", @@ -1293,6 +1323,11 @@ } } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -1421,6 +1456,12 @@ "is-typedarray": "^1.0.0" } }, + "uglify-js": { + "version": "3.12.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.5.tgz", + "integrity": "sha512-SgpgScL4T7Hj/w/GexjnBHi3Ien9WS1Rpfg5y91WXMj9SY997ZCQU76mH4TpLwwfmMvoOU8wiaRkIf6NaH3mtg==", + "optional": true + }, "undefsafe": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.3.tgz", @@ -1484,6 +1525,14 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, + "walk": { + "version": "2.3.14", + "resolved": "https://registry.npmjs.org/walk/-/walk-2.3.14.tgz", + "integrity": "sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==", + "requires": { + "foreachasync": "^3.0.0" + } + }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -1493,6 +1542,11 @@ "string-width": "^4.0.0" } }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index c2ebfa2..cfab4af 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "dependencies": { "bad-words": "^3.0.4", "express": "^4.17.1", + "hbs": "^4.1.1", "socket.io": "^3.1.0" }, "devDependencies": { diff --git a/public/css/styles.css b/public/css/styles.css index 36472d4..0dfbf19 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -90,21 +90,41 @@ button:disabled { } .chat__sidebar { - height: 100vh; + position: relative; + top: 51vh; + /* left: 1vh; */ + /* right: 1vh; */ + /* z-index: 2; */ + height: 49vh; color: rgb(223, 223, 223); background: #333744; - width: 225px; + width: 50%; overflow-y: scroll; scroll-behavior: smooth; } +/* embedded player div */ +.player { + position: absolute; + left: 1vh; + top: 1vh; + width: 49%; + height: 49%; + z-index: 1; + /* margin-top: 5px; */ + /* margin-left: 5px; */ +} + /* Chat styles */ .chat__main { + position: relative; flex-grow: 1; display: flex; flex-direction: column; - max-height: 100vh; + height: 100vh; + /* margin-left: 20vh; */ + background-color: rgb(233, 233, 233); } .chat__messages { diff --git a/public/index.html b/public/index.html index b9c8885..7530a82 100644 --- a/public/index.html +++ b/public/index.html @@ -17,17 +17,25 @@

Join

-
+ - - + +

or

- +
+ \ No newline at end of file diff --git a/public/js/chat.js b/public/js/chat.js index abc362b..76d68da 100644 --- a/public/js/chat.js +++ b/public/js/chat.js @@ -7,6 +7,8 @@ const input = form.childNodes[1]; const button = form.childNodes[3]; const messageContainer = document.querySelector('#messages-container'); const sidebarContainer = document.querySelector('.chat__sidebar'); +const changeVideoButton = document.querySelector('#changeVideo'); +const syncVideosButton = document.querySelector('#syncVideos'); // TEMPLATES const sidebarTemplate = `

{{room}}

@@ -38,7 +40,83 @@ const htmlTemplate = [ ]; let message = ''; -// let user = window.prompt('Please state your username', 'User'); +let videoId = ''; + +// YT PLAYER LOGIC + +// Load the IFrame Player API code asynchronously. +var tag = document.createElement('script'); +tag.src = 'https://www.youtube.com/player_api'; +var firstScriptTag = document.getElementsByTagName('script')[0]; +firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); + +// Replace the 'ytplayer' element with an