YaBB Community and Support Forum
YaBB Home About YaBB Download YaBB YaBB Support Customize Your Forum Development Contribute to the Project
  Welcome, Guest. Please Login or Register


 
Page Index Toggle Pages: 1
Topic Tools
 
Minify JavaScript? (Read 4,016 times)
 Dec 25th, 2010 at 12:07am
There are no actions to perform.  

Chess Publishing 
Junior Member
**
Offline
Posts: 89


None
Minify JavaScript?
Is it possible to combine the various JavaScript files and then call just this one file to improve the Forum performance? Undecided
 
 
IP Logged  
 Reply #1 - Dec 26th, 2010 at 3:15pm
There are no actions to perform.  

Chess Publishing 
Junior Member
**
Offline
Posts: 89


None
Re: Minify JavaScript?
Or what about using individual minified versions of each js file? Here is a minified version of AJS_fx.js, for instance:

Code Select All
AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(c,b){var a=new AJS.fx.Base();a.elm=AJS.$(c);a.options.duration=600;a.setOptions(b);AJS.update(a,{increase:function(){if(this.now==7){c.style.backgroundColor="#fff"}else{c.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)]}}});return a.custom(6,0)},fadeIn:function(c,a){a=a||{};if(!a.from){a.from=0;AJS.setOpacity(c,0)}if(!a.to){a.to=1}var b=new AJS.fx.Style(c,"opacity",a);return b.custom(a.from,a.to)},fadeOut:function(c,b){b=b||{};if(!b.from){b.from=1}if(!b.to){b.to=0}b.duration=300;var a=new AJS.fx.Style(c,"opacity",b);return a.custom(b.from,b.to)},setWidth:function(c,b){var a=new AJS.fx.Style(c,"width",b);return a.custom(b.from,b.to)},setHeight:function(c,b){var a=new AJS.fx.Style(c,"height",b);return a.custom(b.from,b.to)}};AJS.fx.Base=new AJS.Class({init:function(a){this.options={onStart:function(){},onComplete:function(){},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50};AJS.update(this.options,a);AJS.bindMethods(this)},setOptions:function(a){AJS.update(this.options,a)},step:function(){var a=new Date().getTime();if(a<this.time+this.options.duration){this.cTime=a-this.time;this.setNow()}else{setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);this.clearTimer();this.now=this.to}this.increase()},setNow:function(){this.now=this.compute(this.from,this.to)},compute:function(b,a){var c=a-b;return this.options.transition(this.cTime,b,c,this.options.duration)},clearTimer:function(){clearInterval(this.timer);this.timer=null;return this},_start:function(a,b){if(!this.options.wait){this.clearTimer()}if(this.timer){return}setTimeout(AJS.$p(this.options.onStart,this.elm),10);this.from=a;this.to=b;this.time=new Date().getTime();this.timer=setInterval(this.step,Math.round(1000/this.options.fps));return this},custom:function(b,a){return this._start(b,a)},set:function(a){this.now=a;this.increase();return this},setStyle:function(b,a,c){if(this.property=="opacity"){AJS.setOpacity(b,c)}else{AJS.setStyle(b,a,c)}}});AJS.fx.Style=AJS.fx.Base.extend({init:function(a,c,b){this.parent();this.elm=a;this.setOptions(b);this.property=c},increase:function(){this.setStyle(this.elm,this.property,this.now)}});AJS.fx.Styles=AJS.fx.Base.extend({init:function(a,b){this.parent();this.elm=AJS.$(a);this.setOptions(b);this.now={}},setNow:function(){for(p in this.from){this.now[p]=this.compute(this.from[p],this.to[p])}},custom:function(c){if(this.timer&&this.options.wait){return}var b={};var a={};for(p in c){b[p]=c[p][0];a[p]=c[p][1]}return this._start(b,a)},increase:function(){for(var a in this.now){this.setStyle(this.elm,a,this.now[a])}}});AJS.fx.Transitions={linear:function(a,e,f,g){return f*a/g+e},sineInOut:function(a,e,f,g){return -f/2*(Math.cos(Math.PI*a/g)-1)+e}};script_loaded=true;script_loaded=true; 

 
 
