Skip to content

Commit

Permalink
Added basic back button support back in
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Stark committed Mar 23, 2011
1 parent dfd3273 commit a961295
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions jqtouch/jqtouch.js
Expand Up @@ -17,12 +17,11 @@
(c) 2010 by jQTouch project members.
See LICENSE.txt for license.
$Revision: 164 $
$Date: Tue Mar 22 17:42:13 EDT 2011 $
$Revision: 165 $
$Date: Wed Mar 23 02:38:26 EDT 2011 $
$LastChangedBy: jonathanstark $
*/

(function($) {
Expand Down Expand Up @@ -325,15 +324,16 @@
}
function hashChangeHandler(e) {
_debug();
if (hist[1] === undefined) {
_debug('There is no previous page in history');
if (location.hash === hist[0].hash) {
_debug('We are on the right panel');
} else {
_debug('We are not on the right panel');
if(location.hash === hist[1].hash) {
goBack();
} else {
_debug(location.hash + ' !== ' + hist[1].hash);
}
}
}
}
}
function init(options) {
_debug();
Expand Down Expand Up @@ -425,20 +425,13 @@
$body.removeClass('portrait landscape').addClass(orientation).trigger('turn', {orientation: orientation});
}
function setHash(hash) {
_debug('setHash is off at the moment');
return;
_debug();

// Trim leading # if need be
hash = hash.replace(/^#/, ''),

// Remove listener
window.onhashchange = null;

// Change hash
location.hash = '#' + hash;

// Add listener
window.onhashchange = hashChangeHandler;

}
function showPageByHref(href, options) {
Expand Down Expand Up @@ -872,11 +865,12 @@
if (jQTSettings.fullScreenClass && window.navigator.standalone == true) {
$body.addClass(jQTSettings.fullScreenClass + ' ' + jQTSettings.statusBar);
}
if (window.navigator.userAgent.match(/Android/ig)) { // Grr... added to postion checkbox labels. Lame I know. - js
if (window.navigator.userAgent.match(/Android/ig)) { // Grr... added to postion checkbox labels. Lame. I know. - js
$body.addClass('android');
}

// Bind events
$(window).bind('hashchange', hashChangeHandler);
$body.bind('touchstart', touchStartHandler)
.bind('click', clickHandler)
.bind('mousedown', mousedownHandler)
Expand All @@ -885,6 +879,7 @@
.bind('tap', tapHandler)
.trigger('orientationchange');


// Determine what the "current" (initial) panel should be
if ($('#jqt > .current').length == 0) {
currentPage = $('#jqt > *:first');
Expand Down

0 comments on commit a961295

Please sign in to comment.