this post was submitted on 21 Jun 2023
25 points (100.0% liked)

Lemmy Plugins and Userscripts

375 readers
1 users here now

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

Thanks!

founded 1 year ago
MODERATORS
 

Up for discussion:

The userscript I (and others) have written seems to be fairly popular among people who have found it. I've had several requests to turn it into a Lemmy theme, but I have been hesitant to do so. Partly because I lack the skill to do it, and partly because it isn’t really a “theme” as such. It doesn’t change the colors or do some of the things a theme typically does. In truth, the script is actually (essentially) theme agnostic - I use it with darkly, but it works with all of the other Lemmy themes without issue (hopefully).

I have no qualms with someone helping turn the CSS stuff into a Lemmy theme (or just taking the bull by the horns and doing it) , but with the changes coming in v.0.18 it may be better to wait.

Anyone have any thoughts? Is this script even appropriate for a Lemmy theme?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 1 year ago (1 children)

Hey. Let me start off by saying that this script is great and I'm really thankful for it. There's still some room for improvement but it makes the experience much much more enjoyable.

So, I'm working on modding the lemmy-ui source code to work on a modded Lemmy instance I'm building with some friends. I've only been working on it for a couple days so I'm quite ignorant myself, but I have a few ideas about your project.

So, I don't think this could be a theme because it does something fundamentally different. A theme is simply a set of colours, fonts and other customization options that describe how Bootstrap should make the content that's already defined look like. Example, this is what a theme's code looks like.

What you are doing instead, is replacing the Bootstrap code itself, which is beyond a theme's scope. You are touching the page's code.
As far as I know, Lemmy has no way of toggling a feature like this on a user level so user scripts might be your best bet for the time being. However, I like the design so much (and on my instance we are all Reddit refugees anyway) that I'm considering making it the official layout of my instance. I'd still need to figure out how that would work in the details, but I think it could be done without excessive trouble.

As a sidenote, reading your code I saw you used the browser's user agent to check for mobile users. I'd avoid doing that because users can actually modify their user agent if they want to, and some people who really care about their privacy have extensions that do so automatically. Instead you could try using media queries and the window.matchMedia() function (not sure if it's suported in user scripts as I'm quite the noob in that field, but that's how I'd do it in a web page).

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

So, I don’t think this could be a theme because... What you are doing is replacing the Bootstrap code itself

yeah, this is what I thought. Makes sense and I appreciate the insight/feedback.

As a sidenote, reading your code I saw you used the browser’s user agent to check for mobile users.

Yes indeed. That's coming out. New released updates handle screen width with pure CSS (the @media you mentioned) so there's no need to check for browser type/agent anymore. In fact, I'm getting rid of basically all the functions (except for the tagline reposition which I'm pretty sure won't be needed for v0.18).

[–] [email protected] 2 points 1 year ago (1 children)

Is this "new version" you speak of the one you pushed 5 hours ago? I really like it! The fix to the banner in user profiles is great, it looks much nicer. Yes I really think I'm going to add this to my instance.

[–] [email protected] 3 points 1 year ago

yep, that is the new version