From 09364896bebbdaf158a640f93fb80af05d37ee0d Mon Sep 17 00:00:00 2001 From: waveringana Date: Fri, 5 Jan 2024 13:20:17 -0500 Subject: [PATCH] refactor index.js slightly, clean out base.css --- app/public/css/base.css | 137 +--------------------------------------- app/public/js/index.js | 27 +++----- 2 files changed, 10 insertions(+), 154 deletions(-) diff --git a/app/public/css/base.css b/app/public/css/base.css index da65968..cc1a4d4 100644 --- a/app/public/css/base.css +++ b/app/public/css/base.css @@ -3,139 +3,4 @@ hr { border: 0; border-top: 1px dashed #c5c5c5; border-bottom: 1px dashed #f7f7f7; -} - -.learn a { - font-weight: normal; - text-decoration: none; - color: #b83f45; -} - -.learn a:hover { - text-decoration: underline; - color: #787e7e; -} - -.learn h3, -.learn h4, -.learn h5 { - margin: 10px 0; - font-weight: 500; - line-height: 1.2; - color: #000; -} - -.learn h3 { - font-size: 24px; -} - -.learn h4 { - font-size: 18px; -} - -.learn h5 { - margin-bottom: 0; - font-size: 14px; -} - -.learn ul { - padding: 0; - margin: 0 0 30px 25px; -} - -.learn li { - line-height: 20px; -} - -.learn p { - font-size: 15px; - font-weight: 300; - line-height: 1.3; - margin-top: 0; - margin-bottom: 0; -} - -#issue-count { - display: none; -} - -.quote { - border: none; - margin: 20px 0 60px 0; -} - -.quote p { - font-style: italic; -} - -.quote p:before { - content: '“'; - font-size: 50px; - opacity: .15; - position: absolute; - top: -20px; - left: 3px; -} - -.quote p:after { - content: '”'; - font-size: 50px; - opacity: .15; - position: absolute; - bottom: -42px; - right: 3px; -} - -.quote footer { - position: absolute; - bottom: -40px; - right: 0; -} - -.quote footer img { - border-radius: 3px; -} - -.quote footer a { - margin-left: 5px; - vertical-align: middle; -} - -.speech-bubble { - position: relative; - padding: 10px; - background: rgba(0, 0, 0, .04); - border-radius: 5px; -} - -.speech-bubble:after { - content: ''; - position: absolute; - top: 100%; - right: 30px; - border: 13px solid transparent; - border-top-color: rgba(0, 0, 0, .04); -} - -.learn-bar > .learn { - position: absolute; - width: 272px; - top: 8px; - left: -300px; - padding: 10px; - border-radius: 5px; - background-color: rgba(255, 255, 255, .6); - transition-property: left; - transition-duration: 500ms; -} - -@media (min-width: 899px) { - .learn-bar { - width: auto; - padding-left: 300px; - } - - .learn-bar > .learn { - left: 8px; - } -} +} \ No newline at end of file diff --git a/app/public/js/index.js b/app/public/js/index.js index 31d15fe..b015cd3 100644 --- a/app/public/js/index.js +++ b/app/public/js/index.js @@ -1,4 +1,3 @@ -/* eslint no-use-before-define: 0 */ /* eslint-env browser: true */ let newMediaList; @@ -31,11 +30,9 @@ function copyURI(evt) { .writeText(absolutePath(evt.target.getAttribute("src"))) .then( () => { - /* clipboard successfully set */ console.log("copied"); }, () => { - /* clipboard write failed */ console.log("failed"); } ); @@ -189,17 +186,11 @@ function openFullSize(imageUrl) { video.controls = true; if ( - extension(imageUrl) == ".jpg" || - extension(imageUrl) == ".png" || - extension(imageUrl) == ".gif" || - extension(imageUrl) == ".jpeg" || - extension(imageUrl) == ".webp" + imageExtensions.includes(extension(imageUrl)) ) { modal.appendChild(img); } else if ( - extension(imageUrl) == ".mp4" || - extension(imageUrl) == ".webm" || - extension(imageUrl) == ".mov" + videoExtensions.includes(extension(imageUrl)) ) { modal.appendChild(video); } @@ -254,19 +245,19 @@ function checkFileAvailability(filePath) { .then((response) => { if (response.ok) { console.log(`${filePath} still processing`); - return response.json(); - } else { + return response.json().then(json => { + document.getElementById(`spinner-${filePath}`).innerText = `Optimizing Video for Sharing: ${p(json.progress)} done`; + return response; + }) + } else if (response.status === 404) { console.log(`${filePath} finished processing`); console.log(`/uploads/720p-${filePath}-progress.json finished`); clearInterval(interval); createVideoElement(filePath); - return; + } else { + throw new Error(`HTTP error: Status code ${response.status}`); } }) - .then((jsonData) => { - console.log(jsonData); - document.getElementById(`spinner-${filePath}`).innerText = `Optimizing Video for Sharing: ${p(jsonData.progress)} done`; - }) .catch((error) => console.error("Error:", error)); };