2020-12-09 19:03:29 +05:30
|
|
|
<template>
|
2022-01-12 16:57:08 +05:30
|
|
|
<div class="w-full min-h-screen px-1vw reset" :class="[theme]">
|
2022-01-13 10:42:06 +05:30
|
|
|
<NavBar />
|
2022-09-09 23:43:56 +05:30
|
|
|
|
2021-07-07 19:48:09 +05:30
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<keep-alive :max="5">
|
2021-10-09 00:22:51 +05:30
|
|
|
<component :is="Component" :key="$route.fullPath" />
|
2021-07-07 19:48:09 +05:30
|
|
|
</keep-alive>
|
|
|
|
</router-view>
|
2021-03-29 12:08:29 +05:30
|
|
|
|
2022-09-09 23:43:56 +05:30
|
|
|
<FooterComponent />
|
2020-12-09 19:03:29 +05:30
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-04-08 21:16:49 +05:30
|
|
|
import NavBar from "./components/NavBar.vue";
|
2022-09-09 23:43:56 +05:30
|
|
|
import FooterComponent from "./components/FooterComponent.vue";
|
2022-10-10 14:43:21 +05:30
|
|
|
|
|
|
|
const darkModePreference = window.matchMedia("(prefers-color-scheme: dark)");
|
|
|
|
|
2020-12-09 19:03:29 +05:30
|
|
|
export default {
|
2021-04-01 03:39:39 +05:30
|
|
|
components: {
|
2022-01-13 10:42:06 +05:30
|
|
|
NavBar,
|
2022-09-09 23:43:56 +05:30
|
|
|
FooterComponent,
|
2021-05-10 23:44:28 +05:30
|
|
|
},
|
2022-10-10 14:43:21 +05:30
|
|
|
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;
|
|
|
|
},
|
|
|
|
},
|
2021-07-19 01:50:35 +05:30
|
|
|
mounted() {
|
2022-10-10 14:43:21 +05:30
|
|
|
this.setTheme();
|
|
|
|
darkModePreference.addEventListener("change", () => {
|
|
|
|
this.setTheme();
|
|
|
|
});
|
2021-08-22 15:57:09 +05:30
|
|
|
if (this.getPreferenceBoolean("watchHistory", false))
|
|
|
|
if ("indexedDB" in window) {
|
|
|
|
const request = indexedDB.open("piped-db", 1);
|
2022-01-01 20:23:55 +05:30
|
|
|
request.onupgradeneeded = function () {
|
2021-08-22 15:57:09 +05:30
|
|
|
const db = request.result;
|
|
|
|
console.log("Upgrading object store.");
|
|
|
|
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 });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
request.onsuccess = e => {
|
|
|
|
window.db = e.target.result;
|
|
|
|
};
|
|
|
|
} else console.log("This browser doesn't support IndexedDB");
|
2021-08-25 22:00:21 +05:30
|
|
|
|
|
|
|
const App = this;
|
|
|
|
|
2022-01-01 20:23:55 +05:30
|
|
|
(async function () {
|
2022-06-26 07:23:06 +05:30
|
|
|
const defaultLang = await App.defaultLangage;
|
|
|
|
const locale = App.getPreferenceString("hl", defaultLang);
|
2021-10-27 06:29:03 +05:30
|
|
|
if (locale !== App.TimeAgoConfig.locale) {
|
2022-01-12 11:09:36 +05:30
|
|
|
const localeTime = await import(
|
|
|
|
"./../node_modules/javascript-time-ago/locale/" + locale + ".json"
|
|
|
|
).then(module => module.default);
|
2021-10-27 06:29:03 +05:30
|
|
|
App.TimeAgo.addLocale(localeTime);
|
|
|
|
App.TimeAgoConfig.locale = locale;
|
|
|
|
}
|
2021-08-25 22:00:21 +05:30
|
|
|
if (window.i18n.global.locale.value !== locale) {
|
|
|
|
if (!window.i18n.global.availableLocales.includes(locale)) {
|
2021-12-28 20:09:20 +05:30
|
|
|
const messages = await import(`./locales/${locale}.json`).then(module => module.default);
|
2021-08-25 22:00:21 +05:30
|
|
|
window.i18n.global.setLocaleMessage(locale, messages);
|
|
|
|
}
|
|
|
|
window.i18n.global.locale.value = locale;
|
|
|
|
}
|
|
|
|
})();
|
2021-07-19 01:50:35 +05:30
|
|
|
},
|
2020-12-09 19:03:29 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2021-06-28 21:53:24 +05:30
|
|
|
h1,
|
|
|
|
p,
|
|
|
|
a,
|
|
|
|
b {
|
|
|
|
unicode-bidi: plaintext;
|
|
|
|
text-align: start;
|
|
|
|
}
|
|
|
|
|
2020-12-09 19:03:29 +05:30
|
|
|
::-webkit-scrollbar {
|
|
|
|
background-color: #15191a;
|
|
|
|
}
|
|
|
|
|
|
|
|
::-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;
|
|
|
|
}
|
|
|
|
|
2021-02-24 15:05:41 +05:30
|
|
|
* {
|
|
|
|
scrollbar-color: #15191a #444a4e;
|
2021-12-27 20:16:36 +05:30
|
|
|
@apply font-sans;
|
2021-02-24 15:05:41 +05:30
|
|
|
}
|
2021-10-31 23:14:36 +05:30
|
|
|
|
2021-12-27 20:16:22 +05:30
|
|
|
.video-grid {
|
2022-08-17 19:04:57 +05:30
|
|
|
@apply grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 col-auto lt-md:gap-x-2.5 md:gap-x-1vw gap-y-1.5;
|
2021-10-31 23:14:36 +05:30
|
|
|
}
|
2021-11-01 00:06:47 +05:30
|
|
|
|
2021-12-27 20:16:26 +05:30
|
|
|
.btn {
|
2022-10-09 11:24:39 +05:30
|
|
|
@apply py-2 lt-md:px-2 md:px-4 rounded cursor-pointer inline-block;
|
2021-12-27 20:16:26 +05:30
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:34 +05:30
|
|
|
.reset {
|
|
|
|
@apply text-black bg-white;
|
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:26 +05:30
|
|
|
.dark {
|
2021-12-27 20:16:34 +05:30
|
|
|
@apply text-white bg-dark-900;
|
2021-12-27 20:16:26 +05:30
|
|
|
}
|
|
|
|
|
2021-12-28 05:34:20 +05:30
|
|
|
.input,
|
|
|
|
.select,
|
|
|
|
.btn {
|
2022-01-12 17:29:50 +05:30
|
|
|
@apply w-auto text-gray-600 bg-gray-300;
|
|
|
|
}
|
|
|
|
|
|
|
|
.input,
|
|
|
|
.select {
|
|
|
|
@apply h-8;
|
|
|
|
}
|
|
|
|
|
2022-01-12 16:57:08 +05:30
|
|
|
.checkbox {
|
|
|
|
@apply h-4 w-4;
|
2021-12-28 05:34:20 +05:30
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:29 +05:30
|
|
|
.dark .input,
|
|
|
|
.dark .select,
|
|
|
|
.dark .btn {
|
2021-12-28 05:34:20 +05:30
|
|
|
@apply text-gray-400 bg-dark-400;
|
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:33 +05:30
|
|
|
.input {
|
|
|
|
@apply pl-2.5;
|
2021-12-27 20:16:29 +05:30
|
|
|
}
|
|
|
|
|
2022-08-27 17:58:59 +05:30
|
|
|
.input:focus {
|
|
|
|
@apply border-2 border-red-500 outline-none;
|
|
|
|
box-shadow: 0 0 15px rgba(239, 68, 68, var(--un-border-opacity));
|
|
|
|
}
|
|
|
|
|
2021-12-28 05:34:20 +05:30
|
|
|
hr {
|
|
|
|
@apply !mt-2 !mb-3 border-gray-300;
|
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:29 +05:30
|
|
|
.dark hr {
|
|
|
|
@apply border-dark-100;
|
|
|
|
}
|
|
|
|
|
2022-01-12 16:57:08 +05:30
|
|
|
h1,
|
|
|
|
h2 {
|
|
|
|
@apply m-0 font-bold;
|
|
|
|
}
|
|
|
|
|
2021-12-28 05:34:20 +05:30
|
|
|
h1 {
|
2022-01-12 16:57:08 +05:30
|
|
|
@apply !text-5xl;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
@apply !text-3xl;
|
|
|
|
}
|
|
|
|
|
|
|
|
.table {
|
|
|
|
@apply w-full text-lg text-left font-light border;
|
2021-11-01 00:06:47 +05:30
|
|
|
}
|
2021-12-27 20:16:30 +05:30
|
|
|
|
|
|
|
.link {
|
2021-12-27 20:16:34 +05:30
|
|
|
@apply hover:(text-dark-300 underline underline-dark-300);
|
|
|
|
}
|
|
|
|
|
2021-12-28 05:34:20 +05:30
|
|
|
.link-secondary {
|
|
|
|
@apply hover:(text-dark-400 underline underline-dark-400);
|
|
|
|
}
|
|
|
|
|
2021-12-27 20:16:34 +05:30
|
|
|
.dark .link {
|
2021-12-27 20:16:30 +05:30
|
|
|
@apply hover:(text-gray-300 underline underline-gray-300);
|
|
|
|
}
|
2021-12-28 05:34:20 +05:30
|
|
|
|
|
|
|
.dark .link-secondary {
|
|
|
|
@apply text-gray-300 hover:(text-gray-400 underline underline-gray-400);
|
|
|
|
}
|
|
|
|
|
2022-07-22 21:38:52 +05:30
|
|
|
.line {
|
2022-08-18 17:23:22 +05:30
|
|
|
@apply px-2.5 py-0.25 my-0.45 rounded-xl bg-dark-900;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dark .line {
|
|
|
|
@apply bg-white;
|
2022-07-22 21:38:52 +05:30
|
|
|
}
|
2021-02-24 15:05:41 +05:30
|
|
|
</style>
|