function join_site(action){ switch(action){ case 1: case 'getting_started': $.cookie('join_getting_started', 1); break; }//sw var next_click = '#getting_started_btn'; if($.cookie('join_getting_started')){//'quiz': next_click = '#quiz_btn'; } if(false/*quiz iz taken*/){//'core_rules': next_click = '#core_rules_btn'; } if(false/*core rules have been read*/){//'player_stuff': next_click = '#player_stuff_btn'; } if(false/*player stuff is in cookie to be submitted*/){//'human_stuff': next_click = '#human_stuff_btn'; } if(false/*player is logged in*/){//'whats_next': next_click = '#whats_next_btn'; } $(next_click).click(); }//join_site function submit_question(id, axis_lable, answer){ console.log('submit_question', id + ' : ' + axis_lable + ' : ' + answer); }//submit_question function model_quiz_axisquestion(id, axis_lable){ var html = ''; switch(axis_lable){ case 'axis_a': html += "Based on how risky this is, would you do it?"; break; case 'axis_b': html += "Based on how mush effort this takes, would you do it?"; break; case 'axis_c': html += "Based on how freaky this is, would you do it?"; break; case 'axis_d': html += "Based on how sex-oriented this is, would you do it?"; break; }//sw html += '
'+ '' + '' + '' + '' + '' ; return html; }//model_quiz_axisquestion function model_quiz_question(num, victim, add_class){ //console.log('model_quiz_question', victim); /* id description axis_a-d 'quiz_value' => array('easy' => 1, 'probably' => .75, 'maybe' => .5, 'probablynot' => .25, 'not' => 0), */ var html = '
'+ //'#'+num+ '
'+victim.description+'
'+ '
' + model_quiz_axisquestion(num, 'axis_a') + '
' + '
' + model_quiz_axisquestion(num, 'axis_b') + '
' + '
' + model_quiz_axisquestion(num, 'axis_c') + '
' + '
' + model_quiz_axisquestion(num, 'axis_d') + '
' + '
'; html += '' + ''; return html; }//model_quiz_question function populate_panel(which, refresh){ console.log('populate_panel:' + which); if(typeof(refresh) != 'undefined' && refresh){ player_refresh(function(){populate_panel(which)}); return true; }//refresh switch(which){ case 'getting_started': break; case'quiz': show_panel('#quiz_explanation_panel', 'pop'); $('#quiz_questions_panel').html('QUIZ LOADING'); $.ajax({type: 'POST', url: "api/index.php",//worried that this is relative and not absolute, but absolute gets a 301 error data: {'action' : 'quiz_get', 'output' : 'json',/*~jsonp?~*/ }, success: function(data){ if(data.confirm){ console.log('confirm', data); //clear quiz cookie var returner = ''; for(var line in data.data){ returner += model_quiz_question(line, data.data[line]); }//for $('#quiz_questions_panel').html(returner); //click first qestion show_panel('#quiz_question0', 'pop'); }else{ pop_over(data.message); }//if confirm },//success error : function(data){ console.log('quiz_get error'); }, dataType: 'json'/*~jsonp?~*/ });//ajax break; case'core_rules': break; case'player_stuff': break; case'human_stuff': break; case'whats_next': break; }//sw }//populate_panel $(document).ready( function() { console.log('join_js.ready start'); $('.prepanel_btn').click(function(event){ var what = event.target.id.substr(0, event.target.id.lastIndexOf('_')); $('#' + what + '_btn').addClass('btn_highlight'); $('#' + what + '_btn').siblings().removeClass('btn_highlight'); show_panel('#' + what + '_panel', 'pop'); }); panels = ['getting_started', 'quiz', 'core_rules', 'player_stuff', 'human_stuff', 'whats_next']; first_panel = 'getting_started'; for(var c in panels){ if(location.hash.substr(1) == panels[c]){ first_panel = panels[c].valueOf(); }//if populate_panel(panels[c]); }//for $('#'+first_panel+'_btn').click(); });//doc.ready/////////////