2020-12-09 13:33:29 +00:00
|
|
|
<template>
|
2023-03-19 10:10:21 +00:00
|
|
|
<div class="flex flex-col w-full min-h-screen px-1vw py-5 antialiased reset" :class="[theme]">
|
2023-03-12 00:22:36 +00:00
|
|
|
<div class="flex-1">
|
|
|
|
<NavBar />
|
2023-03-06 15:26:14 +00:00
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<keep-alive :max="5">
|
|
|
|
<component :is="Component" :key="$route.fullPath" />
|
|
|
|
</keep-alive>
|
|
|
|
</router-view>
|
2023-03-12 00:22:36 +00:00
|
|
|
</div>
|
2021-03-29 06:38:29 +00:00
|
|
|
|
2022-09-09 18:13:56 +00:00
|
|
|
<FooterComponent />
|
2020-12-09 13:33:29 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-04-08 15:46:49 +00:00
|
|
|
import NavBar from "./components/NavBar.vue";
|
2022-09-09 18:13:56 +00:00
|
|
|
import FooterComponent from "./components/FooterComponent.vue";
|
2022-10-10 09:13:21 +00:00
|
|
|
|
|
|
|
const darkModePreference = window.matchMedia("(prefers-color-scheme: dark)");
|
|
|
|
|
2020-12-09 13:33:29 +00:00
|
|
|
export default {
|
2021-03-31 22:09:39 +00:00
|
|
|
components: {
|
2022-01-13 05:12:06 +00:00
|
|
|
NavBar,
|
2022-09-09 18:13:56 +00:00
|
|
|
FooterComponent,
|
2021-05-10 18:14:28 +00:00
|
|
|
},
|
2022-10-10 09:13:21 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
theme: "dark",
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setTheme() {
|
|
|
|
let themePref = this.getPreferenceString("theme", "dark");
|
|
|
|
if (themePref == "auto") this.theme = darkModePreference.matches ? "dark" : "light";
|
|
|
|
else this.theme = themePref;
|
2022-11-02 16:48:24 +00:00
|
|
|
|
2023-03-04 22:19:02 +00:00
|
|
|
// Change title bar color based on user's theme
|
|
|
|
const themeColor = document.querySelector("meta[name='theme-color']");
|
2023-03-03 12:48:11 +00:00
|
|
|
if (this.theme === "light") {
|
|
|
|
themeColor.setAttribute("content", "#FFF");
|
2023-03-04 22:19:02 +00:00
|
|
|
} else {
|
|
|
|
themeColor.setAttribute("content", "#0F0F0F");
|
2023-03-03 12:48:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
// Used for the scrollbar
|
|
|
|
const root = document.querySelector(":root");
|
|
|
|
this.theme == "dark" ? root.classList.add("dark") : root.classList.remove("dark");
|
2022-10-10 09:13:21 +00:00
|
|
|
},
|
|
|
|
},
|
2021-07-18 20:20:35 +00:00
|
|
|
mounted() {
|
2022-10-10 09:13:21 +00:00
|
|
|
this.setTheme();
|
|
|
|
darkModePreference.addEventListener("change", () => {
|
|
|
|
this.setTheme();
|
|
|
|
});
|
2023-01-06 18:30:28 +00:00
|
|
|
|
|
|
|
if ("indexedDB" in window) {
|
2023-06-15 17:18:47 +00:00
|
|
|
const request = indexedDB.open("piped-db", 5);
|
2023-01-06 18:30:28 +00:00
|
|
|
request.onupgradeneeded = ev => {
|
|
|
|
const db = request.result;
|
|
|
|
console.log("Upgrading object store.");
|
2023-01-08 15:22:28 +00:00
|
|
|
if (!db.objectStoreNames.contains("watch_history")) {
|
|
|
|
const store = db.createObjectStore("watch_history", { keyPath: "videoId" });
|
|
|
|
store.createIndex("video_id_idx", "videoId", { unique: true });
|
|
|
|
store.createIndex("id_idx", "id", { unique: true, autoIncrement: true });
|
|
|
|
}
|
|
|
|
if (ev.oldVersion < 2) {
|
|
|
|
const store = request.transaction.objectStore("watch_history");
|
|
|
|
store.createIndex("watchedAt", "watchedAt", { unique: false });
|
2023-01-06 18:30:28 +00:00
|
|
|
}
|
|
|
|
if (!db.objectStoreNames.contains("playlist_bookmarks")) {
|
|
|
|
const store = db.createObjectStore("playlist_bookmarks", { keyPath: "playlistId" });
|
|
|
|
store.createIndex("playlist_id_idx", "playlistId", { unique: true });
|
|
|
|
store.createIndex("id_idx", "id", { unique: true, autoIncrement: true });
|
|
|
|
}
|
2023-05-07 17:56:56 +00:00
|
|
|
if (!db.objectStoreNames.contains("channel_groups")) {
|
|
|
|
const store = db.createObjectStore("channel_groups", { keyPath: "groupName" });
|
|
|
|
store.createIndex("groupName", "groupName", { unique: true });
|
|
|
|
}
|
2023-06-15 17:18:47 +00:00
|
|
|
if (!db.objectStoreNames.contains("playlists")) {
|
|
|
|
const playlistStore = db.createObjectStore("playlists", { keyPath: "playlistId" });
|
|
|
|
playlistStore.createIndex("playlistId", "playlistId", { unique: true });
|
|
|
|
const playlistVideosStore = db.createObjectStore("playlistVideos", { keyPath: "videoId" });
|
|
|
|
playlistVideosStore.createIndex("videoId", "videoId", { unique: true });
|
|
|
|
}
|
2023-01-06 18:30:28 +00:00
|
|
|
};
|
|
|
|
request.onsuccess = e => {
|
|
|
|
window.db = e.target.result;
|
|
|
|
};
|
|
|
|
} else console.log("This browser doesn't support IndexedDB");
|
2021-08-25 16:30:21 +00:00
|
|
|
|
|
|
|
const App = this;
|
|
|
|
|
2022-01-01 14:53:55 +00:00
|
|
|
(async function () {
|
2022-11-03 16:45:28 +00:00
|
|
|
const defaultLang = await App.defaultLanguage;
|
2022-06-26 01:53:06 +00:00
|
|
|
const locale = App.getPreferenceString("hl", defaultLang);
|
2021-10-27 00:59:03 +00:00
|
|
|
if (locale !== App.TimeAgoConfig.locale) {
|
2022-10-31 14:35:31 +00:00
|
|
|
const localeTime = await import(`../node_modules/javascript-time-ago/locale/${locale}.json`)
|
|
|
|
.catch(() => null)
|
|
|
|
.then(module => module?.default);
|
|
|
|
if (localeTime) {
|
|
|
|
App.TimeAgo.addLocale(localeTime);
|
|
|
|
App.TimeAgoConfig.locale = locale;
|
|
|
|
}
|
2021-10-27 00:59:03 +00:00
|
|
|
}
|
2021-08-25 16:30:21 +00:00
|
|
|
if (window.i18n.global.locale.value !== locale) {
|
|
|
|
if (!window.i18n.global.availableLocales.includes(locale)) {
|
2021-12-28 14:39:20 +00:00
|
|
|
const messages = await import(`./locales/${locale}.json`).then(module => module.default);
|
2021-08-25 16:30:21 +00:00
|
|
|
window.i18n.global.setLocaleMessage(locale, messages);
|
|
|
|
}
|
|
|
|
window.i18n.global.locale.value = locale;
|
|
|
|
}
|
|
|
|
})();
|
2021-07-18 20:20:35 +00:00
|
|
|
},
|
2020-12-09 13:33:29 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2021-06-28 16:23:24 +00:00
|
|
|
h1,
|
|
|
|
p,
|
|
|
|
a,
|
|
|
|
b {
|
|
|
|
unicode-bidi: plaintext;
|
|
|
|
text-align: start;
|
|
|
|
}
|
|
|
|
|
2023-05-01 07:26:09 +00:00
|
|
|
:root {
|
|
|
|
color-scheme: only light;
|
|
|
|
}
|
|
|
|
|
2020-12-09 13:33:29 +00:00
|
|
|
::-webkit-scrollbar {
|
2022-11-03 14:51:38 +00:00
|
|
|
background-color: #d1d5db;
|
2020-12-09 13:33:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
background-color: #4b4f52;
|
|
|
|
}
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb:hover {
|
|
|
|
background-color: #5b6469;
|
|
|
|
}
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb:active {
|
|
|
|
background-color: #485053;
|
|
|
|
}
|
|
|
|
|
|
|
|
::-webkit-scrollbar-corner {
|
|
|
|
background-color: #0b0e0f;
|
|
|
|
}
|
|
|
|
|
2022-11-03 14:51:38 +00:00
|
|
|
:root {
|
|
|
|
scrollbar-color: #4b4f52 #d1d5db;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
.dark ::-webkit-scrollbar {
|
2020-12-09 13:33:29 +00:00
|
|
|
background-color: #15191a;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
.dark ::-webkit-scrollbar-thumb {
|
2020-12-09 13:33:29 +00:00
|
|
|
background-color: #4b4f52;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
.dark ::-webkit-scrollbar-thumb:hover {
|
2020-12-09 13:33:29 +00:00
|
|
|
background-color: #5b6469;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
.dark ::-webkit-scrollbar-thumb:active {
|
2020-12-09 13:33:29 +00:00
|
|
|
background-color: #485053;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
.dark ::-webkit-scrollbar-corner {
|
2020-12-09 13:33:29 +00:00
|
|
|
background-color: #0b0e0f;
|
|
|
|
}
|
|
|
|
|
2022-11-02 16:48:24 +00:00
|
|
|
:root.dark {
|
|
|
|
scrollbar-color: #4b4f52 #15191a;
|
|
|
|
}
|
|
|
|
|
2021-02-24 09:35:41 +00:00
|
|
|
* {
|
2021-12-27 14:46:36 +00:00
|
|
|
@apply font-sans;
|
2021-02-24 09:35:41 +00:00
|
|
|
}
|
2021-10-31 17:44:36 +00:00
|
|
|
|
2021-12-27 14:46:22 +00:00
|
|
|
.video-grid {
|
2023-03-19 10:10:21 +00:00
|
|
|
@apply grid grid-cols-1 mx-2 sm:mx-0 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 col-auto lt-md:gap-x-3 md:gap-x-6 gap-y-5;
|
2021-10-31 17:44:36 +00:00
|
|
|
}
|
2021-10-31 18:36:47 +00:00
|
|
|
|
2021-12-27 14:46:26 +00:00
|
|
|
.btn {
|
2022-10-09 05:54:39 +00:00
|
|
|
@apply py-2 lt-md:px-2 md:px-4 rounded cursor-pointer inline-block;
|
2021-12-27 14:46:26 +00:00
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:34 +00:00
|
|
|
.reset {
|
|
|
|
@apply text-black bg-white;
|
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:26 +00:00
|
|
|
.dark {
|
2021-12-27 14:46:34 +00:00
|
|
|
@apply text-white bg-dark-900;
|
2021-12-27 14:46:26 +00:00
|
|
|
}
|
|
|
|
|
2021-12-28 00:04:20 +00:00
|
|
|
.input,
|
|
|
|
.select,
|
|
|
|
.btn {
|
2022-01-12 11:59:50 +00:00
|
|
|
@apply w-auto text-gray-600 bg-gray-300;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input,
|
|
|
|
.select {
|
|
|
|
@apply h-8;
|
|
|
|
}
|
|
|
|
|
2022-01-12 11:27:08 +00:00
|
|
|
.checkbox {
|
|
|
|
@apply h-4 w-4;
|
2021-12-28 00:04:20 +00:00
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:29 +00:00
|
|
|
.dark .input,
|
|
|
|
.dark .select,
|
|
|
|
.dark .btn {
|
2021-12-28 00:04:20 +00:00
|
|
|
@apply text-gray-400 bg-dark-400;
|
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:33 +00:00
|
|
|
.input {
|
|
|
|
@apply pl-2.5;
|
2021-12-27 14:46:29 +00:00
|
|
|
}
|
|
|
|
|
2022-08-27 12:28:59 +00:00
|
|
|
.input:focus {
|
2023-05-26 08:52:28 +00:00
|
|
|
@apply outline-red-500;
|
|
|
|
outline-style: solid;
|
|
|
|
outline-width: 2px;
|
|
|
|
box-shadow: 0 0 15px rgba(239, 68, 68, 1);
|
2022-08-27 12:28:59 +00:00
|
|
|
}
|
|
|
|
|
2021-12-28 00:04:20 +00:00
|
|
|
hr {
|
|
|
|
@apply !mt-2 !mb-3 border-gray-300;
|
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:29 +00:00
|
|
|
.dark hr {
|
|
|
|
@apply border-dark-100;
|
|
|
|
}
|
|
|
|
|
2022-01-12 11:27:08 +00:00
|
|
|
h1,
|
|
|
|
h2 {
|
|
|
|
@apply m-0 font-bold;
|
|
|
|
}
|
|
|
|
|
2021-12-28 00:04:20 +00:00
|
|
|
h1 {
|
2022-01-12 11:27:08 +00:00
|
|
|
@apply !text-5xl;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
@apply !text-3xl;
|
|
|
|
}
|
|
|
|
|
|
|
|
.table {
|
|
|
|
@apply w-full text-lg text-left font-light border;
|
2021-10-31 18:36:47 +00:00
|
|
|
}
|
2021-12-27 14:46:30 +00:00
|
|
|
|
|
|
|
.link {
|
2021-12-27 14:46:34 +00:00
|
|
|
@apply hover:(text-dark-300 underline underline-dark-300);
|
|
|
|
}
|
|
|
|
|
2021-12-28 00:04:20 +00:00
|
|
|
.link-secondary {
|
|
|
|
@apply hover:(text-dark-400 underline underline-dark-400);
|
|
|
|
}
|
|
|
|
|
2021-12-27 14:46:34 +00:00
|
|
|
.dark .link {
|
2021-12-27 14:46:30 +00:00
|
|
|
@apply hover:(text-gray-300 underline underline-gray-300);
|
|
|
|
}
|
2021-12-28 00:04:20 +00:00
|
|
|
|
|
|
|
.dark .link-secondary {
|
|
|
|
@apply text-gray-300 hover:(text-gray-400 underline underline-gray-400);
|
|
|
|
}
|
|
|
|
|
2022-07-22 16:08:52 +00:00
|
|
|
.line {
|
2022-08-18 11:53:22 +00:00
|
|
|
@apply px-2.5 py-0.25 my-0.45 rounded-xl bg-dark-900;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dark .line {
|
|
|
|
@apply bg-white;
|
2022-07-22 16:08:52 +00:00
|
|
|
}
|
2022-10-11 05:00:51 +00:00
|
|
|
|
|
|
|
.thumbnail-overlay {
|
|
|
|
@apply rounded-md absolute bg-black text-white bg-opacity-75 px-5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.thumbnail-right {
|
|
|
|
@apply bottom-5px right-5px;
|
|
|
|
}
|
|
|
|
.thumbnail-left {
|
|
|
|
@apply bottom-5px left-5px text-xs font-bold bg-red-600 uppercase;
|
|
|
|
}
|
2021-02-24 09:35:41 +00:00
|
|
|
</style>
|