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

Support for mobile #10

Open
qcasey opened this issue Mar 19, 2023 · 4 comments
Open

Support for mobile #10

qcasey opened this issue Mar 19, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@qcasey
Copy link

qcasey commented Mar 19, 2023

Thanks for the neat extension :)

Linkding's support on mobile is very limited right now. Regardless, this would be a great extension to also use on mobile devices. Right now the injector doesn't seem to appear?

I did a rough mockup of what this could look like:

Screen Shot 2023-03-19 at 12 27 58

@Fivefold
Copy link
Owner

Hey, thanks for the suggestion and the nice mockup!

Unfortunately I have no experience with developing and debugging browser extensions for mobile browsers, so don't expect to see this any time soon. Or are you offering to implement this via PR?

Right now the injector doesn't seem to appear?

Did you try out the extension in a mobile browser? If so, which one did you use?

@Fivefold Fivefold added the enhancement New feature or request label Mar 19, 2023
@qcasey
Copy link
Author

qcasey commented Mar 23, 2023

Did you try out the extension in a mobile browser? If so, which one did you use?

Firefox Nightly, which has an option for untested extensions.

Unfortunately I have no experience with developing and debugging browser extensions for mobile browsers, so don't expect to see this any time soon. Or are you offering to implement this via PR?

Totally OK, I don't have a ton of time either I just wanted to check if it's something you've tried yet, and if you'd accept a PR (?). When I get some free time I'll try to put this together. I suspect it's not appearing because mobile Google/DDG is missing the sidebar element

@Fivefold
Copy link
Owner

Fivefold commented Mar 23, 2023

if you'd accept a PR (?)

definitely. If you do decide to work on it I'd greatly appreciate some testing/debugging instructions, since like I said I don't have experience with this and would have to maintain this in the future.

I suspect it's not appearing because mobile Google/DDG is missing the sidebar element

That would be my first guess as well. The content script locates the sidebar element via document.querySelector() and the relevant id of the sidebar and then injects the html.
In the case of google it actually constructs the sidebar element, since google completely removes it if there is no sidebar content (other search engines just have an empty sidebar element)

} else if (searchEngine == "google") {
sidebar = document.querySelector("#rhs");
if (sidebar == null) {
// google completely omits the sidebar container if there is no content.
// we need to add it manually before injection
let sidebarContainerString = `
<div id="rhs" class="TQc1id hSOk2e rhstc4"></div>`;
// construct DOM document from string
let sidebarContainer = parser.parseFromString(
sidebarContainerString,
"text/html"
);
let container = document.querySelector("#rcnt"); // get main search result container
container.appendChild(sidebarContainer.body.querySelector("div"));
sidebar = document.querySelector("#rhs"); // get the added sidebar container
}

So if you can debug on mobile firefox you could try to search in the source code for a div with id "rhs" on google to see if the injection works at all.

@Fivefold
Copy link
Owner

Fivefold commented Oct 9, 2024

You can now install the extension on regular Firefox for Android as well, using a (clunky) workaround:

  1. Go to the firefox extension page for the injector extension.
  2. Switch to desktop mode (by clicking on the three dots next to the address line and then on "Desktop site").
  3. You can now install the extension.
  4. Navigate to the extension settings directly through the firefox settings (Settings > Extensions > linkding injector > Settings). Accessing the injector settings via the cogwheel in the injection box won't work.
  5. Add your connection data and configure the extension.

Unfortunately, injector results will only be shown if you also access the search pages in desktop mode, as the sidebar is hidden in the mobile view. Maybe I can add a different injection method for mobile views (injecting into the regular results area), but it won't happen anytime soon. Pull requests are welcome however, as always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants