From 2097207389ef86fd200cbea66bf1e7ab2937921c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 2 Aug 2013 09:55:34 +0000 Subject: [PATCH] --- js/libs/fluidbook/fluidbook.loader.js | 4 ++-- js/libs/fluidbook/fluidbook.support.js | 16 ++++++++----- js/libs/gal/gal.filesystem.js | 5 +---- js/libs/gal/gal.js | 12 ++++++++-- js/libs/modernizr/modernizr.js | 31 ++++++++++++++++++++++++-- style/fluidbook.css | 1 - 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.loader.js b/js/libs/fluidbook/fluidbook.loader.js index 3b2be5e3..9105a741 100644 --- a/js/libs/fluidbook/fluidbook.loader.js +++ b/js/libs/fluidbook/fluidbook.loader.js @@ -181,7 +181,7 @@ FluidbookLoader.prototype = { prefix = 't'; } - return 'data/background/150/' + prefix + page + '.jpg'; + return 'data/background/' + this.fluidbook.support.resolution + '/' + prefix + page + '.jpg'; }, getTextsURL: function(page) { return 'data/contents/p' + page + '.svg'; @@ -190,7 +190,7 @@ FluidbookLoader.prototype = { var $this = this; var back = $("#page_" + page + ' .background'); this._loadBackground(page, function() { - $(back).addClass('r150'); + $(back).addClass('r' + $this.fluidbook.support.resolution); $(back).append($this.backgrounds[page]); }); }, diff --git a/js/libs/fluidbook/fluidbook.support.js b/js/libs/fluidbook/fluidbook.support.js index b7e2bc27..de7ed49f 100644 --- a/js/libs/fluidbook/fluidbook.support.js +++ b/js/libs/fluidbook/fluidbook.support.js @@ -8,7 +8,11 @@ function FluidbookSupport(fluidbook) { this.transitions3d = Modernizr.csstransforms3d && Modernizr.csstransitions && Modernizr.csstransformspreserve3d; this.transitions2d = Modernizr.csstransforms && Modernizr.csstransitions; this.transitionendevent = null; - this.initialResolution = 150; + if (Modernizr.mq('(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)')) { + this.resolution = this.fluidbook.datas.retinaResolution; + } else { + this.resolution = 150; + } this.isMobile = isMobile(); this.SVG = Modernizr.svg && this.fluidbook.datas.mobileIconVector; @@ -107,16 +111,16 @@ FluidbookSupport.prototype = { } }, getOrientation: function() { - try{ - if(this.fluidbook.pad && this.fluidbook.pad.enabled){ + try { + if (this.fluidbook.pad && this.fluidbook.pad.enabled) { return 0; } - }catch(err){ - + } catch (err) { + } try { - var mql = window.matchMedia("(orientation: portrait)"); + var mql = Modernizr.mq("(orientation: portrait)"); if (mql.matches) { return 0; } else { diff --git a/js/libs/gal/gal.filesystem.js b/js/libs/gal/gal.filesystem.js index b5d3a290..70f061db 100644 --- a/js/libs/gal/gal.filesystem.js +++ b/js/libs/gal/gal.filesystem.js @@ -63,10 +63,7 @@ case FileError.PATH_EXISTS_ERR: message = 'path exists'; break; - } - - console.error('Filesystem error:', error.code + ' :: ' + message); } ; @@ -95,7 +92,6 @@ var f = folders.shift(); - root.getDirectory(f, {create: true}, function(dirEntry) { if (folders.length > 0) { createDir_(dirEntry, folders, callback); @@ -247,6 +243,7 @@ }, onError); var that = this; + this.lookupTable = {}; // And then recreate it this.fs.root.getDirectory(ROOT_DIR, {create: true}, function(dirEntry) { that.root = dirEntry; diff --git a/js/libs/gal/gal.js b/js/libs/gal/gal.js index 8835c773..634d1810 100644 --- a/js/libs/gal/gal.js +++ b/js/libs/gal/gal.js @@ -161,6 +161,7 @@ } var key = bundle[index]; adapter.checkAsset(key, function() { + // Iterate to the next file. loop(index + 1); }, function() { @@ -201,7 +202,12 @@ GAL.prototype.getRootURL = function() { return this.adapter.root.toURL(); - } + }; + + GAL.prototype.downloadAll = function() { + console.log('downloadAll'); + downloadAll_.call(this); + }; /** @@ -295,10 +301,11 @@ } /** - * @private + * * Starts downloading all of the assets in the manifest, in order. */ function downloadAll_() { + console.log('downloadAll_'); var that = this; // Start by downloading the first bundle, then download subsequent ones. (function loop(bundleIndex) { @@ -306,6 +313,7 @@ // We're done downloading stuff! return; } + var bundleName = that.bundleOrder[bundleIndex]; that.onLoaded(bundleName, function() { // Once bundle is loaded, load the next bundle. diff --git a/js/libs/modernizr/modernizr.js b/js/libs/modernizr/modernizr.js index c41c11b3..61c8a90f 100644 --- a/js/libs/modernizr/modernizr.js +++ b/js/libs/modernizr/modernizr.js @@ -1,5 +1,5 @@ /* Modernizr 2.6.2 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load + * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load */ ; @@ -87,7 +87,25 @@ window.Modernizr = (function( window, document, undefined ) { }, + testMediaQuery = function( mq ) { + var matchMedia = window.matchMedia || window.msMatchMedia; + if ( matchMedia ) { + return matchMedia(mq).matches; + } + + var bool; + + injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { + bool = (window.getComputedStyle ? + getComputedStyle(node, null) : + node.currentStyle)['position'] == 'absolute'; + }); + + return bool; + + }, + isEventSupported = (function() { @@ -239,7 +257,15 @@ window.Modernizr = (function( window, document, undefined ) { } } tests['flexbox'] = function() { return testPropsAll('flexWrap'); - }; tests['canvas'] = function() { + }; + + + tests['flexboxlegacy'] = function() { + return testPropsAll('boxDirection'); + }; + + + tests['canvas'] = function() { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }; @@ -782,6 +808,7 @@ window.Modernizr = (function( window, document, undefined ) { Modernizr._domPrefixes = domPrefixes; Modernizr._cssomPrefixes = cssomPrefixes; + Modernizr.mq = testMediaQuery; Modernizr.hasEvent = isEventSupported; diff --git a/style/fluidbook.css b/style/fluidbook.css index 42348ab1..231c41fe 100644 --- a/style/fluidbook.css +++ b/style/fluidbook.css @@ -53,7 +53,6 @@ b,strong,h1,h2,h3,h4,h5,h6{ -ms-touch-action:auto; } - html{ user-select:text; -moz-user-select:text; -- 2.39.5