]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Aug 2013 09:40:27 +0000 (09:40 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Aug 2013 09:40:27 +0000 (09:40 +0000)
js/libs/fluidbook/views/fluidbook.chapters.js
style/fluidbook.css

index 21ef909eb055fe2c3be09d2c549ac78124519b3f..e6f7c01ac860be5cfd5087271b55290b14dd68d4 100644 (file)
@@ -1,6 +1,10 @@
 function FluidbookChapters(fluidbook, chapters) {\r
        this.fluidbook = fluidbook;\r
        this.chapters = chapters;\r
+       this.style = 'classic';\r
+       if (this.fluidbook.datas.mobileChaptersStyle) {\r
+               this.style = this.fluidbook.datas.mobileChaptersStyle;\r
+       }\r
        this.html = '';\r
        this.lastColor;\r
 }\r
@@ -34,16 +38,43 @@ FluidbookChapters.prototype = {
                }\r
                this.html = $(h).get(0).outerHTML;\r
 \r
-               $(document).on('click', 'ul.chapters a', function() {\r
-                       var li = $(this).parent();\r
-                       var subnav = $(li).children('ul');\r
-                       if ($(subnav).length) {\r
-                               $(subnav).slideToggle();\r
-                               return false;\r
-                       } else {\r
-                               return true;\r
-                       }\r
-               });\r
+\r
+               if (this.style == 'classic') {\r
+                       $(document).on('click', 'ul.chapters a', function() {\r
+\r
+                               var li = $(this).parent();\r
+                               var subnav = $(li).children('ul');\r
+                               if ($(subnav).length) {\r
+                                       $(subnav).slideToggle();\r
+                                       return false;\r
+                               } else {\r
+                                       return true;\r
+                               }\r
+                       });\r
+               } else if (this.style == 'ina') {\r
+                       $(document).on('click', 'ul.chapters a .right', function(e) {\r
+                               var p = $(this).data('page');\r
+                               if (p != '') {\r
+                                       $this.fluidbook.setCurrentPage(p);\r
+                                       e.stopImmediatePropagation();\r
+                                       e.stopPropagation();\r
+                                       e.preventDefault();\r
+                                       return false;\r
+                               }\r
+\r
+                       });\r
+\r
+                       $(document).on('click', 'ul.chapters a', function() {\r
+                               var li = $(this).parent();\r
+                               var subnav = $(li).children('ul');\r
+                               if ($(subnav).length) {\r
+                                       $(subnav).slideToggle();\r
+                                       return false;\r
+                               } else {\r
+                                       return true;\r
+                               }\r
+                       });\r
+               }\r
        },\r
        makeClassicMenu: function() {\r
                var $this = this;\r
@@ -71,18 +102,33 @@ FluidbookChapters.prototype = {
 \r
                if (chapter.label.substr(0, 3) == '!!!') {\r
                        chapter.label = chapter.label.substring(3);\r
-                       chapter.level='-1';\r
+                       chapter.level = '-1';\r
                }\r
 \r
+               var p = (this.fluidbook.virtualToPhysical(chapter.page));\r
 \r
-\r
-               var res = '<li data-level="' + chapter.level + '"><a href="#/page/' + (this.fluidbook.virtualToPhysical(chapter.page)) + '" class="level' + chapter.level + '">';\r
+               var res = '';\r
+               if (this.style == 'classic') {\r
+                       res += '<li data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="level' + chapter.level + '">';\r
+               } else if (this.style == 'ina') {\r
+                       res += '<li style="background-color:#' + color + ';" data-level="' + chapter.level + '"><a href="#/page/' + p + '" class="nodark level' + chapter.level + '">';\r
+               }\r
                res += chapter.label;\r
-               res += '<div class="right">';\r
-               if (color == '') {\r
-                       res += chapter.page;\r
+               res += '<div class="right" data-page="' + p + '">';\r
+\r
+               if (this.style == 'classic') {\r
+                       if (color == '') {\r
+                               if (chapter.page != '') {\r
+                                       res += '<span class="pagen">' + chapter.page + '</span>';\r
+                               }\r
+                       } else {\r
+                               res += '<div class="puce" style="background-color:#' + color + ';"></div>';\r
+                       }\r
                } else {\r
-                       res += '<div class="puce" style="background-color:#' + color + ';"></div>';\r
+                       if (chapter.page != '') {\r
+                               res += '<span class="pagen">' + chapter.page + '</span>';\r
+                       }\r
+                       res += '<div class="puce noshadow"></div>';\r
                }\r
                res += '</div>'\r
                res += '</a></li>';\r
index 231c41fe083b2b616f9b8340f8f721ee3cc288ee..871fc1fa190cd815f4a8bb4a88ed9ac343239e64 100644 (file)
@@ -961,6 +961,10 @@ ul.chapters.shareList a.level0 img{
 }\r
 \r
 /* Chapters */\r
+ul.chapters>li{\r
+       clear: both;\r
+}\r
+\r
 ul.chapters a{\r
        display:block;\r
        text-align: left;\r
@@ -1007,11 +1011,29 @@ ul.chapters, ul.chapters ul{
        list-style: none;\r
 }\r
 \r
-ul.chapters a .right{\r
+ul.chapters .right{\r
+       float:right;\r
+       display: inline-block;\r
+}\r
+\r
+ul.chapters .right .puce.noshadow{\r
+       border-radius: 0px;\r
+       -moz-border-radius: 0px;\r
+       -webkit-border-radius: 0px;\r
+       -ms-border-radius: 0px;\r
+       -o-border-radius: 0px;\r
+\r
+       box-shadow: 2px 2px 4px rgba(0,0,0,0);\r
+       -moz-box-shadow: 2px 2px 4px rgba(0,0,0,0);\r
+       -webkit-box-shadow: 2px 2px 4px rgba(0,0,0,0);\r
+       -ms-box-shadow: 2px 2px 4px rgba(0,0,0,0);\r
+       -o-box-shadow: 2px 2px 4px rgba(0,0,0,0);\r
+       \r
+       margin: 0 0 0 15px;\r
        float:right;\r
 }\r
 \r
-ul.chapters .right .puce{\r
+ul.chapters .right .puce{\r
        width:25px;\r
        height:25px;\r
 \r
@@ -1032,6 +1054,11 @@ ul.chapters a .right .puce{
        background-repeat: no-repeat;\r
 }\r
 \r
+ul.chapters a.nodark{\r
+       background-image: none !important;\r
+       border-top:1px solid rgba(255,255,255,0.25);\r
+}\r
+\r
 ul.chapters a.level0 .right .puce{\r
        margin:2px 0 0 0;\r
 }\r