FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 6 users online :: 0 Registered, 0 Hidden and 6 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

[SOLVED] Forumotion: JavaScript Limit

View previous topic View next topic Go down

SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7148
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Tue 17 May 2016, 14:30

I was wondering since there is a limit of 50 JavaScripts on Forumotion, can we have 2 or more different JavaScripts in the same JavaScript as long as the effect the same areas?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12055
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 17 May 2016, 14:38

@SLGray yes, you can include as many scripts as FM's character limit allows in 1 JS file.

For example, most scripts start with a document ready event ( this is jQuery's ) :
Code:
$(function() {
  console.log('Ready !');
});

So, you can just copy and paste one script after another like so :
Code:
$(function() {
  console.log('Ready !');
});

// another script
$(function() {
  console.log('Ready again !');
});

// yet another script
$(function() {
  console.log('Ready yet again !');
});

Or combine them since they all execute when the document is ready :
Code:
$(function() {
  console.log('Ready !');

  // another script
  console.log('Ready again !');

  // yet another script
  console.log('Ready yet again !');
});
and you can use comments to keep track of what's what.
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7148
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Tue 17 May 2016, 14:41

Thanks for the answer and information, @Ange Tuteur.
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7148
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Wed 18 May 2016, 00:27

I have noticed that my forums load faster now after I combined the JavaScripts.
Anonymous
Guest
Guest

PostGuest Wed 18 May 2016, 02:17

Mind you, you can only combine scripts into one if they're using the same placement Wink So you'll be ending up with only, what, 5 or 6 JS...
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 24
Posts : 2153
Points : 5331
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Wed 18 May 2016, 07:48

And it would be good practice to add comments as to what each script is and is doing @slgray
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12055
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 18 May 2016, 10:49

SLGray wrote:I have noticed that my forums load faster now after I combined the JavaScripts.
That should help since sometimes the scripts are split into separate JS files, like this :
[SOLVED] Forumotion:  JavaScript Limit Captur74
and that means you need to send a request to get these files. So more files == more requests, which means slightly longer load times.
Van-Helsing
Van-Helsing

Gender : Male
Age : 49
Posts : 853
Points : 4845
Reputation : 84
Location : Somewhere out there!
Language : English, Greek
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : punBB
http://itexperts.forumgreek.com/

PostVan-Helsing Wed 18 May 2016, 11:24

Hello,
@Ange Tuteur is to better to group the javascripts depending their placements into one javascript instead to have them as separately javascripts? I am thinking it long time ago. Will this reduce the load time?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12055
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 18 May 2016, 11:45

Well technically, yes, there'd be a small improvement in load times, especially if there's a lot of files that have to be retrieved. In Chrome you can go to the sources tab, reload the page, and it'll show all the js / css files that were loaded on the page. You can also use the network tab too, to see how long some resources take to load.
Van-Helsing
Van-Helsing

Gender : Male
Age : 49
Posts : 853
Points : 4845
Reputation : 84
Location : Somewhere out there!
Language : English, Greek
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : punBB
http://itexperts.forumgreek.com/

PostVan-Helsing Wed 18 May 2016, 11:48

OMG! affraid
I have a lot of work I must group a lot of javascripts to improve the load time.Sad
Anonymous
Guest
Guest

PostGuest Wed 18 May 2016, 13:40

lel! Oh that's what you meant when you said 'evil programming'... Laughing Well, I'll be off now. I'll be checking on AvacWeb sometimes at the most for today.

Enjoy, all!

Hello Samantha.
SLGray
SLGray
Valued Member
Gender : Male
Age : 51
Posts : 2465
Points : 7148
Reputation : 290
Location : United States
Language : English
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : ModernBB
http://www.fmthemes.forumotion.com https://www.facebook.com/FM-Themes-655055824604957 https://twitter.com/FMThemes https://pinterest.com/FMThemes

PostSLGray Wed 18 May 2016, 14:45

I understand that you have to group them by where they directed:  homepage, topics, sub-forums, etc.
Van-Helsing
Van-Helsing

Gender : Male
Age : 49
Posts : 853
Points : 4845
Reputation : 84
Location : Somewhere out there!
Language : English, Greek
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : punBB
http://itexperts.forumgreek.com/

PostVan-Helsing Wed 18 May 2016, 16:24

Yes exactly @SLGray.Wink
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum