From 7e4cc929919f05e5b31c6ff7d1ed9b8e53e8a95a Mon Sep 17 00:00:00 2001 From: ewinslow Date: Mon, 1 Nov 2010 20:28:41 +0000 Subject: Refs #2538: Pulled in some i18n features git-svn-id: http://code.elgg.org/elgg/trunk@7182 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/js/lib/elgglib.js | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'engine/js/lib/elgglib.js') diff --git a/engine/js/lib/elgglib.js b/engine/js/lib/elgglib.js index c0ce69fab..28cae8f8f 100644 --- a/engine/js/lib/elgglib.js +++ b/engine/js/lib/elgglib.js @@ -68,6 +68,33 @@ elgg.provide = function(pkg) { } }; +/** + * Inherit the prototype methods from one constructor into another. + * + * @example + *
+ * function ParentClass(a, b) { }
+ * 
+ * ParentClass.prototype.foo = function(a) { alert(a); }
+ *
+ * function ChildClass(a, b, c) {
+ *     //equivalent of parent::__construct(a, b); in PHP
+ *     ParentClass.call(this, a, b);
+ * }
+ *
+ * elgg.inherit(ChildClass, ParentClass);
+ *
+ * var child = new ChildClass('a', 'b', 'see');
+ * child.foo('boo!'); // alert('boo!');
+ * 
+ * + * @param {Function} childCtor Child class. + * @param {Function} parentCtor Parent class. + */ +elgg.inherit = function(Child, Parent) { + Child.prototype = Parent; +}; + /** * Prepend elgg.config.wwwroot to a url if the url doesn't already have it. * @@ -122,10 +149,7 @@ elgg.system_messages = function(msgs, delay, type) { + '

' + msgs.join('

') + '

' + ''; - $(messages_html).insertAfter('#layout_header').click(function () { - $(this).stop().fadeOut('slow'); - return false; - }).show().animate({opacity:'1.0'},delay).fadeOut('slow'); + $(messages_html).appendTo('#elgg_system_messages').show().animate({opacity:'1.0'},delay).fadeOut('slow'); }; /** -- cgit v1.2.3