mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Revert "Nanoui now supports use of multiple templates (#5105)"
This reverts commit a2841ce9d6.
It turns out nanoui already supports multiple templates.
This commit is contained in:
@@ -519,8 +519,3 @@ nanoui is used to open and update nano browser uis
|
|||||||
*/
|
*/
|
||||||
/datum/nanoui/proc/update(var/force_open = 0)
|
/datum/nanoui/proc/update(var/force_open = 0)
|
||||||
src_object.ui_interact(user, ui_key, src, force_open, master_ui, state)
|
src_object.ui_interact(user, ui_key, src, force_open, master_ui, state)
|
||||||
|
|
||||||
/datum/nanoui/proc/append_template(var/key, var/filename)
|
|
||||||
add_template(key, filename)
|
|
||||||
open()
|
|
||||||
update(1)
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ function NanoStateClass() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.key = this.key.toLowerCase();
|
this.key = this.key.toLowerCase();
|
||||||
|
|
||||||
NanoStateManager.addState(this);*/
|
NanoStateManager.addState(this);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,24 +23,29 @@ NanoStateClass.prototype.isCurrent = function () {
|
|||||||
|
|
||||||
NanoStateClass.prototype.onAdd = function (previousState) {
|
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
|
// 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();
|
NanoBaseCallbacks.addCallbacks();
|
||||||
NanoBaseHelpers.addHelpers();
|
NanoBaseHelpers.addHelpers();
|
||||||
};
|
};
|
||||||
|
|
||||||
NanoStateClass.prototype.onRemove = function (nextState) {
|
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
|
// 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();
|
NanoBaseCallbacks.removeCallbacks();
|
||||||
NanoBaseHelpers.removeHelpers();
|
NanoBaseHelpers.removeHelpers();
|
||||||
};
|
};
|
||||||
|
|
||||||
NanoStateClass.prototype.onBeforeUpdate = function (data) {
|
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
|
// 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);
|
data = NanoStateManager.executeBeforeUpdateCallbacks(data);
|
||||||
|
|
||||||
return data; // Return data to continue, return false to prevent onUpdate and onAfterUpdate
|
return data; // Return data to continue, return false to prevent onUpdate and onAfterUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
NanoStateClass.prototype.onUpdate = function (data) {
|
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
|
// 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
|
try
|
||||||
{
|
{
|
||||||
if (!this.layoutRendered || (data['config'].hasOwnProperty('autoUpdateLayout') && data['config']['autoUpdateLayout']))
|
if (!this.layoutRendered || (data['config'].hasOwnProperty('autoUpdateLayout') && data['config']['autoUpdateLayout']))
|
||||||
@@ -49,13 +55,7 @@ NanoStateClass.prototype.onUpdate = function (data) {
|
|||||||
}
|
}
|
||||||
if (!this.contentRendered || (data['config'].hasOwnProperty('autoUpdateContent') && data['config']['autoUpdateContent']))
|
if (!this.contentRendered || (data['config'].hasOwnProperty('autoUpdateContent') && data['config']['autoUpdateContent']))
|
||||||
{
|
{
|
||||||
var content = "";
|
$("#uiContent").html(NanoTemplate.parse('main', data)); // render the 'mail' template to the #mainTemplate div
|
||||||
var keys = NanoTemplate.getKeys();
|
|
||||||
for (i = 0; i < keys.length; i++) {
|
|
||||||
if(keys[i] == "layout"){ continue; }
|
|
||||||
content += NanoTemplate.parse(keys[i], data);
|
|
||||||
}
|
|
||||||
$("#uiContent").html(content); // render the 'mail' template to the #mainTemplate div
|
|
||||||
this.contentRendered = true;
|
this.contentRendered = true;
|
||||||
}
|
}
|
||||||
if (NanoTemplate.templateExists('mapContent'))
|
if (NanoTemplate.templateExists('mapContent'))
|
||||||
@@ -64,12 +64,14 @@ NanoStateClass.prototype.onUpdate = function (data) {
|
|||||||
{
|
{
|
||||||
// Add drag functionality to the map ui
|
// Add drag functionality to the map ui
|
||||||
$('#uiMap').draggable();
|
$('#uiMap').draggable();
|
||||||
|
|
||||||
$('#uiMapTooltip')
|
$('#uiMapTooltip')
|
||||||
.off('click')
|
.off('click')
|
||||||
.on('click', function (event) {
|
.on('click', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(this).fadeOut(400);
|
$(this).fadeOut(400);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mapInitialised = true;
|
this.mapInitialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,11 +106,13 @@ NanoStateClass.prototype.onUpdate = function (data) {
|
|||||||
|
|
||||||
NanoStateClass.prototype.onAfterUpdate = function (data) {
|
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
|
// 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);
|
NanoStateManager.executeAfterUpdateCallbacks(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
NanoStateClass.prototype.alertText = function (text) {
|
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
|
// 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);
|
alert(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -91,13 +91,6 @@ var NanoTemplate = function () {
|
|||||||
templateExists: function (key) {
|
templateExists: function (key) {
|
||||||
return _templates.hasOwnProperty(key);
|
return _templates.hasOwnProperty(key);
|
||||||
},
|
},
|
||||||
getKeys: function () {
|
|
||||||
var _keys = [];
|
|
||||||
for(var key in _templates) {
|
|
||||||
_keys.push(key);
|
|
||||||
}
|
|
||||||
return _keys;
|
|
||||||
},
|
|
||||||
parse: function (templateKey, data) {
|
parse: function (templateKey, data) {
|
||||||
if (!_compiledTemplates.hasOwnProperty(templateKey) || !_compiledTemplates[templateKey]) {
|
if (!_compiledTemplates.hasOwnProperty(templateKey) || !_compiledTemplates[templateKey]) {
|
||||||
if (!_templates.hasOwnProperty(templateKey)) {
|
if (!_templates.hasOwnProperty(templateKey)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user