mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-12 21:27:39 +02:00
7.0: ui refresh and more
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
--without-padding: calc(100% - 4rem);
|
||||
--border-15: 0.15rem solid var(--accent);
|
||||
--border-10: 0.1rem solid var(--accent);
|
||||
--inset-focus: 0 0 0 0.1rem var(--accent) inset;
|
||||
--inset-focus-inv: 0 0 0 0.15rem var(--background) inset;
|
||||
--font-mono: 'Noto Sans Mono', 'Consolas', 'SF Mono', monospace;
|
||||
--padding-1: 0.75rem;
|
||||
--line-height: 1.65rem;
|
||||
@ -20,6 +22,7 @@
|
||||
--accent-button: rgb(25, 25, 25);
|
||||
--accent-button-elevated: rgb(42, 42, 42);
|
||||
--glass: rgba(25, 25, 25, 0.85);
|
||||
--glass-lite: rgba(25, 25, 25, 0.98);
|
||||
--subbackground: rgb(10, 10, 10);
|
||||
--background: rgb(0, 0, 0);
|
||||
}
|
||||
@ -34,6 +37,7 @@
|
||||
--accent-button: rgb(225, 225, 225);
|
||||
--accent-button-elevated: rgb(210, 210, 210);
|
||||
--glass: rgba(230, 230, 230, 0.85);
|
||||
--glass-lite: rgba(230, 230, 230, 0.98);
|
||||
--subbackground: rgb(240, 240, 240);
|
||||
--background: rgb(255, 255, 255);
|
||||
}
|
||||
@ -47,6 +51,7 @@
|
||||
--accent-button: rgb(25, 25, 25);
|
||||
--accent-button-elevated: rgb(42, 42, 42);
|
||||
--glass: rgba(25, 25, 25, 0.85);
|
||||
--glass-lite: rgba(25, 25, 25, 0.98);
|
||||
--subbackground: rgb(10, 10, 10);
|
||||
--background: rgb(0, 0, 0);
|
||||
}
|
||||
@ -59,6 +64,7 @@
|
||||
--accent-button: rgb(225, 225, 225);
|
||||
--accent-button-elevated: rgb(210, 210, 210);
|
||||
--glass: rgba(230, 230, 230, 0.85);
|
||||
--glass-lite: rgba(230, 230, 230, 0.98);
|
||||
--subbackground: rgb(240, 240, 240);
|
||||
--background: rgb(255, 255, 255);
|
||||
}
|
||||
@ -74,6 +80,12 @@ body {
|
||||
overflow: hidden;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
height: calc(100% + env(safe-area-inset-top)/2);
|
||||
}
|
||||
#home {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
a {
|
||||
color: var(--accent);
|
||||
@ -150,12 +162,17 @@ input[type="text"],
|
||||
[type="text"] {
|
||||
border-radius: 0;
|
||||
}
|
||||
.glass-bkg {
|
||||
background: var(--glass);
|
||||
backdrop-filter: blur(7px);
|
||||
-webkit-backdrop-filter: blur(7px);
|
||||
}
|
||||
.desktop button:hover,
|
||||
.desktop .switch:hover,
|
||||
.desktop .checkbox:hover,
|
||||
.desktop .text-to-copy:hover,
|
||||
.desktop .collapse-header:hover,
|
||||
.desktop #close-button:hover {
|
||||
.desktop #back-button:hover {
|
||||
background: var(--accent-hover);
|
||||
box-shadow: 0 0 0 0.1rem var(--accent-highlight) inset;
|
||||
cursor: pointer;
|
||||
@ -243,7 +260,7 @@ button:active,
|
||||
}
|
||||
.box {
|
||||
background: var(--background);
|
||||
border: var(--border-15);
|
||||
border: var(--glass) solid .2rem;
|
||||
color: var(--accent);
|
||||
}
|
||||
#url-input-area {
|
||||
@ -284,13 +301,14 @@ button:active,
|
||||
cursor: not-allowed;
|
||||
}
|
||||
#footer {
|
||||
bottom: 0.8rem;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 2rem);
|
||||
font-size: 0.9rem;
|
||||
text-align: center;
|
||||
width: auto;
|
||||
}
|
||||
#cobalt-main-box #bottom,
|
||||
#footer-buttons,
|
||||
@ -343,27 +361,58 @@ button:active,
|
||||
visibility: hidden;
|
||||
position: fixed;
|
||||
height: auto;
|
||||
width: 32%;
|
||||
width: 36%;
|
||||
z-index: 999;
|
||||
padding: 2rem;
|
||||
font-size: 0.9rem;
|
||||
max-height: 85%;
|
||||
max-height: 95%;
|
||||
opacity: 0;
|
||||
transform: translate(-50%,-48%)scale(.95);
|
||||
}
|
||||
.popup.visible {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
transform: translate(-50%, -50%);
|
||||
transition: transform 0.1s ease-in-out, opacity 0.1s ease-in-out;
|
||||
}
|
||||
#popup-backdrop {
|
||||
visibility: hidden;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 998;
|
||||
opacity: 0;
|
||||
background-color: var(--background);
|
||||
}
|
||||
#popup-backdrop.visible {
|
||||
visibility: visible;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.1s ease-in-out;
|
||||
}
|
||||
.popup.small {
|
||||
width: 20%;
|
||||
background: var(--glass);
|
||||
backdrop-filter: blur(7px);
|
||||
-webkit-backdrop-filter: blur(7px);
|
||||
box-shadow: 0px 0px 80px 0px var(--accent-hover);
|
||||
padding: 1.7rem;
|
||||
border: var(--accent-highlight) solid 0.15rem;
|
||||
padding: 1.7rem;
|
||||
transform: translate(-50%,-50%)scale(.95);
|
||||
pointer-events: all;
|
||||
}
|
||||
.popup.small.visible {
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.popup.small #popup-header-contents,
|
||||
.popup.small .popup-content-inner,
|
||||
.popup.small #popup-header {
|
||||
padding: 0;
|
||||
}
|
||||
.popup.small #popup-header {
|
||||
position: relative;
|
||||
border: none;
|
||||
}
|
||||
.popup.small #popup-title {
|
||||
margin-bottom: .2rem;
|
||||
}
|
||||
.popup.small #popup-header {
|
||||
padding-top: 0;
|
||||
}
|
||||
.popup.small .explanation {
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
@ -371,31 +420,22 @@ button:active,
|
||||
background: var(--accent);
|
||||
color: var(--background);
|
||||
}
|
||||
#popup-backdrop {
|
||||
opacity: 0.5;
|
||||
background-color: var(--background);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 998;
|
||||
}
|
||||
.popup.scrollable {
|
||||
height: 85%;
|
||||
height: 95%;
|
||||
}
|
||||
.scrollable .bottom-link {
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
.changelog-subtitle {
|
||||
font-size: 1.1rem;
|
||||
font-size: 1.3rem;
|
||||
padding-bottom: var(--gap-no-icon);
|
||||
}
|
||||
.changelog-banner {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-height: 300px;
|
||||
min-height: 160px;
|
||||
margin-bottom: 1.65rem;
|
||||
margin-bottom: 1rem;
|
||||
float: left;
|
||||
}
|
||||
.changelog-img {
|
||||
@ -404,6 +444,20 @@ button:active,
|
||||
height: inherit;
|
||||
max-height: inherit;
|
||||
}
|
||||
.changelog-tags {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.7rem;
|
||||
padding-bottom: 0.7rem;
|
||||
}
|
||||
.changelog-tag-version {
|
||||
font-size: 1rem;
|
||||
padding: 0.15rem 0.45rem;
|
||||
}
|
||||
.changelog-tag-date {
|
||||
color: var(--accent-subtext);
|
||||
font-size: .8rem;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
@ -429,25 +483,10 @@ button:active,
|
||||
}
|
||||
#popup-title {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
line-height: 1.85em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
#popup-footer {
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
margin-bottom: 1.5rem;
|
||||
background: var(--background);
|
||||
width: var(--without-padding);
|
||||
}
|
||||
.popup-footer-content {
|
||||
font-size: 0.8rem;
|
||||
line-height: var(--line-height);
|
||||
color: var(--accent-subtext);
|
||||
border-top: 0.05rem solid var(--accent-subtext);
|
||||
padding-top: 0.4rem;
|
||||
}
|
||||
#popup-above-title {
|
||||
color: var(--accent-subtext);
|
||||
font-size: 0.8rem;
|
||||
@ -455,19 +494,27 @@ button:active,
|
||||
#popup-content {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
height: var(--without-padding);
|
||||
height: 100%;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.popup-content-inner,
|
||||
.tab-content-settings {
|
||||
padding-top: calc(env(safe-area-inset-top)/2 + 4.9rem);
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 4.8rem);
|
||||
}
|
||||
.tab-content-settings,
|
||||
#tab-about-about .popup-content-inner {
|
||||
padding-top: calc(env(safe-area-inset-top)/2 + 6.2rem);;
|
||||
}
|
||||
.bullpadding {
|
||||
padding-left: 0.58rem;
|
||||
}
|
||||
#popup-header {
|
||||
position: relative;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
padding-top: 0.8rem;
|
||||
}
|
||||
#popup-content.with-footer {
|
||||
margin-bottom: 3rem;
|
||||
padding-top: calc(env(safe-area-inset-top)/2 + 1.7rem);
|
||||
width: 100%;
|
||||
border-bottom: var(--accent-highlight) solid 0.1rem;
|
||||
}
|
||||
.settings-category {
|
||||
padding-bottom: 1rem;
|
||||
@ -538,15 +585,24 @@ button:active,
|
||||
.switch.space-right {
|
||||
margin-right: var(--padding-1);
|
||||
}
|
||||
.switch[data-enabled="true"] {
|
||||
.switch:focus {
|
||||
box-shadow: var(--inset-focus) inset;
|
||||
}
|
||||
#popup-tabs .switch {
|
||||
background: unset;
|
||||
}
|
||||
.switch[data-enabled="true"],
|
||||
#popup-tabs .switch[data-enabled="true"] {
|
||||
color: var(--background);
|
||||
background: var(--accent);
|
||||
cursor: default;
|
||||
z-index: 999
|
||||
}
|
||||
.switch[data-enabled="true"]:hover {
|
||||
background: var(--accent);
|
||||
}
|
||||
.switch[data-enabled="true"]:focus {
|
||||
box-shadow: var(--inset-focus-inv) inset;
|
||||
}
|
||||
.switches {
|
||||
display: flex;
|
||||
width: auto;
|
||||
@ -575,18 +631,14 @@ button:active,
|
||||
padding: var(--padding-1);
|
||||
overflow: auto;
|
||||
}
|
||||
#close-button {
|
||||
max-width: 2.6rem;
|
||||
margin-left: var(--padding-1);
|
||||
border: var(--border-15);
|
||||
color: var(--accent);
|
||||
padding: 0.3rem 0.75rem 0.5rem;
|
||||
#back-button {
|
||||
padding: 0;
|
||||
background: none;
|
||||
max-width: 4rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
#close-button.up {
|
||||
float: right;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
height: 2.6rem;
|
||||
#back-button svg path {
|
||||
fill: var(--accent);
|
||||
}
|
||||
.popup-tab-content {
|
||||
display: none;
|
||||
@ -594,23 +646,32 @@ button:active,
|
||||
#popup-tabs {
|
||||
z-index: 999;
|
||||
bottom: 0;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
padding-top: 0.2rem;
|
||||
padding-bottom: 1.7rem;
|
||||
border-top: var(--accent-highlight) solid 0.1rem;
|
||||
}
|
||||
.popup-tabs {
|
||||
margin-top: 0.9rem;
|
||||
.popup-tabs-child {
|
||||
width: 100%;
|
||||
padding: 0 0.2rem;
|
||||
}
|
||||
.emoji {
|
||||
.emoji, svg {
|
||||
margin-right: 0.4rem;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
.emoji {
|
||||
margin-right: 0.4rem;
|
||||
}
|
||||
.picker-image {
|
||||
object-fit: cover;
|
||||
width: inherit;
|
||||
height: inherit;
|
||||
cursor: pointer;
|
||||
user-select: all;
|
||||
-webkit-user-select: all;
|
||||
}
|
||||
.picker-image-container {
|
||||
width: 8rem;
|
||||
@ -631,6 +692,8 @@ button:active,
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
align-content: space-around;
|
||||
padding-top: calc(env(safe-area-inset-top)/2 + 7.6rem);
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 4.8rem);
|
||||
}
|
||||
#picker-holder.various {
|
||||
justify-content: left;
|
||||
@ -642,7 +705,7 @@ button:active,
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
z-index: 99;
|
||||
}
|
||||
.picker-element-name {
|
||||
position: absolute;
|
||||
@ -706,41 +769,67 @@ button:active,
|
||||
#about-donate-footer {
|
||||
box-shadow: 0 0 0 0.1rem var(--accent) inset;
|
||||
}
|
||||
.popup-tabs-child {
|
||||
width: 100%;
|
||||
.popup-content-inner,
|
||||
.tab-content-settings,
|
||||
#popup-header-contents {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.urgent-notice {
|
||||
top: 1.7rem;
|
||||
width: auto;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-top: calc(env(safe-area-inset-top) + 1rem);
|
||||
}
|
||||
.no-transparency .glass-bkg {
|
||||
background: var(--glass-lite);
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
.no-animation .popup,
|
||||
.no-animation #popup-backdrop {
|
||||
transition: none;
|
||||
}
|
||||
#floating-notification-area {
|
||||
visibility: visible;
|
||||
z-index: 999999;
|
||||
position: absolute;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding-top: 2rem;
|
||||
}
|
||||
.floating-notification {
|
||||
text-align: center;
|
||||
padding: 0.6rem 1.2rem;
|
||||
background: var(--accent-hover-elevated);
|
||||
display: flex;
|
||||
box-shadow: 0 0 20px 10px var(--accent-hover);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.popup-from-bottom {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
bottom: 0;
|
||||
z-index: 999;
|
||||
visibility: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.popup-from-bottom.visible {
|
||||
visibility: visible;
|
||||
}
|
||||
/* adapt the page according to screen size */
|
||||
@media screen and (min-width: 2300px) {
|
||||
html {
|
||||
zoom: 130%;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 3840px) {
|
||||
html {
|
||||
zoom: 180%;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 5000px) {
|
||||
html {
|
||||
zoom: 300%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1550px) {
|
||||
.popup.small {
|
||||
width: 25%
|
||||
}
|
||||
.popup {
|
||||
width: 35%;
|
||||
width: 40%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1440px) {
|
||||
@ -751,12 +840,12 @@ button:active,
|
||||
width: 30%
|
||||
}
|
||||
.popup {
|
||||
width: 40%;
|
||||
width: 45%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1300px) {
|
||||
.popup {
|
||||
width: 46%;
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1200px) {
|
||||
@ -767,7 +856,7 @@ button:active,
|
||||
width: 35%
|
||||
}
|
||||
.popup {
|
||||
width: 50%;
|
||||
width: 55%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 1025px) {
|
||||
@ -781,23 +870,12 @@ button:active,
|
||||
width: 60%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-height: 605px) {
|
||||
@media screen and (max-width: 850px) {
|
||||
.popup {
|
||||
height: 80%
|
||||
}
|
||||
.popup.small {
|
||||
height: auto;
|
||||
}
|
||||
.bottom-link {
|
||||
padding-bottom: 2rem;
|
||||
width: 75%;
|
||||
}
|
||||
}
|
||||
/* mobile page */
|
||||
@media screen and (max-width: 720px) {
|
||||
#cobalt-main-box, #footer {
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 499px) {
|
||||
.tab {
|
||||
font-size: 0!important;
|
||||
@ -805,9 +883,6 @@ button:active,
|
||||
.tab .emoji {
|
||||
margin-right: 0;
|
||||
}
|
||||
#cobalt-main-box, #footer {
|
||||
width: 90%;
|
||||
}
|
||||
.checkbox {
|
||||
width: calc(100% - 1.3rem);
|
||||
}
|
||||
@ -894,6 +969,9 @@ button:active,
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 720px) {
|
||||
#cobalt-main-box {
|
||||
width: calc(100% - (0.7rem * 2));
|
||||
}
|
||||
#cobalt-main-box #bottom {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
@ -901,12 +979,13 @@ button:active,
|
||||
width: 100%;
|
||||
}
|
||||
#footer {
|
||||
bottom: 4.9%;
|
||||
transform: translate(-50%, 0%);
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.5rem);
|
||||
}
|
||||
#footer-buttons {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
padding: 0 0.7rem;
|
||||
}
|
||||
.footer-pair .footer-button {
|
||||
width: 100%!important;
|
||||
@ -924,7 +1003,7 @@ button:active,
|
||||
gap: var(--gap);
|
||||
}
|
||||
.urgent-notice {
|
||||
width: 100%;
|
||||
padding-top: calc(env(safe-area-inset-bottom)/2 + 1rem);
|
||||
}
|
||||
.popup.small {
|
||||
width: calc(100% - 1.7rem * 2);
|
||||
@ -936,7 +1015,12 @@ button:active,
|
||||
position: absolute;
|
||||
border: none;
|
||||
border-top: var(--accent-highlight) solid 0.15rem;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.7rem)
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.7rem);
|
||||
transform: none;
|
||||
}
|
||||
.popup.small.visible {
|
||||
transform: none;
|
||||
transition: opacity 0.1s ease-in-out;
|
||||
}
|
||||
.popup.small #popup-header {
|
||||
background: none;
|
||||
@ -949,7 +1033,6 @@ button:active,
|
||||
}
|
||||
#picker-holder.various {
|
||||
flex-wrap: wrap;
|
||||
align-content: left;
|
||||
gap: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
@ -966,15 +1049,27 @@ button:active,
|
||||
}
|
||||
.popup, .popup.scrollable {
|
||||
border: none;
|
||||
width: 90%;
|
||||
height: 95%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.popup.center {
|
||||
top: unset;
|
||||
left: unset;
|
||||
transform: unset;
|
||||
}
|
||||
#popup-tabs {
|
||||
padding-bottom: calc(env(safe-area-inset-bottom)/2 + 1.5rem);
|
||||
}
|
||||
.bottom-link {
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
.popup-tabs {
|
||||
margin-top: .3rem;
|
||||
.popup-content-inner,
|
||||
.tab-content-settings,
|
||||
.popup-tabs-child,
|
||||
#popup-header-contents {
|
||||
padding-left: 0.7rem;
|
||||
padding-right: 0.7rem;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 400px) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
const isIOS = ua.match("iphone os");
|
||||
const isMobile = ua.match("android") || ua.match("iphone os");
|
||||
const isFirefox = ua.match("firefox/");
|
||||
const isOldFirefox = ua.match("firefox/") && ua.split("firefox/")[1].split('.')[0] < 103;
|
||||
const version = 31;
|
||||
const regex = new RegExp(/https:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/);
|
||||
const notification = `<div class="notification-dot"></div>`;
|
||||
@ -14,10 +16,11 @@ const switchers = {
|
||||
"vimeoDash": ["false", "true"],
|
||||
"audioMode": ["false", "true"]
|
||||
};
|
||||
const checkboxes = ["disableTikTokWatermark", "fullTikTokAudio", "muteAudio"];
|
||||
const checkboxes = ["disableTikTokWatermark", "fullTikTokAudio", "muteAudio", "reduceTransparency", "disableAnimations"];
|
||||
const exceptions = { // used for mobile devices
|
||||
"vQuality": "720"
|
||||
};
|
||||
const bottomPopups = ["error", "download"]
|
||||
|
||||
let store = {};
|
||||
|
||||
@ -156,16 +159,18 @@ function notificationCheck(type) {
|
||||
function hideAllPopups() {
|
||||
let filter = document.getElementsByClassName('popup');
|
||||
for (let i = 0; i < filter.length; i++) {
|
||||
filter[i].style.visibility = "hidden";
|
||||
filter[i].classList.remove("visible");
|
||||
}
|
||||
eid("picker-holder").innerHTML = '';
|
||||
eid("picker-download").href = '/';
|
||||
eid("picker-download").style.visibility = "hidden";
|
||||
eid("popup-backdrop").style.visibility = "hidden";
|
||||
eid("picker-download").classList.remove("visible");
|
||||
eid("popup-backdrop").classList.remove("visible");
|
||||
store.isPopupOpen = false;
|
||||
}
|
||||
function popup(type, action, text) {
|
||||
if (action === 1) {
|
||||
hideAllPopups(); // hide the previous popup before showing a new one
|
||||
store.isPopupOpen = true;
|
||||
switch (type) {
|
||||
case "about":
|
||||
let tabId = sGet("seenAbout") ? "changelog" : "about";
|
||||
@ -192,7 +197,7 @@ function popup(type, action, text) {
|
||||
if (!eid("popup-picker").classList.contains("scrollable")) eid("popup-picker").classList.add("scrollable");
|
||||
if (eid("picker-holder").classList.contains("various")) eid("picker-holder").classList.remove("various");
|
||||
eid("picker-download").href = text.audio;
|
||||
eid("picker-download").style.visibility = "visible"
|
||||
eid("picker-download").classList.add("visible");
|
||||
for (let i in text.arr) {
|
||||
eid("picker-holder").innerHTML += `<a class="picker-image-container"><img class="picker-image" src="${text.arr[i]["url"]}" onerror="this.parentNode.style.display='none'"></img></a>`
|
||||
}
|
||||
@ -206,12 +211,12 @@ function popup(type, action, text) {
|
||||
let s = text.arr[i], item;
|
||||
switch (s.type) {
|
||||
case "video":
|
||||
item = `<a class="picker-various-container" href="${text.arr[i]["url"]}" target="_blank"><div class="picker-element-name">VIDEO ${Number(i)+1}</div><div class="imageBlock"></div><img class="picker-image" src="${text.arr[i]["thumb"]}" onerror="this.style.display='none'"></img></a>`
|
||||
item = `<div class="picker-various-container" onClick="${isIOS ? `share('${text.arr[i]["url"]}')` : `window.location.href='${text.arr[i]["url"]}'`}"><div class="picker-element-name">VIDEO ${Number(i)+1}</div><div class="imageBlock"></div><img class="picker-image" src="${text.arr[i]["thumb"]}" onerror="this.style.display='none'"></img></div>`
|
||||
break;
|
||||
}
|
||||
eid("picker-holder").innerHTML += item
|
||||
}
|
||||
eid("picker-download").style.visibility = "hidden";
|
||||
eid("picker-download").classList.remove("visible");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -219,14 +224,17 @@ function popup(type, action, text) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
store.isPopupOpen = false;
|
||||
if (type === "picker") {
|
||||
eid("picker-download").href = '/';
|
||||
eid("picker-download").style.visibility = "hidden"
|
||||
eid("picker-download").classList.remove("visible");
|
||||
eid("picker-holder").innerHTML = ''
|
||||
}
|
||||
}
|
||||
eid("popup-backdrop").style.visibility = vis(action);
|
||||
eid(`popup-${type}`).style.visibility = vis(action);
|
||||
if (bottomPopups.includes(type)) eid(`popup-${type}-container`).classList.toggle("visible");
|
||||
eid("popup-backdrop").classList.toggle("visible");
|
||||
eid(`popup-${type}`).classList.toggle("visible");
|
||||
eid(`popup-${type}`).focus();
|
||||
}
|
||||
function changeSwitcher(li, b) {
|
||||
if (b) {
|
||||
@ -249,15 +257,12 @@ function checkbox(action) {
|
||||
sSet(action, !!eid(action).checked);
|
||||
switch(action) {
|
||||
case "alwaysVisibleButton": button(); break;
|
||||
case "reduceTransparency": eid("cobalt-body").classList.toggle('no-transparency'); break;
|
||||
case "disableAnimations": eid("cobalt-body").classList.toggle('no-animation'); break;
|
||||
}
|
||||
action === "disableChangelog" && sGet(action) === "true" ? notificationCheck("disable") : notificationCheck();
|
||||
}
|
||||
function loadSettings() {
|
||||
try {
|
||||
if (typeof(navigator.clipboard.readText) == "undefined") throw new Error();
|
||||
} catch (err) {
|
||||
eid("paste").style.display = "none";
|
||||
}
|
||||
if (sGet("alwaysVisibleButton") === "true") {
|
||||
eid("alwaysVisibleButton").checked = true;
|
||||
eid("download-button").value = '>>'
|
||||
@ -266,6 +271,12 @@ function loadSettings() {
|
||||
if (sGet("downloadPopup") === "true" && !isIOS) {
|
||||
eid("downloadPopup").checked = true;
|
||||
}
|
||||
if (sGet("reduceTransparency") === "true" || isOldFirefox) {
|
||||
eid("cobalt-body").classList.toggle('no-transparency');
|
||||
}
|
||||
if (sGet("disableAnimations") === "true") {
|
||||
eid("cobalt-body").classList.toggle('no-animation');
|
||||
}
|
||||
for (let i = 0; i < checkboxes.length; i++) {
|
||||
if (sGet(checkboxes[i]) === "true") eid(checkboxes[i]).checked = true;
|
||||
}
|
||||
@ -312,7 +323,17 @@ async function pasteClipboard() {
|
||||
eid("url-input-area").value = t;
|
||||
download(eid("url-input-area").value);
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
let errorMessage = loc.featureErrorGeneric;
|
||||
let doError = true;
|
||||
e = String(e).toLowerCase();
|
||||
|
||||
if (e.includes("denied")) errorMessage = loc.clipboardErrorNoPermission;
|
||||
if (e.includes("dismissed")) doError = false;
|
||||
if (e.includes("function") && isFirefox) errorMessage = loc.clipboardErrorFirefox;
|
||||
|
||||
if (doError) popup("error", 1, errorMessage);
|
||||
}
|
||||
}
|
||||
async function download(url) {
|
||||
changeDownloadButton(2, '...');
|
||||
@ -409,7 +430,7 @@ async function download(url) {
|
||||
async function loadCelebrationsEmoji() {
|
||||
let bac = eid("about-footer").innerHTML;
|
||||
try {
|
||||
let j = await fetch(`${apiURL}/api/onDemand?blockId=1`).then((r) => { if (r.status === 200) { return r.json() } else { return false } }).catch(() => { return false });
|
||||
let j = await fetch(`/onDemand?blockId=1`).then((r) => { if (r.status === 200) { return r.json() } else { return false } }).catch(() => { return false });
|
||||
if (j && j.status === "success" && j.text) {
|
||||
eid("about-footer").innerHTML = eid("about-footer").innerHTML.replace('<img class="emoji" draggable="false" height="22" width="22" alt="🐲" src="emoji/dragon_face.svg">', j.text);
|
||||
}
|
||||
@ -426,7 +447,7 @@ async function loadOnDemand(elementId, blockId) {
|
||||
if (store.historyContent) {
|
||||
j = store.historyContent;
|
||||
} else {
|
||||
await fetch(`${apiURL}/api/onDemand?blockId=${blockId}`).then(async(r) => {
|
||||
await fetch(`/onDemand?blockId=${blockId}`).then(async(r) => {
|
||||
j = await r.json();
|
||||
if (j && j.status === "success") {
|
||||
store.historyContent = j;
|
||||
@ -461,14 +482,28 @@ window.onload = () => {
|
||||
button();
|
||||
}
|
||||
}
|
||||
eid("url-input-area").addEventListener("keydown", (event) => {
|
||||
if (event.key === 'Escape') eid("url-input-area").value = '';
|
||||
eid("url-input-area").addEventListener("keydown", (e) => {
|
||||
button();
|
||||
})
|
||||
eid("url-input-area").addEventListener("keyup", (event) => {
|
||||
if (event.key === 'Enter') eid("download-button").click();
|
||||
eid("url-input-area").addEventListener("keyup", (e) => {
|
||||
if (e.key === 'Enter') eid("download-button").click();
|
||||
})
|
||||
document.onkeydown = (event) => {
|
||||
if (event.key === "Tab" || event.ctrlKey) eid("url-input-area").focus();
|
||||
if (event.key === 'Escape') hideAllPopups();
|
||||
document.onkeydown = (e) => {
|
||||
if (!store.isPopupOpen) {
|
||||
if (e.ctrlKey || e.key === "/") eid("url-input-area").focus();
|
||||
if (e.key === "Escape" || e.key === "Clear" || e.key === "Delete") clearInput();
|
||||
|
||||
// top buttons
|
||||
if (e.key === "D") pasteClipboard();
|
||||
if (e.key === "K") changeSwitcher('audioMode', 'false');
|
||||
if (e.key === "L") changeSwitcher('audioMode', 'true');
|
||||
|
||||
// popups
|
||||
if (e.key === "B") popup('about', 1);
|
||||
if (e.key === "N") popup('about', 1, 'donate');
|
||||
if (e.key === "M") popup('settings', 1);
|
||||
|
||||
} else {
|
||||
if (e.key === "Escape") hideAllPopups();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user