правая клавиша на любой части сайта, выбрать из списка "просмотр кода элемента" (если хром) в других браузерах может называться пукт по-другому, или F12
Если есть JS ошибки на странице - справа на панели будет красный крестик. Нажимаете его - ниже открывается еще одна область с описанием ошибки - вот она и нужна
f;++b)d=i.makeReadableBy[b],"blur"==d&&c.blur(function(){n!="read"&&h.call(this)}),"enter"==d&&g.push(13),"esc"==d&&g.push(27);b=0;for(f=i.updateBy.length;b<f;++b)d=i.updateBy[b],"alt+enter"==d&&k.push({ctrl:!1,alt:!0,shift:!1,key:13}),"ctrl+enter"==d&&k.push({ctrl:!0,alt:!1,shift:!1,key:13}),"ctrl+s"==d&&k.push({ctrl:!0,alt:!1,shift:!1,key:17});g.length&&c.keydown(function(a){~g.indexOf(a.keyCode)&&!a.ctrlKey&&!a.altKey&&!a.shiftKey&&n!="read"&&h.call(this,a.keyCode==27?q:null);if(k.length)for(var b in k){var c=
a();return d=(b=parseInt(b,10)||0)?a("#category-"+b+"-handler"):a("#s-category-list-handler")}}})(jQuery);(function(a){a.product_sidebar={options:{},init:function(){var b=a("#s-sidebar");a.product_dragndrop.init({collections:!0}).bind("move_list",function(b){if(b.type){var c={id:b.id,type:b.type,parent_id:b.parent_id||0};b.before_id&&(c.before_id=b.before_id);a.products.jsonPost("?module=products&action=moveList",c,b.success,b.error)}else"function"===typeof b.error&&b.error("Unknown list type")});b.off("add",".s-collection-list ul").on("add",".s-collection-list ul",function(b,c,f,g){var b=a(this),h=b.parents(".s-collection-list:first"),
j=a("<ul></ul>");j.append(tmpl("template-sidebar-list-item",{type:f,item:c}));var c=j.children(":not(.drag-newposition):first"),f=c.attr("id"),f=b.find("#"+f),k=j.children();f.length?g&&f.replaceWith(c):b.prepend(k).show();k.each(function(){var b=a(this);b.hasClass("dr")?b.find("a").mouseover():b.mouseover()});b.find(".drag-newposition").css({height:"2px"}).removeClass("dragging");h.find(".s-empty-list").hide();j.remove();return!1});b.unbind("update").bind("update",function(b,c){for(var f in c)if("all"==
f)a("#s-all-products").find(".count:first").text(c[f].count);else{var g="#"+f+"-",h;for(h in c[f])a(g+h).find(".count:first").text(c[f][h].count)}return!1});a("#s-tag-cloud").unbind("update").bind("update",function(b,c){var f='<ul class="tags"><li class="block align-center">',g;for(g in c)var h=c[g],f=f+('<a href="#/products/tag='+h.uri_name+'/" style="font-size: '+h.size+"%; opacity: "+h.opacity+'" data-id="'+h.id+'" class="s-product-list">'+h.name+"</a>");a("#s-tag-cloud").html(f+"</li></ul>").parents(".block:first").show();
c,d){this.data[a]=this.data[a]||{};this.data[a][c]=d},standalone_tabs:["images","services","pages","reviews"],init:function(a,c){this.setOptions(a,c)},setOptions:function(b,c){c?this[c+"_options"]=a.extend(this[c+"_options"]||{},b||{}):this.options=a.extend(this.options,b||{});this.options.sidebar_width=this.options.sidebar_width||250},get:function(b){if(this.options[b+"_selector"])return a(this.options[b+"_selector"]);throw new exception("");},parsePath:function(b){var b=b.replace(/^.*#\//,"").replace(/(^\/|\/$)/,
this.helper.checkChanges(this.get("form"),!0);a("#s-product-edit-menu li a i.icon10.status-yellow-tiny").remove();a("#s-product-edit-save-panel :submit").removeClass("yellow").addClass("green");"0"==b.raw.sku_type&&(e=a("#s-product-feature-superposition"),e.find("input[type=checkbox]").attr("checked",!1),f=e.find("ul.features li"),f.find(".count").text(""),f.find("i").removeClass("status-blue-tiny status-gray-tiny").addClass("status-gray-tiny"),e=e.find(".superposition-count"),e.find(".options").text(""),
6 ответов
какой-то плагин вызывает ошибку
Проверьте консоль - что пишет?
ничего не устанавливал, товар не виден только в этом виде списка. это произошло после того так удолил несколько характеристик. как проверить консоль?
правая клавиша на любой части сайта, выбрать из списка "просмотр кода элемента" (если хром) в других браузерах может называться пукт по-другому, или F12
Если есть JS ошибки на странице - справа на панели будет красный крестик. Нажимаете его - ниже открывается еще одна область с описанием ошибки - вот она и нужна
Вот код
(function(a){var b=function(a,d,e){var f=!/[^\w\-\.:]/.test(a)?!e?b.cache[a]=b.cache[a]||b(b.load(a)):b.cache[a]=b(b.load(a)):new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;");return d?f(d,b):function(a){return f(a,b)}};b.cache={};b.load=function(a){var b=document.getElementById(a),e=/<\\\/(\w+)/g;if(!b&&console)throw{message:"template with id="+a+" not found"};return b?("textarea"==b.tagName.toLowerCase()?b.value:document.getElementById(a).innerHTML).replace(e,
"</$1"):null};b.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;b.func=function(a,b,e,f,g,h){if(b)return{"\n":"\\n","\r":"\\r","\t":"\\t"," ":" "}[a]||"\\"+a;if(e)return"="===e?"'+_e("+f+")+'":"'+("+f+"||'')+'";if(g)return"';";if(h)return"_s+='"};b.encReg=/[<>&"'\x00]/g;b.encMap={"<":"<",">":">","&":"&",'"':""","'":"'"};b.encode=function(a){return String(a||"").replace(b.encReg,function(a){return b.encMap[a]||""})};b.arg="o";b.helper=",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}";
"function"===typeof define&&define.amd?define(function(){return b}):a.tmpl=b})(this);(function(a){a.fn.lazyLoad=function(b){function c(){if(d.stopped)this.onscroll=null;else if(!d.stopped&&!d.loading&&h(f,e)<=d.distance){if(null!==d.hash){var a=location.hash.replace(/^[^#]*#\/*/,"").split("/")[0];if(-1===d.hash.indexOf(a)){this.onscroll=null;return}}d.load()}}if("stop"==b){var d=this.data("lazyLoadSettings");d&&(d.stopped=!0)}else if("reload"==b){if(d=this.data("lazyLoadSettings"))d.stopped=!1,d.loading=!1,this.get(0).onscroll=null,this.lazyLoad(d)}else if("sleep"==b){if(d=this.data("lazyLoadSettings"))d.loading=
!0}else if("wake"==b){if(d=this.data("lazyLoadSettings"))d.loading=!1}else if("force"==b)(d=this.data("lazyLoadSettings"))&&(d.loading||d.load());else{this.data("lazyLoadSettings",a.extend({distance:50,load:function(){},container:f,state:"wake",hash:location.hash.replace(/^[^#]*#\/*/,"").split("/")[0]||null,distanceBetweenBottoms:null},b||{}));d=this.data("lazyLoadSettings");d.loading=!1;d.stopped=!1;var e=this,f=d.container;null!==d.hash&&!a.isArray(d.hash)&&(d.hash=[d.hash]);a.fn.lazyLoad.call(e,
d.state);var g=setTimeout(function(){if(d.stopped)clearTimeout(g);else{if(d.hash!==null){var a=location.hash.replace(/^[^#]*#\/*/,"").split("/")[0];if(d.hash.indexOf(a)===-1){clearTimeout(g);return}}if(d.loading)g=setTimeout(arguments.callee,350);else{h(f,e);if(h(f,e)<=d.distance){d.load();g=setTimeout(arguments.callee,350)}else{e.get(0).onscroll=c;clearTimeout(g)}}}},350),h="function"===typeof d.distanceBetweenBottoms?d.distanceBetweenBottoms:function(b,c,d){b=typeof b==="string"?a(b):b;return b.position().top+
b.outerHeight()-(d||0)-(c.scrollTop()+c.height())}}}})(jQuery);$.fn.liveDraggable=function(a){this.each(function(){var a=$(this);a.data("init_draggable")&&a.die("mouseover",a.data("init_draggable"))});this.die("mouseover").live("mouseover",function(){var b=$(this);b.data("init_draggable")||b.data("init_draggable",arguments.callee).draggable(a)})};
$.fn.liveDroppable=function(a){this.each(function(){var a=$(this);a.data("init_droppable")&&a.die("mouseover",a.data("init_droppable"))});var b=function(){var b=$(this);b.data("init_droppable")||(b.data("init_droppable",arguments.callee).droppable(a),b.mouseover())};b.call(this);this.die("mouseover",b).live("mouseover",b)};(function(a){a.fn.inlineEditable=function(b,c){function d(){m(a(this))||a(this).addClass(i.placeholderClass).text(i.placeholder)}function e(){m(a(this))==i.placeholder&&a(this).text("").removeClass(i.placeholderClass)}function f(b){return!a(b).val()?(a(this).text(i.placeholder).addClass(i.placeholderClass),!0):!1}function g(){n="edit";this.id=this.id||(""+Math.random()).slice(2);var b=this.id+"-input",c=a("#"+b);c.length||(o.after(j(b)),c=a("#"+b));c.addClass(i.inputClass);var b=c,d=o,f=i.size.height||
d.height(),d=i.size.width||1.5*d.width(),f=i.minSize.height&&f<i.minSize.height?i.minSize.height:f,d=i.minSize.width&&d<i.minSize.width?i.minSize.width:d,f=i.maxSize.height&&f>i.maxSize.height?i.maxSize.height:f,d=i.maxSize.width&&d>i.maxSize.width?i.maxSize.width:d;b.height(f);b.width(d);i.placeholder&&m(a(this))==i.placeholder&&e.call(o);i.beforeMakeEditable.call(this,c);q=i.truncate?o.data("real_text"):m(o);c.val(q).show().focus();o.hide();a(i.editLink).hide();if(!l){for(var g=[],k=[],b=0,f=i.makeReadableBy.length;b<
f;++b)d=i.makeReadableBy[b],"blur"==d&&c.blur(function(){n!="read"&&h.call(this)}),"enter"==d&&g.push(13),"esc"==d&&g.push(27);b=0;for(f=i.updateBy.length;b<f;++b)d=i.updateBy[b],"alt+enter"==d&&k.push({ctrl:!1,alt:!0,shift:!1,key:13}),"ctrl+enter"==d&&k.push({ctrl:!0,alt:!1,shift:!1,key:13}),"ctrl+s"==d&&k.push({ctrl:!0,alt:!1,shift:!1,key:17});g.length&&c.keydown(function(a){~g.indexOf(a.keyCode)&&!a.ctrlKey&&!a.altKey&&!a.shiftKey&&n!="read"&&h.call(this,a.keyCode==27?q:null);if(k.length)for(var b in k){var c=
k[b];if(a.keyCode==c.key&&a.ctrlKey==c.ctrl&&a.altKey==c.alt&&a.shiftKey==c.shift){o.trigger("readable");break}}});o.unbind("readable.inlineEditable").bind("readable.inlineEditable",function(b,c){if(n!="read"){var d=a("#"+(this.id+"-input"));h.call(d,d.val(),c)}});l=!0}i.afterMakeEditable.call(this,c)}function h(b,c){c="undefined"===typeof c?!1:!0;void 0!=b&&null!=b?a(this).val(b):b=a(this).val();if(!(!1===c&&!1===i.beforeBackReadable.call(o.get(0),this,{changed:b!=q,old_text:q,new_text:b}))){n="read";
if(!i.placeholder||!f.call(o,this))if(i.allowEmpty||b)i.truncate?(o.data("real_text",b),o.text(b.length<i.truncate-3?b:b.substr(0,i.truncate-3)+"...")):!i.html?o.text(b):o.html(b),b||d.call(this);o.show();a(this).hide();a(i.editLink).show();!1===c&&i.afterBackReadable.call(o.get(0),this,{changed:b!=q,old_text:q})}}function j(a){switch(i.inputType){case "textarea":return'<textarea id="'+a+'" style="display:none;"></textarea>';default:return'<input type="text" id="'+a+'" style="display:none;">'}}function k(a){return function(){return a}}
function m(a){return!i.html?a.text():a.html()}if(this.length){var l=!1;if("string"==typeof b){if("setOption"==b){var i=this.data("inlineEditableSettings")||{};a.extend(!0,i,c);"undefined"!==typeof c.hold&&"function"!==typeof c.hold&&(i.hold=k(i.hold));this.data("inlineEditableSettings",i)}return this}var p=this.data("inlineEditableSettings");this.data("inlineEditableSettings",a.extend({inputType:"text",inputClass:"",size:{height:null,width:null},minSize:{height:null,width:null},maxSize:{height:null,
width:null},editLink:null,editOnItself:!0,placeholder:null,makeReadableBy:["blur","enter","esc"],updateBy:["ctrl+enter","alt+enter"],beforeBackReadable:function(){},afterBackReadable:function(){},beforeMakeEditable:function(){},afterMakeEditable:function(){},placeholderClass:"hint",truncate:!1,hold:!1,html:!1,allowEmpty:!1},p,b||{}));var i=this.data("inlineEditableSettings")||{},o=this,n="read",q="";"function"!==typeof i.hold&&(i.hold=k(i.hold));this.data("inited")||(i.truncate&&"boolean"==typeof i.truncate&&
(i.truncate=255),i.truncate&&(p=!i.placeholder||i.placeholder!==this.text()?this.text():"",this.data("real_text",p),this.text(p.length<i.truncate-3?p:p.substr(0,i.truncate-3)+"...")),i.placeholder&&d.call(this),i.editLink&&a(i.editLink).unbind("click.inlineEditable").bind("click.inlineEditable",function(){i.hold.call(o)||n!="edit"&&g.call(o.get(0))}),i.editOnItself&&this.unbind("click.inlineEditable").bind("click.inlineEditable",function(){i.hold.call(o)||n!="edit"&&g.call(this)}),this.unbind("editable.inlineEditable").bind("editable.inlineEditable",
function(){i.hold.call(o)||n!="edit"&&g.call(this)}),this.unbind("placeholder.inlineEditable").bind("placeholder.inlineEditable",function(b,c){c&&i.placeholder&&d.call(this);c||a(this).removeClass(i.placeholderClass)}),this.data("inited",!0));return this}}})(jQuery);(function(a){a.fn.photoStreamSlider=function(b){function c(){function b(c){function j(){b.execution=!1;var a="on"+i.charAt(0).toUpperCase()+i.slice(1),a=d[a];"function"==typeof a&&a.call(e);a=c.fn;"function"==typeof a&&a.call(e)}"string"==typeof c&&(c={direction:c,animate:!0});var i=c.direction||"forward",l=c.steps||h.length;if(!b.execution){b.execution=!0;var o=h.filter(":first").outerWidth()*l,n=h.length;if("forward"==i){var r=h.filter(":last").nextAll(":lt("+l+")"),l=r.length,r=r.filter(":last");
l&&(h.removeClass("visible"),r.prevAll(":lt("+(n-1)+")").addClass("visible"),r.addClass("visible"))}else r=h.filter(":first").prevAll(":lt("+l+")"),l=r.length,r=r.filter(":last"),l&&(h.removeClass("visible"),r.nextAll(":lt("+(n-1)+")").addClass("visible").show(),r.addClass("visible"));h=a("li.visible",g);n=g.position().left;"forward"==i?(l=m-k-p,n-=o,n=n>-l?n:-l):(n+=o,n=n<p?n:p);c.animate?g.animate({left:n},d.duration,j):(g.css({left:n}),j())}}var g=e.find(d.photoStream),h=a("li.visible",g),j=a("li",
g),k=h.filter(":first").outerWidth()*h.length,m=j.filter(":first").outerWidth()*j.length,l=d.height||j.filter(":first").outerHeight();g.parent().css({overflow:"hidden",height:l,position:"relative",padding:"4px 0",margin:0,width:k});for(var l=g.find("li:first"),i=h.filter(":first"),p=(i.outerWidth()-i.width())/2,o=0,n=l.outerWidth(),i=i.get(0);l.length&&l.get(0)!=i;)o+=n,l=l.next();g.css({position:"absolute",left:-(o-p),width:m});a(d.forwardLink).unbind("click").bind("click",function(){b("forward");
return!1});a(d.backwardLink).unbind("click").bind("click",function(){b("backward");return!1});e.unbind("append prepend").bind("append prepend",function(b,c){if("append"==b.type){for(var d=g.find("li:last"),f=a();d.hasClass("dummy");)f=f.add(d),d=d.prev("li");f.remove();g.append(c)}else{var d=a("<div></div>").html(c),f=d.find("li"),h=f.length*n;d.remove();for(var d=g.find("li:first"),k=a();d.hasClass("dummy");)k=k.add(d),d=d.next("li");k.remove();g.prepend(f)}j=g.find("li");m=j.filter(":first").outerWidth()*
j.length;g.css("width",m);"prepend"==b.type&&(g.is(":animated")&&g.stop(!1,!0),g.css("left",parseInt(g.css("left"))-h));g.find("li.selected").hasClass("visible")&&e.trigger("home",[null,!1])});e.unbind("forward backward").bind("forward backward",function(a,c){b({direction:a.type,steps:c.steps,animate:"undefined"!==typeof c.animate?c.animate:!0,fn:c.fn});var d=g.find("li.selected"),e="forward"==a.type?d.next("li:not(.dummy)"):d.prev("li:not(.dummy)");e.length&&(d.removeClass("selected"),e.addClass("selected"))});
e.unbind("home").bind("home",function(c,d,e){var c=parseInt(h.length/2),c=h.filter(":eq("+c+")"),g=c.nextAll(".selected:first"),j=c.prevAll(".selected:first"),k=0,m="";"function"!==typeof d&&(e=d);e="undefined"!==typeof e?e:!0;g.length?(m="forward",c.nextAll().each(function(){++k;if(a(this).hasClass("selected"))return!1})):j.length&&(m="backward",c.prevAll().each(function(){++k;if(a(this).hasClass("selected"))return!1}));m&&k?b({direction:m,steps:k,fn:d,animate:e}):"function"==typeof d&&d();return!1});
e.unbind("refresh").bind("refresh",function(){c()})}var d=a.extend({duration:200,height:48},b||{}),e=this;c()}})(jQuery);(function(a){function b(){a("#hint-menu-block").hide().children().hide()}a.product_dragndrop={handlers:{},options:{},init:function(a){this.options=a;a.collections&&(this.initDragCollections(),this.initDropCollections());a.products&&(this.initDragProducts(),this.initDropProducts());return this},bind:function(a,b){this.handlers[a]=b;return this},trigger:function(a){if("function"===typeof this.handlers[a])return this.handlers[a].apply(this,Array.prototype.slice.call(arguments,1))},initDragProducts:function(){var c=
a("#product-list"),d=c.find(".product:not(.s-alien)");d.find(".drag-handle").live("selectstart",function(){document.onselectstart=function(){return!1};return!1});d.liveDraggable({opacity:0.75,zIndex:9999,distance:5,appendTo:"body",cursor:"move",refreshPositions:!0,containment:[0,0,a(window).width(),{toString:function(){return a(document).height()}}],start:function(b,c){document.ondragstart=function(){return!1};c.helper.data("scrollTop",a(document).scrollTop());a(document).bind("scroll",a.product_dragndrop._scrolHelper);
a(".block.drop-target").addClass("drag-active")},handle:".drag-handle",stop:function(){document.ondragstart=null;document.onselectstart=null;var c=a(this);c.find("input:checked").length||c.removeClass("selected");b();a(document).unbind("scroll",a.product_dragndrop._scrolHelper);a(".block.drop-target").removeClass("drag-active");b()},helper:function(){var b=1,d=c.find(".s-select-all");d.is(":checked")?b=d.attr("data-count"):(d=c.find(".product.selected"),d.length?-1!==d.index(this)?b=d.length:(a(this).trigger("select",
!0),b=d.length+1):a(this).addClass("selected"));return'<div id="products-helper"><span class="indicator red">'+b+'</span><i class="icon10 no-bw" style="display:none;"></i></div>'},drag:function(a,b){var c=a.originalEvent;b.position.left=c.pageX-20;b.position.top=c.pageY}})},initDropProducts:function(){a("#product-list .product").liveDroppable({disabled:!1,greedy:!0,tolerance:"pointer",over:function(c,d){if(a(this).hasClass("s-alien")||!d.draggable.hasClass("product"))return!1;if(a.product_dragndrop.trigger("is_product_sortable"))b();
else{var e=a.product_dragndrop.options.sort;if(e){var f=a("#hint-menu-block").show();f.children().hide();f.find("."+e).show()}}a.product_dragndrop._activatePhotoListItem.call(this)},out:function(){a.product_dragndrop._unactivatePhotoListItem.call(this)},drop:function(b,d){if(!d.draggable.hasClass("product"))return!1;var e=a(this);if(e.hasClass("selected"))return a.product_dragndrop._unactivatePhotoListItem.call(this),!1;var f=a("#product-list").find(".product.selected");if(!a.product_dragndrop.trigger("is_product_sortable"))return a.product_dragndrop._unactivatePhotoListItem.call(this),
a.product_dragndrop._unactivatePhotoListItem.call(d.draggable),!1;var g=null;if(e.hasClass("s-alien")){var h=e.nextAll(":not(.s-alien):first");if(h.length)g=h.attr("data-product-id"),h.before(f);else{h=e.prevAll(":not(.s-alien):first");if(!h.length||h.hasClass("selected"))return!1;g=null;h.after(f)}h.hasClass("last")&&(h.removeClass("last"),f.filter(":last").addClass("last"))}else e.hasClass("drag-active-last")||(g=e.attr("data-product-id")),e.hasClass("last")&&e.hasClass("drag-active-last")?(e.after(f).removeClass("drag-active drag-active-last last"),
f.filter(":last").addClass("last")):e.before(f).removeClass("drag-active"),e.removeClass("drag-active drag-active-last");a.product_dragndrop._unactivatePhotoListItem.call(this);a.product_dragndrop._unactivatePhotoListItem.call(d.draggable);f.trigger("select",!1);e=f.map(function(){return a(this).attr("data-product-id")}).toArray();a.product_dragndrop.trigger("move_product",{product_ids:e,before_id:g,error:function(a){a&&console&&console.log("undefined"!==typeof a.errors?a.errors:a)}})}})},initDragCollections:function(){var b=
a("#wa-app .sidebar:first"),d=b.position(),e=b.width(),b=b.height();a(".s-collection-list li.dr").liveDraggable({containment:[d.left,d.top,d.left+1.25*e,d.top+1.25*b],refreshPositions:!0,revert:"invalid",helper:function(){var b=a(this),c=b.parents(".s-collection-list:first").find("ul:first"),b=b.clone().addClass("ui-draggable dr-helper").css({position:"absolute"}).prependTo(c);b.find("a:first").append('<i class="icon10 no-bw" style="margin-left: 0; margin-right: 0; display:none;"></i>');return b},
cursor:"move",cursorAt:{left:5},opacity:0.75,zIndex:9999,distance:5,start:function(){document.ondragstart=function(){return!1}},stop:function(){document.ondragstart=null}})},initDropCollections:function(){this.initDropBetweenCollections();this.initDropInsideCollections()},initDropBetweenCollections:function(){a(".s-collection-list li.drag-newposition").liveDroppable({greedy:!0,tolerance:"pointer",over:function(b,d){var e=a(this);if(d.draggable.attr("data-type")!=e.attr("data-type"))return!1;e.addClass("active").parent().parent().addClass("drag-active")},
out:function(b,d){var e=a(this);if(d.draggable.attr("data-type")!=e.attr("data-type"))return!1;e.removeClass("active").parent().parent().removeClass("drag-active")},deactivate:function(b,d){var e=a(this);if(d.draggable.attr("data-type")!=e.attr("data-type"))return!1;(e.is(":animated")||e.hasClass("dragging"))&&e.stop().animate({height:"2px"},300,null,function(){e.removeClass("dragging")});e.removeClass("active").parent().parent().removeClass("drag-active")},drop:function(b,d){var e=a(this),f=d.draggable,
g=f.attr("data-type");if(g!=e.attr("data-type"))return!1;var h=function(a){a=a.split("-");a.shift();return a.join("-")},j=h(f.attr("id")),k=e.prev("li"),m=f.next(),l=f.prev();if(k.length&&k.attr("id")=="category-"+j&&!k.hasClass("dr-helper")||this==f.next().get(0))return!1;var i=f.parent("ul"),p=i.children("li.dr[id!=category-"+j+"]").length,o=parseInt(h(i.parent().attr("id")),10)||0;e.after(m).after(f);e=f.parent().parent();if(e.is("li.dr")||e.is(".s-collection-list")){var n=0;e.is(".s-collection-list")||
(n=parseInt(h(e.attr("id")),10)||0);e=f.nextAll("li.dr:first");k=null;e.length&&(k=h(e.attr("id"))||null);!p&&o!==n&&(i.parent("li").children("i").hide(),i.hide());a.product_dragndrop.trigger("move_list",{id:j,type:g,before_id:k,parent_id:n,success:function(){if(!p&&o!==n){i.parent("li").children("i").remove();i.remove();a.categories_tree.setCollapsed(o)}},error:function(a){a&&console&&console.log(typeof a.errors!=="undefined"?a.errors:a);l.after(f.next()).after(f);if(!p){i.parent("li").children("i").show();
i.show()}}})}}})},initDropInsideCollections:function(){a(".s-collection-list li.dr a").liveDroppable({tolerance:"pointer",greedy:!0,out:function(b,d){var e=d.draggable,f=a(this).parent();if(!e.hasClass("product")&&f.attr("data-type")!=e.attr("data-type"))return!1;e.hasClass("product")&&d.helper.find("span").show().end().find("i").hide();f.removeClass("drag-newparent")},over:function(b,d){var e=d.draggable,f=a(this).parent(),g=e.attr("data-type");if(!e.hasClass("product")&&g!=f.attr("data-type"))return!1;
"set"!=g&&f.addClass("drag-newparent");if(e.hasClass("product"))return f.hasClass("dynamic")?d.helper.find("span").hide().end().find("i").show():d.helper.find("span").show().end().find("i").hide(),!1;if(!e.hasClass("dynamic")&&f.hasClass("dynamic"))return d.helper.find("i.no-bw").show(),!1;d.helper.find("i.no-bw").hide();var h='.dr[id!="'+e.attr("id")+'"]',j=a(),e=function(a,b){if(!b.length)return a;a=a.add(b.nextUntil(h).filter("li.drag-newposition"));return 0<b.nextAll(h).length?a:arguments.callee(a,
b.parent().closest("li"))},g=f.prevAll(h+":first");if(0<g.length)var k=g.find(h),j=0<k.length?e(j,k.last()):e(j,g);else j=j.add(f.prevUntil(h).filter("li.drag-newposition"));var j=0<f.children("ul").children(h).length?j.add(f.children("ul").children("li.drag-newposition:first")):e(j,f),m=a(".drag-newposition:animated, .drag-newposition.dragging").not(j);m.stop().animate({height:"2px"},300,null,function(){m.removeClass("dragging")});j.stop().animate({height:"10px"},300,null,function(){j.addClass("dragging")})},
drop:function(b,d){var e=d.draggable,f=a(this).parent(),g=e.attr("data-type");if(!e.hasClass("product")&&("set"==g||f.attr("id")==e.attr("id")||g!=f.attr("data-type")))return!1;f.removeClass("drag-newparent");if(e.hasClass("product")){if(f.hasClass("dynamic"))return!1;var h=a("#product-list"),j={};if(h.find(".s-select-all").is(":checked"))j.whole_list=!0;else{var k=h.find(".product.selected");j.product_ids=k.map(function(){return a(this).attr("data-product-id")}).toArray()}a.product_dragndrop.trigger("add_to_list",
a.extend(j,{collection_param:f.attr("id").replace("-","_id="),success:function(a){j.whole_list?h.find(".s-select-all").trigger("select",!1):j.product_ids&&j.product_ids.length&&k.trigger("select",!1);a.data&&(f.find(">.counters .count:not(.subtree)").text(a.data.count),f.find(">.counters .subtree").text(a.data.total_count))}}));return!1}if(!e.hasClass("dynamic")&&f.hasClass("dynamic"))return!1;var m=e.attr("id").split("-")[1];if(f.attr("id")=="category-"+m)return!1;if(e.hasClass("product"))return a("#product-list").find(".product.selected").trigger("select",
!1),!1;var l=parseInt(f.attr("id").split("-")[1],10)||0,i=null,p=e.next(),o=e.prev(),n=!1;f.hasClass("drag-newposition")?i=f.parent("ul"):f.children("ul").length?i=f.children("ul"):f.find(">i.collapse-handler-ajax").length||(i=a('<ul class="menu-v with-icons dr unapproved"><li class="drag-newposition unapproved" data-type="'+g+'"></li></ul>').appendTo(f),i.find(".drag-newposition").mouseover(),a('<i class="icon16 darr overhanging collapse-handler-ajax unapproved" id="'+g+"-"+l+'-handler"></i>').insertBefore(f.children("a")),
n=!0);var q=e.parent("ul"),s=q.children("li.dr[id!=category-"+m+"]").length,t=parseInt(q.parent().attr("id").split("-")[1],10)||0;i&&i.append(e).append(p);!s&&t!==l&&(q.parent("li").children("i").hide(),q.hide());f.is("li.dr")&&a.product_dragndrop.trigger("move_list",{id:m,type:g,parent_id:l,success:function(b){if(!s&&t!==l){q.parent("li").children("i").remove();q.remove();a.categories_tree.setCollapsed(t)}if(i){a(".s-collection-list .unapproved").removeClass("unapproved");n?a.categories_tree.setExpanded(l):
f.trigger("count_subtree")}else{e.remove();p.remove();f.trigger("update_counters",b.data.count||{})}},error:function(b){b&&console&&console.log(typeof b.errors!=="undefined"?b.errors:b);o.after(e).after(p);if(!s){q.parent("li").children("i").show();q.show()}a(".s-collection-list .unapproved").remove()}})}})},_scrolHelper:function(){var b=a("#products-helper"),d=b.data("scrollTop"),e=a(document).scrollTop();b.css("top",b.position().top+(d?e-d:50)+"px");b.data("scrollTop",e)},_extDragActivate:function(b,
d,e){var f=e+"-last";if(d.hasClass("last")){var g=b.pageX,b=b.pageY,h=d.width(),j=d.height(),k=d.offset();"thumbs"==a.product_dragndrop.options.view?g>k.left+0.5*h&&g<=k.left+h?(d.removeClass(e).addClass(f),a.product_dragndrop._shiftToLeft(d)):g>k.left&&g<=k.left+0.5*h?(d.removeClass(f).addClass(e),a.product_dragndrop._shiftToRight(d)):a.product_dragndrop._shiftAtPlace(d):"table"==a.product_dragndrop.options.view&&(b>k.top+0.5*j?d.removeClass(e).addClass(f):b>k.top&&d.removeClass(f).addClass(e));
(b<k.top||b>k.top+j||g<k.left||g>k.left+h)&&d.removeClass(e).removeClass(f)}else d.addClass("drag-active")},_bindExtDragActivate:function(b,d){a(document).bind("mousemove.ext_drag_activate",function(e){a.product_dragndrop._extDragActivate(e,b,d)})},_unbindExtDragActivate:function(){a(document).unbind("mousemove.ext_drag_activate")},_activatePhotoListItem:function(){var b=a(this),d=a.product_dragndrop.trigger("is_product_sortable"),e=d?"drag-active":"drag-active-disabled";d&&"thumbs"==a.product_dragndrop.options.view&&
a.product_dragndrop._shiftToRight(b);b.hasClass("last")?a.product_dragndrop._bindExtDragActivate(b,e):b.addClass(e)},_unactivatePhotoListItem:function(){var b=a(this),d=a.product_dragndrop.trigger("is_product_sortable"),e=d?"drag-active":"drag-active-disabled",f=e+"-last";b.hasClass("last")&&a.product_dragndrop._unbindExtDragActivate();b.removeClass(e+" "+f);d&&"thumbs"==a.product_dragndrop.options.view&&a.product_dragndrop._shiftAtPlace(b)},_shiftToLeft:function(b){if("left"!==b.data("shifted")){var d=
b.find(".p-wrapper");if(!d.length){var e=b.children(),d=a("<div class='p-wrapper' style='position:relative;'></div>").appendTo(b);d.append(e)}d.stop().animate({left:-15},200);b.data("shifted","left")}},_shiftToRight:function(b){if("right"!==b.data("shifted")){var d=b.find(".p-wrapper");if(!d.length){var e=b.children(),d=a("<div class='p-wrapper' style='position:relative;'></div>").appendTo(b);d.append(e)}d.stop().animate({left:15},200);b.data("shifted","right")}},_shiftAtPlace:function(a){if(a.data("shifted")){var b=
a.find(".p-wrapper");if(b.length){var e=b.children();b.stop().css({left:0});a.append(e);b.remove()}a.data("shifted","")}}}})(jQuery);(function(a){var b=function(a){var b=/^category-(.*?)-handler$/;return b.test(a.attr("id"))?a.attr("id").replace(b,function(a,b){return parseInt(b,10)||0}):0},c=function(a){if(b(a))a=a.parents("li:not(.drag-newposition):first"),c=d=a.find("ul:first");else var a=a.parent(),d=a.next(),c=d.find("ul:first");return{parent:a,target:d,ul:c}},d=function(a,b){var d=c(a);"category"==d.parent.attr("data-type")&&d.parent.trigger("count_subtree",!1);a.removeClass("rarr").addClass("darr");d.target.show();"function"===
typeof b&&b(a)},e=function(a,b){var d=a.parent.find(".loading:first"),c=a.parent.find(".counters");b?(d.show(),c.hide()):(d.hide(),c.show())},f=function(d,e){var f=c(d);"category"==f.parent.attr("data-type")&&!f.parent.hasClass("dynamic")&&f.parent.trigger("count_subtree",!0);d.removeClass("darr").addClass("rarr");f.target.hide();"function"===typeof e&&e(d);a.get("?action=categoryExpand&id="+b(d)+"&collapsed=1")},g=function(f,g,k){if(!f.data("loading_content")){var m=c(f);m.ul.length?d(f,g):e(m,!0);
var l=!m.ul.length;f.data("loading_content",l);a.get("?action=categoryExpand&id="+b(f)+(l?"&tree=1":""),function(a){l&&(m.target.length?m.target.append(a):m.parent.append(a),e(m,!1),d(f,g),f.data("loading_content",!1));"function"===typeof k&&k()})}};a.categories_tree={init:function(){a("#s-category-list-block").off("click",".collapse-handler-ajax").on("click",".collapse-handler-ajax",function(){var b=a(this);b.hasClass("darr")?f(b):g(b)});a("#s-category-list-block .heading").off("click").click(function(b){var d=
a(this).find(".collapse-handler-ajax");d.is(b.target)||d.click()})},collapse:function(b,d){b=a(b);b.hasClass("darr")?f(b,d):"function"===typeof d&&d(b)},expand:function(b,d,c){b=a(b);b.hasClass("rarr")?g(b,d,c):("function"===typeof d&&d(b),"function"===typeof c&&c(b))},isCollapsed:function(b){return a(b).hasClass("rarr")},setExpanded:function(b){a.get("?action=categoryExpand&id="+b)},setCollapsed:function(b){a.get("?action=categoryExpand&id="+b+"&collapsed=1")},getHandlerByCategoryId:function(b){var d=
a();return d=(b=parseInt(b,10)||0)?a("#category-"+b+"-handler"):a("#s-category-list-handler")}}})(jQuery);(function(a){a.product_sidebar={options:{},init:function(){var b=a("#s-sidebar");a.product_dragndrop.init({collections:!0}).bind("move_list",function(b){if(b.type){var c={id:b.id,type:b.type,parent_id:b.parent_id||0};b.before_id&&(c.before_id=b.before_id);a.products.jsonPost("?module=products&action=moveList",c,b.success,b.error)}else"function"===typeof b.error&&b.error("Unknown list type")});b.off("add",".s-collection-list ul").on("add",".s-collection-list ul",function(b,c,f,g){var b=a(this),h=b.parents(".s-collection-list:first"),
j=a("<ul></ul>");j.append(tmpl("template-sidebar-list-item",{type:f,item:c}));var c=j.children(":not(.drag-newposition):first"),f=c.attr("id"),f=b.find("#"+f),k=j.children();f.length?g&&f.replaceWith(c):b.prepend(k).show();k.each(function(){var b=a(this);b.hasClass("dr")?b.find("a").mouseover():b.mouseover()});b.find(".drag-newposition").css({height:"2px"}).removeClass("dragging");h.find(".s-empty-list").hide();j.remove();return!1});b.unbind("update").bind("update",function(b,c){for(var f in c)if("all"==
f)a("#s-all-products").find(".count:first").text(c[f].count);else{var g="#"+f+"-",h;for(h in c[f])a(g+h).find(".count:first").text(c[f][h].count)}return!1});a("#s-tag-cloud").unbind("update").bind("update",function(b,c){var f='<ul class="tags"><li class="block align-center">',g;for(g in c)var h=c[g],f=f+('<a href="#/products/tag='+h.uri_name+'/" style="font-size: '+h.size+"%; opacity: "+h.opacity+'" data-id="'+h.id+'" class="s-product-list">'+h.name+"</a>");a("#s-tag-cloud").html(f+"</li></ul>").parents(".block:first").show();
return!1});b.off("count_subtree",".s-collection-list li").on("count_subtree",".s-collection-list li",function(b,c){var f=a(this);"undefined"===typeof c&&(c=f.find("i.collapse-handler-ajax").hasClass("rarr"));var g=f.find(">.counters .count:not(.subtree)"),f=f.find(">.counters .subtree");f.length||(f=g.clone().addClass("subtree").hide(),g.after(f));c?(g.hide(),f.show()):(f.hide(),g.show());return!1});b.off("update_counters",".s-collection-list li").on("update_counters",".s-collection-list li",function(b,
c){var f=a(this),g=f.find(">.count:not(.subtree)"),f=f.find(">.subtree");f.length||(f=g.clone().addClass("subtree").hide(),g.after(f));"undefined"!==typeof c.item&&g.text(parseInt(c.item,10)||0);"undefined"!==typeof c.subtree&&f.text(parseInt(c.subtree,10)||0);return!1});var c=b.find("#s-category-list-widen-arrows");c.find("a.arrow").unbind("click").bind("click",function(){var d=b.attr("class"),e=0,f=d.match(/left([\d]{2,3})px/);if(f&&f[1]&&(e=parseInt(f[1])))if(f=e+(a(this).is(".right")?50:-50),
f=Math.max(Math.min(f,400),200),f!=e){c.css({width:f.toString()+"px"});e=["left"+e+"px","left"+f+"px"];b.attr("class",d.replace(e[0],e[1]));b.css("width","");var g=a("#s-content"),d=g.attr("class");g.attr("class",d.replace(e[0],e[1]));g.css("margin-left","");a.product&&a.product.setOptions({sidebar_width:f});a.shop.jsonPost("?action=sidebarSaveWidth",{width:f});b.trigger("change_width",[f])}return!1});b.off("click","#s-forcesort-by-name").on("click","#s-forcesort-by-name",function(){a.product_sidebar.sortCategoryDialog();
return!1});b.off("click",".s-new-list").on("click",".s-new-list",function(){var b=a(this),c=b.attr("id"),f=0;c?b=c.replace("s-new-",""):(f=b.parents("li.dr:first").attr("id").split("-"),b=f[0],f=f[1]);a.product_sidebar.createListDialog(b,f,function(b,c){var d=a("#s-"+c+"-list"),e=d.find("ul:first");if(!e.length){d.prepend('<ul class="menu-v with-icons"><li class="drag-newposition" data-type="'+c+'"></li></ul>');d.find(".drag-newposition").mouseover();e=d.find("ul:first")}var f=parseInt(b.parent_id,
10)||0,d=a.categories_tree.getHandlerByCategoryId(f),l=function(){if(f){var d=e.find("#"+c+"-"+b.parent_id);if(!d.find(">.collapse-handler-ajax").length){d.append('<ul class="menu-v with-icons dr"><li class="drag-newposition" data-type="'+c+'"></li></ul>');d.find(".drag-newposition").mouseover();d.find(">a").before('<i class="icon16 darr overhanging collapse-handler-ajax" id="'+c+"-"+f+'-handler"></i>');a.categories_tree.setExpanded(f)}e=d.find("ul:first")}e.trigger("add",[b,c])};c=="category"?a.categories_tree.expand(d,
function(){l()}):l()});return!1})},sortCategoryDialog:function(){a("#s-products-sort-categories").waDialog({disableButtonsOnSubmit:!0,onSubmit:function(){a(this)}})},createListDialog:function(b,c,d){var e=a("#s-product-list-create-dialog");(e.length?e.parent():a("<div></div>").appendTo("body")).load("?module=dialog&action=productListCreate&type="+b+"&parent_id="+c,function(){var c=a("#s-product-list-settings-dialog");c.length&&(c.parent().remove(),c.remove());a("#s-product-list-create-dialog").waDialog({esc:!1,
disableButtonsOnSubmit:!0,onLoad:function(){a("#s-category-description-content").length&&a.product_sidebar.initCategoryDescriptionWysiwyg(a(this));setTimeout(function(){a("#s-c-product-list-name").focus()},50)},onSubmit:function(c){var e=a(this),f=function(a){typeof d==="function"&&d(a.data,b);location.href="#/products/"+b+"_id="+a.data.id;c.trigger("close")},k=function(a){if(a&&a.errors){var a=a.errors,b;for(b in a)c.find("input[name="+b+"]").addClass("error").parent().find(".errormsg").text(a[b]);
return false}};a("#s-category-description-content").length&&a("#s-category-description-content").waEditor("sync");if(e.find("input:file").length)a.products._iframePost(e,f,k);else{a.shop.jsonPost(e.attr("action"),e.serialize(),f,k);return false}}})})},initCategoryDescriptionWysiwyg:function(b){var c=b.find(".field.description");c.find("i").hide();c.find(".s-editor-core-wrapper").show();c=0.8*b.find(".dialog-window").height()||350;a("#s-category-description-content").waEditor({lang:wa_lang,toolbarFixed:!1,
maxHeight:c,minHeight:c,uploadFields:b.data("uploadFields")})}}})(jQuery);(function(a){Array.prototype.filter||(Array.prototype.filter=function(a,c){var d=this.length;if("function"!=typeof a)throw new TypeError;for(var e=[],f=0;f<d;f++)if(f in this){var g=this[f];a.call(c,g,f,this)&&e.push(g)}return e});a(function(){a("#s-content").on("click",".s-alert-close",function(){var b=a.storage.get("shop/alerts");b||(b=[]);b.push(a(this).parent().data("alert"));a.storage.set("shop/alerts",b);a(this).parent().remove();return false})});a.storage=new a.store;a.products={hash:"",list_hash:"",
list_params:{},random:"",init:function(b){a.extend(this.options,b);this.initRouting();this.initSearch();a.product_sidebar.init();a.categories_tree.init();this.initCollapsible()},data:{prev_action:null},initRouting:function(){typeof a.History!="undefined"&&a.History.bind(function(){a.products.dispatch()});a.wa.errorHandler=function(b){if(b.status===403||b.status===404){b=a(b.responseText);console.log(b);b=b.find(".dialog-content").length?a('<div class="block double-padded"></div>').append(b.find(".dialog-content *")):
a('<div class="block double-padded"></div>').append(b.find(":not(style)"));a("#s-content").empty().append(b);return false}return true};var b=window.location.hash;b==="#/"||!b?this.dispatch():a.wa.setHash(b)},skip_dispatch:0,forceHash:function(b){if(b!=location.hash){a.products.skip_dispatch++;a.wa.setHash(b)}},dispatch:function(b){if(a.products.skip_dispatch>0)a.products.skip_dispatch--;else{if(b===void 0)b=window.location.hash;this.hash=b=b.replace(/(^[^#]*#\/*|\/$)/g,"");try{if(b){b=b.split("/");
if(b[0]){for(var c="",d=b.length,e=0;e<b.length;e++){var f=b[e];if(e<2)if(e===0)c=f;else if(c=="product"||c=="tag"||c=="search"||c=="plugins"||c=="pages"||c=="stocks"){d=e;break}else if(parseInt(f,10)!=f&&f.indexOf("=")==-1)c=c+(f.substr(0,1).toUpperCase()+f.substr(1));else{d=e;break}else{d=e;break}}var g=b.slice(d);this.preExecute(c,g);if(typeof this[c+"Action"]=="function"){a.shop.trace("$.products.dispatch",[c+"Action",g]);this[c+"Action"].apply(this,g)}else a.shop.error("Invalid action name:",
c+"Action")}else{this.preExecute();this.defaultAction()}}else{this.preExecute();this.defaultAction()}}catch(h){a.shop.error(h.message,h)}}},load:function(b,c){var d=Math.random();this.random=d;var e=this;a.get(b,function(b){if(e.random==d){a("#s-content").removeClass("bordered-left").html(b);a("html, body").animate({scrollTop:0},200);if(c)try{c.call(this)}catch(g){a.shop.error("$.products.load callback error: "+g.message,g)}}})},addOptions:function(b){this.options=a.extend(this.options,b||{})},preExecute:function(b){try{if(this.data.prev_action&&
this.data.prev_action!=b){var c=this.data.prev_action+"Termination";a.shop.trace("$.products.preExecute",[c,b]);typeof this[c]=="function"&&this[c].apply(this,[])}this.data.prev_action=b;var d=a("#wa"),e=d.data("style");e?d.attr("style",e):d.removeAttr("style");a(window).resize();a("body > .dialog").trigger("close").remove()}catch(f){a.shop.error("preExecute error: "+f.message,f)}},defaultAction:function(){this.productsAction()},welcomeAction:function(){this.load("?module=products&action=welcome")},
paramsFromSession:function(b){if(!window.sessionStorage||!window.JSON||!window.JSON.stringify||!window.JSON.parse)return b;if(b.category_id){storage=sessionStorage.getItem("shop/list_categories")||"{}";try{storage=JSON.parse(storage)}catch(c){storage={}}var d=storage[b.category_id]=storage[b.category_id]||{};a.each(["sort","order"],function(a,c){b[c]===void 0?b[c]=d[c]:d[c]=b[c]});try{sessionStorage.setItem("shop/list_categories",JSON.stringify(storage))}catch(e){}}return b},buildProductsUrlComponent:function(a){a=
this.paramsFromSession(a);return((a.view?"&view="+a.view:"")+(a.category_id?"&category_id="+a.category_id:"")+(a.set_id?"&set_id="+a.set_id:"")+(a.tag?"&tag="+a.tag:"")+(a.sort?"&sort="+a.sort:"")+(a.order?"&order="+a.order:"")+(a.text?"&text="+a.text:"")+(a.edit?"&edit="+a.edit:"")+(a.hash?"&hash="+a.hash:"")+(a.type_id?"&type_id="+a.type_id:"")).slice(1)},productsAction:function(){var b=Array.prototype.join.call(arguments,"/"),b=a.shop.helper.parseParams(b||"");this.list_hash=this.hash;this.list_params=
b;if(a.product_list!==void 0&&a.product_list.fixed_blocks!==void 0){a.product_list.fixed_blocks.set&&a.product_list.fixed_blocks.set.unsetFixed();a.product_list.fixed_blocks.category&&a.product_list.fixed_blocks.category.unsetFixed()}this.load("?module=products&"+this.buildProductsUrlComponent(b),this.checkAlerts)},checkAlerts:function(){var b=a.storage.get("shop/alerts");a(".s-alert").each(function(){a.inArray(a(this).data("alert"),b)==-1&&a(this).show()})},productAction:function(b,c,d){var e=Array.prototype.slice.call(arguments).filter(function(a){return a.length}).join("/");
a.shop.trace("$.products.productAction",[e,arguments]);var f="?module=product";b&&(f=f+("&id="+b));typeof a.product!="undefined"?a.product.dispatch(e):this.load(f,function(){a.product.dispatch(e)})},productTermination:function(){typeof a.product!="undefined"&&a.product.termination()},reviewsAction:function(){this.load("?module=reviews")},stocksAction:function(a){this.load("?module=stocks"+(a?"&order="+a:""))},stockslogAction:function(a){this.load("?module=stocksLog"+(a?"&"+a:""))},promosAction:function(a){this.load("?module=promos"+
(a?"&"+Array.prototype.join.call(arguments,"/"):""))},servicesAction:function(b){this.load("?module=services"+(b?"&id="+b:""),function(){a("#s-content").addClass("bordered-left");typeof a.products.afterServicesAction==="function"&&a.products.afterServicesAction()})},initCollapsible:function(){var b=function(b,e){a(b).removeClass("darr").addClass("rarr");c(b).hide();if(!e){a.storage.set("shop/products/"+b.id+"/collapse",1);if(e!==false){var f=b.id.replace(/\-handler$/,""),f=a(b).parents("div.block:first").find("#"+
f+":first");if(f.length)(f=f.data("on-collapse-url"))&&a.get(f)}}},c=function(b){b=a(b).parent();return b.is("li")?b.find("ul:first"):b.next()};a(".collapse-handler").die("click").live("click",function(){if(a(this).hasClass("darr"))b(this);else{c(this).show();var d=a(this);d.removeClass("rarr").addClass("darr");a.storage.del("shop/products/"+this.id+"/collapse");var e=this.id.replace(/\-handler$/,""),f=d.parents("div.block:first").find("#"+e+"-placeholder:first");if(f.length){var g=a(this).parents("div.block:first").find(".count:first");
g.find("i.icon16.loading").remove();g.find("i.icon16").hide();g.prepend('<i class="icon16 loading"></i>');a.get(f.data("url"),function(b){f.replaceWith(a(b));g.find("i.icon16.loading").remove();g.find("i.icon16").show();f.remove()})}else{d=a(this).parents("div.block:first").find("#"+e+":first");if(d.length)(d=d.data("on-expand-url"))&&a.get(d)}}}).each(function(){var c="shop/products/"+this.id+"/collapse",e=a(this).hasClass("rarr");(a.storage.get(c)||e)&&b(this,!e)});a(".collapse-handler").closest(".heading").off("click").on("click",
function(b){$collapse_handler=a(this).find(".collapse-handler");$collapse_handler.is(b.target)||$collapse_handler.click()})},initSearch:function(){var b=function(){a.wa.setHash("#/products/"+(a.products.list_params&&a.products.list_params.view?"view="+a.products.list_params.view+"&":"")+"text="+this.value)},c=a("#s-products-search");c.unbind("keydown").bind("keydown",function(c){if(c.keyCode==13){b.call(this);var e=a(this);e.autocomplete("close");setTimeout(function(){e.autocomplete("close")},300);
return false}});c.unbind("search").bind("search",function(){b.call(this);return false});c.autocomplete({source:"?action=autocomplete",minLength:3,delay:300,select:function(b,e){c.val("");a.wa.setHash("#/product/"+e.item.id);return false}})},jsonPost:function(b,c,d,e){a.shop.jsonPost(b,c,d,e)},_iframePost:function(b,c,d){var e=b.attr("id")+"-iframe";a("#"+e).length||b.after("<iframe id="+e+" name="+e+" style='display:none;'></iframe>");var f=a("#"+e);b.attr("target",e);f.one("load",function(){var b;
try{var e=a(this).contents().find("body").html();b=a.parseJSON(e)}catch(f){d(e);return}b.status=="ok"?c(b):d(b)})}}})(jQuery);(function(a){a.product={options:{duration:200,container_selector:"#shop-productprofile",message_selector:"#product-save-message",form_selector:"#s-product-save",update_delay:100},message:{submit:'<i class="icon16 loading"></i>',success:'<i class="icon16 yes"></i>',error:'<i class="icon16 no"></i>'},path:{id:null,mode:null,tab:null,tail:null,raw:null,params:{}},ajax:{random:null,target:null,link:null,save:!1,cached:{}},data:{main:{}},getData:function(a,c){return(this.data[a]||{})[c]},setData:function(a,
c,d){this.data[a]=this.data[a]||{};this.data[a][c]=d},standalone_tabs:["images","services","pages","reviews"],init:function(a,c){this.setOptions(a,c)},setOptions:function(b,c){c?this[c+"_options"]=a.extend(this[c+"_options"]||{},b||{}):this.options=a.extend(this.options,b||{});this.options.sidebar_width=this.options.sidebar_width||250},get:function(b){if(this.options[b+"_selector"])return a(this.options[b+"_selector"]);throw new exception("");},parsePath:function(b){var b=b.replace(/^.*#\//,"").replace(/(^\/|\/$)/,
""),c=b.split("/"),d=c.pop(),e={};d.match(/^[\w_\-]+=/)?e=a.shop.helper.parseParams(d):c.push(d);return{id:c[0]||"new",mode:c[1]||"profile",tab:c[1]?c[2]||"main":!1,tail:c.slice(3).join("/")||"",raw:b,params:e}},dispatch:function(b){"string"==typeof b&&(b=this.parsePath(b));var c=[];a.shop.trace("$.product.dispatch",[this.path,b,b.raw]);if(!this.path.id){var d=this.get("container");d.length&&(this.path.id=d.data("product-id"),c.push("load"))}if(this.path.id!=b.id)this.path.id&&c.push("blur"),c.push("load");
else{d="undefined";this.path.mode!=b.mode?(a.shop.trace("$.product.dispatch mode",this.path.mode+"->"+b.mode),this.path.mode&&this.path.tab?(a.shop.trace("$.product.dispatch tabBlur",this.path.tab+"->"+b.tab),d=this.path.tab.substr(0,1).toUpperCase()+this.path.tab.substr(1),c.push(this.path.mode+"Tab"+d+"Blur"),c.push(this.path.mode+"TabBlur"),c.push(this.path.mode+"Blur")):c.push("focus"),c.push(b.mode+"Init"),c.push(b.mode+"Focus")):this.path.tab&&b.tab!=this.path.tab&&(a.shop.trace("$.product.dispatch tabBlur",
this.path.tab+"->"+b.tab),d=this.path.tab.substr(0,1).toUpperCase()+this.path.tab.substr(1),c.push(b.mode+"Tab"+d+"Blur"),c.push(b.mode+"TabBlur"));c.push(b.mode+"Action");var e=this.tabIsLoaded(b);b.tab&&(d=b.tab.substr(0,1).toUpperCase()+b.tab.substr(1));if(b.tab&&b.tab!=this.path.tab)if(a.shop.trace("$.product.dispatch tabFocus",this.path.tab+"->"+b.tab),e)c.push(b.mode+"TabShow"),c.push(b.mode+"TabInit"),c.push(b.mode+"Tab"+d+"Init"),c.push(b.mode+"TabFocus"),c.push(b.mode+"Tab"+d+"Focus");else{c.push(b.mode+
"TabFocus");var f=b.mode+"Tab"+d+"Load";this.isCallable(f)?c.push(f):c.push(b.mode+"TabLoad")}b.tab&&e&&c.push(b.mode+"Tab"+d+"Action")}for(d=0;d<c.length;d++)if(!1===this.call(c[d],[b]))return!1},termination:function(){var a=[];if(this.path.mode&&this.path.tab){var c=this.path.tab.substr(0,1).toUpperCase()+this.path.tab.substr(1);a.push(this.path.mode+"Tab"+c+"Blur");a.push(this.path.mode+"TabBlur");a.push(this.path.mode+"Blur")}a.push("blur");for(c=0;c<a.length;c++)this.call(a[c],[])},isCallable:function(a){return"function"==
typeof this[a]},tabIsLoaded:function(b){return a("#s-product-edit-forms").find(".s-product-form."+b.tab).length?!0:!1},call:function(b,c){var d=null,e=this.isCallable(b),c=c||[];a.shop.trace("$.product.call",[b,c,e]);if(e)try{d=this[b].apply(this,c)}catch(f){a.shop.error("Error at method $.product."+b+". Original message: "+f.message,f)}return d},load:function(b){var c=this.get("container");if(!c.length||c.data("product-id")!=b.id){var d=this,c="?module=product&id="+b.id;a.shop.trace("$.product.load product",
c);a.products.load(c,function(){d.dispatch(b)})}this.editTabMainData.sku_id="new"==b.id?-1:0;this.editTabMainData.stocks={}},focus:function(){a("*").off(".product");this.helper.init()},blur:function(){this.path.id=null;this.path.mode=null;this.path.tab=null;this.path.tail=null;a("*").off(".product");a("#mainmenu").find(".s-level2").show();a("#s-product-edit-menu, #s-product-edit-save-panel").hide();a("#s-sidebar").show().animate({width:a.product.options.sidebar_width},"fast").queue(function(){a(this).dequeue()});
a("#s-toolbar").show().animate({width:"200px"});a("#maincontent").animate({"margin-top":"84px"},"fast");a("#s-content").animate({"margin-left":a.product.options.sidebar_width},"fast")},saveData:function(b,c,d){var e=this,f=e.get("form"),g,h="radio",j=f.find('input[name="product[sku_type]"]:first');j.is(":radio")?(g=f.find('input[name="product[sku_type]"]:checked').val(),j=f.find('input[name="product[sku_type]"]')):(h="hidden",g=f.find('input[name="product[sku_type]"]:not(:disabled)').val());if("1"==
g&&!a("#s-product-feature-superposition").find("input:checked:first").length)return"radio"==h&&(j.filter("[value=0]").attr("checked",!0),a.product.onSkuTypeChange(0)),!1;if(e.ajax.save)return setTimeout(function(){e.saveData(b,c,d)},100),!1;if(this.path.tab&&(g="editTab"+this.path.tab.substr(0,1).toUpperCase()+this.path.tab.substr(1)+"Save",!1===this.call(g)))return!1;e.ajax.save=!0;a("#s-product-description-content").length&&a("#s-product-description-content").waEditor("sync");f.find(".s-price").find("input").each(function(){this.value=
this.value.replace(/\s+/g,"")});a.shop.trace("$.product.saveData("+b+","+c+")");g=a("#product-tags_tag");g.length&&(h=jQuery.Event("keypress",{which:13}),g.trigger(h));a(f).find(':input[name^="product\\["]:not(:disabled)').each(function(){var b=a(this).attr("type");if(b!="text"&&b!="textarea")return true;this.defaultValue==this.value?a(this).attr("disabled",true).addClass("js-ajax-disabled"):a(this).hasClass("js-ajax-disabled")&&a(this).removeAttr("disabled").removeClass("js-ajax-disabled")});this.refresh("submit");
a.ajax({url:a(f).attr("action"),data:a(f).serializeArray(),dataType:"json",type:"post",success:function(f){if(f.status=="fail")e.refresh("error",f.errors);else if(f.data.redirect){a.shop.trace("$.product.saveData redirect",f.data.redirect);window.location.href=f.data.redirect}else{e.refresh("success",f.data.message||"");a.shop.trace("$.product.saveData updateData",[b,c]);e.updateData(f.data,b,c);d&&typeof d=="function"&&d();if(e.path.tab){f="editTab"+e.path.tab.substr(0,1).toUpperCase()+e.path.tab.substr(1)+
"Saved";if(e.call(f)===false)return false}}e.ajax.save=false},error:function(a,b){e.ajax.save=false;e.refresh("error",b)}});return!1},updateData:function(b,c,d){a.shop.trace("$.product.updateData("+c+","+d+")",b);var e=a("#s-product-edit-forms .s-product-form.main"),f=this.path.id;if(!this.path.id||"new"==this.path.id){this.path.id=b.id;a(this.options.container_selector).data("product-id",this.path.id);var g="/product/"+this.path.id+"/";if(null!==c&&(c=c||this.path.mode||"profile"))if("profile"!=
c&&(g+=c+"/"),null!==d&&(d=d||this.path.tab||""))"main"!=d.toLowerCase()&&(g+=d+"/");a.shop.trace("update location.hash="+g);var h=/#\/product\/new\//,j="#/product/"+this.path.id+"/";a("#shop-productprofile, #s-product-edit-menu, #s-product-edit-forms, #s-product-profile-page").find('[href*="#/product/new/"]').each(function(){a(this).attr("href",a(this).attr("href").replace(h,j))});a("#s-product-edit-forms").find(':input[name="product\\[id\\]"]').val(this.path.id);window.location.hash=g}else this.path.id!=
b.id&&a.shop.error("Abnormal product ID change",[this.path.id,b]);c=a("#shop-productprofile h1");c.find(".s-product-name:first").text(b.name);c.find(".s-product-id").show().text("id: "+b.id);document.title=b.name+a.product.options.title_suffix;a("#product-stock-stat").html(tmpl("template-product-stock-stat",b.raw));e.find(':input[name="product\\[type_id\\]"]').parents(".value").data("type",b.type_id);if(a.isEmptyObject(b.frontend_urls))a(".s-product-frontend-url-not-empty").hide(),a(".s-product-frontend-url-empty").show();
else{c=a("#s-product-frontend-url");c.text(b.url);a("#s-product-frontend-url-input").val(b.url);c.trigger("readable");d=c.parent();d.attr("href",b.frontend_urls[0].url);d.find("span:first").text(b.frontend_urls[0].base);c.closest("div.value").find(".s-product-frontend-url").each(function(c){b.frontend_urls[c+1]&&a(this).attr("href",b.frontend_urls[c+1].url).text(b.frontend_urls[c+1].url)});a(".s-product-frontend-url-not-empty").show();a(".s-product-frontend-url-empty").hide();c="";d=0;for(g=b.frontend_urls.length;d<
g;d+=1)c+=' <span class="s-product-frontend-url-not-empty"><a href="'+b.frontend_urls[d].url+'" target="_blank">'+b.frontend_urls[d].url+'</a><i class="icon10 new-window"></i></span> ';c&&a("#s-product-frontend-links").find(".s-product-frontend-url-not-empty").wrapAll("<div></div>").closest("div").replaceWith(c)}this.editTabMainUpdate(b.raw||{},b.features_selectable_strings,f);e.find("select.s-product-categories").each(function(){var c=a(this),d=c.parent(),e=c.val();if("select"==e||"---"==e){var f=
a("#s-product-edit-forms .s-product-form.main select.s-product-categories");1<f.length?d.remove():d.find(".s-product-delete-from-category").hide()}else if("create"==e){var g=d.find("input.val").val();"0"==g?(f=a("#s-product-edit-forms .s-product-form.main select.s-product-categories"),1<f.length?d.remove():(c.val(g),c.show().attr("disabled",!1),d.find("input.val").attr("disabled",!0),d.find(".s-new-category").hide(),d.find(".s-product-delete-from-category").hide())):(c.val(g),c.show().attr("disabled",
!1),d.find("input.val").attr("disabled",!0),d.find(".s-new-category").hide(),d.find(".s-product-delete-from-category").show())}e=parseInt(e,10);if(!a.isEmptyObject(b.storefront_map[e])){c="";e=b.storefront_map[e];for(f=0;f<e.length;f+=1)c+='<a class="hint" href="'+e[f]+'" target="_blank">'+e[f]+"</a> ";d.find(".s-storefront-map").html(c)}});a("#s-product-categories").html(tmpl("template-product-categories",{categories:b.categories||[]}));a("#s-product-tags").html(tmpl("template-product-tags",{tags:b.tags||
[]}));a("#s-product-save table.s-product-skus > tbody > tr").each(function(){var c=a(this).data("id");a(this).find("td.s-stock .s-product-stock-icon").each(function(){var d=a(this).data("stock");b.raw&&(b.raw.skus&&b.raw.skus[c]&&b.raw.skus[c].stock_icon[d])&&a(this).html(b.raw.skus[c].stock_icon[d])})});e.find("tr.js-sku-settings").each(function(){var c=a(this),d=c.attr("data-id");if((d=b.raw.skus[d])&&void 0!==d.file_name&&!d.file_name)c.find(".s-sku-attachment").hide(),c.find(".fileupload").show()});
this.helper.checkChanges(this.get("form"),!0);a("#s-product-edit-menu li a i.icon10.status-yellow-tiny").remove();a("#s-product-edit-save-panel :submit").removeClass("yellow").addClass("green");"0"==b.raw.sku_type&&(e=a("#s-product-feature-superposition"),e.find("input[type=checkbox]").attr("checked",!1),f=e.find("ul.features li"),f.find(".count").text(""),f.find("i").removeClass("status-blue-tiny status-gray-tiny").addClass("status-gray-tiny"),e=e.find(".superposition-count"),e.find(".options").text(""),
e.find(".skus").text(""));a("#s-product-meta-title").attr("placeholder",b.default_meta_title);a("#s-product-meta-keywords").attr("placeholder",b.default_meta_keywords);a("#s-product-meta-description").attr("placeholder",b.default_meta_description);a('#s-product-profile-tabs .s-tab-block[data-tab="stock-logs"]').trigger("refresh")},refresh:function(b,c){a(this.options.form_selector).find(':input[name^="product\\["]:disabled.js-ajax-disabled').each(function(){a(this).removeAttr("disabled").removeClass("js-ajax-disabled")});
var d=a(this.options.message_selector);d.removeClass("errormsg successmsg status").empty().show();this.timer&&clearTimeout(this.timer);var e=null;d.append(this.message[b]||"");switch(b){case "submit":d.addClass("status");break;case "error":d.addClass("errormsg");for(e=0;e<c.length;e++)d.append(c[e][0]);e=2E4;break;case "success":c&&d.addClass("successmsg").append(c),e=3E3,a("#s-product-edit-save-panel :submit").removeClass("yellow").addClass("green")}e&&(this.timer=setTimeout(function(){d.removeClass("errormsg successmsg status").empty().show()},
e))},editTabLoad:function(b,c){var d=this,e=a("#s-product-edit-forms .s-product-form."+b.tab);c||!e.length&&"new"==b.id?(a.shop.trace("product.profileTabHandler: create",[b.tab+" \u2014 create",b]),this.saveData(this.path.mode,b.tab,function(){b.tab&&d.call(b)})):this.editTabLoadContent(b)},editTabLoadContent:function(b,c){var d=this,b=b||this.path,e="?module=product&action="+b.tab+"&id="+b.id;b.tail&&(e+="¶m[]="+b.tail.split("/").join("¶m[]="));var f=Math.random();this.ajax.random=f;var
Ну так что мне делать?
pavel@gordovoy.net
вышлите доступы - посмотрю