var _DEBUG = true; window.jsonParse=function(){var r="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",k='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';k='(?:"'+k+'*")';var s=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+r+"|"+k+")","g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),u={'"':'"',"/":"/","\\":"\\",b:"\u0008",f:"\u000c",n:"\n",r:"\r",t:"\t"};function v(h,j,e){return j?u[j]:String.fromCharCode(parseInt(e,16))}var w=new String(""),x=Object.hasOwnProperty;return function(h, j){h=h.match(s);var e,c=h[0],l=false;if("{"===c)e={};else if("["===c)e=[];else{e=[];l=true}for(var b,d=[e],m=1-l,y=h.length;m=0;)delete f[i[g]]}return j.call(n, o,f)};e=p({"":e},"")}return e}}(); (function($){$.toJSON=function(o) {if(typeof(JSON)=='object'&&JSON.stringify) return JSON.stringify(o);var type=typeof(o);if(o===null) return"null";if(type=="undefined") return undefined;if(type=="number"||type=="boolean") return o+"";if(type=="string") return $.quoteString(o);if(type=='object') {if(typeof o.toJSON=="function") return $.toJSON(o.toJSON());if(o.constructor===Date) {var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+ hours+':'+minutes+':'+seconds+'.'+milli+'Z"';} if(o.constructor===Array) {var ret=[];for(var i=0;i= 0; i--) { if (/\S/.test(str.charAt(i))) { str = str.substring(0, i + 1); break; } } return str; } App.Ajax.request = function(jedi_method, data, callback) { if ($.inArray(jedi_method, App.Settings.AJAX_SYNCRONOUS) != -1) { if (App.Tmp.AJAX_SYNCRONOUS[jedi_method] == true) { return false; } else { App.Tmp.AJAX_SYNCRONOUS[jedi_method] = true; } } App.Helpers.beforeAjax(jedi_method); $.ajax({ url: App.Helpers.getBackendUrl(), global: false, type: data.request_method || "POST", data: $.extend(data, {'jedi_method': jedi_method}), dataType: "text", async: true, success: function(reply) { if ($.inArray(jedi_method, App.Settings.AJAX_SYNCRONOUS) != -1) { App.Tmp.AJAX_SYNCRONOUS[jedi_method] = false; } reply = reply.replace(/\\'/gi, ''); reply = reply.replace(/\'/gi, ''); reply = jsonParse(reply); if (reply.result == 'NOT_AUTHORISED') { $('#content').html('

Not Authorized

'); App.Helpers.afterAjax(); return App.Actions.authorize(); } callback && callback(reply); App.Helpers.afterAjax(); }, error: function() { App.View.popup('error'); } }); } /** * Timer for profiling */ var timer = {}; timer.start = function() { timer.start_time = new Date(); } timer.stop = function(msg) { timer.stop_time = new Date(); timer.print(msg); } timer.print = function(msg) { var passed = timer.stop_time - timer.start_time; fb.info((msg || '') + ': ' + passed / 1000); }