Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/user_date.min.js |
define ("core/user_date",["jquery","core/ajax","core/sessionstorage","core/config"],function(a,b,c,d){var e={},f=function(b){var c=a("html").attr("lang").replace(/-/g,"_");return"core_user_date/"+c+"/"+d.usertimezone+"/"+b.timestamp+"/"+b.format},g=function(a){return c.get(a)},h=function(a,b){c.set(a,b)},i=function(a){return"undefined"!=typeof e[a]},j=function(a){return e[a]},k=function(a,b){e[a]=b},l=function(a){var c=a.map(function(a){var b=a.hasOwnProperty("fixday")?a.fixday:1,c=a.hasOwnProperty("fixhour")?a.fixhour:1;return{timestamp:a.timestamp,format:a.format,type:a.type||"",fixday:b,fixhour:c}}),e={methodname:"core_get_user_dates",args:{contextid:d.contextid,timestamps:c}};return b.call([e],!0,!0)[0].then(function(b){b.dates.forEach(function(b,c){var d=a[c],e=f(d);h(e,b);d.deferred.resolve(b)})}).catch(function(b){a.forEach(function(a){a.deferred.reject(b)})})};return{get:function get(b){var c=[],d=[];b.forEach(function(b){var e=f(b);if(i(e)){d.push(j(e))}else{var h=a.Deferred(),l=g(e);if(l){h.resolve(l)}else{b.deferred=h;c.push(b)}k(e,h.promise());d.push(h.promise())}});if(c.length){l(c)}return a.when.apply(a,d).then(function(){return 1===arguments.length?[arguments[0]]:Array.apply(null,arguments)})},getUserMidnightForTimestamp:function getUserMidnightForTimestamp(a,b){var c=a>b,d=Math.abs(a-b),e=c?Math.floor(d/86400):Math.ceil(d/86400),f=e*86400,g=c?b+f:b-f;return g}}}); //# sourceMappingURL=user_date.min.js.map