diff --git a/index.html b/index.html index 910c9e5e..bd0029d8 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ + diff --git a/src/boot/after_store.js b/src/boot/after_store.js index d27d4fb8..f6c98386 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -209,7 +209,7 @@ const getTOS = async ({ store }) => { const getInstancePanel = async ({ store }) => { try { - const res = await preloadFetch('/instance/panel.html') + const res = await preloadFetch('/static/addons/panel.html') if (res.ok) { const html = await res.text() store.dispatch('setInstanceOption', { name: 'instanceSpecificPanelContent', value: html }) diff --git a/static/addons/panel.html b/static/addons/panel.html new file mode 100644 index 00000000..b8841b5c --- /dev/null +++ b/static/addons/panel.html @@ -0,0 +1,18 @@ +
+
+ Music Controls +
+
+ +
+
+
+
+
+
+
20%
+
+
diff --git a/static/addons/rot.css b/static/addons/rot.css new file mode 100644 index 00000000..2b5a8060 --- /dev/null +++ b/static/addons/rot.css @@ -0,0 +1,106 @@ +#music-controls { + padding: 15px; +} + +.music-controls-title { + text-align: left; + font-size: 18px; +} + +.mutebutton { + position: relative; + display: inline-block; + cursor: pointer; + padding: 5px 10px; + border-radius: var(--panelRadius); + transition: background-color 0.2s; +} + +.mutebutton input { + position: absolute; + opacity: 0; + cursor: pointer; + height: 0; + width: 0; +} + +.mutecheck { + display: inline-block; + width: 24px; + height: 24px; + vertical-align: middle; + padding: 5px; + border-radius: var(--btnRadius); +} + +/* SVG for unmuted state */ +.mutecheck::before { + content: ''; + display: inline-block; + width: 24px; + height: 24px; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23cdd6f4' d='M2.003 11.716c.037-1.843.056-2.764.668-3.552a3 3 0 0 1 .413-.431c.752-.636 1.746-.636 3.733-.636c.71 0 1.065 0 1.403-.092q.105-.03.209-.067c.33-.121.627-.33 1.22-.746c2.338-1.645 3.508-2.467 4.489-2.11c.188.069.37.168.533.29c.848.635.913 2.115 1.042 5.073c.048 1.096.08 2.034.08 2.555s-.032 1.46-.08 2.555c-.13 2.958-.194 4.438-1.042 5.073a2.1 2.1 0 0 1-.533.29c-.982.357-2.15-.465-4.49-2.11c-.592-.416-.889-.625-1.22-.746a3 3 0 0 0-.208-.067c-.338-.092-.693-.092-1.403-.092c-1.987 0-2.98 0-3.733-.636a3 3 0 0 1-.413-.43c-.612-.79-.63-1.71-.668-3.552a14 14 0 0 1 0-.57'/%3E%3Cpath fill='%23cdd6f4' fill-rule='evenodd' d='M19.49 5.552a.66.66 0 0 1 .97.094l-.529.471l.53-.47l.002.002l.003.004l.007.009l.079.112q.072.107.186.305c.149.264.339.652.526 1.171C21.64 8.291 22 9.851 22 12s-.36 3.71-.736 4.75c-.187.52-.377.907-.526 1.172a5 5 0 0 1-.265.417l-.007.009l-.003.003l-.001.002s-.001.001-.531-.47l.53.471a.66.66 0 0 1-.971.094a.77.77 0 0 1-.09-1.035l.03-.041q.04-.06.125-.207a6 6 0 0 0 .422-.943c.314-.871.644-2.253.644-4.222s-.33-3.35-.644-4.222a6 6 0 0 0-.422-.942a3 3 0 0 0-.157-.253m-1.641 1.833c.333-.197.753-.07.938.286l-.603.357l.603-.357l.001.002l.002.003l.003.007l.01.018l.024.053q.028.063.07.17c.053.145.12.35.185.62c.13.54.252 1.337.252 2.425c0 1.089-.122 1.886-.252 2.426c-.065.27-.132.475-.186.619a3 3 0 0 1-.094.223l-.009.018l-.003.007l-.002.003v.002s-.001.001-.604-.356l.603.357c-.185.355-.605.483-.938.286c-.33-.196-.45-.638-.272-.991l.004-.01l.035-.085c.032-.086.08-.23.13-.438c.1-.416.208-1.09.208-2.06c0-.971-.108-1.645-.208-2.06a4 4 0 0 0-.165-.524l-.004-.01a.76.76 0 0 1 .272-.991' clip-rule='evenodd'/%3E%3C/svg%3E"); + background-repeat: no-repeat; +} + +/* SVG for muted state */ +input:checked ~ .mutecheck::before { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23f38ba8' fill-rule='evenodd' d='M13.47 8.47a.75.75 0 0 1 1.06 0L17 10.94l2.47-2.47a.75.75 0 1 1 1.06 1.06L18.06 12l2.47 2.47a.75.75 0 0 1-1.06 1.06L17 13.06l-2.47 2.47a.75.75 0 0 1-1.06-1.06L15.94 12l-2.47-2.47a.75.75 0 0 1 0-1.06'/%3E%3Cpath fill='%23f38ba8' d='M3.681 8.164c-.621.788-.64 1.71-.678 3.552a14 14 0 0 0 0 .569c.038 1.842.057 2.763.678 3.551c.113.144.28.315.42.431c.763.636 1.771.636 3.788.636c.72 0 1.081 0 1.425.093q.107.029.211.066c.336.121.637.33 1.238.746c2.374 1.645 3.56 2.467 4.557 2.11a2.1 2.1 0 0 0 .541-.29c.786-.58.91-1.863 1.024-4.331l-1.294 1.294a2.25 2.25 0 1 1-3.182-3.182L13.818 12l-1.409-1.409a2.25 2.25 0 1 1 3.182-3.182l1.294 1.294c-.115-2.468-.238-3.751-1.024-4.331a2.1 2.1 0 0 0-.54-.29c-.997-.357-2.184.465-4.558 2.11c-.601.416-.902.625-1.238.746a3 3 0 0 1-.211.067c-.344.092-.704.092-1.425.092c-2.017 0-3.025 0-3.789.636c-.14.116-.306.287-.419.43'/%3E%3C/svg%3E"); +} + +input:checked ~ .mutecheck { + background: color-mix(in srgb, var(--cRed) 5%, transparent); +} + +.volume-slider { + position: relative; + display: inline-block; + width: 100%; + height: 24px; + margin: 0 10px; + vertical-align: middle; + cursor: pointer; +} + +.volume-track { + position: absolute; + top: 50%; + transform: translateY(-50%); + width: 100%; + height: 4px; + background-color: var(--btn); + border-radius: 2px; +} + +.volume-fill { + position: absolute; + height: 100%; + width: 20%; + background-color: var(--selectedMenuFaintLink); + border-radius: 2px; +} + +.volume-thumb { + position: absolute; + top: 50%; + left: 20%; + transform: translate(-50%, -50%); + width: 12px; + height: 12px; + background-color: var(--link); + border-radius: 50%; +} + +.audioControl { + border: 1.5px solid var(--icon); + border-radius: var(--panelRadius); + padding: 6px; + margin-top: 13px; + display: flex; + align-items: center; + gap: 2px; +} + +#user-audio-percentage { + margin-right: 10px; +} diff --git a/static/config.json b/static/config.json index b9aa3cbe..06762e80 100644 --- a/static/config.json +++ b/static/config.json @@ -18,7 +18,7 @@ "redirectRootLogin": "/main/friends", "redirectRootNoLogin": "/about", "showFeaturesPanel": true, - "showInstanceSpecificPanel": false, + "showInstanceSpecificPanel": true, "sidebarRight": false, "subjectLineBehavior": "email", "theme": "paw-catppuccin", diff --git a/static/js/rot.js b/static/js/rot.js index a6d33f31..0d487ba9 100644 --- a/static/js/rot.js +++ b/static/js/rot.js @@ -14,7 +14,7 @@ } // MIT Licensed - // Author: jwilson8767 + // Author: jwilson8767 [modified by @leafus@puppyspace.rog] function waitUntil(selector) { return new Promise((resolve, reject) => { const el = document.querySelector(selector); @@ -134,15 +134,15 @@ let p = pinnedPost.nextElementSibling; if (!p) return false; - + let statusBody = p.querySelector(".StatusBody"); if (!statusBody) return false; - + let txtElm = statusBody.querySelector(".text"); if (!txtElm) return false; - + if (txtElm.innerHTML.replace(/(<([^>]+)>)/ig, '').search(/profile them/ig) == -1) return false; @@ -253,15 +253,57 @@ audio.volume = 0.2; //Default volume //Initialize audio controls and event listeners - waitUntil("#music-controls").then((controls) => { - updateVolumeLabel(); - controls.querySelector("#music-up").onclick = () => volumeAdd(0.05); - controls.querySelector("#music-down").onclick = () => volumeAdd(-0.05); - }); + waitUntil("#music-up").then((btn) => btn.addEventListener('click', () => volumeAdd(0.05))); + waitUntil("#music-down").then((btn) => btn.addEventListener('click', () => volumeAdd(-0.05))); + waitUntil("#user-audio-percentage").then(updateVolumeLabel); - waitUntil("#music-slider").then((slider) => { - updateVolumeLabel(); - slider.oninput = () => volumeSet(slider.value / 100); + waitUntil(".volume-slider").then((slider) => { + const thumb = slider.querySelector('.volume-thumb'); + const fill = slider.querySelector('.volume-fill'); + let isDragging = false; + + function updateVolume(e) { + const rect = slider.getBoundingClientRect(); + let x = Math.max(0, Math.min(e.clientX - rect.left, rect.width)); + let percentage = (x / rect.width) * 100; + + // Update visual elements + thumb.style.left = `${percentage}%`; + fill.style.width = `${percentage}%`; + + // Update actual volume + volumeSet(percentage / 100); + } + + function onMouseDown(e) { + isDragging = true; + updateVolume(e); + document.addEventListener('mousemove', onMouseMove); + document.addEventListener('mouseup', onMouseUp); + } + + function onMouseMove(e) { + if (isDragging) { + updateVolume(e); + } + } + + function onMouseUp() { + isDragging = false; + document.removeEventListener('mousemove', onMouseMove); + document.removeEventListener('mouseup', onMouseUp); + } + + slider.addEventListener('mousedown', onMouseDown); + + // Update slider position when volume is changed through other means + const originalVolumeSet = volumeSet; + window.volumeSet = function(number) { + originalVolumeSet(number); + const percentage = number * 100; + thumb.style.left = `${percentage}%`; + fill.style.width = `${percentage}%`; + } }); waitUntil("#music-mute").then((box) => { @@ -291,4 +333,4 @@ addEventListener('popstate', updateRot); })(); -console.log("rot.js loaded"); \ No newline at end of file +console.log("rot.js loaded"); diff --git a/static/themes/paw-catppuccin.json b/static/themes/paw-catppuccin.json index e639107a..f214302f 100644 --- a/static/themes/paw-catppuccin.json +++ b/static/themes/paw-catppuccin.json @@ -212,7 +212,7 @@ "underlay": "#000000", "bg": "#1e1e2e", "fg": "#181825", - "cRed": "#eba0ac", + "cRed": "#f38ba8", "cGreen": "#a6e3a1", "cOrange": "#fab387", "cBlue": "#a6e3a1", @@ -546,7 +546,7 @@ "link": "#89b4fa", "accent": "#89b4fa", "cBlue": "#a6e3a1", - "cRed": "#eba0ac", + "cRed": "#f38ba8", "cGreen": "#a6e3a1", "cOrange": "#fab387", "border": "--fg,3",