Fivefold/linkding-injector

Support for mobile

Opened this issue · 3 comments

qcasey commented

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

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?

qcasey commented

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

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.