1
0
mirror of https://gitlab.com/Cha_deL/peertubeify synced 2024-12-21 20:34:23 +01:00

Remove video link even if search fail (duh)

The bar was just staying there after having been displayed once.
This commit is contained in:
Ealhad 2018-08-28 23:19:48 +02:00
parent 8d7e24270c
commit 67beeca09d

View File

@ -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;