src/tizen/help/help.js

changeset 14
d1b294812560
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/tizen/help/help.js	Wed Jul 31 19:48:00 2013 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +/*
     1.5 + * OTPWCalc - One time password challenge response calculator client
     1.6 + * Copyright © 2013 Michael Schloh von Bennewitz <michael@schloh.com>
     1.7 + * 
     1.8 + * OTPWCalc is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the European Union Public Licence, either
    1.10 + * version 1.1 of the license, or (at your option) any later version.
    1.11 + * 
    1.12 + * OTPWCalc is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty
    1.14 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
    1.15 + * the European Union Public License for more details.
    1.16 + * 
    1.17 + * You should have received a copy of the European Union Public
    1.18 + * Licence along with OTPWCalc. If not, please refer to
    1.19 + * <http://joinup.ec.europa.eu/software/page/eupl/>.
    1.20 + * 
    1.21 + * This file is part of project OTWPCalc, a one time password challenge
    1.22 + * response calculator client and is found at http://otpwcalc.europalab.com/
    1.23 + * 
    1.24 + * help.js: ECMA JavaScript implementation
    1.25 + */
    1.26 +
    1.27 +// <![CDATA[
    1.28 +//// This doesn't work with AJAX (use pageinit instead)
    1.29 +//// That means JavaScript in the head of any other HTML
    1.30 +//// will be ignored, only the data-role="page" is parsed
    1.31 +//$(document).ready(function() {
    1.32 +    //$.mobile.ajaxLinksEnabled = false;
    1.33 +//});
    1.34 +$(document).on("mobileinit", function() {
    1.35 +    $.extend( $.mobile , {
    1.36 +        pageLoadErrorMessage: 'Either the page cannot be found or it cannot be loaded.'
    1.37 +    });
    1.38 +    //$("#pageid").on("pagebeforeshow", function(event, data) {
    1.39 +    //    alert("the previous page was: " + data.prevPage.attr("id"));
    1.40 +    //});
    1.41 +});
    1.42 +$(document).on("pageinit", "[data-role='page'].type-interior", function() {
    1.43 +    $(".ui-collapsible[data-allow-collapse=false]").off("expand collapse");
    1.44 +});
    1.45 +$(document).on("pageinit", "[data-role='page'].oc-swipage", function() {
    1.46 +    var makepage = "#" + $(this).attr("id"),
    1.47 +        next = $(this).jqmData("next"),  // Next page stored in data-next
    1.48 +        prev = $(this).jqmData("prev");  // Previous page stored in data-prev
    1.49 +
    1.50 +    if (next) {  // Check if data-next attribute is indeed set
    1.51 +        //// Prefetch next page
    1.52 +        //$.mobile.loadPage(next);
    1.53 +        // Navigate to next page on swipe left
    1.54 +        $(document).on("swipeleft", makepage, function(inev) {
    1.55 +            inev.stopImmediatePropagation();
    1.56 +            $.mobile.changePage(next, {transition: "slide"});
    1.57 +        });
    1.58 +    }
    1.59 +    else {  // If data-next not set then default to history
    1.60 +        $(document).on("swipeleft", makepage, function(inev) {
    1.61 +            inev.stopImmediatePropagation();
    1.62 +            window.history.forward({transition: "slide"});
    1.63 +        });
    1.64 +    }
    1.65 +    if (prev) {  // Check if data-prev attribute is set
    1.66 +        $(document).on("swiperight", makepage, function(inev) {
    1.67 +            inev.stopImmediatePropagation();
    1.68 +            $.mobile.changePage(prev, {transition: "slide", reverse: true});
    1.69 +        });
    1.70 +    }
    1.71 +    else {  // If data-prev not set then default to history
    1.72 +        $(document).on("swiperight", makepage, function(inev) {
    1.73 +            inev.stopImmediatePropagation();
    1.74 +            //history.back();  // or window.history.back();
    1.75 +            $.mobile.back({transition: "slide", reverse: true});
    1.76 +        });
    1.77 +    }
    1.78 +});

mercurial