Sorry for the late reply. For some reason, I wasn't getting notification about new forum posts.
First of all, Files Gallery is considered a "single page application". All page content is "injected" when you navigate, as that makes it a smooth dynamic experience. Therefore, custom Javascript is injected once immediately as soon as the website is loaded into browser. If you want to trigger functions on a per-page basis, you would need to use the `x3_load_page()` function.
If you want to trigger javascript on select pages only, then there are a couple of options, but you would of course still need to "apply" this logic somewhere. Either trigger the function from each page (either directly from your "content" or from Settings > Page > Advanced > Page Javascript). You could of course create global functions, and then simply trigger the function name on each page where you want it to apply. X3 can't guess what pages you want to apply the javascript of course.
JMM wrote:According to the non-X3 guy that wrote that little script & is helping me, that Javascript code is being called AFTER the sb-site-container div, but needs to be before.
Yes it's called after the HTML content. Most javascript is called once the DOM has rendered, else you wouldn't be able to target any of the HTML in the DOM. Besides, I'm not sure what your javascript is supposed to do, or why it specifically needs to get called BEFORE sb-site-container exists. I can't see how that makes any sense to be honest.
You could of course insert some Javascript into the <head> (Settings > Custom > Custom Head) section, which could render before any dom elements exist. Hard to imagine why you would need to do that.