src/firefoxos/main.js

changeset 8
9b8205e1e4a4
parent 0
6a0957738c54
equal deleted inserted replaced
0:ba46118cad40 1:2d8c9b5d6df4
27 //// will be ignored, only the data-role="page" is parsed 27 //// will be ignored, only the data-role="page" is parsed
28 //$(document).ready(function() { 28 //$(document).ready(function() {
29 //$.mobile.ajaxLinksEnabled = false; 29 //$.mobile.ajaxLinksEnabled = false;
30 //}); 30 //});
31 $(document).on("mobileinit", function() { 31 $(document).on("mobileinit", function() {
32 $.extend( $.mobile , { 32 $.extend($.mobile, {
33 pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' 33 pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.'
34 }); 34 });
35 }); 35 });
36 //$(document).on("pageinit", function() { 36 //$(document).on("pageinit", function() {
37 //}); 37 //});
38 $(document).on("pageinit", "[data-role='page'].oc-swipage", function() {
39 var makepage = "#" + $(this).attr("id"),
40 next = $(this).jqmData("next"), // Next page stored in data-next
41 prev = $(this).jqmData("prev"); // Previous page stored in data-prev
42
43 if (next) { // Check if data-next attribute is indeed set
44 //// Prefetch next page
45 //$.mobile.loadPage(next);
46 // Navigate to next page on swipe left
47 $(document).on("swipeleft", makepage, function(inev) {
48 inev.stopImmediatePropagation();
49 $.mobile.changePage(next, {transition: "slide"});
50 });
51 }
52 else { // If data-next not set then default to history
53 $(document).on("swipeleft", makepage, function(inev) {
54 inev.stopImmediatePropagation();
55 window.history.forward({transition: "slide"});
56 });
57 }
58 if (prev) { // Check if data-prev attribute is set
59 $(document).on("swiperight", makepage, function(inev) {
60 inev.stopImmediatePropagation();
61 $.mobile.changePage(prev, {transition: "slide", reverse: true});
62 });
63 }
64 else { // If data-prev not set then default to history
65 $(document).on("swiperight", makepage, function(inev) {
66 inev.stopImmediatePropagation();
67 //history.back(); // or window.history.back();
68 $.mobile.back({transition: "slide", reverse: true});
69 });
70 }
71 });
38 72
39 // the main logical entry point 73 // the main logical entry point
40 function otpwcalc() { 74 function otpwcalc() {
41 var secr = $('#paswrd').val(); 75 var secr = $('#paswrd').val();
42 var user = $('#seedid').val(); 76 var user = $('#seedid').val();

mercurial