diff --git a/TODO.otl b/TODO.otl index b328edd..cb726b6 100755 --- a/TODO.otl +++ b/TODO.otl @@ -6,6 +6,9 @@ [_] BUG: no drag threshold on excludedElements (TouchSwipe) | stalled... [_] 67% general todo + [_] add separate history manager... + | might be a virtual history rather than browser history which + | tends to slow things down -- just a simple stack... [_] move some of the current configuration options to the magazine... | same idea as .no-resize class... [_] add option to align page to right or left screen border diff --git a/index.html b/index.html index f2b2794..8e00597 100755 --- a/index.html +++ b/index.html @@ -668,6 +668,14 @@ $(document).ready(function(){ + + + Full navigation gistory: + + + + + Reset stored data: @@ -738,6 +746,7 @@ $(document).ready(function(){ DRAG_FULL_PAGE = $('#DRAG_FULL_PAGE').text() == 'true' ? true : false USE_REAL_PAGE_SIZES = $('#USE_REAL_PAGE_SIZES').text() == 'true' ? true : false UPDATE_HASH_URL_POSITION = $('#UPDATE_HASH_URL_POSITION').text() == 'true' ? true : false + FULL_HISTORY_ENABLED = $('#FULL_HISTORY_ENABLED').text() == 'true' ? true : false } function loadSettings(){ $('#PAGES_IN_RIBBON').attr('value', PAGES_IN_RIBBON) @@ -746,6 +755,7 @@ $(document).ready(function(){ $('#DRAG_FULL_PAGE').text(DRAG_FULL_PAGE) $('#USE_REAL_PAGE_SIZES').text(USE_REAL_PAGE_SIZES) $('#UPDATE_HASH_URL_POSITION').text(UPDATE_HASH_URL_POSITION) + $('#FULL_HISTORY_ENABLED').text(FULL_HISTORY_ENABLED) $('#FingersSupported').text($.fn.swipe.fingers.ALL) var b = $('#BrowserInfo') diff --git a/magazine.js b/magazine.js index a23ac7f..1cae4d2 100755 --- a/magazine.js +++ b/magazine.js @@ -30,8 +30,17 @@ var USE_REAL_PAGE_SIZES = false // if true this will make each page flip update the hash url... // if false, only direct linking will update the url. -// XXX this if false, will break the layer hide/show toggle... -var UPDATE_HASH_URL_POSITION = true +// NOTE: this can slow down navigation... +// XXX BUG this if false, will break the layer hide/show toggle... +var UPDATE_HASH_URL_POSITION = false + +// if true this will enable history for local page navigation regardless +// of weather UPDATE_HASH_URL_POSITION state. +// NOTE: UPDATE_HASH_URL_POSITION implicitly enables full browser history +// based navigation. +// NOTE: this can slow down navigation... +// NOTE: partial history navigation over links will still work. +var FULL_HISTORY_ENABLED = false @@ -680,6 +689,12 @@ function loadURLState(){ .addClass('hidden') .removeClass('shown') } + if(!UPDATE_HASH_URL_POSITION){ + // push current position... + // NOTE: this will enable partial history navigation, but only + // on actions envolving actual links... + window.history.pushState(null, null, '#' + getPageNumber()) + } return n } } @@ -705,6 +720,9 @@ function saveURLState(){ } if(UPDATE_HASH_URL_POSITION){ window.location.hash = n + } else if(FULL_HISTORY_ENABLED){ + // XXX add option to disable history altogether... + window.history.pushState(null, null, '#' + n) } return n }