/**
- *
+ * Priority lists allow you to create an indexed list that can be iterated through in a specific
+ * order.
*/
elgg.ElggPriorityList = function() {
this.length = 0;
};
/**
+ * Inserts an element into the priority list at the priority specified.
*
+ * @param {Object} obj The object to insert
+ * @param {Number} opt_priority An optional priority to insert at.
+ *
+ * @return {Void}
*/
elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) {
var priority = parseInt(opt_priority || 500, 10);
};
/**
+ * Iterates through each element in order.
+ *
+* Unlike every, this ignores the return value of the callback.
*
+ * @param {Function} callback The callback function to pass each element through. See
+ * Array.prototype.every() for details.
+ * @return {Object}
*/
elgg.ElggPriorityList.prototype.forEach = function(callback) {
elgg.assertTypeOf('function', callback);
};
/**
+ * Iterates through each element in order.
+ *
+ * Unlike forEach, this returns the value of the callback and will break on false.
*
+ * @param {Function} callback The callback function to pass each element through. See
+ * Array.prototype.every() for details.
+ * @return {Object}
*/
elgg.ElggPriorityList.prototype.every = function(callback) {
elgg.assertTypeOf('function', callback);
};
/**
+ * Removes an element from the priority list
*
+ * @param {Object} obj The object to remove.
+ * @return {Void}
*/
elgg.ElggPriorityList.prototype.remove = function(obj) {
this.priorities_.forEach(function(elems) {
* If the url is already absolute or protocol-relative, no change is made.
*
* elgg.normalize_url(''); // 'http://my.site.com/'
- * elgg.normalize_url('dashboard'); // 'http://my.site.com/dashboard'
+ * elgg.normalize_url('dashboard'); // 'http://my.site.com/dashboard'
* elgg.normalize_url('http://google.com/'); // no change
* elgg.normalize_url('//google.com/'); // no change
*
/**
* Wrapper function for system_messages. Specifies "messages" as the type of message
- * @param {String} msg The message to display
+ * @param {String} msgs The message to display
* @param {Number} delay How long to display the message (milliseconds)
*/
elgg.system_message = function(msgs, delay) {
/**
* Wrapper function for system_messages. Specifies "errors" as the type of message
- * @param {String} error The error message to display
- * @param {Number} delay How long to dispaly the error message (milliseconds)
+ * @param {String} errors The error message to display
+ * @param {Number} delay How long to dispaly the error message (milliseconds)
*/
elgg.register_error = function(errors, delay) {
elgg.system_messages(errors, delay, "error");
returnValue = value,
callHookHandler = function(handler) {
tempReturnValue = handler(name, type, params, value);
- // always continue through all the handlers
- return true;
};
elgg.provide(name + '.' + type, hooks);
hooks['all']['all']
].every(function(handlers) {
if (handlers instanceof elgg.ElggPriorityList) {
- handlers.every(callHookHandler);
+ handlers.forEach(callHookHandler);
}
return true;
});
*/
elgg.reload_all_translations = function(language) {
var lang = language || elgg.get_language();
+ // This...................vvvvv is a double encoded question mark (? -> %2f -> %252f)
elgg.getJSON('js/languages%252f' + lang + '.js', {
data: {
'viewtype': 'default',
/**
+ * Interates through each element of an array and calls a callback function.
+ * The callback should accept the following arguments:
+ * element - The current element
+ * index - The current index
*
+ * This is different to Array.forEach in that if the callback returns false, the loop returns
+ * immediately without processing the remaining elements.
+ *
+ * @param {Function} callback
+ * @return {Bool}
*/
if (!Array.prototype.every) {
Array.prototype.every = function(callback) {
}
/**
+ * Interates through each element of an array and calls callback a function.
+ * The callback should accept the following arguments:
+ * element - The current element
+ * index - The current index
+ *
+ * This is different to Array.every in that the callback's return value is ignored and every
+ * element of the array will be parsed.
*
+ * @param {Function} callback
+ * @return {Void}
*/
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback) {
}
/**
+ * Left trim
*
+ * Removes a character from the left side of a string.
+ * @param {String} str The character to remove
+ * @return {String}
*/
if (!String.prototype.ltrim) {
String.prototype.ltrim = function(str) {
elgg.security.token = {};
+/**
+ * Sets the currently active security token and updates all forms and links on the current page.
+ *
+ * @param {Object} json The json representation of a token containing __elgg_ts and __elgg_token
+ * @return {Void}
+ */
elgg.security.setToken = function(json) {
//update the convenience object
elgg.security.token = json;
};
/**
- * Security tokens time out, so lets refresh those every so often
+ * Security tokens time out, so lets refresh those every so often.
*
* @todo handle error and bad return data
*/
elgg.security.init = function() {
//refresh security token every 5 minutes
+ //this is set in the js/elgg PHP view.
setInterval(elgg.security.refreshToken, elgg.security.interval);
};
/**
- * @todo comment
+ * Provides session methods.
*/
elgg.provide('elgg.session');
* @param {string} name
* @param {string} value
* @param {Object} options
+ *
* {number|Date} options[expires]
* {string} options[path]
* {string} options[domain]
};
/**
+ * Returns the object of the user logged in.
+ *
* @return {ElggUser} The logged in user
*/
elgg.get_logged_in_user_entity = function() {
};
/**
+ * Returns the GUID of the logged in user or 0.
+ *
* @return {number} The GUID of the logged in user
*/
elgg.get_logged_in_user_guid = function() {
};
/**
+ * Returns if a user is logged in.
+ *
* @return {boolean} Whether there is a user logged in
*/
elgg.is_logged_in = function() {
};
/**
+ * Returns if the currently logged in user is an admin.
+ *
* @return {boolean} Whether there is an admin logged in
*/
elgg.is_admin_logged_in = function() {
};
elgg.register_hook_handler('init', 'system', elgg.ui.init);
-//elgg.register_hook_handler('popup', 'ui', elgg.ui.likesPopupHandler);
elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.likesPopupHandler);
\ No newline at end of file
elgg.userpicker.init = function() {
// binding autocomplete.
- // doing this as an each so we can past this to functions.
+ // doing this as an each so we can pass this to functions.
$('.elgg-input-user-picker').each(function() {
var _this = this;