From: Vincent Vanwaelscappel Date: Mon, 26 Aug 2013 16:38:04 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c353765980a9d8853418206ff2f522cf1a57b4ad;p=fluidbook-html5.git --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index fa709b5a..8eb02dfb 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -102,6 +102,7 @@ Fluidbook.prototype = { $("#main").css('visibility', 'visible'); this.hideLoader(0, true); $("#splash").css('opacity', 0).one(this.support.getTransitionEndEvent(), function() { + fb('removed splash'); $(this).remove(); }); }, @@ -833,6 +834,8 @@ Fluidbook.prototype = { pagesWithHits++; } } + + if($(this)) if ($(this).find('.hits').length > 0) { return; @@ -847,7 +850,7 @@ Fluidbook.prototype = { $(this).append('
' + $this.l10n.__('no result found') + '
'); } else { $(this).append('
' + hitsp + ' ' + $this.l10n.__('hit(s)') + '
'); - if (pagesWithHits <= 1) { + if (pagesWithHits <= 2) { $(this).find('a').attr('href', '#/page/' + $(this).attr('page')); } else { $(this).find('a').attr('href', '#/search/' + e + '/' + $(this).attr('page')); diff --git a/js/libs/fluidbook/fluidbook.resize.js b/js/libs/fluidbook/fluidbook.resize.js index 6bf23440..f6c9ddd9 100644 --- a/js/libs/fluidbook/fluidbook.resize.js +++ b/js/libs/fluidbook/fluidbook.resize.js @@ -42,6 +42,8 @@ FluidbookResize.prototype = { init = false; } + $("#main").hide(); + var $this = this; this.updateWindow(); this.handleOrientation(); @@ -56,7 +58,6 @@ FluidbookResize.prototype = { var cssInterfaceScale = [interfaceScale, interfaceScale]; var cssNavScale = [navScale, navScale]; - $("#main").css({ width: this.ww, height: this.hh @@ -108,18 +109,26 @@ FluidbookResize.prototype = { scale: [this.bookScale, this.bookScale], origin: ['50%', '50%'] }); + var top = marginTop + (ah - fhh) / 2; + var left = marginLeft + (aw - fww) / 2; $("#fluidbook").css({ - top: marginTop + (ah - fhh) / 2, - left: marginLeft + (aw - fww) / 2, + top: top, + left: left, width: fww, height: fhh }); - $("#next,#previous").transform({ - scale: cssInterfaceScale + $("#next").transform({ + scale: cssInterfaceScale, + translateX: 40 * (1 - interfaceScale) + 'px' }); + $("#previous").transform({ + scale: cssInterfaceScale, + translateX: -40 * (1 - interfaceScale) + 'px' + }) + $("#nav,#logo,footer").transform({ scale: navScale }); @@ -154,8 +163,12 @@ FluidbookResize.prototype = { this.resizeNav(interfaceScale); } + + this.resizePopupVideos(); this.resizeSplash(); + + $("#main").show(); }, resizeNav: function(interfaceScale) { var topNext = (this.hh - 100 * interfaceScale) / 2; @@ -178,6 +191,9 @@ FluidbookResize.prototype = { }); }, resizeSplash: function() { + if ($("#splash").length == 0) { + return; + } $("#splash").css({ width: this.ww, height: this.hh @@ -252,8 +268,8 @@ FluidbookResize.prototype = { newo = 'landscape'; $('body').removeClass('portrait'); } - - if (this.orientation == newo) { + var force = this.fluidbook.datas.mobileNavigationType != 'book'; + if (!force && this.orientation == newo) { return; } this.orientation = newo; diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index de7ed49f..d5b92364 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -76,6 +76,8 @@ FluidbookSupport.prototype = { return t; }, initEvents: function() { + + var $this=this; if (!this.isMobile) { $(window).resize(function() { @@ -86,7 +88,7 @@ FluidbookSupport.prototype = { if ("onorientationchange" in window) { window.addEventListener('orientationchange', function() { - if (this.iOS) { + if ($this.iOS) { resize(); } else { resize(); @@ -96,7 +98,6 @@ FluidbookSupport.prototype = { } }, false); } else { - var $this = this; setInterval(function() { $this.checkOrientation(); }, 100); @@ -114,26 +115,21 @@ FluidbookSupport.prototype = { try { if (this.fluidbook.pad && this.fluidbook.pad.enabled) { return 0; + }else if(this.fluidbook.datas.mobileNavigationType=='landscape'){ + return 90; + }else if(this.fluidbook.datas.mobileNavigationType=='portrait'){ + return 0; } } catch (err) { } try { - var mql = Modernizr.mq("(orientation: portrait)"); - if (mql.matches) { - return 0; - } else { - return 90; - } + return Modernizr.mq("(orientation: portrait)") ? 0 : 90; } catch (err) { } - if ($("#op").is(':visible')) { - return 0; - } else { - return 90; - } + return $("#op").is(':visible') ? 0 : 90; }, getZoomLevel: function() { var tzoom = DetectZoom.zoom();