From 80c878523614264c9c526e30bab78b340a952f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Guti=C3=A9rez=20Barquero?= Date: Fri, 17 May 2013 17:53:37 -0600 Subject: [PATCH 1/2] Mirror margins are now an option --- book.js | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/book.js b/book.js index a57ea96..cf01d9c 100644 --- a/book.js +++ b/book.js @@ -125,7 +125,10 @@ * settings are different from the baove ones in that they can be overriden * through CSS to provide more advanced designs (see the above note on * pagination.css). - * + * + * mirrorMargins: true -- If true outerMargin and innerMargin will be + * contraries for odd and even pages. + * * outerMargin: .5 (inch)-- This controls the margin on the outer part of the * page. * @@ -209,6 +212,7 @@ 'marginnoteSelector': '.pagination-marginnote', 'maxPageNumber': 10000, 'columnSeparatorWidth': 0.09, + 'mirrorMargins': true, 'outerMargin': 0.5, 'innerMargin': 0.8, 'contentsTopMargin': 0.8, @@ -365,15 +369,25 @@ headerTopMargin + ";}" + "\n#pagination-toc-title:before {content:'Contents';}" + "\n#pagination-tof-title:before {content:'Figures';}" + - "\n.pagination-page:nth-child(odd) .pagination-contents-container, " + - ".pagination-page:nth-child(odd) .pagination-pagenumber," + - ".pagination-page:nth-child(odd) .pagination-header {" + "right:" + - outerMargin + ";left:" + innerMargin + ";}" + - "\n.pagination-page:nth-child(even) .pagination-contents-container, " + - ".pagination-page:nth-child(even) .pagination-pagenumber," + - ".pagination-page:nth-child(even) .pagination-header {" + "right:" + - innerMargin + ";left:" + outerMargin + ";}" + - "\n.pagination-page:nth-child(odd) .pagination-pagenumber," + + +(paginationConfig['mirrorMargins']? + ("\n.pagination-page:nth-child(odd) .pagination-contents-container, " + + ".pagination-page:nth-child(odd) .pagination-pagenumber," + + ".pagination-page:nth-child(odd) .pagination-header {" + + "right:"+outerMargin+";left:"+innerMargin+";}" + + "\n.pagination-page:nth-child(even) .pagination-contents-container, " + + ".pagination-page:nth-child(even) .pagination-pagenumber," + + ".pagination-page:nth-child(even) .pagination-header {" + + "right:"+innerMargin+";left:"+outerMargin+";}"): + /*else*/ + ("\n.pagination-page:nth-child(odd) .pagination-contents-container, " + + ".pagination-page:nth-child(odd) .pagination-pagenumber," + + ".pagination-page:nth-child(odd) .pagination-header {" + + "right:"+outerMargin+";left:"+innerMargin+";}" + + "\n.pagination-page:nth-child(even) .pagination-contents-container, " + + ".pagination-page:nth-child(even) .pagination-pagenumber," + + ".pagination-page:nth-child(even) .pagination-header {" + + "right:"+outerMargin+";left:"+innerMargin+";}")) + + "\n.pagination-page:nth-child(odd) .pagination-pagenumber," + ".pagination-page:nth-child(odd) .pagination-header {" + "text-align:right;}" + "\n.pagination-page:nth-child(even) .pagination-pagenumber," + From df1fc751f3be11f4efe2c99f76fe6a6e691d11f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Guti=C3=A9rez=20Barquero?= Date: Sat, 18 May 2013 22:00:27 -0600 Subject: [PATCH 2/2] Simplifying mirror margin implementation --- book.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/book.js b/book.js index cf01d9c..cd9287a 100644 --- a/book.js +++ b/book.js @@ -379,13 +379,9 @@ + ".pagination-page:nth-child(even) .pagination-header {" + "right:"+innerMargin+";left:"+outerMargin+";}"): /*else*/ - ("\n.pagination-page:nth-child(odd) .pagination-contents-container, " - + ".pagination-page:nth-child(odd) .pagination-pagenumber," - + ".pagination-page:nth-child(odd) .pagination-header {" - + "right:"+outerMargin+";left:"+innerMargin+";}" - + "\n.pagination-page:nth-child(even) .pagination-contents-container, " - + ".pagination-page:nth-child(even) .pagination-pagenumber," - + ".pagination-page:nth-child(even) .pagination-header {" + ("\n.pagination-page .pagination-contents-container, " + + ".pagination-page .pagination-pagenumber," + + ".pagination-page .pagination-header {" + "right:"+outerMargin+";left:"+innerMargin+";}")) + "\n.pagination-page:nth-child(odd) .pagination-pagenumber," + ".pagination-page:nth-child(odd) .pagination-header {" +