Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open all search results in multiple tabs #290

Closed
ukcuddlyguy opened this issue Jun 30, 2022 · 3 comments
Closed

Open all search results in multiple tabs #290

ukcuddlyguy opened this issue Jun 30, 2022 · 3 comments

Comments

@ukcuddlyguy
Copy link
Contributor

Would be really nice if there was a single button (maybe next to the bulk edit button), that opened all results (regardless of pagination) for the current search results in multiple tabs. Maybe if there are more than (e.g.) 10, it pops up a confirm dialog to be sure before tab-bombing.

Use-case: I have a "daily" tag for sites I visit once each day, would be really nice to bookmark my linkding search results for the daily tag, and click a button to open them all up! I have other tags for specific purposes that would be also good for the same feature.

I don't know what frontend framework linkding is written in, but if anyone can give me a tip on what sort of file to implement the JS code for this and how to connect it to a button, I'd be happy giving it a whack, but may need some help on the way.

For Chrome it could be specifically be:

var linkArray = []; // your links
for (var i = 0; i < linkArray.length; i++) {
    // will open each link in the current window
    chrome.tabs.create({
        url: linkArray[i]
    });
}

Which apparently is better with popup blocking, or just iterating and calling window.open.

@sissbruecker
Copy link
Owner

Since you seem to be comfortable with Javascript, have you considered writing a bookmarklet for that?

@ukcuddlyguy
Copy link
Contributor Author

ukcuddlyguy commented Jun 30, 2022

That's an absolute game-changer! I've been a web developer for decades, never written a bookmarklet before! Maybe because Javascript for me is a sprinkling I add to sites, rather than the core of them, so I don't think of all the things I can do with it.

For anyone finding this in future, this is the "URL" to use when creating a bookmarklet.

javascript:document.querySelectorAll("div.title a[rel=noopener]").forEach(function(url) { window.open(url) })

@sissbruecker
Copy link
Owner

Awesome! Yeah they are a good solution for adding some functionality without writing a full blown extension or adding features to an app.

If you feel like it, you could create a Github Gist from your solution, and then open a PR to add it to the Community section. This might be helpful to someone else, if just for the idea that you can use bookmarklets to add some functionality.

ukcuddlyguy added a commit to ukcuddlyguy/linkding that referenced this issue Jul 4, 2022
sissbruecker added a commit that referenced this issue Jul 4, 2022
* Add bookmarklet to community

#290

* Update README.md

Co-authored-by: Sascha Ißbrücker <sascha.issbruecker@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants