UNLEASHED YOUR CREATIVITY!
You'll need to login or register in order to fully use all the features and view all the sections of this site.
Thank you.
Regards: FSMANIA Team

UNLEASHED YOUR CREATIVITY!


 
HomePortalCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in

 

Compiling JS to one file

View previous topic View next topic Go down 
Author Message
[AKOSIAMICK]
VIP

avatar


Age : 21 Registration date : 2009-03-11 Number of posts : 60 Location : Job/hobbies : Humor :

PostSubject: Compiling JS to one file   Wed Mar 11, 2009 7:32 am

Here's a script to load multiple js files. so you can have separate js files for specific scripts.i suggest you place the most important script as the very 1st one. if you have multiple functions in one js file, one error may prevent the function below it from functioning unless the call function is done before the error. example: if function AAAA() has an error, it may prevent BBBB() and CCCC() from executing even if they are independent functions.

INSTRUCTIONS

1.Create a subfolder & name it as whatever you want to name it.

2.Inside your script folder, save any js you want in each file like for example,

1)if you want your who right clicked cbox, save it as wrccbox.js

2)if you want friend randomizer save it also as one file as frbox.js

3)if you want wvm cbox mode, save it also as one file as wvmcbox.js So the above examples will be the contents of your scriptfolder. To apply it in the script it will then look like this:


Code:
scriptFolder = 'http://h1.badwaresite.www/username/javascripts/' scripts = new Array() scripts[0] = 'wrccbox.js' scripts[1] = 'frbox.js' scripts[2] = 'wvmcbox.js' for(x in scripts){ myscripts = document.createElement('script') myscripts.src = scriptFolder+scripts[x] document.getElementsByTagName('head')[0].appendChild(myscripts)}


3.Save as whatever you want to name it.This will then your main js file which you need to add in your linker to paste in your profile.

Credits:
Yoshi
Back to top Go down
View user profile

Compiling JS to one file

View previous topic View next topic Back to top 
Page 1 of 1
Friendster Mania Members
Follow the rules of this forum!

Permissions in this forum: You cannot reply to topics in this forum
UNLEASHED YOUR CREATIVITY! :: FSMANIA DESIGN AND DEVELOPMENT :: JAVASCRIPT -