Your IP : 216.73.216.170


Current Path : /var/www/iplanru/data/www/i-plan.ru/media/zoo/elements/repeatable/
Upload File :
Current File : /var/www/iplanru/data/www/i-plan.ru/media/zoo/elements/repeatable/repeatable.js

/* Copyright (C) YOOtheme GmbH, http://www.gnu.org/licenses/gpl.html GNU/GPL */

(function(e){var t=function(){};e.extend(t.prototype,{name:"ElementRepeatable",options:{msgDeleteElement:null,msgSortElement:null},initialize:function(t,a){this.options=e.extend({},this.options,a);var n=this;var i=t.find("ul.repeatable-list");var o=i.find("li.hidden").remove();var l=i.find("li.repeatable-element").length;i.find("li.repeatable-element").each(function(){n.attachButtons(e(this))});i.delegate("span.sort","mousedown",function(){i.find(".more-options.show-advanced").removeClass("show-advanced")}).delegate("span.delete","click",function(){e(this).closest("li.repeatable-element").fadeOut(200,function(){e(this).remove()})}).sortable({handle:"span.sort",placeholder:"repeatable-element dragging",axis:"y",opacity:1,delay:100,cursorAt:{top:16},tolerance:"pointer",containment:"parent",scroll:false,start:function(e,t){t.item.addClass("ghost");t.placeholder.height(t.item.height()-2);t.placeholder.width(t.item.find("div.repeatable-content").width()-2)},stop:function(e,t){t.item.removeClass("ghost")}});t.find("p.add a").bind("click",function(){var t=e("<li>").addClass("repeatable-element").html(o.html().replace(/(elements\[\S+])\[(-?\d+)\]/g,"$1["+l++ +"]"));n.attachButtons(t);t.appendTo(i);t.find('input:not([type="radio"]), :not([type="checkbox"])').each(function(){if(e(this).val())e(this).val("")});t.children("div.repeatable-content").effect("highlight",{},1e3)})},attachButtons:function(t){t.children().wrapAll(e("<div>").addClass("repeatable-content"));e("<span>").addClass("sort").attr("title",this.options.msgSortElement).appendTo(t);e("<span>").addClass("delete").attr("title",this.options.msgDeleteElement).appendTo(t)}});e.fn[t.prototype.name]=function(){var a=arguments;var n=a[0]?a[0]:null;return this.each(function(){var i=e(this);if(t.prototype[n]&&i.data(t.prototype.name)&&n!="initialize"){i.data(t.prototype.name)[n].apply(i.data(t.prototype.name),Array.prototype.slice.call(a,1))}else if(!n||e.isPlainObject(n)){var o=new t;if(t.prototype["initialize"]){o.initialize.apply(o,e.merge([i],a))}i.data(t.prototype.name,o)}else{e.error("Method "+n+" does not exist on jQuery."+t.name)}})}})(jQuery);