]> _ Git - fluidbook-html5.git/commitdiff
Done #1500 @0.5
authorStephen Cameron <stephen@cubedesigners.com>
Mon, 26 Jun 2017 19:14:06 +0000 (21:14 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Mon, 26 Jun 2017 19:14:06 +0000 (21:14 +0200)
js/libs/fluidbook/fluidbook.nav.js
plugins/com/promotal/catalogue/plugin.js

index e52ba24d880d304c6cc49652de244729e5968031..193915ae15e13933242f12d041ec1add615a30ce 100644 (file)
@@ -75,18 +75,18 @@ FluidbookNav.prototype = {
     //     }
     //     return this.fluidbook.loader.getImage(src, this._dimensions[name][0], this._dimensions[name][1]);
     // },
-    addLink: function (name, href, id, help, before, c) {
+    addLink: function (name, href, id, title, help, before, c) {
         if (this.menu.find('#' + id).length > 0) {
             return;
         }
-        var l = '<li>' + this.getLink(name, href, id, help, c) + '</li>';
+        var l = '<li>' + this.getLink(name, href, id, title, help, c) + '</li>';
         if (before == undefined) {
             this.menu.find('ul').append(l);
         } else {
             this.menu.find("ul #" + before).before(l);
         }
     },
-    getLink: function (name, href, id, help, className, icon) {
+    getLink: function (name, href, id, title, help, className, icon) {
         if (icon == undefined) {
             icon = true;
         }
@@ -107,9 +107,8 @@ FluidbookNav.prototype = {
             res += getSpriteIcon(name);
         }
 
-        // Temporary: use the help text as the link text - we probably need a dedicated string for these
         if (help != undefined && help != '') {
-            res += ' ' + this.fluidbook.l10n.__(help);
+            res += ' ' + this.fluidbook.l10n.__(title);
         }
 
         // If there's no link defined, return the text an icon wrapped in a <span> (useful for MMenu)
@@ -170,7 +169,7 @@ FluidbookNav.prototype = {
                 }
                 try {
                     if (homeURL != '') {
-                        this.addLink('nav-home', homeURL, 'home', 'home');
+                        this.addLink('nav-home', homeURL, 'home', 'home', 'home');
                     }
                 } catch (err) {
 
@@ -185,14 +184,14 @@ FluidbookNav.prototype = {
                     return false;
                 })
             } else if (icon == 'index') {
-                this.addLink('interface-index', '#/index', 'index', 'overview');
+                this.addLink('interface-index', '#/index', 'index', 'overview', 'overview');
             } else if (icon == 'chapters') {
                 if (this.fluidbook.datas.displayChaptersIcon) {
                     if (this.fluidbook.datas.chaptersPage != '') {
-                        this.addLink('interface-chapters', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters');
+                        this.addLink('interface-chapters', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters', 'chapters');
                     } else if (this.fluidbook.datas.chapters.length > 0) {
                         // this.addLink('nav-sommaire', '#/chapters', 'chapters', 'chapters');
-                        this.addLink('interface-chapters', '', 'chapters', 'chapters');
+                        this.addLink('interface-chapters', '', 'chapters', 'chapters', 'chapters');
 
                         // Get HTML for submenus (appended later)
                         this.chaptersMenuHTML = this.makeChapterLists(this.fluidbook.datas.chapters);
@@ -249,7 +248,7 @@ FluidbookNav.prototype = {
 
             } else if (icon == 'bookmark') {
                 if (this.fluidbook.datas.bookmark) {
-                    this.addLink('interface-bookmarks', '#/bookmark', 'bookmarks', 'bookmarks');
+                    this.addLink('interface-bookmarks', '#/bookmark', 'bookmarks', 'bookmarks', 'bookmarks');
                     $("#bookmarks").click(function () {
                         if (!$this.fluidbook.bookmarks.hasBookmarkedPages()) {
                             var message = $this.fluidbook.l10n.__("you don't have any bookmarks");
@@ -265,7 +264,8 @@ FluidbookNav.prototype = {
                 }
             } else if (icon == 'pdf' || icon == 'print') {
                 if ($("#print").length == 0 && (this.fluidbook.datas.print || this.fluidbook.datas.pdf)) {
-                    this.addLink('interface-print', '#', 'print', '!' + this.fluidbook.l10n.__('print') + ' | ' + this.fluidbook.l10n.__('download pdf'));
+                    var printOrDownload = '!' + this.fluidbook.l10n.__('print') + ' | ' + this.fluidbook.l10n.__('download pdf');
+                    this.addLink('interface-print', '#', 'print', printOrDownload, printOrDownload);
                     $("#print").on('click', function () {
                         $this.fluidbook.print();
                         return false;
@@ -277,15 +277,15 @@ FluidbookNav.prototype = {
                 }
             } else if (icon == 'archives') {
                 if (this.fluidbook.datas.archivesLink != '') {
-                    this.addLink('nav-archives', this.fluidbook.datas.archivesLink, 'archives', '!' + this.fluidbook.datas.archivesLabel);
+                    this.addLink('nav-archives', this.fluidbook.datas.archivesLink, 'archives', '!' + this.fluidbook.datas.archivesLabel, '!' + this.fluidbook.datas.archivesLabel);
                 } else if (this.fluidbook.datas.externalArchives != '') {
-                    this.addLink('nav-archives', '#/archives', 'archives', '!' + this.fluidbook.datas.archivesLabel);
+                    this.addLink('nav-archives', '#/archives', 'archives', '!' + this.fluidbook.datas.archivesLabel, '!' + this.fluidbook.datas.archivesLabel);
                 }
             } else if (icon == 'help') {
-                this.addLink('interface-help', '#', 'help', 'help');
+                this.addLink('interface-help', '#', 'help', 'help', 'help');
             } else if (icon == 'zoom' && !this.fluidbook.support.isMobile) {
-                this.addLink('nav-zoomin', '#', 'zoomin', 'zoom in');
-                this.addLink('nav-zoomout', '#', 'zoomout', 'zoom out');
+                this.addLink('nav-zoomin', '#', 'zoomin', 'zoom in', 'zoom in');
+                this.addLink('nav-zoomout', '#', 'zoomout', 'zoom out', 'zoom out');
 
                 $("#zoomin").click(function (e) {
                     $this.fluidbook.desktop.clickZoom(e, 'in');
@@ -297,7 +297,7 @@ FluidbookNav.prototype = {
                     return false;
                 });
             } else if (icon == 'fullscreen' && Modernizr.fullscreen && !DATAS.phonegap) {
-                this.addLink('interface-fullscreen', '#', 'fullscreen', 'switch between fullscreen and normal');
+                this.addLink('interface-fullscreen', '#', 'fullscreen', 'Full screen', 'switch between fullscreen and normal');
                 $("#fullscreen").click(function () {
                     $this.menuAPI.close();
                     screenfull.toggle();
@@ -547,8 +547,8 @@ FluidbookNav.prototype = {
     },
     setInterface: function () {
 
-        var res = this.getLink('interface-previous', '#', 'previous', '', '', false);
-        res += this.getLink('interface-next', '#', 'next', '', '', false);
+        var res = this.getLink('interface-previous', '#', 'previous', '', '', '', false);
+        res += this.getLink('interface-next', '#', 'next', '', '', '', false);
         $('#interface').append(res);
         $(document).on('click', '#next', goNextPage);
         $(document).on('click', '#previous', goPreviousPage);
index f3399da88134cf5be059eeb860033fa171b07128..278655819b9897d37d054e2db6d594b3d0732787 100644 (file)
@@ -15,7 +15,7 @@ function com_promotal_catalogue() {
                                        data = JSON.parse(data);\r
                                }\r
                                distributeurs = data;\r
-                               fluidbook.nav.addLink('nav-map', '#/distributors', 'map', 'find a distributor', 'help');\r
+                               fluidbook.nav.addLink('nav-map', '#/distributors', 'map', 'find a distributor', 'find a distributor', 'help');\r
                        },\r
                        error: getDistributeursFromCache\r
                });\r
@@ -28,7 +28,7 @@ function com_promotal_catalogue() {
                                fluidbook.cache.set('promotions_' + locale, data);\r
                                promotions = data;\r
                                if (promotions.length > 0) {\r
-                                       fluidbook.nav.addLink('nav-tag', '#/promotions', 'tag', 'promotions', 'help');\r
+                                       fluidbook.nav.addLink('nav-tag', '#/promotions', 'tag', 'promotions', 'promotions', 'help');\r
                                }\r
                        },\r
                        error: getPromotionsFromCache\r
@@ -45,7 +45,7 @@ function getDistributeursFromCache() {
        var locale = fluidbook.l10n.getActiveLang();\r
        if (fluidbook.cache.isset('distributeurs_' + locale)) {\r
                distributeurs = fluidbook.cache.get('distributeurs_' + locale);\r
-               fluidbook.nav.addLink('nav-map', '#/distributors', 'map', 'find a distributor', 'help');\r
+               fluidbook.nav.addLink('nav-map', '#/distributors', 'map', 'find a distributor', 'find a distributor', 'help');\r
        }\r
 }\r
 \r
@@ -55,7 +55,7 @@ function getPromotionsFromCache() {
        if (fluidbook.cache.isset('promotions_' + locale)) {\r
                promotions = fluidbook.cache.get('promotions_' + locale);\r
                if (promotions.length > 0) {\r
-                       fluidbook.nav.addLink('nav-tag', '#/promotions', 'tag', 'promotions', 'help');\r
+                       fluidbook.nav.addLink('nav-tag', '#/promotions', 'tag', 'promotions', 'promotions', 'help');\r
                }\r
        }\r
 }\r