App-MFILE-WWW

 view release on metacpan or  search on metacpan

share/js/core/ajax.js  view on Meta::CPAN

// The 'ajax' function takes three arguments:
// - MFILE AJAX Object (an object)
// - success callback 
// - failure callback
//
// The success and failure callbacks can be null or undefined, in which case App::MFILE::WWW will
// just display the status text in the #result div (i.e., the line at the bottom of the frame).
// If your AJAX calls needs any other handling than this, you need to provide at least a success
// callback.
//
// In all cases except login/logout, the MFILE AJAX Object looks like this:
// {
//     "method": any HTTP method accepted by the backend server
//     "path": valid path to backend server resource
//     "body": content body to be sent to backend server (can be null)
// }
//
// MFILE AJAX Object for _login_ to backend server:
// {
//     "method": "LOGIN",
//     "path": "login",

share/js/core/datetime.js  view on Meta::CPAN

                return null;
            }
            buf[1] = parseInt(buf[1], 10);
            if (buf[1] > 59) {
                return null;
            }
            return buf[0] * 60 + buf[1];
        },

        tsrangeToDateAndTimeRange = function (tsr) {
            // tsr looks like this: ["2017-10-20 08:00:00+02","2017-10-20 12:00:00+02")
            var date = tsr.match(/\d{4}-\d{2}-\d{2}/)[0];
            return [date, tsrangeToTimeRange(tsr)];
        },

        tsrangeToTimeRange = function (tsr) {
            // tsr looks like this: ["2017-10-20 08:00:00+02","2017-10-20 12:00:00+02")
            var begin, end, h, m, s, re = /\d{2}:\d{2}:\d{2}/;
            [begin, end] = tsr.split(',');
            begin = begin.match(re)[0];
            [h, m, s] = begin.split(':');
            begin = h + ':' + m;
            end = end.match(re)[0];
            [h, m, s] = end.split(':');
            end = h + ':' + m;
            return begin + '-' + end;
        },



( run in 0.402 second using v1.01-cache-2.11-cpan-64827b87656 )