Open Archie-2021 opened 1 year ago
It is technically possible to run arbitrary JS on the page with insertJS
Opening them like a bookmark don't work.
What have you tried? I tried before to run JS code from a custom omnibar, I even had that attempt still commented out in my code:
var myUrls = [
{
title: "Home Page",
url: "javascript:alert('home')",
},
{
title: "wp admin",
url: "javascript:alert('admin')",
},
];
Front.openOmnibar({ type: "UserURLs", extra: myUrls });
So I'm guessing that at least from the omnibar, it should be possible to trigger JS that starts with javascript:
It is technically possible to run arbitrary JS on the page with insertJS
Opening them like a bookmark don't work.
What have you tried? I tried before to run JS code from a custom omnibar, I even had that attempt still commented out in my code:
var myUrls = [ { title: "Home Page", url: "javascript:alert('home')", }, { title: "wp admin", url: "javascript:alert('admin')", }, ]; Front.openOmnibar({ type: "UserURLs", extra: myUrls });
So I'm guessing that at least from the omnibar, it should be possible to trigger JS that starts with
javascript:
Interesting, I just tried to open JS bookmarklets from bookmarks (b
mapping) omnibar. can you explain more how to trigger this custom omnibar? I like to give it a try. I should put this in settings put my JS code as url and then what should I map it to?
mapkey("co", "Custom omnibar", function () {
var myUrls = [
{
title: "Home Page",
url: "javascript:alert('home')",
},
{
title: "wp admin",
url: "javascript:alert('admin')",
},
];
Front.openOmnibar({ type: "UserURLs", extra: myUrls });
});
mapkey("co", "Custom omnibar", function () { var myUrls = [ { title: "Home Page", url: "javascript:alert('home')", }, { title: "wp admin", url: "javascript:alert('admin')", }, ]; Front.openOmnibar({ type: "UserURLs", extra: myUrls }); });
I copied this to my setting, first it was giving me "mapkey undefined" error. I added api. before key map and know it shows custom omnibar option in the c
menu but when I hit co nothing happens
api.mapkey("co", "Custom omnibar", function () {
var myUrls = [
{
title: "Home Page",
url: "javascript:alert('home')",
},
{
title: "wp admin",
url: "javascript:alert('admin')",
},
];
api.Front.openOmnibar({ type: "UserURLs", extra: myUrls });
});
Adding api.
before those 2 lines work for me.
This is currently supported, but it is planned to be removed in migration to MV3 due to a more strict restriction on execution of arbitrary JS code.
I have JS bookmarklets and I like to trigger them via hotkey, Is there a way to do that? Opening them like a bookmark don't work. Can I add them to settings as a function and run them from there? If the answer is yes how? Sorry but I am new to coding and don't know a lot of stuff still trying to learn.
And thank you for this awesome extension, it makes a lot of difference in my workflow.