55 <p >
66 {{ formatDate(show.latestepisode?.date) }}   ;
77 <b >
8- <a v-tooltip =" 'search this episode'" :href =" `http://google.com/search?q=${parseName(show) } ${show.latestepisode?.number}`" target =" _blank" rel =" noopener" >{{ show.latestepisode?.number }}</a >
8+ <a v-tooltip =" 'search this episode'" :href =" `http://google.com/search?q=${parsedName } ${show.latestepisode?.number}`" target =" _blank" rel =" noopener" >{{ show.latestepisode?.number }}</a >
99 </b >
10- <a v-if =" isDate(show.latestepisode?.date)" v-tooltip =" 'watch online'" :href =" watchseries(show) " target =" _blank" rel =" noopener" ><i class =" fa fa-fw fa-play-circle-o" ></i ></a >
10+ <a v-if =" isDate(show.latestepisode?.date)" v-tooltip =" 'watch online'" :href =" watchseriesUrl " target =" _blank" rel =" noopener" ><i class =" fa fa-fw fa-play-circle-o" ></i ></a >
1111 <!-- <a ng-href="{{_.availability[show.id].amazon}}" target="_blank" ng-class="{freeForPrime:_.availability[show.id].freeForPrime, invisible:!_.availability[show.id].amazon}" v-tooltip="'watch via Amazon'" ><i class="fa fa-fw fa-amazon"></i></a> -->
1212   ;
1313 <small v-if =" show.lastSeen && !show.seen" >
2020 </p >
2121 </div >
2222 <div class =" col-xs-2 text-right" v-if =" isDate(show.latestepisode?.date)" >
23- <i @click =" toggleSeen" v-tooltip =" 'seen?'" class =" fa fa-check-circle" :class =" {green:show.seen}" ></i ><i v-if =" show.loading && isDate(show.nextepisode?.date)" class =" fa fa-circle-o-notch fa-spin" ></i >
24- <!-- < br><i v-if="!show.seen" ng- click="_. catchUp(show) " v-tooltip="catch up!" tooltip-placement="bottom" class="fa fa-arrow-circle-up"></i> -- >
23+ <i @click =" toggleSeen" v-tooltip =" 'seen?'" class =" fa fa-check-circle" :class =" {green:show.seen}" role = " button " ></i ><i v-if =" show.loading && isDate(show.nextepisode?.date)" class =" fa fa-circle-o-notch fa-spin" ></i >
24+ <br ><i v-if =" !show.seen" @ click =" catchUp" v-tooltip =" ' catch up!' " tooltip-placement =" bottom" class =" fa fa-arrow-circle-up" role = " button " ></i >
2525 </div >
2626 </div >
2727</template >
2828<script setup>
29- import { ref } from ' vue' ;
29+ import { computed , ref } from ' vue' ;
3030import { isDate , formatDate } from ' ./formatDate.js' ;
3131import { useShowsStore } from ' ../stores/shows' ;
3232import { vTooltip } from ' ../directives/tooltip' ;
@@ -45,34 +45,34 @@ const episodes = ref([])
4545 * < a href= " https://www.google.com/search?q={{show.parseName()}}" >
4646 * @return {String} name without special chars
4747 */
48- function parseName ( show ) {
49- return show .name .replace (/ [^ a-zA-Z0-9 ] / g , ' ' );
50- }
48+ const parsedName = computed (() => {
49+ return show .value . name .replace (/ [^ a-zA-Z0-9 ] / g , ' ' );
50+ })
5151
5252/**
5353 * Generates watchseries Link
5454 * @example
55- * https: // www.watchseries1.video /tv-series/big-little-lies-season-2-episode-1
55+ * https: // www.watchseries1.fun /tv-series/big-little-lies-season-2-episode-1
5656 * @return {String} link to watchseries-online
5757 */
58- function watchseries ( show ) {
59- var episodeNo = nextEpisodeNo (show );
60- var series = show .name .replace (' &' , ' and' ).replace (/ [^ a-zA-Z0-9 ] / g , ' ' ).replace (/ \s + / g , ' -' ).toLowerCase ();
61- var season = parseInt (episodeNo .split (' x' )[0 ]);
62- var episode = parseInt (episodeNo .split (' x' )[1 ]);
58+ const watchseriesUrl = computed (() => {
59+ let episodeNo = nextEpisodeNo ();
60+ let series = show . value .name .replace (' &' , ' and' ).replace (/ [^ a-zA-Z0-9 ] / g , ' ' ).replace (/ \s + / g , ' -' ).toLowerCase ();
61+ let season = parseInt (episodeNo .split (' x' )[0 ]);
62+ let episode = parseInt (episodeNo .split (' x' )[1 ]);
6363
64- return ' https://www.watchseries1.video /tv-series/' + series + ' -season-' + season + ' -episode-' + episode;
65- }
64+ return ` https://www.watchseries1.fun /tv-series/${ series} -season-${ season} -episode-${ episode} `
65+ })
6666
67- function nextEpisodeNo (show ) {
68- if (! show .seen && show . episodes ? .length ) {
67+ function nextEpisodeNo () {
68+ if (! show .value . seen && episodes . value .length ) {
6969
70- var nextIndex = show .lastSeen ? show . episodes .indexOf (show .lastSeen ) + 1 : 0 ;
71- nextIndex = show . episodes [nextIndex] ? nextIndex : show . episodes .length - 1 ;
70+ let nextIndex = show .value . lastSeen ? episodes .value . indexOf (show . value .lastSeen ) + 1 : 0 ;
71+ nextIndex = episodes . value [nextIndex] ? nextIndex : episodes . value .length - 1 ;
7272
73- return show . episodes [nextIndex];
73+ return episodes . value [nextIndex];
7474 } else {
75- return show .latestepisode ? .number ;
75+ return show .value . latestepisode ? .number ;
7676 }
7777}
7878
@@ -110,4 +110,14 @@ function clearLastSeen() {
110110 changeLastSeen .value = false ;
111111 showsStore .updateStorage ();
112112}
113+
114+ async function catchUp () {
115+ if (show .value .seen ) {return ;} // already seen
116+
117+ await getEpisodes ();
118+
119+ show .value .lastSeen = nextEpisodeNo ();
120+ show .value .seen = show .value .lastSeen === show .value .latestepisode .number ;
121+ showsStore .updateStorage ();
122+ }
113123< / script>
0 commit comments