fixed a feature that made me make the same mistake three times...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-26 18:55:20 +04:00
parent 16968d7876
commit 21fca66036
3 changed files with 19 additions and 5 deletions

View File

@ -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...

View File

@ -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')

View File

@ -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