2022-01-24 22:56:57 +00:00
|
|
|
<template>
|
2022-03-21 06:03:33 +00:00
|
|
|
<v-app v-show="stateLoaded" style="background: black !important">
|
2022-03-21 20:34:34 +00:00
|
|
|
<topNavigation
|
2022-03-21 23:47:11 +00:00
|
|
|
:search="search"
|
|
|
|
:page="page"
|
2022-03-21 20:34:34 +00:00
|
|
|
@close-search="search = !search"
|
|
|
|
@search-btn="searchBtn"
|
|
|
|
@text-changed="textChanged"
|
2022-03-24 04:55:38 +00:00
|
|
|
@scroll-to-top="$refs.pgscroll.scrollTop = 0"
|
2022-03-21 20:34:34 +00:00
|
|
|
/>
|
2022-01-24 23:16:53 +00:00
|
|
|
|
2022-03-22 00:52:45 +00:00
|
|
|
<div class="accent" style="height: 100%; margin-top: 4rem">
|
2022-03-18 11:49:47 +00:00
|
|
|
<div
|
2022-03-21 20:34:34 +00:00
|
|
|
v-show="!search"
|
2022-03-21 05:13:21 +00:00
|
|
|
class="background"
|
|
|
|
style="
|
|
|
|
overflow: hidden;
|
|
|
|
height: calc(100vh - 8rem);
|
|
|
|
transition-duration: 0.3s;
|
|
|
|
transition-property: border-radius;
|
|
|
|
"
|
|
|
|
:style="{
|
|
|
|
borderRadius: `${roundTweak / 2}rem`,
|
|
|
|
}"
|
2022-03-17 23:17:08 +00:00
|
|
|
>
|
2022-03-21 06:03:33 +00:00
|
|
|
<!-- element above removes artifacting from things like v-ripple by -->
|
2022-03-21 05:13:21 +00:00
|
|
|
<!-- scrollbox below must be a standalone div -->
|
2022-03-25 12:07:35 +00:00
|
|
|
<div ref="pgscroll" class="scroll-y" style="height: 100%">
|
2022-03-21 05:13:21 +00:00
|
|
|
<nuxt v-show="!search" />
|
2022-03-21 20:34:34 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
v-show="search"
|
2022-03-22 00:52:45 +00:00
|
|
|
class="accent"
|
2022-03-21 20:34:34 +00:00
|
|
|
style="
|
|
|
|
padding: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
height: calc(100vh - 4rem);
|
|
|
|
transition-duration: 0.3s;
|
|
|
|
transition-property: border-radius;
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<div class="scroll-y" style="height: 100%">
|
2022-03-21 23:47:11 +00:00
|
|
|
<div v-if="search" style="min-width: 180px">
|
2022-03-22 08:23:23 +00:00
|
|
|
<v-list-item
|
|
|
|
v-for="(item, index) in response"
|
|
|
|
:key="index"
|
|
|
|
class="px-0"
|
|
|
|
>
|
2022-03-21 05:13:21 +00:00
|
|
|
<v-btn
|
|
|
|
text
|
2022-03-22 01:13:48 +00:00
|
|
|
tile
|
2022-03-21 05:13:21 +00:00
|
|
|
dense
|
|
|
|
class="info--text searchButton text-left text-capitalize"
|
|
|
|
@click="youtubeSearch(item)"
|
2022-03-22 01:13:48 +00:00
|
|
|
>
|
|
|
|
<v-icon class="mr-5">mdi-magnify</v-icon>
|
|
|
|
{{ item[0] }}
|
|
|
|
</v-btn>
|
2022-03-21 05:13:21 +00:00
|
|
|
</v-list-item>
|
|
|
|
</div>
|
2022-03-07 18:53:14 +00:00
|
|
|
</div>
|
2022-02-25 04:45:17 +00:00
|
|
|
</div>
|
2022-02-24 19:45:36 +00:00
|
|
|
</div>
|
2022-01-24 22:56:57 +00:00
|
|
|
|
2022-03-18 12:21:06 +00:00
|
|
|
<bottomNavigation v-if="!search" />
|
2022-01-24 22:56:57 +00:00
|
|
|
|
2022-03-13 20:16:00 +00:00
|
|
|
<updateChecker />
|
2022-01-24 22:56:57 +00:00
|
|
|
</v-app>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-03-21 05:13:21 +00:00
|
|
|
import { App as CapacitorApp } from "@capacitor/app";
|
|
|
|
import { mapState } from "vuex";
|
2022-03-22 08:23:23 +00:00
|
|
|
import constants from "../plugins/constants";
|
2022-03-07 18:53:14 +00:00
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
search: false,
|
|
|
|
response: [],
|
2022-03-21 20:34:34 +00:00
|
|
|
stateLoaded: false,
|
2022-03-07 18:53:14 +00:00
|
|
|
}),
|
2022-03-23 13:30:24 +00:00
|
|
|
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
roundTweak: (state) => state.tweaks.roundTweak,
|
|
|
|
}),
|
|
|
|
page: function () {
|
|
|
|
const splitPath = this.$route.path.split("/");
|
|
|
|
let pageName = splitPath[splitPath.length - 1];
|
|
|
|
pageName = pageName.charAt(0).toUpperCase() + pageName.slice(1);
|
|
|
|
return pageName || "Home";
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
// Watch for any changes in the route string
|
|
|
|
// When change is detected, scroll main div back to the top
|
|
|
|
$route() {
|
|
|
|
this.$refs.pgscroll.scrollTop = 0; // scroll back to top when moving to new route
|
2022-03-23 15:31:04 +00:00
|
|
|
// Exit fullscreen if currently in fullscreen
|
|
|
|
this.$vuetube.statusBar.show();
|
|
|
|
this.$vuetube.navigationBar.show();
|
2022-03-25 12:07:35 +00:00
|
|
|
},
|
2022-03-23 13:30:24 +00:00
|
|
|
},
|
|
|
|
|
2022-03-21 05:13:21 +00:00
|
|
|
beforeCreate() {
|
|
|
|
// initializes UI tweaks to the saved state
|
|
|
|
this.$store.commit("tweaks/initTweaks");
|
|
|
|
},
|
2022-03-23 13:30:24 +00:00
|
|
|
|
2022-03-07 18:53:14 +00:00
|
|
|
mounted() {
|
2022-03-21 20:34:34 +00:00
|
|
|
this.stateLoaded = true;
|
2022-03-13 19:45:48 +00:00
|
|
|
//--- Back Button Listener ---//
|
2022-03-21 05:13:21 +00:00
|
|
|
CapacitorApp.addListener("backButton", ({ canGoBack }) => {
|
2022-03-13 19:45:48 +00:00
|
|
|
//--- Back Closes Search ---//
|
2022-03-13 18:20:43 +00:00
|
|
|
if (this.search) {
|
|
|
|
this.search = false;
|
2022-03-14 17:13:24 +00:00
|
|
|
|
2022-03-21 05:13:21 +00:00
|
|
|
//--- Back Goes Back ---//
|
|
|
|
} else if (!canGoBack) {
|
2022-03-07 18:53:14 +00:00
|
|
|
CapacitorApp.exitApp();
|
|
|
|
} else {
|
|
|
|
window.history.back();
|
2022-02-24 22:21:28 +00:00
|
|
|
}
|
2022-03-07 18:53:14 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-03-21 20:34:34 +00:00
|
|
|
textChanged(text) {
|
|
|
|
this.$youtube.autoComplete(text, (res) => {
|
2022-03-21 05:13:21 +00:00
|
|
|
const data = res.replace(/^.*?\(/, "").replace(/\)$/, ""); //Format Response
|
|
|
|
this.response = JSON.parse(data)[1];
|
2022-03-07 18:53:14 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
youtubeSearch(item) {
|
2022-03-16 00:34:34 +00:00
|
|
|
this.$router.push(`/search?q=${item[0]}`);
|
2022-03-16 00:37:33 +00:00
|
|
|
this.search = false;
|
2022-03-17 22:25:13 +00:00
|
|
|
},
|
|
|
|
|
2022-03-21 20:34:34 +00:00
|
|
|
searchBtn(text) {
|
|
|
|
const query = text;
|
2022-03-17 22:25:13 +00:00
|
|
|
|
2022-03-22 08:23:23 +00:00
|
|
|
this.$logger(
|
|
|
|
constants.LOGGER_NAMES.search,
|
|
|
|
"Query: " + query + " this.search: " + this.search
|
|
|
|
);
|
|
|
|
|
2022-03-17 22:25:13 +00:00
|
|
|
if (this.search === true) {
|
2022-03-21 05:13:21 +00:00
|
|
|
if (query) {
|
2022-03-19 19:39:07 +00:00
|
|
|
this.$router.push(`/search?q=${query}`);
|
|
|
|
this.search = false;
|
|
|
|
}
|
2022-03-17 22:25:13 +00:00
|
|
|
} else {
|
|
|
|
this.search = true;
|
|
|
|
}
|
2022-03-21 05:13:21 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-01-24 22:56:57 +00:00
|
|
|
</script>
|
2022-03-23 13:30:24 +00:00
|
|
|
|
|
|
|
<style>
|
|
|
|
* {
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
|
|
|
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
|
|
|
}
|
2022-03-25 12:07:35 +00:00
|
|
|
*:focus::before {
|
|
|
|
opacity: 0 !important;
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:30:24 +00:00
|
|
|
.scroll-y {
|
|
|
|
overflow-y: scroll !important; /* has to be scroll, not auto */
|
|
|
|
-webkit-overflow-scrolling: touch !important;
|
|
|
|
}
|
|
|
|
html,
|
|
|
|
body {
|
|
|
|
background: black;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
p,
|
|
|
|
span,
|
|
|
|
div {
|
|
|
|
-webkit-user-select: none; /* Safari */
|
|
|
|
-moz-user-select: none; /* Firefox */
|
|
|
|
-ms-user-select: none; /* IE10+/Edge */
|
|
|
|
user-select: none; /* Standard */
|
|
|
|
}
|
|
|
|
|
|
|
|
.invert {
|
|
|
|
filter: invert(100%);
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.searchButton {
|
|
|
|
width: 100%;
|
|
|
|
justify-content: left !important;
|
|
|
|
}
|
|
|
|
</style>
|