From: Vincent Vanwaelscappel Date: Wed, 11 Jan 2017 14:44:19 +0000 (+0100) Subject: wip #1089 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=707df7dbaf63e9ce0f997f0803448f612d07068c;p=fluidbook-html5.git wip #1089 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.js b/js/libs/fluidbook/fluidbook.js index 1c293db0..8d6ade2f 100644 --- a/js/libs/fluidbook/fluidbook.js +++ b/js/libs/fluidbook/fluidbook.js @@ -1263,7 +1263,7 @@ Fluidbook.prototype = { if (this.datas.pdfName.substr(0, 4) == 'http') { pdf = this.datas.pdfName; } else { - pdf = getBaseURL() + '/data/' + this.datas.pdfName; + pdf = getBaseURL(true) + '/data/' + this.datas.pdfName; } var e = pdf.split('/'); pdfName = e.pop(); diff --git a/js/libs/fluidbook/fluidbook.utils.js b/js/libs/fluidbook/fluidbook.utils.js index aa19a5d4..841a353a 100644 --- a/js/libs/fluidbook/fluidbook.utils.js +++ b/js/libs/fluidbook/fluidbook.utils.js @@ -1,40 +1,49 @@ function isMobile() { - var ua = navigator.userAgent; - var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile', 'htc', 'samsung', 'nokia', 'archos', 'galaxy', 'motorola', 'pad', 'tab', 'slate', 'motorola', 'symbian', 'phone', 'nintendo', 'playstation', 'touch', 'webos', 'ericsson']; - var pattern; + var ua = navigator.userAgent; + var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile', 'htc', 'samsung', 'nokia', 'archos', 'galaxy', 'motorola', 'pad', 'tab', 'slate', 'motorola', 'symbian', 'phone', 'nintendo', 'playstation', 'touch', 'webos', 'ericsson']; + var pattern; - if (Modernizr.ftouch) { - return true; - } + if (Modernizr.ftouch) { + return true; + } - for (i = 0; i < devices.length; i++) { - pattern = new RegExp(devices[i], 'i'); - if (ua.search(pattern) > -1) { - return true; - } - } - return false; + for (i = 0; i < devices.length; i++) { + pattern = new RegExp(devices[i], 'i'); + if (ua.search(pattern) > -1) { + return true; + } + } + return false; } function parseGet() { - var couples = window.location.search.substr(1).split('&'); - var res = new Array(); - var couple = new Array(); - for (var i = 0; i < couples.length; i++) { - couple = couples[i].split('='); - res[couple[0]] = couple[1]; - } - return res; + var couples = window.location.search.substr(1).split('&'); + var res = new Array(); + var couple = new Array(); + for (var i = 0; i < couples.length; i++) { + couple = couples[i].split('='); + res[couple[0]] = couple[1]; + } + return res; } -function getBaseURL() { - var l = window.location.toString(); - var e = l.split("#"); - var l = e[0]; - if (l.indexOf('.') != -1) { - e = l.split('/'); - e.pop(); - l=e.join('/'); - } - return l; +function getBaseURL(removeQuery) { + if (removeQuery === undefined) { + removeQuery = false; + } + var l = window.location.toString(); + var e = l.split("#"); + var l = e[0]; + + if (removeQuery) { + e = l.split('?'); + l = e[0]; + } + + if (l.indexOf('.') != -1) { + e = l.split('/'); + e.pop(); + l = e.join('/'); + } + return l; } \ No newline at end of file