| |
1 /* |
| |
2 * OTPWCalc - One time password challenge response calculator client |
| |
3 * Copyright © 2013 Michael Schloh von Bennewitz <michael@schloh.com> |
| |
4 * |
| |
5 * OTPWCalc is free software: you can redistribute it and/or modify |
| |
6 * it under the terms of the European Union Public Licence, either |
| |
7 * version 1.1 of the license, or (at your option) any later version. |
| |
8 * |
| |
9 * OTPWCalc is distributed in the hope that it will be useful, |
| |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty |
| |
11 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| |
12 * the European Union Public License for more details. |
| |
13 * |
| |
14 * You should have received a copy of the European Union Public |
| |
15 * Licence along with OTPWCalc. If not, please refer to |
| |
16 * <http://joinup.ec.europa.eu/software/page/eupl/>. |
| |
17 * |
| |
18 * This file is part of project OTWPCalc, a one time password challenge |
| |
19 * response calculator client and is found at http://otpwcalc.europalab.com/ |
| |
20 * |
| |
21 * help.js: ECMA JavaScript implementation |
| |
22 */ |
| |
23 |
| |
24 // <![CDATA[ |
| |
25 //// This doesn't work with AJAX (use pageinit instead) |
| |
26 //// That means JavaScript in the head of any other HTML |
| |
27 //// will be ignored, only the data-role="page" is parsed |
| |
28 //$(document).ready(function() { |
| |
29 //$.mobile.ajaxLinksEnabled = false; |
| |
30 //}); |
| |
31 $(document).on("mobileinit", function() { |
| |
32 $.extend( $.mobile , { |
| |
33 pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.' |
| |
34 }); |
| |
35 //$("#pageid").on("pagebeforeshow", function(event, data) { |
| |
36 // alert("the previous page was: " + data.prevPage.attr("id")); |
| |
37 //}); |
| |
38 }); |
| |
39 $(document).on("pageinit", "[data-role='page'].type-interior", function() { |
| |
40 $(".ui-collapsible[data-allow-collapse=false]").off("expand collapse"); |
| |
41 }); |
| |
42 $(document).on("pageinit", "[data-role='page'].oc-swipage", function() { |
| |
43 var makepage = "#" + $(this).attr("id"), |
| |
44 next = $(this).jqmData("next"), // Next page stored in data-next |
| |
45 prev = $(this).jqmData("prev"); // Previous page stored in data-prev |
| |
46 |
| |
47 if (next) { // Check if data-next attribute is indeed set |
| |
48 //// Prefetch next page |
| |
49 //$.mobile.loadPage(next); |
| |
50 // Navigate to next page on swipe left |
| |
51 $(document).on("swipeleft", makepage, function(inev) { |
| |
52 inev.stopImmediatePropagation(); |
| |
53 $.mobile.changePage(next, {transition: "slide"}); |
| |
54 }); |
| |
55 } |
| |
56 else { // If data-next not set then default to history |
| |
57 $(document).on("swipeleft", makepage, function(inev) { |
| |
58 inev.stopImmediatePropagation(); |
| |
59 window.history.forward({transition: "slide"}); |
| |
60 }); |
| |
61 } |
| |
62 if (prev) { // Check if data-prev attribute is set |
| |
63 $(document).on("swiperight", makepage, function(inev) { |
| |
64 inev.stopImmediatePropagation(); |
| |
65 $.mobile.changePage(prev, {transition: "slide", reverse: true}); |
| |
66 }); |
| |
67 } |
| |
68 else { // If data-prev not set then default to history |
| |
69 $(document).on("swiperight", makepage, function(inev) { |
| |
70 inev.stopImmediatePropagation(); |
| |
71 //history.back(); // or window.history.back(); |
| |
72 $.mobile.back({transition: "slide", reverse: true}); |
| |
73 }); |
| |
74 } |
| |
75 }); |