mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
The layout HTML (which was mainly used for the title bar) is no longer hard coded in nanoui.dm. Layouts are now dynamic and each consists of a template and stylesheet (CSS) file. Multiple layouts can exist, they can be switched to using the set_layout_key proc. See the proc comments for more info. Added "default" and "basic" layouts, "basic" has no title bar. Moved image source assets (GIMP and Flash files) into a separate source folder so that they are not sent to the client.
71 lines
2.4 KiB
JavaScript
71 lines
2.4 KiB
JavaScript
// This is the base state class, it is not to be used directly
|
|
|
|
function NanoStateClass() {
|
|
/*if (typeof this.key != 'string' || !this.key.length)
|
|
{
|
|
alert('ERROR: Tried to create a state with an invalid state key: ' + this.key);
|
|
return;
|
|
}
|
|
|
|
this.key = this.key.toLowerCase();
|
|
|
|
NanoStateManager.addState(this);*/
|
|
}
|
|
|
|
NanoStateClass.prototype.key = null;
|
|
|
|
NanoStateClass.prototype.isCurrent = function () {
|
|
return NanoStateManager.getCurrentState() == this;
|
|
};
|
|
|
|
NanoStateClass.prototype.onAdd = function (previousState) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
NanoBaseCallbacks.addCallbacks();
|
|
NanoBaseHelpers.addHelpers();
|
|
};
|
|
|
|
NanoStateClass.prototype.onRemove = function (nextState) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
NanoBaseCallbacks.removeCallbacks();
|
|
NanoBaseHelpers.removeHelpers();
|
|
};
|
|
|
|
NanoStateClass.prototype.onBeforeUpdate = function (data) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
data = NanoStateManager.executeBeforeUpdateCallbacks(data);
|
|
|
|
return data; // Return data to continue, return false to prevent onUpdate and onAfterUpdate
|
|
};
|
|
|
|
NanoStateClass.prototype.onUpdate = function (data) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
try
|
|
{
|
|
$("#uiLayout").html(NanoTemplate.parse('layout', data)); // render the 'mail' template to the #mainTemplate div
|
|
$("#uiContent").html(NanoTemplate.parse('main', data)); // render the 'mail' template to the #mainTemplate div
|
|
}
|
|
catch(error)
|
|
{
|
|
alert('ERROR: An error occurred while rendering the UI: ' + error.message);
|
|
return;
|
|
}
|
|
};
|
|
|
|
NanoStateClass.prototype.onAfterUpdate = function (data) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
NanoStateManager.executeAfterUpdateCallbacks(data);
|
|
};
|
|
|
|
NanoStateClass.prototype.alertText = function (text) {
|
|
// Do not add code here, add it to the 'default' state (nano_state_defaut.js) or create a new state and override this function
|
|
|
|
alert(text);
|
|
};
|
|
|
|
|