MaketRandevu/rsc/scripts/jsdoc/out/general_functions.js.html

135 lines
3.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: general_functions.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: general_functions.js</h1>
<section>
<article>
<pre class="prettyprint source"><code>/**
* This file contains the Genral Functions javascript namespace.
* It contains functions that apply both on the front and back
* end of the application.
*
* @namespace General javascript functions.
*/
var GeneralFunctions = {};
/**
* This functions displays a message box in
* the admin array. It is usefull when user
* decisions or verifications are needed.
*
* @param {string} title The title of the message box.
* @param {string} message The message of the dialog.
* @param {array} messageButtons Contains the dialog
* buttons along with their functions.
*/
GeneralFunctions.displayMessageBox = function(title, message, messageButtons) {
// Check arguments integrity.
if (title == undefined || title == "") {
title = "&lt;No Title Given>";
}
if (message == undefined || message == "") {
message = "&lt;No Message Given>";
}
if (messageButtons == undefined) {
messageButtons = {
Close: function() {
jQuery("#message_box").dialog("close");
}
};
}
// Destroy previous dialog instances.
jQuery("#message_box").dialog("destroy");
jQuery("#message_box").remove();
// Create the html of the message box.
jQuery("body").append(
"&lt;div id='message_box' title='" + title + "'>" +
"&lt;p>" + message + "&lt;/p>" +
"&lt;/div>"
);
jQuery("#message_box").dialog({
autoOpen : false,
modal : true,
resize : "auto",
width : 400,
height : "auto",
resizable : false,
buttons : messageButtons,
closeOnEscape : false
});
jQuery("#message_box").dialog("open");
jQuery("#message_box .ui-dialog-titlebar-close").hide();
}
/**
* This method centers a DOM element vertically and horizontally
* on the page.
*
* @param {object} elementHandle The object that is going to be
* centered.
*/
GeneralFunctions.centerElementOnPage = function(elementHandle) {
// Center main frame vertical middle
$(window).resize(function() {
var elementLeft = ($(window).width() - elementHandle.outerWidth()) / 2;
var elementTop = ($(window).height() - elementHandle.outerHeight()) / 2;
elementTop = (elementTop > 0 ) ? elementTop : 20;
elementHandle.css({
position : 'absolute',
left : elementLeft,
top : elementTop
});
});
$(window).resize();
}</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="functions..html">General javascript functions.</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Mon May 20 2013 17:22:10 GMT+0300 (EEST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>