This object is in archive! 
Upvote 1

If custom theme, also load custom JavaScript

Archived Annevar Media, LLC 9 years ago

If I have a custom theme selected, it would be nice if the application would load the custom JavaScript files as well.


First one being main.js, which currently has nothing defined in it. But if I want to add anything, I must do this at the system level, as that is what the template loads.


The second being global.js, this I feel should load from the custom theme. I realize this has quite a lot of functionality in it, but I would rather not be making destructive changes to system-level files. Though in many cases I am.


I have made a change to toTopResize, and I would rather make a change like that to a theme-level file, and not a system-level file. Your documentation still refers to 2.3.x so I do not know what you have planned for your Theme documentation for 3.x but all I have done is copy the assets, layouts, and templates from the system-level /applications/3.0.2/... to create my custom theme.


For reference, this is the change I have made, as I do not want the JS dictating the inline CSS, other than display: block and display:none.

  1. if ($('a.toTop').width() < top_right && $(window).scrollTop() != "0") {
  2. $('a.toTop').css({'display': 'block'});
  3. } else {
  4. $('a.toTop').hide();
  5. }

Replies (1)

photo
1

This is possible starting from 3.1 release. To add custom js in theme, you need to have theme.js and add any custom js there that will load on every page and be minified.

Replies have been locked on this page!