From f79a295e19073ca3ba1c72aa1ef00bd76a7e817d Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 24 Jan 2013 03:12:01 +0400 Subject: [PATCH] several minor updates and migrations... Signed-off-by: Alex A. Naanou --- jli.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/jli.js b/jli.js index 8ccebbe..0cb4a52 100755 --- a/jli.js +++ b/jli.js @@ -1,4 +1,10 @@ /********************************************************************** +* JavaScript Lib +* at this point this is just a place I put most of the generic stuff I +* use. +* +* P.S. the name "jli" just stands for Java script LIb, like how it +* looks... **********************************************************************/ var DEBUG = true @@ -164,7 +170,25 @@ function setElementScale(elem, scale){ } +/************************************************ jQuery extensions **/ -/*********************************************************************/ +jQuery.fn.reverseChildren = function(){ + return $(this).each(function(_, e){ + return $(e).append($(e).children().detach().get().reverse()) + }) +} + + +jQuery.fn.sortChildren = function(func){ + return $(this).each(function(_, e){ + return $(e).append($(e).children().detach().get().sort(func)) + }) +} + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */