|
|
@ -58,30 +58,9 @@ export class TvSearchComponent implements OnInit {
|
|
|
|
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
|
|
|
this.defaultPoster = "../../.." + base + "/images/default_tv_poster.png";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public openClosestTab(el: any) {
|
|
|
|
public openClosestTab(node: ISearchTvResult,el: any) {
|
|
|
|
el.preventDefault();
|
|
|
|
el.preventDefault();
|
|
|
|
const rowclass = "undefined ng-star-inserted";
|
|
|
|
node.open = !node.open;
|
|
|
|
el = el.toElement || el.relatedTarget || el.target;
|
|
|
|
|
|
|
|
while (el.className !== rowclass) {
|
|
|
|
|
|
|
|
// Increment the loop to the parent node until we find the row we need
|
|
|
|
|
|
|
|
el = el.parentNode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point, the while loop has stopped and `el` represents the element that has
|
|
|
|
|
|
|
|
// the class you specified
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Then we loop through the children to find the caret which we want to click
|
|
|
|
|
|
|
|
const caretright = "fa-caret-right";
|
|
|
|
|
|
|
|
const caretdown = "fa-caret-down";
|
|
|
|
|
|
|
|
for (const value of el.children) {
|
|
|
|
|
|
|
|
// the caret from the ui has 2 class selectors depending on if expanded or not
|
|
|
|
|
|
|
|
// we search for both since we want to still toggle the clicking
|
|
|
|
|
|
|
|
if (value.className.includes(caretright) || value.className.includes(caretdown)) {
|
|
|
|
|
|
|
|
// Then we tell JS to click the element even though we hid it from the UI
|
|
|
|
|
|
|
|
value.click();
|
|
|
|
|
|
|
|
//Break from loop since we no longer need to continue looking
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
@ -146,7 +125,7 @@ export class TvSearchComponent implements OnInit {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.searchService.getShowInformation(val.id)
|
|
|
|
this.searchService.getShowInformation(val.id)
|
|
|
|
.subscribe(x => {
|
|
|
|
.subscribe(x => {
|
|
|
|
if (x.data) {
|
|
|
|
if (x) {
|
|
|
|
this.setDefaults(x);
|
|
|
|
this.setDefaults(x);
|
|
|
|
this.updateItem(val, x);
|
|
|
|
this.updateItem(val, x);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -236,15 +215,15 @@ export class TvSearchComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private setDefaults(x: any) {
|
|
|
|
private setDefaults(x: ISearchTvResult) {
|
|
|
|
if (x.data.banner === null) {
|
|
|
|
if (x.banner === null) {
|
|
|
|
x.data.banner = this.defaultPoster;
|
|
|
|
x.banner = this.defaultPoster;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (x.data.imdbId === null) {
|
|
|
|
if (x.imdbId === null) {
|
|
|
|
x.data.imdbId = "https://www.tvmaze.com/shows/" + x.data.seriesId;
|
|
|
|
x.imdbId = "https://www.tvmaze.com/shows/" + x.seriesId;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
x.data.imdbId = "http://www.imdb.com/title/" + x.data.imdbId + "/";
|
|
|
|
x.imdbId = "http://www.imdb.com/title/" + x.imdbId + "/";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|