Summary: | Replace UserJS system preference with snippets | ||
---|---|---|---|
Product: | Koha | Reporter: | Lucas Gass (lukeg) <lucas> |
Component: | Architecture, internals, and plumbing | Assignee: | Bugs List <koha-bugs> |
Status: | NEW --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | andrew, blawlor, dcook, hacheng, kebliss, lisette, magnus, marion.durand, martin.renvoize, michael.skarupianski, michaela.sieber, paul.derscheid |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39538 | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: |
Description
Lucas Gass (lukeg)
2024-12-13 20:55:37 UTC
+1 -- It could be interesting to have enabled/disabled options as well. Sure, in theory, you can always just comment out the code you want to disable, but depending on how you've done your code comments this can actually be a bit of a pain. Having an easy way to turn these on/off could potentially be handy. -- This is a bit of a tangent, but this could also allow us to enhance the UserJS feature. For instance, if we could toggle on 'type="module"', then we'd be able to add support for user-defined ES6 modules. (I'm curious how ES6 module imports from external URLs work with Content-Security-Policy...) That said, I don't know how much of a value add this really would be. It just popped into my mind, as I was writing some ES6 modules last week, which made it easy to share code around my codebase without interfering/polluting the global namespace. Anyway, just food for thought. (Aside: Of course, today is the day I learn that you can actually use dynamic imports in regular Javascript code...so even less utility for making the snippets appear as modules...) +1 I think it would make sense to do the same for UserCSS? And have one smippet go to either the OPAC or staff, or both? (In reply to Magnus Enger from comment #3) > +1 I think it would make sense to do the same for UserCSS? And have one > smippet go to either the OPAC or staff, or both? I like the idea of doing the same to UserCSS. I also like the idea of giving the user the choice of where to apply those snippets. I suppose we'd want to cover all the varieties of those sysprefs, though: SelfCheckInUserCSS SCOUserCSS OPACUserCSS IntranetUserCSS SelfCheckInUserJS SCOUserJS OPACUserJS IntranetSlipPrinterJS IntranetUserJS (In reply to Magnus Enger from comment #3) > +1 I think it would make sense to do the same for UserCSS? And have one > smippet go to either the OPAC or staff, or both? This would be a problem when we implement Content-Security-Policy. Each individual snippet will need its own type indicated. (In reply to David Cook from comment #5) > (In reply to Magnus Enger from comment #3) > > +1 I think it would make sense to do the same for UserCSS? And have one > > smippet go to either the OPAC or staff, or both? > > This would be a problem when we implement Content-Security-Policy. Each > individual snippet will need its own type indicated. I might be misinterpreting what you're saying though. Overall, yes for doing it for UserCSS as well. Just so long as the snippets are clearly marked as CSS or Javascript. (In reply to Andrew Fuerste-Henry from comment #4) > I also like the idea of giving the user the choice of where to apply those > snippets. I suppose we'd want to cover all the varieties of those sysprefs, There's also the question of branch-level CSS and Javascript and how that fits into this... (In reply to David Cook from comment #7) > (In reply to Andrew Fuerste-Henry from comment #4) > > I also like the idea of giving the user the choice of where to apply those > > snippets. I suppose we'd want to cover all the varieties of those sysprefs, > > There's also the question of branch-level CSS and Javascript and how that > fits into this... True! I forgot that OPAC CSS and JS had been added to branches. In the structure we're ideating here it would make sense to pull that out of the branches setup and instead let each snippet be limited to one or more branches. (In reply to Andrew Fuerste-Henry from comment #8) > True! I forgot that OPAC CSS and JS had been added to branches. In the > structure we're ideating here it would make sense to pull that out of the > branches setup and instead let each snippet be limited to one or more > branches. Yep, I'd agree. |