Topics: Themes
Oct 15, 2012 at 10:10 PM
Edited Oct 17, 2012 at 3:44 PM

I'm using version

I've created a custom theme and I have some .js files that use jquery and specifically the jquery.innerfade.js include to control an image slider on the home page.

Before I upgraded to version 2.6 all the .js files in my theme would be pulled in and included. Now it seems I have to include them myself within the site.master which is fine.

I'm also using some cufon javascript files to get some custom fonts in, which is working correctly after I added it to the site.master.

I can't figure out why I can't get innerfade to work correctly though using this same method.

Any help is appreciated!

Oct 16, 2012 at 1:25 AM

Scripts added to /Scripts folder are deferred and loaded asynchronously to not block markup. The downside is you can call script before it is loaded, as in your case. If you have to, move it to /Scripts/Header - header scripts not deferred. It is slower but you guaranteed script downloaded to browser before HTML.

<script type="text/javascript" src="/upsfcu/Scripts/Header/js"></script>
<script type="text/javascript" src="/upsfcu/Scripts/js" defer="defer" async="async"></script>

Oct 16, 2012 at 3:28 AM

Thanks for responding!

I've tried moving all my javascript from my theme to /Scripts/Header and that didn't work. So then I thought maybe I'd try just moving just jquery.innerfade.js and leaving the innerfade function calling javascript in site.js in my theme with a site.master reference to it. That didn't work either though.

I then tried to move everything to /Scripts and nothing was being pulled in. It looks like the script tag is actually:

<script async="async" defer="defer" src="/upsfcu/Scripts/jsauth" type="text/javascript">

Does it have anything to do with how the .js files are named like it did before?

Oct 16, 2012 at 4:09 AM
Edited Oct 16, 2012 at 4:10 AM

All scripts compressed and combined into single file (scripts/js or scripts/jsauth for authenticated users), so you should not see any .js files. That "jsauth" should have all scripts you put into /scripts folder, loaded alphabetically.

Oct 16, 2012 at 4:41 AM

I can see they are all being combined into one file. When you are logged in it's /Scripts/jsauth, and it's /Scripts/js is when you are logged out.

It's odd that now when I try to drop .js files in either /Scripts/Header/ or /Scripts/ that neither of them are finding my .js files. I know this was working before as well. I've tried clearing cache and hitting hard reset and no change.

Any other things I can take a look at or try perhaps? Thanks again for helping me out!

Oct 16, 2012 at 1:53 PM

I had a problem with scripts loading in I discovered that if I uncheck "Enable Optimization" in Admin->Settings->Advanced that it resolved my issue and that all scripts load individually in alphebetical order as rtur mentions.

Oct 16, 2012 at 2:50 PM
MGD_King wrote:

I had a problem with scripts loading in I discovered that if I uncheck "Enable Optimization" in Admin->Settings->Advanced that it resolved my issue ...

Sometimes script compression can't handle .js formatting and messes up code which lead to js errors. I had to modify couple scripts BE admin uses to fix this.

Oct 16, 2012 at 9:26 PM

I checked in the admin backend and there wasn't a setting called "Enable Optimization" under Settings > Advanced. There was one called "Enable HTTP compression" that I played with to try to get my javascript files to load that didn't work.

At this point using either /Scripts/ or /Scripts/Header does not load the javascript files I drop into each directory.

Can you perhaps tell me what BE scripts you modified and how to fix this?

Oct 17, 2012 at 12:13 AM

Your scripts are loaded, but compression throws errors. In there is no option to turn it off, it was added later after release and is only in the source repository.

Oct 17, 2012 at 3:44 PM

So I tried to narrow the problem down and I think it had something to do with the jquery.innerfade.js file. If I removed that file all of the other .js files load no problem. I also replaced the innerfade with jquery cycle, ( and now everything works perfectly when loaded from /Scripts/Header.

I guess I've found a solution for my problem, thanks for all your help!

Oct 24, 2012 at 8:16 PM
Edited Nov 8, 2012 at 7:51 PM

I was having some trouble trying viewing my uploaded images when editing a page. Existing images on the page were viewable, but when I tried to insert new ones they wouldn't show up.

Existing image code:

<img src="/upsfcu/image.axd?picture=2011%2f11%2fmain_slider_1.jpg" alt="" />

New image code:

<img src="/upsfcu/IMAGES%2f2012%2f10%2fUP_banner_1.jpg.jpgx" alt="" />

I reverted back to version 2.5 through godaddy. I then went through and updated again to 2.6 through godaddy and my site came back correctly. I checked again and I can't upload new images and have them work.

However now I'm back to square one with the javascript not loading from /Scripts/Header. As far as options go would it be easier to delete what I have and try to reinstall 2.6? Or is there a way I can still salvage what I have?


Oct 24, 2012 at 9:17 PM

You loading jQuery 1.5.2 from the header and then another jQuery 1.4.4 from the /scripts. They conflict and break all other scripts, should be only one jQuery in application. You don't need that 1.4.4. It probably there from older version, may be with some other scripts that you need to make sure have no duplicates.

Nov 8, 2012 at 7:53 PM

I went back with a fresh download of version and compared it's file structure to what I had and you were correct I had some extra files that I did not need. I deleted them and now everything works correctly!

Thanks for all of you help in this matter!