diff --git a/TODO.otl b/TODO.otl index a907f3d..e165b88 100755 --- a/TODO.otl +++ b/TODO.otl @@ -1,5 +1,5 @@ [_] 37% Priority work - [_] 65% general todo + [_] 66% general todo [_] 37% Version 1.0 checklist (migration to layout.html) [X] page scaling for full page view [X] top/bottom toolbars @@ -88,7 +88,7 @@ [_] scrollend [_] 0% snap [_] snapped - [_] BUG: full-page-view-mode class does not apply to some elements... + [X] BUG: full-page-view-mode class does not apply to some elements... | - toolbars | - bookmarks [_] BUG: #URLs do not all work in the new index... diff --git a/layout.js b/layout.js index 88b6c43..e1a5466 100755 --- a/layout.js +++ b/layout.js @@ -23,7 +23,7 @@ var toggleThemes = createCSSClassToggler('.chrome', [ var togglePageFitMode = createCSSClassToggler( '.chrome', - '.page-fit-to-viewer', + 'page-fit-to-viewer', function(action){ if(action == 'on'){ var n = getPageNumber() @@ -39,7 +39,7 @@ var togglePageFitMode = createCSSClassToggler( var togglePageView = createCSSClassToggler( '.chrome', - '.full-page-view-mode', + 'full-page-view-mode', function(action){ var view = $('.viewer') var page = $('.page') diff --git a/lib/jli.js b/lib/jli.js index ed427e4..626b1ba 100755 --- a/lib/jli.js +++ b/lib/jli.js @@ -41,13 +41,27 @@ // 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... function createCSSClassToggler(elem, class_list, callback_a, callback_b){ var bool_action = false if(typeof(class_list) == typeof('')){ class_list = ['none', class_list] bool_action = true } + // Normalize classes -- remove the dot from class names... + // NOTE: this is here because I've made the error of including a + // leading "." almost every time I use this after I forget + // the UI... + class_list = $(class_list).map(function(i, e){ + return $(e.split(' ')).map(function(i, c){ + c = c.trim() + return c[0] == '.' ? c.slice(1) : c + }).toArray().join(' ') + }).toArray() + // normalize the callbacks... if(callback_b == null){ var callback_pre = null var callback_post = callback_a