src/firefoxos/help/help.js

Wed, 05 Jun 2013 19:51:25 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 05 Jun 2013 19:51:25 +0200
changeset 8
9b8205e1e4a4
parent 4
5d1908d87db8
permissions
-rw-r--r--

Update JQuery core logic to current minified version 1.10.1.

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

mercurial