mirror of
https://github.com/xevidos/codiad.git
synced 2024-12-22 13:52:16 +01:00
5583db5528
* Added PostgreSQL * Added SQL library * Added show password * Performance Improvements * Updated active files module * Updated cursor tracking * Updated settings module
48 lines
1.1 KiB
JavaScript
Executable file
48 lines
1.1 KiB
JavaScript
Executable file
( function( global, $ ) {
|
|
|
|
var codiad = global.codiad;
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Parse JSEND Formatted Returns
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
codiad.jsend = {
|
|
|
|
parse: function( d ) {
|
|
|
|
// (Data)
|
|
var obj = $.parseJSON( d );
|
|
if ( obj === undefined || obj === null ) {
|
|
|
|
return 'error';
|
|
}
|
|
|
|
if ( obj !== undefined && obj !== null && Array.isArray( obj.debug ) ) {
|
|
|
|
var debug = obj.debug.join('\nDEBUG: ');
|
|
if( debug !== '' ) {
|
|
|
|
debug = 'DEBUG: ' + debug;
|
|
}
|
|
console.log( debug );
|
|
}
|
|
|
|
if ( obj.status == 'error' ) {
|
|
|
|
codiad.message.error( obj.message );
|
|
return 'error';
|
|
} else if( obj.status == 'warning' ) {
|
|
|
|
codiad.message.warning( obj.message );
|
|
return 'warning';
|
|
} else if( obj.status == 'notice' ) {
|
|
|
|
codiad.message.notice( obj.message );
|
|
return 'notice';
|
|
} else {
|
|
|
|
return obj.data;
|
|
}
|
|
}
|
|
};
|
|
})(this, jQuery);
|