IP Logged  
 Reply #2 - Dec 26th, 2010 at 5:55pm
There are no actions to perform.  

Unilat 
Development Team
Theme Team
****
Offline
Posts: 1,047
Columbus Ohio, USA


None
Re: Minify JavaScript?
The second would be the only way to make it faster, and barely at that. The first would not help because not all of the javascript files are required on each page and so putting them all together would make each page have to evaluate all of the javascript whether it was needed or not. Making the files as they are now smaller would just make them harder to read and write for us devs.
 
 
IP Logged  
 Reply #3 - Jan 2nd, 2011 at 3:53pm
There are no actions to perform.  

Chess Publishing 
Junior Member
**
Offline
Posts: 89


None
Re: Minify JavaScript?
OK, I've tried making a minified combined.js file and deleted most of the calls anyway to see what happens!
No, of course it makes the files much harder to read for humans, they look a complete mess!
 
 
IP Logged  
 Reply #4 - Sep 23rd, 2011 at 12:08am
There are no actions to perform.  

genghis 
Junior Member
**
Offline
Posts: 84


None
Re: Minify JavaScript?
I run another forum software in addition to YaBB, and they have the choice to run Javascript from the server or to let Google handle the javascript "calls" (Is that that right word?) Enabling Google to handle it there sped it up quite a bit. I was wondering if it could be an option in YaBB.
 
 
IP Logged  
 Reply #5 - Sep 23rd, 2011 at 12:40am
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Minify JavaScript?
Hi,

Google doesn't have YaBB's JavaScript so it wouldn't be possible. I'm assuming the other forum software uses a JavaScript library such as JQuery which can be hosted on Google if you choose to do so.

http://code.google.com/apis/libraries/

And a little reading why it would speed it up (if you're interested):

http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/

But YaBB doesn't use any such libraries.
« Last Edit: Sep 23rd, 2011 at 12:44am by Derek Barnstorm »  
 
IP Logged  
 Reply #6 - Oct 4th, 2011 at 3:00am
There are no actions to perform.  

liuvincent19 
YaBB Newbie
*
Offline
Posts: 4


YaBB 2.4
Re: Minify JavaScript?
The first would not help because not all of the javascript files are required on each page
 
 
IP Logged  
 Reply #7 - Dec 21st, 2011 at 11:22am
There are no actions to perform.  

JonB 
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 3,616
Land of the Blazing Sun!


None
Re: Minify JavaScript?
Off-Topic replies have been moved to this Topic.
 
I find your lack of faith disturbing.
 
IP Logged  
 Reply #8 - Dec 21st, 2011 at 3:05pm
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,856
Earth


YaBB 2.5
Re: Minify JavaScript?
And then we have the people who add their own javascripts for various and sundry things.
 
WWW  
IP Logged  
 Reply #9 - Dec 21st, 2011 at 11:59pm
There are no actions to perform.  

JonB 
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 3,616
Land of the Blazing Sun!


None
Re: Minify JavaScript?
Indeed Dandello - such as 'seasonal snow' or 'village scenes' in my case...

Cool
« Last Edit: Dec 21st, 2011 at 11:59pm by JonB »  
I find your lack of faith disturbing.
 
IP Logged  
 Reply #10 - Aug 10th, 2012 at 8:57pm
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,856
Earth


YaBB 2.5
Re: Minify JavaScript?
This Topic was moved here from Non-YaBB Programming and Technical Help by Dandello.
 
WWW  
IP Logged  
Page Index Toggle Pages: 1
Topic Tools
 

Get Yet another Bulletin Board at SourceForge.net. Fast, secure and Free Open Source software downloads Support This Project BoardMod - YaBB features and templates YaBB Codex - support on installation and usage YaBB Toolbar for your browser

YaBB Facebook Group Page

Vulnerability Scanner

Valid RSS Valid XHTML Valid CSS Powered by Perl
YaBB Chat and Support Community » Powered by YaBB 3.0 Beta!
YaBB Forum Software © 2000-2011. All Rights Reserved.