1.1 --- a/src/firefoxos/main.js Tue Apr 23 22:01:36 2013 +0200 1.2 +++ b/src/firefoxos/main.js Fri Apr 26 19:10:52 2013 +0200 1.3 @@ -29,12 +29,46 @@ 1.4 //$.mobile.ajaxLinksEnabled = false; 1.5 //}); 1.6 $(document).on("mobileinit", function() { 1.7 - $.extend( $.mobile , { 1.8 + $.extend($.mobile, { 1.9 pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' 1.10 }); 1.11 }); 1.12 //$(document).on("pageinit", function() { 1.13 //}); 1.14 +$(document).on("pageinit", "[data-role='page'].oc-swipage", function() { 1.15 + var makepage = "#" + $(this).attr("id"), 1.16 + next = $(this).jqmData("next"), // Next page stored in data-next 1.17 + prev = $(this).jqmData("prev"); // Previous page stored in data-prev 1.18 + 1.19 + if (next) { // Check if data-next attribute is indeed set 1.20 + //// Prefetch next page 1.21 + //$.mobile.loadPage(next); 1.22 + // Navigate to next page on swipe left 1.23 + $(document).on("swipeleft", makepage, function(inev) { 1.24 + inev.stopImmediatePropagation(); 1.25 + $.mobile.changePage(next, {transition: "slide"}); 1.26 + }); 1.27 + } 1.28 + else { // If data-next not set then default to history 1.29 + $(document).on("swipeleft", makepage, function(inev) { 1.30 + inev.stopImmediatePropagation(); 1.31 + window.history.forward({transition: "slide"}); 1.32 + }); 1.33 + } 1.34 + if (prev) { // Check if data-prev attribute is set 1.35 + $(document).on("swiperight", makepage, function(inev) { 1.36 + inev.stopImmediatePropagation(); 1.37 + $.mobile.changePage(prev, {transition: "slide", reverse: true}); 1.38 + }); 1.39 + } 1.40 + else { // If data-prev not set then default to history 1.41 + $(document).on("swiperight", makepage, function(inev) { 1.42 + inev.stopImmediatePropagation(); 1.43 + //history.back(); // or window.history.back(); 1.44 + $.mobile.back({transition: "slide", reverse: true}); 1.45 + }); 1.46 + } 1.47 +}); 1.48 1.49 // the main logical entry point 1.50 function otpwcalc() {