]> _ Git - fluidbook-html5.git/commitdiff
wip #2021 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Apr 2018 13:49:17 +0000 (15:49 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Apr 2018 13:49:17 +0000 (15:49 +0200)
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.nav.js
style/fluidbook.less

index c48741c5fc19c7eeb40bbe52570f15f67f169e85..2699f5004e981089ad8dd59a61b73ca081945198 100644 (file)
@@ -258,8 +258,35 @@ FluidbookMenu.prototype = {
     openShare: function (p1, p2, callback) {
         this.fluidbook.share.openShare(p1, p2, callback);
     },
+
+    openBookmarkHelp: function (p1, p2, callback) {
+        // __("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner")
+        //var message = this.fluidbook.l10n.translate("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner")
+        var message = __("you don't have any bookmark. to add a bookmark, please click on the icon in the page corner");
+        var view = '<div><div class="caption">' + this.fluidbook.menu.closeButton() + '<h2></h2>';
+        view += '</div>';
+        view += '<div class="content">';
+        view += '<p>' + message + '</p>';
+        view += '<div class="visual">';
+        view += '<div class="doubleThumb"><div class="thumb left"><div class="img"></div><a href="#" class="bookmark left" data-enabled="enabled"></a></div><div class="thumb right"><div class="img"></div><a href="#" class="bookmark right" data-enabled="enabled"></a></div></div>';
+        view += '</div>';
+        view += '';
+        view += '</div>';
+        view += '</div>';
+        $("#view").append('<div class="mview" data-menu="bookmarks-help">' + view + '</div>');
+
+        this.fluidbook.loader.getThumbImage(2, $("#view .thumb.left .img"), false, 147);
+        this.fluidbook.loader.getThumbImage(3, $("#view .thumb.right .img"), false, 147);
+
+        if (callback != undefined) {
+            callback();
+        }
+    },
+
     openBookmark: function (p1, p2, callback) {
-        console.log('!!' + JSON.stringify(p1));
+        if (!this.fluidbook.bookmarks.hasBookmarkedPages()) {
+            return this.openBookmarkHelp(p1, p2, callback);
+        }
         var title = '';
         var downloadLabel = '';
         try {
@@ -280,25 +307,11 @@ FluidbookMenu.prototype = {
         }
 
         var view = this.fluidbook.bookmarks.getView(title, downloadLabel);
-        if (view !== false) {
-            $("#view").append('<div class="mview" data-menu="bookmarks">' + view + '</div>');
-            if (callback != undefined) {
-                callback();
-            }
-        } else {
-            var message = this.fluidbook.l10n.__("you don't have any bookmarks");
-            if (this.fluidbook.datas.phonegap) {
-                navigator.notification.alert(message, function () {
-
-                }, this.fluidbook.l10n.__('bookmarks'));
-            } else {
-                window.alert(message);
-                window.history.back();
-            }
-            this.fluidbook.hideLoader();
+        $("#view").append('<div class="mview" data-menu="bookmarks">' + view + '</div>');
+        if (callback != undefined) {
+            callback();
         }
-    }
-    ,
+    },
     openChapters: function (submenu, callback) {
         if (this.fluidbook.datas.externalChaptersHTML != '') {
             this.openExternalChapters(callback);
@@ -460,6 +473,12 @@ FluidbookMenu.prototype = {
                     fullscreen = true;
                 }
                 break;
+            case 'bookmarks-help':
+                w = 420;
+                if (ww < 520) {
+                    fullscreen = true;
+                }
+                break;
             case 'webvideo':
                 var w = Math.max(ww * 0.8, 600);
                 h = (w / 16) * 9;
@@ -549,13 +568,30 @@ FluidbookMenu.prototype = {
 
 
                 if (s < 1) {
-                    var css = {overflow: 'hidden', width: nw * s, height: nh * s, top: y, left: x, position: 'absolute'};
+                    var css = {
+                        overflow: 'hidden',
+                        width: nw * s,
+                        height: nh * s,
+                        top: y,
+                        left: x,
+                        position: 'absolute'
+                    };
                     m.find('.multimediaHolder').css(css);
                 } else {
-                    m.find('.multimediaHolder').css({position: "", overflow: '', width: '', height: '', top: '', left: ''});
+                    m.find('.multimediaHolder').css({
+                        position: "",
+                        overflow: '',
+                        width: '',
+                        height: '',
+                        top: '',
+                        left: ''
+                    });
                 }
 
-                m.find('.multimediaScale').css({width: nw, height: nh, overflow: 'hidden'}).transform({scale: [s, s], origin: [0, 0]}).css('text-align', 'left');
+                m.find('.multimediaScale').css({width: nw, height: nh, overflow: 'hidden'}).transform({
+                    scale: [s, s],
+                    origin: [0, 0]
+                }).css('text-align', 'left');
                 break;
             default:
                 break;
index c62713c2979acbd41c5f36cc61b3b06c9842d076..8f1ade3ef81fce8843052e1ca1ed023e34d59dbd 100644 (file)
@@ -669,16 +669,6 @@ FluidbookNav.prototype = {
 
         // Bookmarks icon
         $(document).on('click', '.icon-bookmarks', function () {
-            if (!$this.fluidbook.bookmarks.hasBookmarkedPages()) {
-                var message = $this.fluidbook.l10n.__("you don't have any bookmarks");
-                if ($this.fluidbook.datas.phonegap) {
-                    navigator.notification.alert(message, function () {
-                    }, $this.fluidbook.l10n.__('bookmarks'));
-                } else {
-                    window.alert(message);
-                }
-                return false;
-            }
             if ($(this).data('extra') != null) {
                 $this.fluidbook.menu.openView('bookmark', $(this).data('extra'), null, function () {
                 });
index 2ff8f20666f0bd0dde6432d51b0c34b738da3704..f53b38095f482d57321e67ac4320debaade1b39d 100644 (file)
@@ -1079,25 +1079,27 @@ html.ios body.portrait #interface {
                                text-align: center;
                        }
 
-                       @w: 147px;
+                       @w: 100px;
                        .doubleThumb {
                                position: relative;
                                width: @w*2;
                                height: @w/@book-page-ratio;
                                margin: 0 auto;
                                .thumb {
+
                                        &:before {
                                                display: none;
                                        }
                                        &.left {
                                                margin-right: @w;
+
                                        }
                                        &.right {
                                                left: @w;
                                                .img {
                                                        &:after {
                                                                left: auto;
-                                                               right: -24px;
+                                                               right: -20px;
                                                        }
                                                }
                                        }
@@ -1108,14 +1110,15 @@ html.ios body.portrait #interface {
                                                position: relative;
                                                width: @w;
                                                height: @w/@book-page-ratio;
+
                                                &:after {
                                                        content: "";
                                                        position: absolute;
                                                        z-index: -1;
-                                                       top: -24px;
-                                                       left: -24px;
-                                                       width: 90px;
-                                                       height: 90px;
+                                                       top: -20px;
+                                                       left: -20px;
+                                                       width: 75px;
+                                                       height: 75px;
                                                        background-color: @menu-background;
                                                        border: 2px solid #fff;
                                                        border-radius: 50%;
@@ -1124,8 +1127,8 @@ html.ios body.portrait #interface {
                                        }
 
                                        .bookmark {
-                                               width: 60px;
-                                               height: 60px;
+                                               width: 45px;
+                                               height: 45px;
                                                z-index: 2;
                                        }