From 29da1228767b0d47612f9afb164e10d2f397e09e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 29 Sep 2016 17:04:32 +0000 Subject: [PATCH] wip #740 @1.5 --- _index.html | 9 ++-- js/libs/fastclick/fastclick.js | 57 ++++++++++++------------- js/libs/fluidbook/fluidbook.resize.js | 18 ++++++++ js/libs/fluidbook/fluidbook.support.js | 2 + js/libs/fluidbook/fluidbook.viewport.js | 6 +-- style/fluidbook.css | 5 --- style/fluidbook.less | 6 --- 7 files changed, 56 insertions(+), 47 deletions(-) diff --git a/_index.html b/_index.html index 04f6051a..4ab306f7 100644 --- a/_index.html +++ b/_index.html @@ -1,11 +1,14 @@ - prefix="og: http://ogp.me/ns#"> + + + prefix="og: http://ogp.me/ns#"> <!-- $titre --> - + + content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> diff --git a/js/libs/fastclick/fastclick.js b/js/libs/fastclick/fastclick.js index d3409af5..f40e0298 100644 --- a/js/libs/fastclick/fastclick.js +++ b/js/libs/fastclick/fastclick.js @@ -1,5 +1,4 @@ -; -(function () { +;(function () { 'use strict'; /** @@ -109,9 +108,7 @@ // Some old versions of Android don't have Function.prototype.bind function bind(method, context) { - return function () { - return method.apply(context, arguments); - }; + return function() { return method.apply(context, arguments); }; } @@ -138,7 +135,7 @@ // which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick // layer when they are cancelled. if (!Event.prototype.stopImmediatePropagation) { - layer.removeEventListener = function (type, callback, capture) { + layer.removeEventListener = function(type, callback, capture) { var rmv = Node.prototype.removeEventListener; if (type === 'click') { rmv.call(layer, type, callback.hijacked || callback, capture); @@ -147,10 +144,10 @@ } }; - layer.addEventListener = function (type, callback, capture) { + layer.addEventListener = function(type, callback, capture) { var adv = Node.prototype.addEventListener; if (type === 'click') { - adv.call(layer, type, callback.hijacked || (callback.hijacked = function (event) { + adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) { if (!event.propagationStopped) { callback(event); } @@ -169,7 +166,7 @@ // Android browser on at least 3.2 requires a new reference to the function in layer.onclick // - the old one won't work if passed to addEventListener directly. oldOnClick = layer.onclick; - layer.addEventListener('click', function (event) { + layer.addEventListener('click', function(event) { oldOnClick(event); }, false); layer.onclick = null; @@ -227,7 +224,7 @@ * @param {EventTarget|Element} target Target DOM element * @returns {boolean} Returns true if the element needs a native click */ - FastClick.prototype.needsClick = function (target) { + FastClick.prototype.needsClick = function(target) { switch (target.nodeName.toLowerCase()) { // Don't send a synthetic click to disabled inputs (issue #62) @@ -263,7 +260,7 @@ * @param {EventTarget|Element} target Target DOM element * @returns {boolean} Returns true if the element requires a call to focus to simulate native click. */ - FastClick.prototype.needsFocus = function (target) { + FastClick.prototype.needsFocus = function(target) { switch (target.nodeName.toLowerCase()) { case 'textarea': return true; @@ -294,7 +291,7 @@ * @param {EventTarget|Element} targetElement * @param {Event} event */ - FastClick.prototype.sendClick = function (targetElement, event) { + FastClick.prototype.sendClick = function(targetElement, event) { var clickEvent, touch; // On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24) @@ -311,7 +308,7 @@ targetElement.dispatchEvent(clickEvent); }; - FastClick.prototype.determineEventType = function (targetElement) { + FastClick.prototype.determineEventType = function(targetElement) { //Issue #159: Android Chrome Select Box does not open with a synthetic click event if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') { @@ -325,7 +322,7 @@ /** * @param {EventTarget|Element} targetElement */ - FastClick.prototype.focus = function (targetElement) { + FastClick.prototype.focus = function(targetElement) { var length; // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724. @@ -343,7 +340,7 @@ * * @param {EventTarget|Element} targetElement */ - FastClick.prototype.updateScrollParent = function (targetElement) { + FastClick.prototype.updateScrollParent = function(targetElement) { var scrollParent, parentElement; scrollParent = targetElement.fastClickScrollParent; @@ -374,7 +371,7 @@ * @param {EventTarget} targetElement * @returns {Element|EventTarget} */ - FastClick.prototype.getTargetElementFromEventTarget = function (eventTarget) { + FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) { // On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node. if (eventTarget.nodeType === Node.TEXT_NODE) { @@ -391,7 +388,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.onTouchStart = function (event) { + FastClick.prototype.onTouchStart = function(event) { var targetElement, touch, selection; // Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111). @@ -459,7 +456,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.touchHasMoved = function (event) { + FastClick.prototype.touchHasMoved = function(event) { var touch = event.changedTouches[0], boundary = this.touchBoundary; if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) { @@ -476,7 +473,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.onTouchMove = function (event) { + FastClick.prototype.onTouchMove = function(event) { if (!this.trackingClick) { return true; } @@ -497,7 +494,7 @@ * @param {EventTarget|HTMLLabelElement} labelElement * @returns {Element|null} */ - FastClick.prototype.findControl = function (labelElement) { + FastClick.prototype.findControl = function(labelElement) { // Fast path for newer browsers supporting the HTML5 control attribute if (labelElement.control !== undefined) { @@ -521,7 +518,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.onTouchEnd = function (event) { + FastClick.prototype.onTouchEnd = function(event) { var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement; if (!this.trackingClick) { @@ -618,7 +615,7 @@ * * @returns {void} */ - FastClick.prototype.onTouchCancel = function () { + FastClick.prototype.onTouchCancel = function() { this.trackingClick = false; this.targetElement = null; }; @@ -630,7 +627,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.onMouse = function (event) { + FastClick.prototype.onMouse = function(event) { // If a target element was never set (because a touch event was never fired) allow the event if (!this.targetElement) { @@ -680,7 +677,7 @@ * @param {Event} event * @returns {boolean} */ - FastClick.prototype.onClick = function (event) { + FastClick.prototype.onClick = function(event) { var permitted; // It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early. @@ -712,7 +709,7 @@ * * @returns {void} */ - FastClick.prototype.destroy = function () { + FastClick.prototype.destroy = function() { var layer = this.layer; if (deviceIsAndroid) { @@ -734,7 +731,7 @@ * * @param {Element} layer The layer to listen on */ - FastClick.notNeeded = function (layer) { + FastClick.notNeeded = function(layer) { var metaViewport; var chromeVersion; var blackberryVersion; @@ -746,7 +743,7 @@ } // Chrome version - zero for other browsers - chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]; + chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1]; if (chromeVersion) { @@ -797,7 +794,7 @@ } // Firefox version - zero for other browsers - firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [, 0])[1]; + firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1]; if (firefoxVersion >= 27) { // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896 @@ -824,7 +821,7 @@ * @param {Element} layer The layer to listen on * @param {Object} [options={}] The options to override the defaults */ - FastClick.attach = function (layer, options) { + FastClick.attach = function(layer, options) { return new FastClick(layer, options); }; @@ -832,7 +829,7 @@ if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) { // AMD. Register as an anonymous module. - define(function () { + define(function() { return FastClick; }); } else if (typeof module !== 'undefined' && module.exports) { diff --git a/js/libs/fluidbook/fluidbook.resize.js b/js/libs/fluidbook/fluidbook.resize.js index 65fbe0e6..df199e85 100644 --- a/js/libs/fluidbook/fluidbook.resize.js +++ b/js/libs/fluidbook/fluidbook.resize.js @@ -184,6 +184,9 @@ FluidbookResize.prototype = { this.resizePopupVideos(); this.resizeSplash(); + if (this.fluidbook.support.ie9) { + this.resizeIE9Multimedia(); + } if (this.fluidbook.form) { this.fluidbook.form.resize(); @@ -208,6 +211,21 @@ FluidbookResize.prototype = { return $(window).height() - 44; }, + resizeIE9Multimedia: function () { + return; + var links = $("#links .link.multimedia"); + $(links).each(function () { + $(this).css('zoom', (this.bookScale)); + var i = $(this).find("iframe") + var scale=this.bookScale*$(this).transform('scale'); + if ($(i).length) { + var iframe = $(i).contents(); + // $(iframe).find('#swiffycontainer>div').css('zoom', (1 / this.bookScale)); + } + }); + + }, + resizePopupVideos: function () { var $this = this; var maxh = this.getPopupVideoHeight(); diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index 54f4e933..828435c5 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -8,6 +8,8 @@ function FluidbookSupport(fluidbook) { this.transitions2d = Modernizr.csstransforms && Modernizr.csstransitions; this.transitions3d = Modernizr.csstransforms3d && Modernizr.preserve3d && this.transitions2d; + this.ie9=$("html").hasClass('ie9'); + this.androidbrowser = this.android && this.userAgent.search(/applewebkit/i) > -1; this.transitionendevent = null; diff --git a/js/libs/fluidbook/fluidbook.viewport.js b/js/libs/fluidbook/fluidbook.viewport.js index 1e0666cb..e01e21e9 100644 --- a/js/libs/fluidbook/fluidbook.viewport.js +++ b/js/libs/fluidbook/fluidbook.viewport.js @@ -2,8 +2,8 @@ function FluidbookViewport(fluidbook) { this.width = 'device-width'; this.height = null; this.minScale = 1; - this.maxScale = 5; - this.initialScale = 0; + this.maxScale = 10; + this.initialScale = 1; this.userScalable = true; this.meta = $('meta[name="viewport"]'); this.fluidbook = fluidbook; @@ -26,7 +26,7 @@ FluidbookViewport.prototype = { if (this.initialScale > 0) { var is = 'initial-scale=' + this.initialScale + ', '; } - var us = this.userScalable == true ? '1' : '0'; + var us = this.userScalable == true ? 'yes' : 'no'; var value = w + h + is + 'minimum-scale=' + Math.max(0.25, this.minScale) + ', maximum-scale=' + Math.min(10, this.maxScale) + ', user-scalable=' + us + ", shrink-to-fit=no"; this.meta.attr('content', value); diff --git a/style/fluidbook.css b/style/fluidbook.css index 831e2ebf..8ec68ee9 100644 --- a/style/fluidbook.css +++ b/style/fluidbook.css @@ -229,11 +229,6 @@ body { left: 0px; overflow: hidden; } -#pages { - position: absolute; - top: 0px; - left: 0px; -} /* Shadow */ #shadow { position: absolute; diff --git a/style/fluidbook.less b/style/fluidbook.less index 261cf5b2..001085c5 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -260,12 +260,6 @@ body { overflow: hidden; } -#pages { - position: absolute; - top: 0px; - left: 0px; -} - /* Shadow */ #shadow { position: absolute; -- 2.39.5