MyBB Community Forums

Full Version: Do I need these default JS?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
prototype.js?ver=1603
general.js?ver=1603
popup_menu.js


Could you please tell what these files are used for. I would like to make them smaller I want to keep only stuff my forum needs????
prototype.js is a javascript library that the MyBB 1.6 series uses. 1.8 uses the jQuery library instead.

popup_menu.js is javascript that opens new popup windows. You get these when you report a post,view who posted in a thread. I'm not sure if the Are you sure you want to delete is part of this or a separate file.

general.js is basically a global javascript file kind of like global.php except it has the essential javascript the other javascript files need.
Also, you may want to change the ver parameter to reflect your installed version of MyBB. In reality, these JS files are static, but use the ver parameter to get around browser caching when updating.
(2014-06-24, 03:01 PM)laie_techie Wrote: [ -> ]Also, you may want to change the ver parameter to reflect your installed version of MyBB.
There don't have to match the version you are using as most files haven't been changed for a while. E.g. popup_menu.js is still identically to the file in MyBB 1.6.0 hence ?ver=1600.
Ok looks like they are pretty need files thanks guys.
You can combine all the three to one file and minimize using javascript compressor. Overall size and number of file requests to the server will be reduced.
(2014-06-25, 03:14 AM)_Jerry_ Wrote: [ -> ]You can combine all the three to one file and minimize using javascript compressor. Overall size and number of file requests to the server will be reduced.

Thanks buddy I have them optimized but how can I combine them without messing things up? And what final file size are we talking about?
I am attaching a working combined version of:
general.js?ver=1603
popup_menu.js
For prototype.js, add the following line
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
Hope this helps to improve your site performance.
+1 buddy but calling or depending on an external source is not why like to do. Don't get me wrong here I very appreciate your support.


ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js is 180kb and it's an external file will slow my website a lot. I have optimized prototype.js using Google JS optimizer and it's 85kb
OK, actually Google's data center would be among the best data-centers in the world today, I had same thoughts of not depending any external js file for my forum, how ever after having some comparisons. 180kb is the size once you downloaded to your computer and seeing the size, in browser, you will have gzip and the actual network download size will be as follows
GET prototype.js 304 Not Modified ajax.googleapis.com 39.8 KB 74.125.135.95:80
That said, it is compressed to 39.8kb and loaded in 159ms in India. You may consider this again :-)
This also comes with an expiry header,
Age	8464
Alternate-Protocol	80:quic
Date	Thu, 26 Jun 2014 10:36:35 GMT
Expires	Fri, 26 Jun 2015 10:36:35 GMT
Server	GFE/2.0
that said, there will be no request to the server for the next one year, if your browser has already a copy of it. I am using it in my forum and the results are pretty good.
Bonus point: this cache will be shared for any website, the user visits.