"; html += "
"; html += " "; html += ""; return html; } function createCart(data) { if (!(JSON.stringify(data) == "[null]" || data == null)) { var html = ""; $(".shopcart-box .table").html(html); $.each(data, function(id,d) { html += renderCart(d); }); $(".shopcart-box .table").html(html); updateTotal(); $(".shopcart-box .table .quantity_itemcart").change(function(){ var id = $(this).attr("id").replace("quantity_itemcart_",""); var qty = $(this).val()-shopcart[id]["quantity"]; updateItem(undefined,id,qty); }); $(".shopcart-box .table .remove_itemcart").click(function(){ var id = $(this).attr("id").replace("remove_itemcart_",""); updateItem(undefined,id); }); $(".shopcart-widget .dropdown-menu,.shopcart-box .table .remove_itemcart,.shopcart-box .table .quantity_itemcart").click(function(e){ e.stopPropagation(); }); } } $(".order_itemcart").click(function() { var id = parseInt($(this).attr("id").replace("order_itemcart_","")); var d = {}; var idata = id; $("#item-shopcart-"+id+" .item-shopcart").each( function(v,i) { var atr = $(i).attr("id"); if (atr.substr(0,5) == "data_") { idata += $(i).val(); d["data_"+atr.substr(5).replace(/_/g," ")] = $(i).val(); } else { d[atr] = $(i).val(); } } ); var idata = enAsci(idata); d["idata"] = idata; var val = {"shopcart":{}}; val["shopcart"]["data"] = d; if ($("#quantity_itemcart_"+d["idata"]).length > 0) { $("#quantity_itemcart_"+d["idata"]).val(parseFloat($("#quantity_itemcart_"+d["idata"]).val())+parseFloat(d["quantity"])); updateItem(undefined,d["idata"],d["quantity"]); } else { updateItem(val,idata); } }); var shopcart = null; createCart(shopcart); var istest = window.location.href.indexOf("/galeri/"); if (istest >= 0) { var x = document.getElementsByClassName("gallery-index"); x = x[0]; console.log(x); var es = x.childNodes[0]; es = es.childNodes; console.log(es); var rm = []; var c2 = []; var c4 = []; for (var i = 0; i < es.length; i++) { var e = es[i]; var k = false; if (!e.classList.contains('clearfix')) { k = parseInt(e.getAttribute("data-key")); e.classList.remove('col-md-4'); e.classList.add('col-md-3'); if (k % 2 == 0 && k > 0) { c2.push(k); console.log('c2',k); } if (k % 4 == 0 && k > 0) { c4.push(k); console.log('c4',k); } } else { rm.push(e); } } for (var i = 0; i < rm.length; i++) { var e = rm[i]; e.parentNode.removeChild(e); } for (var i = 0; i < c4.length; i++) { var sel = '[data-key="'+c4[i]+'"]'; var e = document.querySelectorAll(sel)[0]; console.log('c4',sel,e,e.parentNode); if (typeof e != 'undefined') { var newItem = document.createElement("DIV"); newItem.classList.add('clearfix'); newItem.classList.add('visible-md-block'); newItem.classList.add('visible-lg-block'); document.getElementById('w0').insertBefore(newItem, e); } } for (var i = 0; i < c2.length; i++) { var sel = '[data-key="'+c2[i]+'"]'; var e = document.querySelectorAll(sel)[0]; console.log('c2',sel,e,e.parentNode); if (typeof e != 'undefined') { var newItem = document.createElement("DIV"); newItem.classList.add('clearfix'); newItem.classList.add('visible-sm-block'); document.getElementById('w0').insertBefore(newItem, e); } } } var Ssidebar = $('#navbar-collapse'); var Swindow = $(window); var done = false; Swindow.on('scroll resize', function(e) { var offsetPixels = 80; var mh = $(".main-header").width(); Ssidebar.css({"width":mh+"px"}); if (Swindow.scrollTop() > offsetPixels) { if(!done && Swindow.width() >= 753) { done = true; Ssidebar.css({"position": "fixed","top": "0px","margin-left":"-15px","margin-right":"-15px"}); $("#navbar-collapse #logocon").css("display",""); $("#header .logo").css("display","none"); } } else { if(done) { done = false; Ssidebar.css({"position": "","top": ""}); $("#navbar-collapse #logocon").css("display","none"); $("#header .logo").css("display",""); } } }); $("#btn-scroll-up").click(function() { $("html, body").animate({ scrollTop: 0 }, "slow"); return false; }); $(document).ready(function() { setTimeout(function(){ $('body').addClass('loaded'); }, 500); });