/*! JQuery InsertInOrder plugin - v0.1.0 - 2014-03-01 * https://github.com/rudyrigot/jquery-insertinorder * Copyright (c) 2014 Rudy Rigot; Licensed MIT */ !function(a){a.fn.insertinorder=function(b,c,d){var e=d&&d.direction&&"desc"===d.direction?"desc":"asc";return this.each(function(d,f){var g=!1;a("[data-order]",f).each(function(d,f){var h=parseInt(a(f).attr("data-order"),10);!g&&("desc"===e&&c>h||"asc"===e&&h>c)&&(a(f).before(b),g=!0)}),g||a(f).append(b)})}}(jQuery);