Optionally provide private feedback to help us improve this doc...

Thank you for your feedback!


How to edit JavaScript within InstantForum

This article describes how to modify the JavaScript within InstantForum 2013 or above.

We opted to move to compile time minification and bundling of all client side resources with InstantForum 2013. Previous versions of InstantForum managed this dynamically (scripts were bundled and minified at run-time). This worked great, but also added unnecessary load on the web server which could impact the performance of very busy sites - obviously defeating the original purpose. For InstantForum 2013 we opted to move to compile time minification and bundling.

By default all JavaScript used by InstantForum is now minified and bundled into a single file called "Core.js". This file is generated once at compile time ensuring maximum performance at run-time. If you wish to modify our JavaScript and rebuild the "Core.js" file please follow the steps in this article.

NOTE: This article applies to InstantForum 2013 or above. Earlier versions of InstantForum use dynamic run-time script bundling and bundling minifcation.

What is Core.js

Core.js is the main minified and bundled JavaScript file loaded into all InstantForum pages. This file contains all the client side JavaScript code required by InstantForum.

If you open Core.js within NotePad or similar text editor you'll notice this file is minified. To create Core.js we take all the separate JavaScript files within the InstantForum JS folder and build Core.js from these seperate files as described below.

By default the following JavaScript files within the InstantForum "js" folder will be minified and bundled into core.js...

  • 1-debug-json.js
  • 2-debug-jquery-1.8.2.js
  • 3-debug-common.js
  • 4-debug-jPlugIns.js
  • 5-debug-forum.js
  • 6-debug-richtextbox.js

How is Core.js generated?

The "Core.js" file will only be generated from the various debug scripts only if Core.js does not already exists within the InstantForum JS folder and the "InstantASP_DebugMode" application setting within the InstantForum web.config is set to true...

<add key="InstantASP_DebugMode" value="true"/>

To re-create Core.js after you've modified our unminified debug JavaScript you will first need to delete Core.Jjs from the InstantForum JS folder. Once you've removed Core.js you will need to ensure the InstantASP_DebugMode application setting within the web.config is set to "true".

Once you've made these changes simply visit your InstantForum installation in a web browser and InstantForum will automatically create the Core.js again from the various debug JavaScript files.

NOTE: To actually use Core.js within your InstantForum pages you will need to set the InstantASP_DebugMode application setting within the web.config to "false". If you leave InstantASP_DebugMode set to "true" only the debug un-minified JavaScript files will be loaded into InstantForum pages.
If you wanted to include your own JavaScript to be bundled and minified into Core.js simply ensure your JavaScript file follows the same naming convention as the existing JavaScript files within the InstantForum JS folder.

For example...

7-debug-myscript.js

This will then be added to the very end of Core.js when it's generated. The number at the start of the JavaScript file indicates the order in which the scripts are bundled. This is important to ensure your JavaScript loads after any other dependencies.

For example our common.js file has dependencies on jQuery so jQuery must be loaded first.

Where is the Core.js included?

Core.js is added programmatically via the master page code-behind to the master page header element only if "InstantASP_DebugMode" within the web.config is set to false. If InstantASP_DebugMode is set to true the various debug JavaScript files will be loaded.

That's It!

I hope this article helps you work with the JavaScript files provided within InstantForum. IF we can assist fuerther with any questions of course please don't hesitate to contact us or open a support ticket.