// console.log('footer_js.php'); console.log('player>>>>', typeof(player) == 'undefined' ? 'NO PLAYER DEFINED' : player); function assemble_date(prefix, output, local){ var d = new Date(); var whiches = Array('y', 'm', 'd', 'h', 'i', 's', 'z'); var stack = {}; for(which in whiches){ var preval = parseFloat($('[name="' + prefix + '_' + whiches[which] + '"]').val()); stack[whiches[which]] = isNaN(preval) ? 0 : preval; }//for if(typeof(local) != 'undefined' && local){ d.setFullYear(stack.y); d.setMonth(stack.m - 1); d.setDate(stack.d); d.setHours(stack.h + stack.z); d.setMinutes(stack.i); d.setSeconds(stack.s); }else{ d.setUTCFullYear(stack.y); d.setUTCMonth(stack.m - 1); d.setUTCDate(stack.d); d.setUTCHours(stack.h + stack.z); d.setUTCMinutes(stack.i); d.setUTCSeconds(stack.s); }//if local switch(output){ case 'object': return d; break; case 'utc_seconds': default: return Math.round(d.getTime() / 1000); break; }//sw }//assemble_date function captcha_get(victim){ console.log('captcha_get'); if(typeof(victim) == 'undefined'){ victim = $('.captcha_block'); }else if(typeof(victim) == 'string'){ victim = $(victim); }//if if(typeof(victim) == 'object' && victim.length > 0){ $.ajax({type: 'POST', url: "api/index.php",//worried that this is relative and not absolute, but absolute gets a 301 error-- maybe has to do with the jsonp? data: {'action' : 'captcha_get', 'output' : 'json'}, success: function(data){ if(data.confirm){ $(victim).children('.captcha_image').attr('src', data.data); }else{ pop_over(data.message); }//if confirm }, error : function(data){ console.log('captcha_get error'); }, dataType: 'json'/*~jsonp?~*/ });//ajax }//if victim }//captcha_get var copy_months = {"1":"Jan","2":"Feb","3":"Mar","4":"Apr","5":"May","6":"Jun","7":"Jul","8":"Aug","9":"Sep","10":"Oct","11":"Nov","12":"Dec"}; function decode_date(time_stamp, format){ var date; if(isNaN(Number(time_stamp))){ date = new Date(time_stamp); }else{ date = new Date(time_stamp * 1000); }//if if(typeof(format) != 'string'){ format = "M d, YYYYY h:i"; }//if switch(format){ case 'js': return date.toLocaleString(); break; case 'M d, YYYYY h:i': default: return copy_months[date.getMonth()+1] + ' '+date.getDate()+', '+date.getFullYear()+' '+date.getHours()+':'+date.getMinutes(); break; }//sw }//decode_date function id(victim){ switch(typeof(victim)){ case 'boolean': return victim ? 1:0; break; case 'number': return victim; break; case 'object': return id(victim.id); break; case 'string': return parseInt(victim); break; case 'undefined': default: return -1; break; }//sw }//id function log_in(){ console.log('log_in'); pop_over('
NOT A MEMBER?
SIGN UP
' + '
'+ ''+ ''+ 'u:
'+ 'p:
'+ 'LOST LOG-IN' + '
',//html "LOG IN",//btn_lable function(){ $.ajax({"type": "POST", "dataType" : 'json', "url": "api/index.php", "data": {"output":"json", "action" : "log_in", 'user_name' : $('#log_in_form [name="user_name"]').val(), 'password' : $('#log_in_form [name="password"]').val() }, //data "success" : function(data){ if(data.confirm){ console.log("SUCCESS from API"); console.log(data); $.cookie('auth',data.data, { expires: 14, path: '/', domain: "www.instigation.net" }); }//if if(typeof(data.header) != 'undefined'){ //console.log( data.header.substr(9)); window.location = data.header.substr(9); }else if(typeof(data.message) != 'undefined'){ pop_over(data.message); } }, "error" : function(data){ console.log("error"); console.log(data); pop_over("internal error"); } });//ajax },//confirm function 'pop_over_log_in'//class );//pop_over }//log_in function log_out(){ console.log('log_out'); $.ajax({"type": "POST", "dataType" : 'json', "url": "api/index.php", "data": {"output":"json", "action" : "log_out" }, //data "success" : function(data){ if(data.confirm){ console.log("SUCCESS from API"); console.log(data); $.cookie('auth', '', { expires: -1, path: '/', domain: "www.instigation.net" }); if(typeof(data.header) != 'undefined'){ window.location = data.header.substr(9); } }else{ pop_over(data.message); } }, "error" : function(data){ console.log("error"); console.log(data); pop_over("internal error"); } });//ajax }//log_out function lost_log_in(){ console.log('lost_log_in'); pop_over('
'+ ''+ ''+ 'u: or '+ 'p:
-and-
'+ 'email:
-or-
'+ 'first:'+ 'last:'+ 'city:'+ 'state:'+ 'phone:' + '
',//html "SEND IT",//btn_lable function(){ $.ajax({"type": "POST", "dataType" : 'json', "url": "api/index.php", "data": {"output":"json", "action" : "lost_log_in", 'user_name' : $('#lost_log_in_form [name="user_name"]').val(), 'password' : $('#lost_log_in_form [name="password"]').val(), 'email' : $('#lost_log_in_form [name="email"]').val(), 'first_name' : $('#lost_log_in_form [name="first_name"]').val(), 'last_name' : $('#lost_log_in_form [name="last_name"]').val(), 'city' : $('#lost_log_in_form [name="city"]').val(), 'state' : $('#lost_log_in_form [name="state"]').val(), 'phone' : $('#lost_log_in_form [name="phone"]').val() }, //data "success" : function(data){ console.log(data); pop_over(data.message); }, "error" : function(data){ console.log("error"); console.log(data); pop_over("internal error"); } });//ajax },//confirm function 'pop_over_lost_log_in'//class );//pop_over }//lost_log_in function player_refresh(after){ console.log('player_refresh'); $.ajax({type: 'POST', url: "api/index.php",//worried that this is relative and not absolute, but absolute gets a 301 error data: {'action' : 'get', 'output' : 'json',/*~jsonp?~*/ 'type' : 'player', 'src' : {'id' : player.id}, 'deep' : 3}, success: function(data){ if(data.confirm){ player = data.data; console.log(player); if(typeof(after) == 'function'){ after(); }//if }else{ pop_over(data.message); }//if confirm },//success error : function(data){ console.log('player_refresh error'); }, dataType: 'json'/*~jsonp?~*/ });//ajax }//player_refresh var pop_over_float = {'html': null, 'btn_lable': null, 'confirm': null, 'addclass': null}; function pop_over(html, btn_lable, confirm, addclass){ console.log('pop_over'); //console.log(html); if($('#pop_over_general').css('display') == 'none'){ spinner_end(); //addclass// if(addclass == null || typeof(addclass) == 'undefined' || addclass.length < 1){ $('#pop_over_general').removeClass(); }else if(typeof(addclass) == 'string'){ $('#pop_over_general').addClass(addclass); }//if addclass //confirm// $('#pop_over_general #confirm_btn').unbind('click'); if(typeof(confirm) != 'function' ){ confirm = function(event) { event.preventDefault(); pop_over(); }; }//if $('#pop_over_general #confirm_btn').click(confirm); //btn_lable// if(typeof(btn_lable) == 'undefined'){ btn_lable = "CONFIRM"; } if(btn_lable != null && typeof(btn_lable) == 'string' && btn_lable.length > 0 ){ $('#pop_over_general #confirm_btn').show(); $('#pop_over_general #confirm_btn').html(btn_lable); }else{ $('#pop_over_general #confirm_btn').hide(); } //html// if(typeof(html) == 'undefined' || html.length < 1){ $('#pop_over_general #content').html(null); $('#pop_over_general').hide();//animate it away here }else{ $('#pop_over_general #content').html(html); $('#pop_over_general').show();//animate it in here }//ifhtml //captcha refresh// if($('#pop_over_general').find('.captcha_block').length){ captcha_get($('#pop_over_general').find('.captcha_block')); }// }else{ pop_over_float.html = html; pop_over_float.btn_lable = btn_lable; pop_over_float.confirm = confirm; pop_over_float.addclass = addclass; $('#pop_over_general').hide({'complete' : function(){ pop_over(pop_over_float.html, pop_over_float.btn_lable, pop_over_float.confirm, pop_over_float.addclass); }//complete });//animate it away here }//if pop_over display }//pop_over function show_panel(victim, which){ console.log('show_panel:' + victim +', '+which); if(typeof(victim) == 'string'){ victim = $(victim); }//if if(typeof(victim) == 'object' && victim.length > 0){ switch(which){ case 'pop': default: $(victim).siblings().hide(); $(victim).show(); break; }//sw }//if victim }//show_panel function spinner_start(){ $('#spinner_general').show();//animate it in here }//spinner_start function spinner_end(){ $('#spinner_general').hide();//animate it away here }//spinner_end function val_match_confirm(subject){ var name = $(subject).attr('name'); var compare; if(name.substr(-8) == '_confirm'){ name = name.substr(0, name.length - 8); compare = $(subject).siblings('[name="'+name+'"]').val(); }else{ compare = $(subject).siblings('[name="'+name+'_confirm"]').val(); }//if if($(subject).val() == compare){ $(subject).siblings('.'+name+'_val_match_confirm').show(); $(subject).siblings('.'+name+'_val_match_deny').hide(); }else{ $(subject).siblings('.'+name+'_val_match_confirm').hide(); $(subject).siblings('.'+name+'_val_match_deny').show(); }//if }//val_match_confirm $(document).ready( function() { console.log('footer_js.php, doc.ready-------' + "10:39:55"); spinner_end(); $('#pop_over_general #close_btn').click(function(){pop_over();}); $('.val_match_confirm_changer').change(function(event){ val_match_confirm($(event.target) ); });//on change //captcha_get(); console.log('footer_js.php, doc.ready end'); });//doc.ready/////////////