//-- function ajxh(s){var r='';if(s.match(/(\X[0-9]{1}.$)/gm)) {s=s.replace(new RegExp("\X","g"),"");for(i=0; i div"); // if( d!=null) { d.insertAdjacentHTML("beforeend","
"+q+"
"); } // var ajaxOpts = { //type :(!oundef(opts,"type")?opts["type"]:"POST"), type :(typeof(opts)=='object'&&typeof(opts.type)!='undefined'?opts["type"]:"POST"), //contentType:(!oundef(opts,"contentType")?opts.contentType:"application/x-www-form-urlencoded; charset=UTF-8"), contentType:(typeof(opts)=='object'&&typeof(opts.contentType)!='undefined'?opts.contentType:"application/x-www-form-urlencoded; charset=UTF-8"), //crossDomain:(!oundef(opts,'crossdomain')?opts['crossdomain']:false), crossDomain:(typeof(opts)=='object'&&typeof(opts.crossdomain)!='undefined'?opts["crossdomain"]:false), url :ajxh(r), data :ajxh(q), success : function(data, textStatus, response) { //console.warn("other.js=>ajx() respnose",response); //-- global check on all requests because all use ajx() if missing credentials then redirect to login. if(data.toLowerCase().match(/error/i)) { //-- Debug iPhone :x /*console.warn("AJX() ERROR textStatus",textStatus); console.warn("AJX() ERROR data",data); console.warn("AJX() ERROR response",response); return;*/ // var json = {}; try { json = JSON.parse(data); //if(!oundef(json,"noredirect") || (typeof(v_noredirect)!='undefined' && v_noredirect)) { if(typeof(json)=='object' && typeof(json.noredirect)!='undefined' || (typeof(v_noredirect)!='undefined' && v_noredirect)) { } else { //if(!oundef(json,"error") && json.error==-999 && !undef(g_s1url) && !(document.location.href).match(/login$|login\/$/) && uidr==0) { //-- required credentials, redirect to login page. if(typeof(json)=='object' && typeof(json.error)!='undefined' && json.error==-999 && typeof(g_s1url)!='undefined' && !(document.location.href).match(/login$|login\/$/) && uidr==0) { //-- required credentials, redirect to login page. console.warn("DEBUG but should redirect to login!"); //document.location.href = "/"+g_s1url+"/login/"; return; } } } catch(E) { console.warn("other.js -> ajx() -> JSON not supported on req: "+q+". Continuing..."); } //return false; //console.warn("other.js -> ajx() -> continuing..."); } //-- if (f.length==1) f(data); else if(f.length==2) f(data, textStatus); else if(f.length==3) f(data, textStatus, response); else f(); }, error : function(response, textStatus, errorThrown) { //-- Debug iPhone :x /*console.warn("AJX() ERROR textStatus",textStatus); console.warn("AJX() ERROR errorThrown",errorThrown); console.warn("AJX() ERROR response",response);*/ //if(!oundef(opts,"on_error")) { if( typeof(opts)=='object' && typeof(opts.on_error)!='undefined') { opts.on_error(response,textStatus,errorThrown); } }, }; if( typeof(opts)=='object' && typeof(opts["headers"])!='undefined') { ajaxOpts["headers"] = opts.headers; } if( typeof(opts)=='object' && typeof(opts["dataType"])!='undefined') { ajaxOpts["dataType"] = opts.dataType; } if( typeof(opts)=='object' && typeof(opts["withCredentials"])!='undefined' && opts.withCredentials ) { console.info("ajx() => Enabling withCredentials!"); ajaxOpts["xhrFields"] = { withCredentials: true } } var XHR = $.ajax(ajaxOpts); return XHR; } //-- // var LokkaLHighlights = function( opts ) { // var opt_displayTo = ( typeof(opts)=='object' && typeof(opts['displayTo'])!='undefined'?opts.displayTo:false ); var opt_rdomain = ( typeof(opts)=='object' && typeof(opts['rdomain'])!='undefined'?opts.rdomain:"https://www.lokkal.com" ); var opt_rpath = ( typeof(opts)=='object' && typeof(opts['rpath'])!='undefined'?opts.rpath:"/rest/shalomsanmiguel/index.php" ); // this.init = function() { // ajx(opt_rdomain+opt_rpath,"get_event_highlights=1", function(response) { console.info("get_event_highlights",response); var json = JSON.parse(response); if( json.success==false ) { console.warn("Retrive of event highlights Failed!",response); return false; } // var data = json.data; // data.res1 and data.res2 // for(var i=0; i