var ImgViewer = { returnCallback : null, imgOlHandler : null }; ImgViewer.init = function () { var elem = document.getElementById('iv-anchor'); elem.setAttribute('onkeydown', 'ImgViewer.onInput();'); this.isActive = false; this.eFullScreen = 0; this.eMedIcons = 1; this.screenMode = this.eFullScreen; // this.imgOlHandler = new OverlayHandler("ImgHndl"); // this.imgOlHandler.init(Display.handlerShowImgInfo, Display.handlerHideImgInfo); $("#imageViewer").hide(); }; ImgViewer.show = function () { Display.hide(); this.isActive = true; this.screenMode = this.eFullScreen; this.imgList = []; this.curImg = 0; $("#imageViewer").show(); ImgViewer.focus (); Main.log ("URL= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.link); Spinner.show(); ImgViewer.createImgArray(); if (this.imgList.length == 0) { Notify.showNotify("No Image Found", true); ImgViewer.hide(); return; } // ImgViewer.showImageGrid(); ImgViewer.showImage(); }; ImgViewer.focus = function () { Main.log("ImgViewer.focus "); $("#iv-anchor").focus(); }; ImgViewer.hide = function () { this.isActive = false; this.screenMode = this.eFullScreen; Display.show(); $("#imageViewer").hide(); Spinner.hide(); Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow)); Main.enableKeys(); }; ImgViewer.createImgArray = function () { this.imgList = []; var max = Data.getVideoCount(); for (var i = 0; i < Data.getVideoCount() ; i ++) { if (ImgViewer.isImage( (Main.selectedVideo + i) % max) == true) { this.imgList.push((Main.selectedVideo + i) % max); } } }; ImgViewer.isImage = function(no) { if ((Data.getCurrentItem().childs[no].payload.mime == "image/jpeg") || (Data.getCurrentItem().childs[no].payload.mime == "image/png")) return true; else return false; }; ImgViewer.isImage = function() { if ((Data.getCurrentItem().childs[Main.selectedVideo].payload.mime == "image/jpeg") || (Data.getCurrentItem().childs[Main.selectedVideo].payload.mime == "image/png")) return true; else return false; }; ImgViewer.showNextImage = function () { this.curImg++; if (this.curImg >= this.imgList.length) this.curImg = 0; ImgViewer.showImage(); }; ImgViewer.showPrevImage = function () { this.curImg--; if (this.curImg <0) this.curImg = this.imgList.length-1; ImgViewer.showImage(); }; ImgViewer.showImage = function () { Main.log("showImage: "+ Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link); Main.logToServer("showImage: "+ Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link); var p_width = $("#imageViewer").width(); var p_height = $("#imageViewer").height(); var img_name = Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link.split("/"); Notify.showNotify( img_name[img_name.length -1], true); $("#ivImage") .error(function() { Main.log("ERROR"); ImgViewer.hide(); Spinner.hide(); Notify.showNotify("Error while loading image.", true); }) .load(function () { Main.logToServer("showImage Loaded"); Spinner.hide(); /* if($(this).height() > $(this).width()) { $(this).css({"height": "100%", "width" : "auto"}); } else { $(this).css({"width": "100%", "height" : "auto"}); }*/ }) .attr('src', Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link +"?"+Math.random()) .css({"max-width": p_width + "px", "max-height" :p_height + "px" }); }; ImgViewer.ImgLoader = function(url, w, h) { // this.url = url; var elm = $("