@ -53,7 +53,12 @@
}
}
body.playerExists .button-enqueue{
body.playerExists .button-enqueue{
display: inline-block;
display: inline-block;
[v-cloak] {
display: none;
}
}
}
< / style >
< / style >
< / head >
< / head >
< body >
< body >
@ -62,10 +67,13 @@
< br / > {{$setting := .setting}}
< br / > {{$setting := .setting}}
< div id = "app" >
< div id = "app" v-cloak >
< form @ submit . prevent = "submitFilters()" >
< button @ click = "toggleFilters()" class = "u-full-width" >
< span v-show = "!showFilters" > Show Filters< / span >
< span v-show = "showFilters" > Hide Filters< / span >
< / button >
< form @ submit . prevent = "submitFilters()" v-show = "showFilters" >
< div class = "row" >
< div class = "row" >
< input class = "columns five" type = "search" @ input = "searchQueryUpated()" v-model = "filter.q" placeholder = "Search" >
< input class = "columns five" type = "search" @ input = "searchQueryUpated()" v-model = "filter.q" placeholder = "Search" >
< div class = "columns three" > < vue-multiselect v-model = "selectedSorting" :options = "sortOptions" :searchable = "false"
< div class = "columns three" > < vue-multiselect v-model = "selectedSorting" :options = "sortOptions" :searchable = "false"
@ -75,32 +83,35 @@
< div class = "columns one" > < vue-multiselect :show-pointer = "false" v-model = "filter.count" :options = "pagingOptions" :searchable = "false" :allow-empty = "false" :close-on-select = "true" :show-labels = "false" placeholder = "Pick a value" > < / vue-multiselect >
< div class = "columns one" > < vue-multiselect :show-pointer = "false" v-model = "filter.count" :options = "pagingOptions" :searchable = "false" :allow-empty = "false" :close-on-select = "true" :show-labels = "false" placeholder = "Pick a value" > < / vue-multiselect >
< / div >
< / div >
< div class = "columns three" >
< div class = "columns three" > < vue-multiselect v-model = "selectedPlayedStatus" :options = "playedStatusOptions" :searchable = "false"
< input type = "submit" value = "Filter" class = "button" >
:multiple="false" :close-on-select="true" :clear-on-select="true" :allow-empty="false" :show-labels="false"
< button class = "button" @ click = "resetFilters()" > Reset< / button >
placeholder="Sort By" label="Label" track-by="Value" :preselect-first="true">
< / div >
< / vue-multiselect > < / div >
< / div >
< / div >
< div class = "row" >
< div class = "row" >
< vue-multiselect class = "columns three" v-model = "selectedPodcasts" :options = "podcasts"
< vue-multiselect class = "columns three" v-model = "selectedPodcasts" :options = "podcasts" :show-labels = "false"
:multiple="true" :close-on-select="false" :clear-on-select="false"
:multiple="true" :close-on-select="false" :clear-on-select="false"
:preserve-search="true" placeholder="Podcasts" label="Title" track-by="ID" :preselect-first="false">
:preserve-search="true" placeholder="Podcasts" label="Title" track-by="ID" :preselect-first="false">
< template slot = "selection" slot-scope = "{ values, search, isOpen }" >
< template slot = "selection" slot-scope = "{ values, search, isOpen }" >
< span class = "multiselect__single" v-if = "values.length && !isOpen" > ${ values.length } options selected< / span >
< span class = "multiselect__single" v-if = "values.length && !isOpen" > ${ values.length } options selected< / span >
< / template >
< / template >
< / vue-multiselect >
< / vue-multiselect >
< vue-multiselect class = "columns three" v-model = "selectedTags" :options = "tags" :multiple = "true" :close-on-select = "false" :clear-on-select = "false" :preserve-search = "true" placeholder = "Tags" label = "Label" track-by = "ID" :preselect-first = "false" >
< vue-multiselect class = "columns three" v-model = "selectedTags" :show-labels = "false" :options = "tags" :multiple = "true" :close-on-select = "false" :clear-on-select = "false" :preserve-search = "true" placeholder = "Tags" label = "Label" track-by = "ID" :preselect-first = "false" >
< template slot = "selection" slot-scope = "{ values, search, isOpen }" > < span class = "multiselect__single" v-if = "values.length && !isOpen" > ${ values.length } options selected< / span > < / template >
< template slot = "selection" slot-scope = "{ values, search, isOpen }" > < span class = "multiselect__single" v-if = "values.length && !isOpen" > ${ values.length } options selected< / span > < / template >
< / vue-multiselect >
< / vue-multiselect >
< div class = "columns three" > < vue-multiselect v-model = "selectedDownloadStatus" :options = "downloadStatusOptions" :searchable = "false"
< div class = "columns three" > < vue-multiselect v-model = "selectedDownloadStatus" :options = "downloadStatusOptions" :searchable = "false"
:multiple="false" :close-on-select="true" :clear-on-select="true" :allow-empty="false" :show-labels="false"
:multiple="false" :close-on-select="true" :clear-on-select="true" :allow-empty="false" :show-labels="false"
placeholder="Sort By" label="Label" track-by="Value" :preselect-first="true">
placeholder="Sort By" label="Label" track-by="Value" :preselect-first="true">
< / vue-multiselect > < / div >
< / vue-multiselect > < / div >
< div class = "columns three" > < vue-multiselect v-model = "selectedPlayedStatus" :options = "playedStatusOptions" :searchable = "false"
< div class = "columns three" >
:multiple="false" :close-on-select="true" :clear-on-select="true" :allow-empty="false" :show-labels="false"
< a title = "Play items in this page" v-if = "podcastItems.length" class = "button" @ click = "playPage()" > < i class = "fas fa-play" > < / i > < / a >
placeholder="Sort By" label="Label" track-by="Value" :preselect-first="true">
< a title = "Enqueue items in this page" v-if = "podcastItems.length" class = "button button-enqueue" @ click = "enqueuePage()" > < i class = "fas fa-plus" > < / i > < / a >
< / vue-multiselect > < / div >
< a title = "Reset Filters" class = "button" @ click = "resetFilters()" > < i class = "fas fa-undo" > < / i > < / a >
< / div >
< / div >
< / div >
< / form >
< / form >
< hr >
< hr >
@ -275,10 +286,17 @@ var app = new Vue({
computed:{
computed:{
page(){
page(){
return this.filter.page;
return this.filter.page;
},
count(){
return this.filter.count;
}
}
},
},
watch:{
watch:{
page(newPage,oldPage){
page(newPage,oldPage){
if(newPage==oldPage){
return;
}
if(newPage==1){
if(newPage==1){
this.filter.previousPage=0;
this.filter.previousPage=0;
}else{
}else{
@ -292,6 +310,17 @@ var app = new Vue({
this.getData()
this.getData()
},
},
count(current,old){
this.getData()
},
showFilters(current,old){
if(localStorage){
localStorage.showFilters=current
}
},
selectedPodcasts(current,old){
selectedPodcasts(current,old){
var arr=[];
var arr=[];
for (let index = 0; index < current.length ; index + + ) {
for (let index = 0; index < current.length ; index + + ) {
@ -299,7 +328,7 @@ var app = new Vue({
arr.push(element.ID);
arr.push(element.ID);
}
}
this.filter['podcastIds']=arr;
this.filter['podcastIds']=arr;
this.getData ()
this.submitFilters ()
},
},
selectedTags(current,old){
selectedTags(current,old){
var arr=[];
var arr=[];
@ -308,25 +337,28 @@ var app = new Vue({
arr.push(element.ID);
arr.push(element.ID);
}
}
this.filter['tagIds']=arr;
this.filter['tagIds']=arr;
this.getData ()
this.submitFilters ()
},
},
selectedSorting(current,old){
selectedSorting(current,old){
this.filter.sorting=current.Value;
this.filter.sorting=current.Value;
this.getData ()
this.submitFilters ()
},
},
selectedDownloadStatus(current,old){
selectedDownloadStatus(current,old){
this.filter.isDownloaded=current.Value;
this.filter.isDownloaded=current.Value;
this.getData ()
this.submitFilters ()
},
},
selectedPlayedStatus(current,old){
selectedPlayedStatus(current,old){
this.filter.isPlayed=current.Value;
this.filter.isPlayed=current.Value;
this.getData ()
this.submitFilters ()
},
},
},
},
mounted(){
mounted(){
if(localStorage & & localStorage.episodesFilter){
if(localStorage & & localStorage.episodesFilter){
this.filter=JSON.parse(localStorage.episodesFilter);
this.filter=JSON.parse(localStorage.episodesFilter);
}
}
if(localStorage & & localStorage.showFilters){
this.showFilters=JSON.parse(localStorage.showFilters);
}
if(this.filter.podcastIds!=null){
if(this.filter.podcastIds!=null){
var selectedPodcasts=[];
var selectedPodcasts=[];
@ -425,15 +457,17 @@ var app = new Vue({
downloadToDisk(item.ID)
downloadToDisk(item.ID)
},
},
openPlayer(item){
openPlayer(item){
openPlayer(item.ID)
openPlayer([ item.ID] )
},
},
enqueuePlayer (item){
enqueueEpisode (item){
enqueuePlayer(item.ID )
enqueueEpisode([item.ID] )
},
},
searchQueryUpated(){
searchQueryUpated(){
var self=this;
var self=this;
clearTimeout(this.debounce)
clearTimeout(this.debounce)
this.debounce = setTimeout(() => {
this.debounce = setTimeout(() => {
self.filter.page=1
self.getData()
self.getData()
}, 600)
}, 600)
},
},
@ -447,6 +481,23 @@ var app = new Vue({
this.getData();
this.getData();
},
},
toggleFilters(){
this.showFilters=!this.showFilters
},
playPage(){
var itemIds=[];
for(var i=0;i< this.podcastItems.length ; i + + ) {
itemIds.push(this.podcastItems[i].ID)
}
openPlayer(itemIds)
},
enqueuePage(){
var itemIds=[];
for(var i=0;i< this.podcastItems.length ; i + + ) {
itemIds.push(this.podcastItems[i].ID)
}
enqueueEpisode(itemIds)
},
updateUrl(){
updateUrl(){
var url= new URL(window.top.location.href);
var url= new URL(window.top.location.href);
var copy= Vue.util.extend({},this.filter);
var copy= Vue.util.extend({},this.filter);
@ -479,6 +530,7 @@ var app = new Vue({
self.filter=response.data.filter;
self.filter=response.data.filter;
self.saveFilter(self.filter);
self.saveFilter(self.filter);
self.updateUrl();
self.updateUrl();
setPageTitle("Episodes ("+self.filter.totalCount+")")
})
})
.catch(function (error) {
.catch(function (error) {
if (error.response & & error.response.data & & error.response.data.message) {
if (error.response & & error.response.data & & error.response.data.message) {
@ -505,6 +557,7 @@ var app = new Vue({
selectedTags:[],
selectedTags:[],
selectedDownloadStatus:"",
selectedDownloadStatus:"",
selectedPlayedStatus:"",
selectedPlayedStatus:"",
showFilters:localStorage & & JSON.parse(localStorage.showFilters),
{{ $len := len .podcastItems}}
{{ $len := len .podcastItems}}
podcastItems: {{if gt $len 0}} {{ .podcastItems }} {{else}} [] {{end}},
podcastItems: {{if gt $len 0}} {{ .podcastItems }} {{else}} [] {{end}},
@ -664,11 +717,11 @@ var app = new Vue({
document.body.classList.add("playerExists")
document.body.classList.add("playerExists")
}
}
});
});
function enqueueEpisode(id){
function enqueueEpisode(ids ){
if(!socket){
if(!socket){
return
return
}
}
socket.send(getWebsocketMessage("Enqueue",`{"itemId":" ${id}" }`))
socket.send(getWebsocketMessage("Enqueue",`{"itemIds ":${JSON.stringify( ids) }}`))
}
}
function enquePodcast(id){
function enquePodcast(id){
if(!socket){
if(!socket){