Remove video link even if search fail (duh)
The bar was just staying there after having been displayed once.
This commit is contained in:
parent
8d7e24270c
commit
67beeca09d
|
@ -28,16 +28,16 @@ function peertubeify(query: string) {
|
|||
browser.runtime.sendMessage({
|
||||
query
|
||||
}).then(async video => {
|
||||
removeVideoLink();
|
||||
|
||||
const options = await browser.storage.local.get();
|
||||
const openInOriginalInstance = _.getOr(true, 'openInOriginalInstance', options);
|
||||
const searchInstance = _.getOr(constants.defaultInstance, 'searchInstance', options);
|
||||
|
||||
const url = watchURL(openInOriginalInstance ? video.account.host : searchInstance, video.uuid);
|
||||
const link = videoLink(url, video);
|
||||
|
||||
removeVideoLink();
|
||||
document.querySelector('ytd-app').appendChild(link);
|
||||
});
|
||||
}).catch(removeVideoLink);
|
||||
}
|
||||
|
||||
const throttledPeertubify = _.throttle(1000, peertubeify);
|
||||
|
@ -58,7 +58,7 @@ observer.observe(document.body, {
|
|||
subtree: true,
|
||||
})
|
||||
|
||||
function htmlToElement(html: string) : Element {
|
||||
function htmlToElement(html: string): Element {
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = html.trim();
|
||||
return template.content.firstElementChild;
|
||||
|
|
Loading…
Reference in New Issue