diff --git a/lib/jli.js b/lib/jli.js index fb65ee2..8da08f3 100755 --- a/lib/jli.js +++ b/lib/jli.js @@ -45,8 +45,10 @@ // In all forms this will return the current state string or null if the // action argument given is invalid. // -// NOTE: if it is needed to apply this to and explicit target but with -// no action explicit action, just pass null as the second argument. +// NOTE: there is a special action 'next', passing it will have the same +// effect as not passing any action. +// NOTE: if it is needed to apply this to an explicit target but with +// no explicit action, just pass 'next' as the second argument. // NOTE: a special class name 'none' means no class is set, if it is present // in the class_list then that state will be with all other state // classes removed. @@ -54,10 +56,10 @@ // NOTE: of only one callback is given then it will be called after the // class change... // a way around this is to pass an empty function as callback_b -// NOTE: due to several times I've repeated the same mistake of forgetting -// to write the classes without leading dots, this now will normalize -// the class list, so now this will correctly treat both dotted -// and non-dotted class names... +// NOTE: leading dots in class names in class_list are optional. +// this is due to several times I've repeated the same mistake of +// forgetting to write the classes without leading dots, this now +// will normalize the class list... // // // This also takes one or two callbacks. If only one is given then it is @@ -97,11 +99,11 @@ function createCSSClassToggler(elem, class_list, callback_a, callback_b){ // XXX make this generic... var func = function(a, b){ if(b == null){ - var action = a + var action = a == 'next' ? null : a var e = elem } else { var e = a - var action = b + var action = b == 'next' ? null : b } e = $(e) // option number... diff --git a/magazine.css b/magazine.css index b0b43a7..72a5c64 100755 --- a/magazine.css +++ b/magazine.css @@ -612,6 +612,13 @@ div.page-number-text { } /* column layouts */ +.page .content .one-column { + column-count: 1; + -webkit-column-count: 1; + -moz-column-count: 1; + + text-align: justify; +} .page .content .two-column { column-count: 2; -webkit-column-count: 2; diff --git a/templates.html b/templates.html index 7fc336f..f3b3e38 100755 --- a/templates.html +++ b/templates.html @@ -100,6 +100,7 @@ body { text-shadow: black 0.1em 0.1em 0.4em, black 0.1em 0.1em; } +.container .column-toggle, .container .light.theme-toggle, .container .theme-toggle { position: absolute; @@ -139,6 +140,17 @@ body { background: white; } +.container .column-toggle div { + width: 8px; + height: 18px; + margin: 1px; + background: gray; + float: left; +} +.container .column-toggle { + right: 40px; +} + @@ -160,6 +172,21 @@ function toggleTheme(){ return false } +var togglePageColumns = createCSSClassToggler('', [ + 'one-column', + 'two-column', + 'three-column', + 'four-column', +]) + +function toggleColumns(){ + var page = $(this) + .parents('.page-box, .preview') + .find('.one-column, .two-column, .three-column, .four-column') + togglePageColumns(page, 'next') + return false +} + function addThemeToggleZones(){ $('