diff -r 09006594d51d -r 5d1908d87db8 src/firefoxos/main.js --- a/src/firefoxos/main.js Tue Apr 23 22:01:36 2013 +0200 +++ b/src/firefoxos/main.js Fri Apr 26 19:10:52 2013 +0200 @@ -29,12 +29,46 @@ //$.mobile.ajaxLinksEnabled = false; //}); $(document).on("mobileinit", function() { - $.extend( $.mobile , { + $.extend($.mobile, { pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' }); }); //$(document).on("pageinit", function() { //}); +$(document).on("pageinit", "[data-role='page'].oc-swipage", function() { + var makepage = "#" + $(this).attr("id"), + next = $(this).jqmData("next"), // Next page stored in data-next + prev = $(this).jqmData("prev"); // Previous page stored in data-prev + + if (next) { // Check if data-next attribute is indeed set + //// Prefetch next page + //$.mobile.loadPage(next); + // Navigate to next page on swipe left + $(document).on("swipeleft", makepage, function(inev) { + inev.stopImmediatePropagation(); + $.mobile.changePage(next, {transition: "slide"}); + }); + } + else { // If data-next not set then default to history + $(document).on("swipeleft", makepage, function(inev) { + inev.stopImmediatePropagation(); + window.history.forward({transition: "slide"}); + }); + } + if (prev) { // Check if data-prev attribute is set + $(document).on("swiperight", makepage, function(inev) { + inev.stopImmediatePropagation(); + $.mobile.changePage(prev, {transition: "slide", reverse: true}); + }); + } + else { // If data-prev not set then default to history + $(document).on("swiperight", makepage, function(inev) { + inev.stopImmediatePropagation(); + //history.back(); // or window.history.back(); + $.mobile.back({transition: "slide", reverse: true}); + }); + } +}); // the main logical entry point function otpwcalc() {