Added shortcut for Redirect To Original
This commit is contained in:
parent
b26f510616
commit
f93de9220c
|
@ -68,6 +68,12 @@
|
||||||
"default": "Alt+Shift+C"
|
"default": "Alt+Shift+C"
|
||||||
},
|
},
|
||||||
"description": "Copies the original link. Ex: Copies the original twitter link while in the nitter website"
|
"description": "Copies the original link. Ex: Copies the original twitter link while in the nitter website"
|
||||||
|
},
|
||||||
|
"reverse": {
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Alt+Shift+R"
|
||||||
|
},
|
||||||
|
"description": "Redirect to the original link. Ex: Redirects to the original twitter link while in the nitter website"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
|
|
|
@ -97,6 +97,19 @@ browser.commands.onCommand.addListener(async command => {
|
||||||
else if (command == "copyRaw") {
|
else if (command == "copyRaw") {
|
||||||
servicesHelper.copyRaw(url)
|
servicesHelper.copyRaw(url)
|
||||||
}
|
}
|
||||||
|
else if (command == "reverse") {
|
||||||
|
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
|
||||||
|
if (tabs[0].url) {
|
||||||
|
const url = new URL(tabs[0].url)
|
||||||
|
const newUrl = await servicesHelper.reverse(url)
|
||||||
|
if (newUrl) {
|
||||||
|
browser.tabs.update(tabs[0].id, { url: newUrl }, () => {
|
||||||
|
tabIdRedirects[tabs[0].id] = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue