Just like "Open Link in a New Tab" but adding some user defined "thing" beginning of the url.
For example:
This is URL I applied the gesture on: example.com
Gesture will open it in new tab by adding "something" before it:
telegram.me/share/url?url=example.com
about:reader?url=example.com
ssl-proxy.my-addr.org/myaddrproxy.php/example.com
Thanks for the suggestion and the provided use case. Since this seems to be more of a specific use case I tend not to implement it. However I will provide a userscript once the functionality has been added to Firefox.
@Robbendebiene Hi, I used JS to share _window.location_ to Telegram with this:
window.open("tg://msg_url?url="+window.location+"","_self");
Is there a way to do this for URLs where gesture started?
Currently this issue cannot be properly solved by userscripts. But if you want to get the link where the gesture started you can use the TARGET variable to get the element where the gesture started like so:
let node = TARGET;
while (node !== null && !node.href) {
node = node.parentElement;
}
if (node) alert(node.href)
Thank you so much.
If there's anyone looking for same solution:
let node = TARGET;
while (node !== null && !node.href) {
node = node.parentElement;
}
if (node) {
window.open("tg://msg_url?url="+node.href+"","_self");
} else {
window.open("tg://msg_url?url="+window.location+"","_self");
}
It shares URL gesture started on, if there's no URL where gesture started, it shares window location URL.
@Robbendebiene Hi.
let node = TARGET;
while (node !== null && !node.href) {
node = node.parentElement;
}
if (node) {
var openthis = "about:reader?url=" + node.href;
API.tabs.create({url:openthis});
} else {
openthis = "about:reader?url=" + window.location;
API.tabs.create({url:openthis});
}
I made this but it's not working, is it because of the "about:reader" or did i make something wrong?
is it because of the "about:reader"
Hi, yeah sadly it's still not possible for add-ons to open about: urls..
But you could use the openInReaderMode property.
API.tabs.create({url:openthis, openInReaderMode: true});
Thank you. If there's anyone need this:
let node = TARGET;
while (node !== null && !node.href) {
node = node.parentElement;
}
if (node) {
API.tabs.create({url:node.href, openInReaderMode: true});
} else {
API.tabs.create({url:window.location.href, openInReaderMode: true});
}