Jump to content

Optimized JavaScript files


Guest Luke

Recommended Posts

Posted

It's nice that IPS has decided to optimize the code to bring the file size down on the javascript files. But often modding involves trying to figure out how certain features work so a mod can be made. Can you guys please provide a "full-jscripts" folder with the un-optimized code to make it easier to read for developers? The "jscripts" directory would be for loading it on the forum, and the "full-jscripts" folder could be just there for development purposes.

If you guys could do this that would be awesome :)

Posted

Hey I'm working on it :P....

I actually need this for another mod... We'll... did need... I was too determined to find out what I needed to... top secret mod :D...

Posted

I may try to get you to do some custom mods for me. I really have forgotten what all mods I've wanted in the past, there have been so many. One mod in particular I am not so sure you could do and it would be so huge I would maybe not evenw ant to know what it would cost. lol But one mod in particular i will geta quote from you soon hopefully.

Anyway can't wait to see what mod you're referring to and also report center. Hoping it will work for gallery and blogs both. I THINK you were always planning on it working for those, along with board of course.

Sorry, I have gone beyond off-topic. lol

  • 2 weeks later...
Posted

well i just decided to look @ the js files and thought came across my mind was WTF!!! i have a ajax mod on my site and made use of ipb_topic.js but at the moment it just looks like one long mess, none of its spaced out and pretty impossible to read or make sense of and totally confused. I'm not a javascript buff or anything so was removing all whitespace a way of optimizing it or summit cus atm i'm pretty confused :P.

Posted

How big of a resource saving is this, considering that typically these files are cached anyway? I try to avoid editing these files typically, but sometimes you need to, and it's pretty much impossible now.

Posted

well i just decided to look @ the js files and thought came across my mind was WTF!!! i have a ajax mod on my site and made use of ipb_topic.js but at the moment it just looks like one long mess, none of its spaced out and pretty impossible to read or make sense of and totally confused. I'm not a javascript buff or anything so was removing all whitespace a way of optimizing it or summit cus atm i'm pretty confused :P .



You could load it into Visual Studio or something similar and whack the "Reformat document" (Ctrl+K,Ctrl+D in VS) function, that should set it out the way you want :)

Now if it were anything like the way Google optimises their scripts, yeech.
Posted

It's optimized by removing all unnecessary comments, line breaks, and whitespace.

If you are adding a function to the js file, why not just add it on a new line? It won't interfer with the existing js, and unlike php where you have an opening and closing tag, the entire js file is parsed.

Posted

Ah I figured you would have removed the comments and line breaks but wouldn't removing all the whitespace mean it was all clumped up? Like in a big splodgy pile? :lol:

Posted

It's optimized by removing all unnecessary comments, line breaks, and whitespace.


What if part of your mod requires you to edit part of an existing javascript function?
Posted

The idea behind doing this is it makes the js files smaller, which means the client (browser) has less to download. It does have a rather decent effect on your site... I've already done it on 2.1...

So I don't mind that it's optimized. That's actually a very good thing. But what I would like to see is a sub-folder that contains all the same files, just un-optimized. And what would be really neat is if you included a program to do the optimization for you, or a link to a site that does or something. That way when a mod does require you to edit the js files you can do something like:

Step 1) Copy /jscripts/full/ipb_global.js to /jscripts/ipb_global.js
Step 2-5) Modification steps
Step 6) Run /jscripts/optimize.php?ipb_global.js

Something like that would be really neat, as long as optimize.php works :)

Posted

It's optimized by removing all unnecessary comments, line breaks, and whitespace.



If you are adding a function to the js file, why not just add it on a new line? It won't interfer with the existing js, and unlike php where you have an opening and closing tag, the entire js file is parsed.



What if you're trying to figure out what a particular JS call does?
  • Management
Posted

IPB 2.2.0 RC 2 (and future releases) contain a directory called "Development" which contains "javascript_uncompressed".

Posted

Yay thanks, i was editing the profile_portal.js so I could add a new tab (One that was part of profile.php) and it was pretty hard to find it.

Cant wait for RC2 now :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...