]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Oct 2014 16:08:02 +0000 (16:08 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 28 Oct 2014 16:08:02 +0000 (16:08 +0000)
js/libs/fluidbook/fluidbook.resize.js
js/libs/modernizr/tests.js
style/fluidbook.css

index ca3c138e66ee6e333b8fa9074127aecacb2b4212..edffa709ff9986cd156e6cdfb0ce66092b44f9cf 100644 (file)
@@ -187,21 +187,30 @@ FluidbookResize.prototype = {
        resizePopupVideos: function () {
                var maxh = this.hh - 80;
                $(".mview .videoContainer video").each(function () {
+                       var w;
+                       var h;
                        var maxw = $(window).width() - 40;
 
-                       var ratio = parseInt($(this).attr('data-width')) / parseInt($(this).attr('data-height'));
-                       var h = w / ratio;
-                       if (isNaN(h)) {
-                               h = maxh;
-                       }
-                       if (isNaN(w)) {
-                               w = maxw;
+                       if ($(this).data('width') !== null) {
+                               w = parseInt($(this).data('width'));
+                               h = parseInt($(this).data('height'));
+                               var s = Math.min(maxw / w, maxh / h);
+                               w *= s;
+                               h *= s;
+
+                               $(this).css({
+                                       width: w
+                               });
+                               if (Modernizr.ios7) {
+                                       $(this).css({
+                                               height: h
+                                       });
+                               }
                        }
+
                        $(this).css({
-                               height: h,
-                               width: w,
                                maxHeight: maxh,
-                               maxWidth: maxw,
+                               maxWidth: maxw
                        });
                });
        },
index 1188a5d38f8efa40fbdcc785f2b0c3250bd32b3f..1f0e6f5784f30beb419d7275f6e6abe12fe9e2ec 100644 (file)
@@ -1,4 +1,4 @@
-Modernizr.addTest('csstransformspreserve3d', function() {
+Modernizr.addTest('csstransformspreserve3d', function () {
        var prop,
                        val,
                        cssText,
@@ -10,20 +10,20 @@ Modernizr.addTest('csstransformspreserve3d', function() {
        }
        val = 'preserve-3d';
        cssText = '#modernizr { ' + prop + ': ' + val + '; }';
-       Modernizr.testStyles(cssText, function(el, rule) {
+       Modernizr.testStyles(cssText, function (el, rule) {
                ret = window.getComputedStyle ? getComputedStyle(el, null).getPropertyValue(prop) : '';
        });
        return (ret === val);
 });
 
-Modernizr.addTest('ftouch', function() {
+Modernizr.addTest('ftouch', function () {
        var bool;
 
        if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch || ('onmsgesturechange' in window)) {
                bool = true;
        } else {
                var query = ['@media (', Modernizr._prefixes.join('touch-enabled),('), 'heartz', ')', '{#modernizr{top:9px;position:absolute}}'].join('');
-               Modernizr.testStyles(query, function(node) {
+               Modernizr.testStyles(query, function (node) {
                        bool = node.offsetTop === 9;
                });
        }
@@ -31,10 +31,30 @@ Modernizr.addTest('ftouch', function() {
        return bool;
 });
 
-Modernizr.addTest('fullscreen', function() {
+Modernizr.addTest('fullscreen', function () {
        for (var i = 0; i < Modernizr._domPrefixes.length; i++) {
                if (document[Modernizr._domPrefixes[i].toLowerCase() + 'CancelFullScreen'] || document[Modernizr._domPrefixes[i].toLowerCase() + 'ExitFullscreen'])
                        return true;
        }
        return !!document['cancelFullScreen'] || false;
+});
+
+Modernizr.addTest('ipad', function () {
+       return !!navigator.userAgent.match(/iPad/i);
+});
+
+Modernizr.addTest('iphone', function () {
+       return !!navigator.userAgent.match(/iPhone/i);
+});
+
+Modernizr.addTest('ipod', function () {
+       return !!navigator.userAgent.match(/iPod/i);
+});
+
+Modernizr.addTest('ios', function () {
+       return (Modernizr.ipad || Modernizr.ipod || Modernizr.iphone);
+});
+
+Modernizr.addTest('ios7', function () {
+       return Modernizr.ios && navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i);
 });
\ No newline at end of file
index efb3c3cffe67ddabac633fc09b44d9f84271b308..a8897d612bfc042871bc195f8cbd54ee62b1b04e 100644 (file)
@@ -1171,6 +1171,7 @@ ul.chapters.shareList a.level0 img{
        height:auto;
        display: block;
        background-color:transparent !important;
+       margin: 0 auto;
 }
 .videoContainer{
        position:relative;