minor modifications in the general_functions.js

This commit is contained in:
Alex Tselegidis 2015-04-26 16:20:16 +02:00
parent c01bfe464e
commit e223b7a5b5

View file

@ -26,46 +26,46 @@ var GeneralFunctions = {
*/ */
displayMessageBox: function(title, message, messageButtons) { displayMessageBox: function(title, message, messageButtons) {
// Check arguments integrity. // Check arguments integrity.
if (title == undefined || title == "") { if (title == undefined || title == '') {
title = "<No Title Given>"; title = '<No Title Given>';
} }
if (message == undefined || message == "") { if (message == undefined || message == '') {
message = "<No Message Given>"; message = '<No Message Given>';
} }
if (messageButtons == undefined) { if (messageButtons == undefined) {
messageButtons = {}; messageButtons = {};
messageButtons[EALang['close']] = function() { messageButtons[EALang['close']] = function() {
jQuery("#message_box").dialog("close"); $('#message_box').dialog('close');
}; };
} }
// Destroy previous dialog instances. // Destroy previous dialog instances.
jQuery("#message_box").dialog("destroy"); $('#message_box').dialog('destroy');
jQuery("#message_box").remove(); $('#message_box').remove();
// Create the html of the message box. // Create the html of the message box.
jQuery("body").append( $('body').append(
"<div id='message_box' title='" + title + "'>" + '<div id="message_box" title="' + title + '">' +
"<p>" + message + "</p>" + '<p>' + message + '</p>' +
"</div>" '</div>'
); );
jQuery("#message_box").dialog({ $("#message_box").dialog({
autoOpen: false, autoOpen: false,
modal: true, modal: true,
resize: "auto", resize: 'auto',
width: 400, width: 'auto',
height: "auto", height: 'auto',
resizable: false, resizable: false,
buttons: messageButtons, buttons: messageButtons,
closeOnEscape: true closeOnEscape: true
}); });
jQuery("#message_box").dialog("open"); $('#message_box').dialog('open');
jQuery(".ui-dialog .ui-dialog-buttonset button").addClass('btn'); $('.ui-dialog .ui-dialog-buttonset button').addClass('btn');
jQuery("#message_box .ui-dialog-titlebar-close").hide(); $('#message_box .ui-dialog-titlebar-close').hide();
}, },
/** /**
@ -101,12 +101,12 @@ var GeneralFunctions = {
* @returns {String} Returns the parameter value. * @returns {String} Returns the parameter value.
*/ */
getUrlParameter: function(url, parameterName) { getUrlParameter: function(url, parameterName) {
parameterName = parameterName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); parameterName = parameterName.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]');
var regexS = "[\\#&]"+parameterName+"=([^&#]*)"; var regexS = '[\\#&]' + parameterName + '=([^&#]*)';
var regex = new RegExp( regexS ); var regex = new RegExp( regexS );
var results = regex.exec( url ); var results = regex.exec( url );
if( results == null ) if( results == null )
return ""; return '';
else else
return results[1]; return results[1];
}, },
@ -141,7 +141,7 @@ var GeneralFunctions = {
*/ */
clone: function(originalObject) { clone: function(originalObject) {
// Handle the 3 simple types, and null or undefined // Handle the 3 simple types, and null or undefined
if (null == originalObject || "object" != typeof originalObject) if (null == originalObject || 'object' != typeof originalObject)
return originalObject; return originalObject;
// Handle Date // Handle Date
@ -170,7 +170,7 @@ var GeneralFunctions = {
return copy; return copy;
} }
throw new Error("Unable to copy obj! Its type isn't supported."); throw new Error('Unable to copy obj! Its type isn\'t supported.');
}, },
/** /**
@ -228,7 +228,7 @@ var GeneralFunctions = {
var parsedExceptions = new Array(); var parsedExceptions = new Array();
$.each(exceptions, function(index, exception) { $.each(exceptions, function(index, exception) {
parsedExceptions.push(jQuery.parseJSON(exception)); parsedExceptions.push($.parseJSON(exception));
}); });
return parsedExceptions; return parsedExceptions;