Fix Major UI updating issues, jQuery changes, debug hooks.

Also fixes incredibly fucked-up air alarm template and CSS.
This commit is contained in:
Tigercat2000
2015-11-07 09:46:43 -08:00
parent 8e74283240
commit 4e6397ffec
8 changed files with 46 additions and 47 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
world << "[src]'s Topic: [href] destined for [hsrc]."
if(href_list["nano_err"]) //nano throwing errors
world << "## NanoUI Error for [src], Error:" + href_list["nano_err"]
world << "## NanoUI, Subject [src]: " + html_decode(href_list["nano_err"]) //NANO DEBUG HOOK
#endif
+8 -2
View File
@@ -179,9 +179,11 @@ nanoui is used to open and update nano browser uis
* @return /list config data
*/
/datum/nanoui/proc/get_config_data()
var/name = "[src_object]"
name = sanitize(name) //jQuery's parseJSON fails with byond formatting characters in the JSON
var/list/config_data = list(
"title" = title,
"srcObject" = list("name" = "[src_object]"),
"srcObject" = list("name" = name),
"stateKey" = state_key,
"status" = status,
"autoUpdateLayout" = auto_update_layout,
@@ -371,6 +373,10 @@ nanoui is used to open and update nano browser uis
{
NanoStateManager.receiveUpdateData(jsonString);
}
else
{
alert('browser.recieveUpdateData failed due to jQuery or NanoStateManager being unavailiable.');
}
}
</script>
[head_content]
@@ -447,7 +453,7 @@ nanoui is used to open and update nano browser uis
var/list/send_data = get_send_data(data)
//user << list2json(data) // used for debugging
//user << list2json_usecache(send_data) // used for debugging //NANO DEBUG HOOK
user << output(list2params(list(list2json_usecache(send_data))),"[window_id].browser:receiveUpdateData")
/**
+1
View File
@@ -298,6 +298,7 @@ div.notice {
border: 1px solid #40628a;
padding: 4px;
margin: 3px 0;
overflow: hidden;
}
.statusDisplayRecords {
+4 -4
View File
File diff suppressed because one or more lines are too long
+26 -37
View File
@@ -8508,51 +8508,40 @@ var nonce = jQuery.now();
var rquery = (/\?/);
var rvalidchars = /^[\],:{}\s]*$/;
var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
var rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g;
var rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g;
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
jQuery.parseJSON = function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = jQuery.trim( data + "" );
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
// after removing valid tokens
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
// Force termination if we see a misplaced comma
if ( requireNonComma && comma ) {
depth = 0;
jQuery.parseJSON: function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Perform no more replacements after returning to outermost depth
if ( depth === 0 ) {
return token;
if ( data === null ) {
return data;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
if ( typeof data === "string" ) {
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
if ( data ) {
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
}
}
// Remove this token
return "";
}) ) ?
( Function( "return " + str ) )() :
jQuery.error( "Invalid JSON: " + data );
};
}
// Cross-browser xml parsing
+5 -1
View File
@@ -48,6 +48,8 @@ NanoStateManager = function ()
var receiveUpdateData = function (jsonString)
{
var updateData;
alert("recieveUpdateData called." + "<br>Type: " + typeof jsonString);
try
{
// parse the JSON string from the server into a JSON object
@@ -55,10 +57,12 @@ NanoStateManager = function ()
}
catch (error)
{
alert(error.Message);
alert("recieveUpdateData failed. " + "<br>Error name: " + error.name + "<br>Error Message: " + error.message);
return;
}
alert("recieveUpdateData passed trycatch block.");
if (!updateData.hasOwnProperty('data'))
{
if (_data && _data.hasOwnProperty('data'))
+1 -1
View File
@@ -53,7 +53,7 @@ if (typeof doT == 'undefined') {
(function() {
var _alert = window.alert;
window.alert = function(str) {
window.location = "byond://?nano_err=" + str;
window.location = "byond://?nano_err=" + encodeURIComponent(str);
_alert(str);
};
})();
-1
View File
@@ -87,7 +87,6 @@ Used In File(s): /code/game/machinery/alarm.dm
{{:helper.link('Activate Alarm',null,{'atmos_alarm':1},null)}}
{{/if}}
{{/if}}
</div>
</div>
<div class="line">
<!--