diff --git a/css/main.css b/css/main.css index 3774509..f60e772 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; } @@ -246,6 +261,32 @@ input:-moz-placeholder { display: block; } +#settingsPanel { + display:none; +} + +#settingsPanel h3 { + color:#f1f1f1; + font-family:Georgia, "Times New Roman", Times, serif; + margin-bottom:10px; +} + +#settingsPanel ul { + margin-top:60px; + list-style-type:none; +} + +#settingsPanel li { + font-size:1em; + color:#f1f1f1; +} + +#settingsPanel .xsmall { font-size:x-small; } +#settingsPanel .small { font-size:small; } +#settingsPanel .medium { font-size:medium; } +#settingsPanel .large { font-size:large; } +#settingsPanel .xlarge { font-size:x-large; } + @media only screen and (max-width: 1040px) { #area{ width: 50%; @@ -332,6 +373,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 1caf007..cb0fab3 100644 --- a/fpjs/reader/app.js +++ b/fpjs/reader/app.js @@ -24,7 +24,7 @@ FPR.app.init = (function($){ $("#main").width(windowWidth); } - + loadSettings(); //-- Create a new book object, // this will create an iframe in the el with the ID provided Book = new FP.Book("area"); @@ -75,7 +75,7 @@ FPR.app.init = (function($){ $toc.empty(); //-- Recursively generate TOC levels - $items = generateTocItems(contents); + $items = generateTocItems(contents, 1); $toc.append($items); @@ -85,8 +85,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 @@ -99,20 +101,62 @@ FPR.app.init = (function($){ }); } + + function loadSettings() { + + var userFont = ""; + + if (!localStorage.getItem("fontSize")) { + userFont = "medium"; + localStorage.setItem("fontSize", userFont); + } else { + userFont = localStorage.getItem("fontSize"); + } + + var $settings = $("#settingsPanel"); + $settings.append(""); + + var $settingsItem = $("
  • "); + + var $fontSizes = $("Extra Small
    " + + "Small
    " + + "Medium
    " + + "Large
    " + + "Extra Large"); + + $settingsItem.find("h3").text('Font Size').after($fontSizes); + $settings.find("ul").append($settingsItem); + + var $fontSizeButtons = $('input[name="fontSize"]'); + + $fontSizeButtons.each(function() { + + if ($(this).attr("value") == userFont) { + $(this).attr("checked", "checked"); + } + $(this).on("click", function() { + localStorage.setItem("fontSize", $(this).attr("value")); + }); + }); + + } + + - function generateTocItems(contents){ + function generateTocItems(contents, level){ var $container = $("