Fixed Copy Raw shortcut not working #324

This commit is contained in:
ManeraKai 2022-06-10 20:00:12 +03:00
parent 931ad2256d
commit 61f2390323
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
3 changed files with 3 additions and 5 deletions

View File

@ -374,18 +374,15 @@ function copyRaw(test, copyRawElement) {
if (!newUrl) newUrl = await imgurHelper.reverse(url);
if (newUrl) {
resolve(true);
resolve(newUrl);
if (test) return;
navigator.clipboard.writeText(newUrl);
console.log('newUrl', newUrl)
if (copyRawElement) {
console.log('working')
const textElement = copyRawElement.getElementsByTagName('h4')[0]
const oldHtml = textElement.innerHTML;
textElement.innerHTML = browser.i18n.getMessage('copied');
setTimeout(() => textElement.innerHTML = oldHtml, 1000);
}
console.log('finished')
}
}
resolve()

View File

@ -26,6 +26,7 @@
"unlimitedStorage",
"cookies",
"privacy",
"clipboardWrite",
"contextMenus",
"<all_urls>"
],

View File

@ -212,7 +212,7 @@ browser.webRequest.onErrorOccurred.addListener(
)
browser.commands.onCommand.addListener(
async command => {
command => {
if (command === 'switchInstance') utils.switchInstance();
else if (command == 'copyRaw') utils.copyRaw();
else if (command == 'unify') utils.unify();