Summary: | Page specific jQuery | ||
---|---|---|---|
Product: | Koha | Reporter: | Christopher Brannon <cbrannon> |
Component: | System Administration | Assignee: | Bugs List <koha-bugs> |
Status: | NEW --- | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | dcook, emmi.takkinen, fridolin.somers, gmcharlt |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: |
Description
Christopher Brannon
2021-10-20 22:44:05 UTC
You mean JQuery code added in IntranetUserJS or OPACUserJS ? Each page as an id in the body. For example : <body id="main_intranet-main" class="intranet-main"> So you can create a code loaded just for that page with : if ( $("body#main_intranet-main").length > 0 ) { (In reply to Fridolin Somers from comment #1) > You mean JQuery code added in IntranetUserJS or OPACUserJS ? > > Each page as an id in the body. > For example : > <body id="main_intranet-main" class="intranet-main"> > > So you can create a code loaded just for that page with : > if ( $("body#main_intranet-main").length > 0 ) { That solution is a logical selector. I am talking about jquery that will only be loaded for specific pages. If you look at ANY page source in Koha, you will always see ALL of your jQuery, not just jQuery that relates to that page. Some libraries have a lot of jQuery, and an enhancement of this nature would A) reduce the amount of code that is looked at and processed when the page is loaded, and B) reduce unexpected side effects of jQuery that might affect unintended pages due to mistakes in the Koha or jQuery code. |