added two finger actions and migrated article nav...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-26 02:49:18 +04:00
parent c09e069dca
commit 0bbb0aeb6b
2 changed files with 16 additions and 4 deletions

View File

@ -85,6 +85,11 @@ function prepareTransitions(elem){
}
$(document).ready(function(){
$(window)
//.resize(viewResizeHandler)
.resize(updateView)
.bind('hashchange', hashChangeHandler)
// keyboard...
$(document)
.keydown(makeKeyboardHandler({

View File

@ -94,7 +94,7 @@ function handleLongClick(evt, data){
}
}
function makeSwipeHandler(action){
function makeSwipeHandler(actionA, actionB){
return function(evt, data){
// ribbon mode...
if(isNavigationViewRelative()){
@ -112,11 +112,15 @@ function makeSwipeHandler(action){
//setTransitionEasing(mag, 'ease-out')
setTransitionEasing(mag, 'cubic-bezier(0.33,0.66,0.66,1)')
action($('.current.page'))
if(data.fingers == 2){
actionA($('.current.page'))
} else {
actionA($('.current.page'))
}
}
}
var handleSwipeLeft = makeSwipeHandler(prevPage)
var handleSwipeRight = makeSwipeHandler(nextPage)
var handleSwipeLeft = makeSwipeHandler(prevPage, prevArticle)
var handleSwipeRight = makeSwipeHandler(nextPage, nextArticle)
// do snap and innertia...
// NOTE: this will also handle swipeUp/swopeDown as we do not
@ -312,6 +316,9 @@ function setCurrentPage(n){
if(n == null){
n = getPageNumber()
}
if(typeof(n) != typeof(3)){
n = getPageNumber(n)
}
var l = $('.page').length
// normalize the number...
n = n < 0 ? l - n : n