]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 27 Oct 2014 15:02:31 +0000 (15:02 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 27 Oct 2014 15:02:31 +0000 (15:02 +0000)
js/libs/fluidbook/fluidbook.resize.js

index e8a8358c53a349fce1c0d772044dafe43f1af618..40a1deb55b663e4c136df683e10b711cc183477d 100644 (file)
@@ -16,7 +16,7 @@ function FluidbookResize(fluidbook) {
 }
 
 FluidbookResize.prototype = {
-       init: function() {
+       init: function () {
 
                var left = this.fluidbook.l10n.dir == 'ltr' ? '0%' : '100%';
                var right = this.fluidbook.l10n.dir == 'ltr' ? '100%' : '0%';
@@ -41,7 +41,7 @@ FluidbookResize.prototype = {
                        origin: [left, '50%']
                });
        },
-       resize: function(init) {
+       resize: function (init) {
                if (init == undefined || init == null) {
                        init = false;
                }
@@ -159,7 +159,7 @@ FluidbookResize.prototype = {
                if (timeout > 0) {
                        $("#next,#previous").hide();
                        clearTimeout(this.navresizeTimeout);
-                       this.navresizeTimeout = setTimeout(function() {
+                       this.navresizeTimeout = setTimeout(function () {
                                $this.resizeNav(interfaceScale)
                        }, timeout);
                } else {
@@ -177,28 +177,31 @@ FluidbookResize.prototype = {
 
                $("#main").show();
        },
-       resizeNav: function(interfaceScale) {
+       resizeNav: function (interfaceScale) {
                var topNext = (this.hh - 100 * interfaceScale) / 2;
                $("#next,#previous").css({
                        top: topNext
                });
                $("#next,#previous").show();
        },
-       resizePopupVideos: function() {
+       resizePopupVideos: function () {
                var maxh = this.hh - 80;
-               $(".mview .videoContainer video").each(function() {
+               $(".mview .videoContainer video").each(function () {
                        var w = $(window).width() - 40;
 
                        var ratio = parseInt($(this).attr('data-width')) / parseInt($(this).attr('data-height'));
                        var h = w / ratio;
+                       if (isNaN(h)) {
+                               h = maxh;
+                       }
                        $(this).css({
                                height: h,
                                maxHeight: maxh
                        });
                });
        },
-       resizePopupAudios: function() {
-               $(".mview audio").each(function() {
+       resizePopupAudios: function () {
+               $(".mview audio").each(function () {
                        var w = $(window).width() - 200;
                        var h = 30;
                        $(this).css({
@@ -209,7 +212,7 @@ FluidbookResize.prototype = {
                        });
                });
        },
-       resizeSplash: function() {
+       resizeSplash: function () {
                if ($("#splash").length == 0) {
                        return;
                }
@@ -230,11 +233,11 @@ FluidbookResize.prototype = {
                        left: (this.ww - lw) / 2
                });
        },
-       updateWindow: function() {
+       updateWindow: function () {
                this.ww = $(window).width();
                this.hh = $(window).height();
        },
-       resizeView: function() {
+       resizeView: function () {
                var $this = this;
                this.updateWindow();
 
@@ -250,9 +253,9 @@ FluidbookResize.prototype = {
                });
 
 
-               $(".mview .caption h2").each(function() {
+               $(".mview .caption h2").each(function () {
                        var wavailable = $this.ww;
-                       $(this).parent().find('a.back').each(function() {
+                       $(this).parent().find('a.back').each(function () {
                                wavailable -= ($(this).outerWidth() + 10) * 2;
                        });
                        $(this).css('max-width', wavailable);
@@ -264,7 +267,7 @@ FluidbookResize.prototype = {
                        $("#archivesview .links").transform({scale: [ratio]});
                }
 
-               $(".bookmarkView").each(function() {
+               $(".bookmarkView").each(function () {
                        var w = $(this).parent().width();
                        var perCol = Math.floor(w / 120);
 
@@ -276,7 +279,7 @@ FluidbookResize.prototype = {
                        })
                });
        },
-       handleOrientation: function() {
+       handleOrientation: function () {
                var changeOrientation = this.orientation != '';
                var o = this.fluidbook.support.getOrientation();
                var newo;