+4420 3290 2266


Project Haala


Javascript guidelines Web frontend

Javascript provides all the logic for a page. It listens for clicks, submits forms, retrieves data, validates user input and much more. All of the Javascript code is written in jQuery.

Javascript initialization

When Javascript configures itself it usually reads values from special user defined data attributes. For example there is common ivars DIV tag which contain attributes to restore paginated table, populate initial values etc. This it is the easiest way to pass parameters into Javascript files. Almost all of the configuration is hardcoded in Javascript files and the rest is read from pages DIV tags embedded in JSON format.

Loading Javascript files

Javascript files served by the controller which first checks if the requested file exist in the database then reverts to the file packaged in the WAR. The controller also merges several files into one if special syntax exist within the requested Javascript file. All website specific Javascript files (including those to be merged) are either saved in the database or included in the WAR package. The very same applies to CSS files which served by another controller with the similar functionality.