var _LargePreview =function() { this.scrollview = null; this.images=[]; //this.divLargePreviewMask=null; this.divLargePreview=null; this.show = function(sDishKey, lstDishes) { this.images=[]; //var arr = T_Dishes.getDishesForCategory(sCategoryKey); if (this.divLargePreview!=null && this.divLargePreview.parentNode!=null ) this.divLargePreview.parentNode.removeChild(this.divLargePreview); this.divLargePreview=null; this._show(lstDishes, sDishKey); }; this._show = function(arrDishes, sCurrentDishKey) { // this.divLargePreviewMask = document.createElement("div"); // this.divLargePreviewMask.style.backgroundColor = "rgba(0,0,0,0.5)"; // this.divLargePreviewMask.style.position = "fixed"; // this.divLargePreviewMask.style.zIndex=200; // this.divLargePreviewMask.style.width = "100%"; // this.divLargePreviewMask.style.height = "90%"; // this.divLargePreviewMask.style.top=Toolbar.getBottom()+"px"; // GUI.divMain.appendChild(this.divLargePreviewMask); //if (T_MenuLanguages.isLangRTL()) // arrDishes = arrDishes.slice(0).reverse(); Toolbar.showBackButton(true); this.divLargePreview = document.createElement("div"); this.divLargePreview.style.backgroundImage="url("+Common.getUrl("smartphones/sites/" + Common.getSiteID() + "/innerPageBg.jpg")+")"; this.divLargePreview.style.backgroundRepeat="repeat"; this.divLargePreview.style.backgroundColor = "white"; //this.divLargePreview.style.borderRadius = "15px"; this.divLargePreview.style.position = "absolute"; this.divLargePreview.style.width = "100%"; this.divLargePreview.style.height = "90%"; this.divLargePreview.style.left = "0%"; this.divLargePreview.style.top =Toolbar.getBottom()+"px"; this.divLargePreview.align = "center"; GUI.divMain.appendChild(this.divLargePreview); // btnClose = document.createElement("button"); // divLargePreview.appendChild(btnClose); // btnClose.style.position = "relative"; // btnClose.style.top = "90%"; // //btnClose.style.height = "8%"; // btnClose.style.padding="5px"; // // btnClose.style.width="50%"; // btnClose.textContent = UITexts.getText("Close"); // btnClose.onclick = function(e) { // if (GUI.isDoubleFired()) // return; // LargePreview.hide(); // }; // CREATE SCROLL VIEW this.divWrapper = document.createElement("div"); this.divWrapper.id = "divLargePreviewScrollView"; this.divWrapper.style.position = "absolute"; this.divWrapper.style.top = "0px"; this.divWrapper.style.width = "100%"; this.divWrapper.style.height = "100%"; this.divScroller = document.createElement("div"); this.divScroller.style.height = "100%"; this.divWrapper.appendChild(this.divScroller); this.scrollview = new iScroll(this.divWrapper, { snap : true, vScroll : false, momentum : false, hScrollbar : false, vScrollbar : false, lockDirection:true, onPageChange:function() { LargePreview.loadVisibleImages(); // alert(this.currPageX); }, //onBeforeScrollStart: function (e) { /*e.preventDefault();*/ }, onDomChanged : function() { }, onAnimationStart : function() { }, onAnimationEnd : function() { }, onScrollStart : function() { }, onScrollEnd : function() { } }); this.divLargePreview.appendChild(this.divWrapper); var i = 0; var width = this.divWrapper.clientWidth; var height = this.divWrapper.clientHeight; var firstDishIndex=null; for ( var index in arrDishes) { var dish=arrDishes[index]; var page = new LargePreviewPage(dish); this.divScroller.appendChild(page.getDiv(width * i, 0, width, height)); this.images.push(page.imgDish); if (dish==sCurrentDishKey) firstDishIndex=i; i++; } if (T_MenuLanguages.isLangRTL()) firstDishIndex = arrDishes.length -1- firstDishIndex; this.divScroller.style.width = (this.divWrapper.offsetWidth * i + "px"); this.scrollview.refresh(); if (firstDishIndex==null) firstDishIndex==0; setTimeout(function(e){ LargePreview.loadVisibleImages(firstDishIndex); },10); if (firstDishIndex!=0) this.scrollview.scrollToPage(firstDishIndex, 0, 0); }; this.loadVisibleImages = function(currPageX) { if (currPageX==undefined) currPageX = this.scrollview.currPageX; if (T_MenuLanguages.isLangRTL()) currPageX = this.images.length - 1 - currPageX; for (var i=Math.max(0,currPageX-1);i