From 44b7b35ba0b23f1c5639363684272de2919b666d Mon Sep 17 00:00:00 2001 From: krushton Date: Sun, 3 Feb 2013 15:51:19 -0800 Subject: [PATCH 1/2] adjust sizing of table of contents to better display nested items, fix bug with display of final item in list --- css/main.css | 20 ++++++++++++++++++-- fpjs/reader/app.js | 17 ++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/css/main.css b/css/main.css index 3774509..85f014d 100755 --- a/css/main.css +++ b/css/main.css @@ -208,12 +208,12 @@ input:-moz-placeholder { #toc > ul{ margin-top: 50px; margin-bottom: 50px; - padding-left: 40px; + padding-left: 20px; display: block; } #toc li { - margin-bottom: 10px; + margin-bottom:10px; width: 225px; font-family: Georgia, "Times New Roman", Times, serif; list-style: none; @@ -231,12 +231,27 @@ input:-moz-placeholder { text-decoration: none; } +#toc a.chapter { + font-size: 1em; +} + +#toc a.section { + font-size: .8em; +} + #toc li.currentChapter > a, #toc li a:hover { color: #f1f1f1 } +#toc li.openChapter > a, +#toc li a:hover { + color: #E2E2E2; +} + #toc li ul { + padding-left:10px; + margin-top: 8px; display: none; } @@ -332,6 +347,7 @@ input:-moz-placeholder { #toc > ul{ padding-left: 10px; + webkit-padding-start:; } } diff --git a/fpjs/reader/app.js b/fpjs/reader/app.js index 1024d19..76c4ae1 100644 --- a/fpjs/reader/app.js +++ b/fpjs/reader/app.js @@ -73,7 +73,7 @@ FPR.app.init = (function($){ $toc.empty(); //-- Recursively generate TOC levels - $items = generateTocItems(contents); + $items = generateTocItems(contents, 1); $toc.append($items); @@ -83,8 +83,10 @@ FPR.app.init = (function($){ var $this = $(this), url = $this.data("url"); - $(".openChapter").removeClass("openChapter"); - $this.parent().addClass("openChapter"); + + $(".openChapter").removeClass("openChapter"); + $this.parents('li').addClass("openChapter"); + //-- Provide the Book with the url to show // The Url must be found in the books manifest @@ -98,19 +100,20 @@ FPR.app.init = (function($){ } - function generateTocItems(contents){ + function generateTocItems(contents, level){ var $container = $("