CumulusUtils Runtime Library

Introduction

CumulusUtils.js is the javascript runtime library providing the modular user with functionality otherwise available only in the website. It provides e.g. timing, realtime values, clocks and report loading. It is intended for users who are using CumulusUtils in a modular fashion. The available globals and functions are described below.

The library can be found in the utils directory (on the CumulusMX machine) and is transferred after generation to the lib directory on the server.

The library is generated implicitly with the Website command parameter or on its own with the CUlib parameter:

utils/bin/cumulusutils.exe CUlib         => this command creates the library in the lib directory on the server

The user is free to load the library in the editor (formatting required) and make suggestions or modify changes. When modifying support is not available anymore.

Usage

NOTE: the publication of the library requires feedback by the users if anything does not work as expected or as intended!
NOTE: Be aware the globals are for internal use and are generated with CUtils parameter values. Changes to these globals is disadvised and they are lost when generating a new version of the library.
NOTE: cumulusutils.js requires jquery for proper functioning and d3 when using the sun and moon discs.

The library is intended to be used when CUtils is used in a modular fashion. Any other use is not supported. When using modules which require javascript to function properly (e.g. the Graphs modules) cumulusutils.js must be included in the users webpage using the following HTML code:

<script defer src='lib/cumulusutils.js'></script>

Globals

Commandline parameters

CumulusUtils handles URL parameters and uses the following global for this:

const urlParams = new URLSearchParams(window.location.search);

The Cutils modules will make use of this global, if the user wishes to handle URL parameters for all pages it would be a good idea to use this parameter.

Functions

All functions are initialised including the timers and output will be displayed in the users website if a specific DIV with an id is used e.g.

<div id='#d3SunDisc'></div>

will display the Sun disc and update it over the day.

The DIV id's will be shown under the specific caption, all functions below can be called by the user. If the specific DIV IDs does not exist in the website, that should not break the calling sequence.

Init function

$(function () {}

At load this function is executed and initialises the library by calling the following functions:

  1. loadRealtimeTxt => initializes the loading of realtime.txt and distributes the values over the dashboard
  2. Initialize the timer interval for reading realtime.txt
  3. DoGaugeSettings => initializes the settings for the gauges as defined within CUtils. Note that Cutils uses its own gauges library and css file.
  4. worldClockZone => Initializes the clocks
  5. CreateSun and CreateMoon => Creates the sun and moon disc
  6. MinuteFunctions => initializes the minute function which takes care of the chart refreshes and the moving of the sun disc hand.
  7. HourFunctions => initialisez the hour functions which takes care of the moondisc updates
  8. LoadUtilsReport => It calls the initial report to load

loadRealtime.txt

This function is called automatically by the runtime system at the interval defined by the user in CMX (Menu=>Internet Settings=>Interval Configuration=>Real time Interval Settings).

The values are distributed to the DIVs with the (self-explaining) IDs:

ajxCurTemp, ajxTempChange, ajxTempChangeIndicator, ajxTempMax, ajxTempMin, ajxCurPression, ajxBarChange, [...]

The values get the configured change colour which is reset after 3 seconds.

DoGaugesSettings

This applies the gauges settings from cumulusutils.ini which requires the CUtils specific gauges.js Gauges which use the CMX gauges library are untouched.

CreateSun / CreateMoon

These functions create the sun and the moon discs in the DIVs with the IDs d3SunDisc and d3MoonDisc respectively. These functions require the d3 library to be loaded.