Scripted bookmarks
-
Hi.
In a lot of modern web pages, especially single page applications, it can sometimes be difficult or impossible to point a bookmark to a given place (and state) in the web page. Say, for instance, you use some team work tool like Jira, and you would like a bookmark that opens the task board page and scrolls (past a large amount of tasks) to the first task that has your name on it. Or, say your place of work has a complicated time accounting system, and you would like a bookmark to open the system, navigate to the right place, and fill in the amount of hours you normally work, leaving you only to adjust if necessary and then click 'submit'.To make scenarios like this possible, I would like to suggest scripted bookmarks. They would be like normal bookmarks, except with the possibility to run a (JavaScript) script after the page has opened.
A scripted bookmark for the latter scenario, would work like this: The address field would simply contain: "https://badtimeaccountsystem.com". In addition there is a "script" field containing either a short script, or a pointer to a file containing a script, e.g. "fill_in_hours.js". The script could then contain something like:
$(window).load(function() {
$("button.begin-time-accounting").click()
$("input#monday").value("8");
$("input#tuesday").value("8");
...
$("input#friday").value("8");
});And then after clicking the bookmark it would have navigated to the right place inside the single-page application, and also filled 8 hours into every day of the current week.
This would be a lot like the Chrome extension Tampermonkey, except it would be tied to a bookmark, and thus used more like a command than a permanent modification to the site. It would also be comparable to Selenium, (used for testing web pages), which is capable of navigating around, filling forms and making assertions (typically driven by a custom Java or .NET application), except this would be integrated into the browser and thus a lot simpler to set up and use.
For users with knowledge to write scripts like this, scripted bookmarks could be an extremely powerful tool. A lot of people are wasting a lot of time every day clicking the same buttons on the same web pages. Automation support like this would truly make Vivaldi the power user browser.
-
It's already possible to add JavaScript bookmarklets as bookmarks in Vivaldi. Is there anything additional that you would need beyond them?
-
@eriklothe While I find the idea interesting, you are aware that your code is not JavaScript?
Including or integrating (possibly different) js frameworks into VIvaldi starts seeming a bit far-fetched...
But if we can get some kind of automation, that'd be terrific...
Seeing @LonM's comment: bookmarklets should be able to do this, if they can be made to open a page, wait till it's loaded and then execute further code. Alternatively, you could first use a classic bookmark and then a bookmarklet...
-
@LonM, while bookmarklets are very useful for these scenarios, they cannot, as far as I understand, navigate to other pages (https://stackoverflow.com/questions/7103996/javascript-bookmarklet-go-to-url-and-execute). Essentially, I would like a bookmark that is a normal bookmark and a bookmarklet combined. @Morg42 the example code is JavaScript
It's heavily dependent on JQuery, though (the dollar sign is just a function name from the JQuery framework).
I should perhaps have addressed this in my original post: A "scripted bookmarks" feature should include dependency support, as frameworks like JQuery are very helpful for short and simple scripts like this. Tampermonkey solves this by supporting require statements like "@require http://code.jquery.com/jquery-1.12.4.min.js". This way no libraries needs to be integrated or directly supported by the browser, but can be fetched as needed from third-party CDNs.
-
@eriklothe said in Scripted bookmarks:
the example code is JavaScript
It's heavily dependent on JQuery, though (the dollar sign is just a function name from the JQuery framework).
Yeah, ok. Not wrong, but "pure" jQuery code ist "not js" in the sense that the interpreter needs to have access to jQuery. This seems a bit much for a requirement where the bookmark management of the browser is still not finished...
-
I guess the main aim here would be to be able to 'chain' things together. Like:
- Plain bookmark takes you to yyy
- Vivaldi knows to then initiate a special bookmarklet whenever this plain bookmark is used
- Special bookmarklet does thing zzz
-
@LonM exactly
@Morg42 JQuery and other libraries are just JS code. There is no need for the interpreter to support any specific framework. It just needs to support loading code from a third-party CDN. Essentially, this is nothing more than fetching a URL and loading the content into the interpreter. Check out Tampermonkey's documentation for their require statmenent. This is my request anyway
-
@eriklothe said in Scripted bookmarks:
It just needs to support loading code from a third-party CDN.
A bit off topic, but I really don't like to load stuff from 3rd party CDNs, especially not for local stuff. This is really worth a try:
https://github.com/Synzvato/decentraleyes -
@quhno cool
I'll check it out.
-
Ppafflick moved this topic from Automotive News on
-
Thank you for your request. As it has received few votes over 4 years, it is now going to be archived.
-
LLonM moved this topic from Desktop Feature Requests on