]> _ Git - fluidbook-html5.git/commitdiff
wip #1089 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Jan 2017 14:44:19 +0000 (15:44 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Jan 2017 14:44:19 +0000 (15:44 +0100)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.utils.js

index 1c293db0bf51def58349372895b68a321da45bbe..8d6ade2fe7476c7599dc7f181d0ba69b16c78d6e 100644 (file)
@@ -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();
index aa19a5d45a8ebd79c9a0b40158d42af67ed3bc4f..841a353af9a43c888ef5c955696acff383b59732 100644 (file)
@@ -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