-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquicksearch.html
More file actions
31 lines (25 loc) · 84.7 KB
/
quicksearch.html
File metadata and controls
31 lines (25 loc) · 84.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<html>
<head>
</head>
<body style="background: transparent;">
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/lunr.min.js"></script>
<script src="scripts/fulltext-search.js"></script>
<script type="text/x-docstrap-searchdb">
{"app.js.html":{"id":"app.js.html","title":"Source: app.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: app.js /** * @fileoverview * This module sets up a global object used in the application * It also has the global non page-specific setup for the site pages * I contains function for: * - banner creation and event linking * * Places of interest as of 24Jan16 * - See {@link module:app/appLib} for all "lib" interaction * - [Navigation Bar]{@link module:app~loginNavBar} * @module app * @return {Object} object with specific initialization and data handling for ISIB */ define([ 'jquery', 'appLib', 'cookie', 'blockUI', 'jqueryUI', 'validate', 'tooltipster'], function($, lib){ var app, objCategories = {}, testBtnDialog, defaultTheme = 'ui-lightness', app_engine = "cgi-bin/engine.py", default_avatar = 'assets/css/images/anon_user.png', selectMenuOpt = { width: '65%'}, tabOptions = { active: false, collapsible: true, heightStyle: 'content', hide: { effect: "explode", duration: 1000 }, show: { effect: "slide", duration: 800 } }; /** * @method init * @desc Initialization function for all pages * @param {string} page code name for current pages * @return {boolean} If true show the login window */ var init = function(page){ var returnValue, showLogin = false; // if not logged in send to login page user = this.getCookie('user'); this.currentPage = page; // ensure player is logged in showLogin = this.ensureLogin(page, user); // Initalize app setup functions this.setTheme(); this.navBar(page); // show active page $('.main-nav li').removeClass(); $('#' + page).addClass('ui-state-active pageLinks'); // page specific initialization switch (page) { case 'home': $('.signin-message').toggle((user === undefined)); $("#reset-tab").toggle(); returnValue = showLogin; break; case 'game': $(".sel").selectmenu(selectMenuOpt); // load category selectmenu this.getCategories(); this.accordion = $("#accordion").accordion({ heightStyle: 'content', collapsable: true}); $("#debateResults").toggle(); // create counter for sub-category templates $(document).data("tempCount",0); // hide result pane till necessary $('.debateVote').toggle(); $('#gameWait').toggle(); $('h3:contains("Game Results")').toggle(); $("h3:contains('Pre Game')").toggle(); // create param tabs $('#paramOptions').tabs(tabOptions); break; case 'admin': // load category selectmenu this.getCategories(); $('select').selectmenu(selectMenuOpt); // create counter for sub-category templates $(document).data("tempCount",0); break; case 'feedback': optCategory = { change: function(){ // validate select $(this).closest('form').validate().element(this); } }; settings = $.extend({}, selectMenuOpt, optCategory); $(".sel").selectmenu(settings); $("input").not('[type=submit]').width('110%'); break; default: } // jquery-fy page with Page Stylings $("input[type=submit]").button(); $("input[type=button]").button(); // final page setup // add event listener for logout this.logout(); this.setFooter(); this.rankInfo(); // initialize agreement module this.agreement(); return returnValue; }; /** * @method ensureLogin * @desc Use window location information to determine if login flag is needed */ function ensureLogin(page, user){ locParams = window.location; paths = locParams.pathname.split('/'); webPage = paths[paths.length - 1]; search = locParams.search.split('?')[1]; showLogin = (webPage === this.pages.home && search !== undefined); // pages allowed to be viewed without logging in allowedPages = ['home', 'feedback', 'about']; // is current page on the VIP list? if (-1 == $.inArray(page, allowedPages) && !showLogin){ // set location to home page with login flag if (user === undefined) window.location.assign(this.pages.home + "?true"); } return showLogin; } /** * @method setFooter * @desc Universal function to create the footer * Uses template string from library to load footer {@link module:app/appLib~getFooterText} */ function setFooter(){ // NOTE: ids/classes are important progmatically (caution when changing) // wrap the content of the body with a container and wrap that with container to accomodate the footer stylings $('body').wrapInner("<div id='content'></div>"); $('#content').wrap('<div id="container" />'); $('<div class="footer"> </div>') .addClass('ui-state-default') .html(lib.getFooterText()) .prepend( $('<div class="test" />') ) .insertAfter('#container'); } /** * * Shows test buttons for the current page if any * */ function toggleTestButtons(){ btnContainer = $('#btnTest'); if (btnContainer.length > 0){ // create test button dialog if (testBtnDialog === undefined){ btnContainer.toggleClass('no-display'); $('.test').html("TEST TOGGLE"); testBtnDialog = btnContainer.dialog({ title: "Test Buttons", dialogClass: 'no-close', height: 200, width: 800, modal: true, hide: { effect: "fade", duration: 300 }, show: { effect: "fade", duration: 300 }, buttons: [{ text: 'Close', click: function() { $(this).dialog('close'); $('.test').html(""); } }] }); }else{ testBtnDialog.dialog('open'); } } } /** * @method agreement * @desc Shows agreement window */ function agreement(){ // make sure rules are read before 'agreeing' $('.rules').scroll(function(){ if ($(this).scrollTop() + $(this).innerHeight() + 2 >= $(this)[0].scrollHeight){ $('#rulesChk').prop('disabled', false); $('#rulesChk').prop('checked', true); } }); $('.agreement_close').click(function(){ event.preventDefault(); $.unblockUI(); }); $('.agreement').click(function(){ event.preventDefault(); // open rules $.blockUI({ fadeIn: 1000, css: { top: ($(window).height() - 500) /2 + 'px', left: ($(window).width() - 500) /2 + 'px', width: '500px' }, message: $('.agreement_text'), onOverlayClick: $.unblockUI }); }); } /** * @method showRanking * @desc Build rankings element */ function showRanking(){ if ($('div#ranks').length === 0) { $('.footer') .append( $('<div id="ranks" />') .append( $('<div />') .addClass('center-content') .append('<h1>Rank Description</h1>') .append('<dl />') ) ); $.each(lib.skillLevels,function(idx, value){ $('#ranks dl') .append( $('<dt />') .append( $('<img src="/assets/css/images/trans1.png" />') .removeClass() .addClass('star' + (1 + idx)), $('<span>' + value.title + '</span>') ) ) .append( $('<dd />') .html(value.description) ); }); // let the user know that 0 stars and 1/2 star are equal rank $('dt:first') .prepend( $('<img src="/assets/css/images/trans1.png" />') .removeClass() .addClass('star0') ,$('<br />') ) $('#ranks') .append("<a class='rank_close' href='#'>Close this dialog</a>"); $('.rank_close').click(function(){ event.preventDefault(); $.unblockUI(); $('#ranks').remove(); }); } $('#ranks').toggle(false); return $('#ranks'); } /** * @method rankInfo * @desc Display rank info */ function rankInfo(){ $('.rankInfo').click(function(){ event.preventDefault(); // open rank info $.blockUI({ fadeIn: 1000, css: { top: ($(window).height() - 600) /2 + 'px', left: ($(window).width() - 500) /2 + 'px', width: '500px' }, message: showRanking(), onOverlayClick: function(){ $.unblockUI(); $('#ranks').remove(); } }); }); } /** * @method getAvatar * @param {string} avFilespec Name of file * @returns {string} Fully file specification of avatar */ function getAvatar(avFilespec){ if (avFilespec === undefined){ info = getCookie('user'); return (info.avatar) ? '/assets/avatars/' + info.avatar : default_avatar; }else{ return (avFilespec !== "") ? '/assets/avatars/' + avFilespec : default_avatar; } } /** * @method logout * @desc Logout */ function logout(){ app = this; $('.logout').on('click', function(e){ e.preventDefault(); $.removeCookie('user'); window.location.assign(app.pages.home); }); } /** * @method loginNavBar * @param {string} page Page key from library * @desc Uses parameter to appropriately set the navigation bar * See {@link module:app/appLib~navPages} for param (page) reference */ var loginNavBar = function(page){ // logged in user app = this; info = app.getCookie('user'); /** */ for(var key in lib.navPages){ // don't show links if not logged in if (info === undefined){ if (key == 'profile') $('#' + key).toggle(); if (key == 'admin') $('#' + key).toggle(); if (key == 'game') $('#' + key).toggle(); }else{ // don't show admin to reg user if (key == 'admin' && info.role == 'user') $('#' + key).toggle(); if (key == 'registration') $('#' + key).toggle(); } } if (info){ // hide signin/signup $('.cd-signin, .cd-signup').toggle(); // if (page === 'home') return false; userSpan = "<span id='welcome' class='ui-widget'>Welcome, <a href='" + lib.navPages.profile + "'> " + info.username ; userSpan += "<img src='" + getAvatar() + "' title='Edit " + info.username + "' class='avatar_icon'></a>"; userSpan += "<br /><span class='skill_level ui-widget'><span class='skill_level_text rankInfo'>Level</span>:<img src='/assets/css/images/trans1.png' class=''></span></span>"; $("header").after(userSpan); // show skills this.showSkills(); }else{ $('.logout').toggle(); } }; /** * @method showSkills * @desc Show user rank */ var showSkills = function(){ user = this.getCookie('user'); data = {}; data.user_id = user.user_id; data.id = 'tr'; data.function = 'TRU'; $.ajax({ desc: 'Get TrackRecord', data: data, type: "POST", url: app_engine }) .done(function(data, textStatus, jqXHR){ data = data[0]; wins = data.wins; losses = data.losses; sumGames = wins + losses; winPct = wins / sumGames; winPct = (isNaN(winPct)) ? 0 : winPct; rate_level = parseInt(Math.ceil(winPct * 10)); rate_class = 'star' + rate_level; $('.skill_level img').removeClass().addClass(rate_class); $('.skill_level_text').html(getLevelName(winPct * 100)); }); }; /** * @method getLevelName * @param {number} val * @desc Base on this param, this function returns the correct skill level title using the [skillLevel object]{@link module:app/appLib~skillLevels} */ function getLevelName(val){ // get the index of the skill level name idx = val % 100 / 10 | 0; return lib.skillLevels[idx].title; } /** * @method loading * @param {string} msg Message string */ var loading = function(msg){ loadingImg = '<img src="assets/css/images/loading.gif" />'; loadingHtml = ' <h3>We are processing your request. Please be patient.</h3>'; msg = (msg === undefined) ? loadingImg + loadingHtml : loadingImg + msg; $.blockUI({message: msg}); }; /** * @method unloading * @desc Unblock the ui */ var unloading = function(element){ var data = $(window).data(); if (data['blockUI.isBlocked'] == 1) { $('#content').unblock(); } $.unblockUI(); }; /** * @desc Adds loading message to all ajax calls by default */ $(document) .ajaxStart(function(event, xhr, options) { loading(); }) .ajaxComplete(function(event, xhr, options) { // if options.function == logger or utility...don't log if (options.function === undefined){ // if (options.desc === undefined) return false; user = getCookie("user"); if (typeof(options.data) === 'object') options.data = JSON.stringify(options.data); data = { 'function': 'LOG', 'user_id': (user === undefined) ? 0 : user.user_id, 'description': options.desc || 'utility function', 'action' : options.data || 'utility data', 'result' : xhr.responseText, 'detail' : options.url + " | " + xhr.status + " | " + xhr.statusText }; // log event $.ajax({ contentType: "application/x-www-form-urlencoded", function: 'logger', data: data, type: "POST", url: app_engine }) .done(function(data, textStatus, jqXHR){ // NOTE: comment line below for production // console.log("Logged data: " + JSON.stringify(data, null, 4)); }) .fail(function(jqXHR, textStatus, errorThrown) { console.log('log request failed! ' + textStatus); }) .always(function() { return false; }); } unloading(); }) .ajaxError(function(event, xhr, options) { unloading(); }); /** * sets cookies with info * @method setCookie * @param {string} name Cookie name * @param {object} data Cookie data */ function setCookie(name, data){ $.cookie.json = true; $.removeCookie(name); // remove default theme and use user theme if (name == 'user') $.removeCookie('theme'); $.cookie(name, data); } /** * @method setTheme * @param {string} theme JQuery ui theme string */ function setTheme(theme){ // if no theme sent set default var cook_theme; uObj = getCookie('user'); if (typeof(uObj) !== "undefined") cook_theme = uObj.theme; if (theme === undefined){ theme = (cook_theme === undefined) ? defaultTheme : cook_theme; } theme = theme.replace(/['"]+/g,''); // refresh cookie $.removeCookie("theme"); $.cookie("theme", theme); cook_theme = $.cookie('theme'); var theme_url = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/" + theme + "/jquery-ui.css"; $('head').append('<link href="'+ theme_url +'" rel="Stylesheet" type="text/css" />'); } /** * gets cookies info * @method getCookie * @param {string} name Cookie name */ function getCookie(name){ $.cookie.json = true; return $.cookie(name); } function pprint(obj){ return "<pre>" + JSON.stringify(obj, null, 2) + "</pre>"; } /** * Determines of an object is empty * @return {Boolean} [description] */ function isEmpty(obj){ length = Object.getOwnPropertyNames(obj).length; return length > 0 ? false : true; } var getCategories = function(){ app = this; $.ajax({ contentType: "application/x-www-form-urlencoded", function: 'utility', data: {'function' : 'GC'}, type: "POST", url: app_engine }) .done(function(result, status, jqXHR){ if (typeof(result) === 'string'){ isHTML = /<(?=.*? .*?\\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\\/\\1>/i.test(result); if (isHTML){ app.dMessage('Error', jqXHR.getAllResponseHeaders()); }else{ result = JSON.parse(result)[0]; } } // internal error handling if (result.error !== undefined){ console.log(result.error); return result; }else{ app.objCategories = result.categories; loadCategories(app.objCategories); } }) .fail(function(jqXHR, textStatus, errorThrown) { app.dMessage(textStatus + ': request failed! ', errorThrown); console.log(textStatus + ': request failed! ' + errorThrown); }); }; /** * loads categories into appropriate selectmenu * @param {object} categories object containing all category data * @return none */ var loadCategories = function(objCategories){ if (objCategories === undefined) { getCategories(); return false; } // get all "Category" select menus menus = $('select[id$=Category]').not('[id*=Sub]').not('[id*=temp]'); $.each(menus, function(){ $(this) .empty() .append(new Option("None", "")); element = $(this); $.each(objCategories, function(idx, objCat){ parentID = objCat.parent_id; cat = objCat.category; id = objCat.category_id; if (element.hasClass('allCategories')){ // do not filter categories element.append(new Option(cat, id)); }else{ // get top level categories if (parentID === 0){ element.append(new Option(cat, id)); } } }); $(this).selectmenu().selectmenu("refresh", true); }); }; /** * @method getCatQuestions * @param {int} catID Category ID * @param {int} elementID Category ID * */ var getCatQuestions = function(catID, elementID){ app = this; if (catID === "") return false; qList = $(elementID); data = {'function' : 'GQ'}; data.category_id = catID; $.ajax({ contentType: "application/x-www-form-urlencoded", function: 'utility', data: data, type: "POST", url: app_engine }) .done(function(result){ if (typeof(result) !== 'object'){ app.dMessage('Error Getting Category Questions', result); return result; } // internal error handling if (result.error !== undefined){ app.dMessage(result.error.error, result.error.msg); console.log(result.error); return result; } // load question selectmenu $.each(result.questions, function(){ qList.append($('<option />').val(this.question_id).text(this.question_text)); qList.val(""); qList.selectmenu('refresh'); }); }); }; function escapeId(myID){ return "#" + myID.replace(/[!"#$%&'()*+,.\\/:;<=>?@[\\\\\\]^`{|}~]/g, "\\\\\\\\$&"); } // validator selectmenu method $.validator.addMethod("selectNotEqual", function(value, element, param) { return param != value; },"Please choose a subcategory"); // validator defaults $.validator.setDefaults({ debug: true, ignore: "", errorPlacement: function (error, element) { // account for jquery selectmenu id = escapeId(element.context.id); /* I was lazy and copied the forms so ids are duplicated The next if is to specify the element by form */ if (id.indexOf('[') < 0){ // the previous test is for dynamic subcategory elements (eg. "#p_subCategory\\\\[2\\\\]") currentForm = "#" + $(element).closest('form')[0].id; currentId = currentForm + " " + id; element = $(currentId); } if (element[0].nodeName === "SELECT"){ // account for jquery selectmenu structure which // uses a span to display list/button // next() refers to '#' + element.id + '-button' element = element.next(); } // last chance to init element if not done already if ($(element).data('tooltipster-ns') === undefined) $(element).tooltipster(); var lastError = $(element).data('lastError'), // get the last message if one exists newError = $(error).text(); // set the current message $(element).data('lastError', newError); // set "lastError" to the current message for the next time 'errorPlacement' is called if(newError !== '' && newError !== lastError){ // make sure the message is not blank and not equal to the last message before allowing the Tooltip to update itself $(element) .tooltipster('content', newError) // insert content into tooltip .tooltipster('show'); // show the tooltip } }, success: function (label, element) { if (element.nodeName === "SELECT"){ // account for jquery selectmenu structure which // uses a span to display list/button // next() refers to '#' + element.id + '-button' element = $(element).next(); } // last chance to init element if not done already if ($(element).data('tooltipster-ns') === undefined) $(element).tooltipster(); $(element).tooltipster('hide'); // hide tooltip when field passes validation }, showErrors: function (errorMap, errorList) { if (typeof errorList[0] != "undefined") { var position = $(errorList[0].element).position().top; $('html, body').animate({ scrollTop: position }, 300); } this.defaultShowErrors(); } }); function get_mboxDefaults(title, message){ return { autoResize: true, dialogClass: 'no-close', modal: true, title: title, open: function(){ icon = '<span class="ui-icon ui-icon-info" style="float:left; margin:0 7px 5px 0;"></span>'; $(this).parent().find("span.ui-dialog-title").prepend(icon); $(this).html(message); }, buttons: { Ok: function () { $(this).dialog("close"); } } }; } // usersnap code for bug reporting (function() { var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = '//api.usersnap.com/load/'+ '1135d21c-f848-4993-a9cb-fe7141f4cac2.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); })(); function toggleSignIn(){ $("#login-tab, #reset-tab").toggle(); } function showLoginDialog(idx, fn){ // get logic for signup and login require(['pages/index','pages/signup']); if (!$('.modal-container').length) createLoginDialog(); $('.modal-container') .tabs({ active: idx }) .dialog('open') .siblings('div.ui-dialog-titlebar').remove(); } /** * Returns the app object with var/functions built in * @alias module:app */ app = { /** @property {string} defaultTheme Default theme */ defaultTheme: defaultTheme, /** @property {object} selectMenuOpt Default select menu options */ selectMenuOpt: selectMenuOpt, /** @property {object} tabOptions Default tab options */ tabOptions: tabOptions, /** @property {object} pages Site pages from library so no hard coding is necessary */ pages: lib.navPages, /** @property {string} engine CGI script = site traffic cop for database interaction */ engine : app_engine, /** @property {object} objCategories global object used to populate category selectmenu */ objCategories: objCategories, // utility functions /** @property {function} init Initialization of all pages */ init: init, /** @property {function} mboxDefaults gets message box default options (params: title, message) */ mboxDefaults: get_mboxDefaults, /** @property {function} isEmpty Test if object is empty*/ isEmpty: isEmpty, /** @property {function} setCookie */ setCookie: setCookie, /** @property {function} getCookie */ getCookie: getCookie, /** @property {function} showSkills */ showSkills: showSkills, /** @property {function} showLoading Handles wait message for ajax calls */ showLoading: loading, /** @property {function} navBar Handles navigation bar and welcome info */ navBar: loginNavBar, /** @property {function} hideLoading Handles closing wait message for ajax calls */ hideLoading: unloading, /** @property {function} setTheme */ setTheme: setTheme, /** @property {function} prettyPrint Formatting for js objects */ prettyPrint: pprint, /** @property {function} logout */ logout: logout, /** @property {function} getCategories */ getCategories: getCategories, /** @property {function} loadCategories */ loadCategories: loadCategories, /** @property {function} getCatQuestions */ getCatQuestions: getCatQuestions, /** @property {function} getAvatar */ getAvatar: getAvatar, /** @property {function} agreement Functions for terms and conditions */ agreement: agreement, /** @property {function} setFooter */ setFooter: setFooter, /** @property {function} rankInfo Functions for displaying rank info */ rankInfo: rankInfo, /** @property {function} toggleTestButtons */ toggleTestButtons: toggleTestButtons, /** @property {function} ensureLogin */ ensureLogin: ensureLogin, /** @property {function} showLoginDialog */ showLoginDialog: showLoginDialog, /** @property {function} toggleSignIn */ toggleSignIn: toggleSignIn, /** @property {function} dMessage Generate app messages */ dMessage : function(title, message, options){ title = (title === undefined) ? "Error" : title; if (message !== undefined){ // print objects in readable form message = (typeof(message) === 'object') ? this.prettyPrint(message) : message; }else{ message = ""; } settings = this.mboxDefaults(title, message); if (options) settings = $.extend({}, this.mboxDefaults(title, message), options); $('<div />').dialog(settings); }, /** @property {function} getTheme Get current theme*/ getTheme: function(){ $.cookie.json = true; current_theme = $.cookie('theme'); return (current_theme === undefined) ? this.defaultTheme : current_theme; }, /** @property {function} subCheck Handles sub-category selectmenu generation */ subCheck:function(element){ app = this; if (element === undefined) return false; // get calling element info current_id = parseInt(element.val()); current_selection = $("option:selected", element).text(); element_id_prefix = element.attr('id').prefix(); element_is_top = false; // quit if None selected if (isNaN(current_id)) return false; // check the categories object for subcategories of current selection catCollection = []; $.each(app.objCategories, function(idx, objCat){ parentID = objCat.parent_id; catID = objCat.category_id; if (current_id == catID && parentID === undefined ){ element_is_top = true; } // accumulate children if (parentID == current_id){ catCollection.push(objCat); } }); if (catCollection.length > 0){ /* create subcategory select, fill and new subs checkbox */ // get the template paragraph element $('#placeHolder').load('templates.html #subCatTemplate', function(response, status, xhr){ if (status != 'error'){ parentP = $('#subCatTemplate'); // clone it var clone = parentP.children().clone(); // add identifying class for later removal clone.addClass('clone'); // get current iteration of instantiation of the template for naming var iteration = $(document).data('tempCount'); // increment iteration as index and save new iteration index = ++iteration; $(document).data('tempCount', iteration); // loop through all child elements to modify before appending to the dom clone.children().each(function(){ changeID = true; elName = null; elID = null; // get the id ov the current element var templateID = $(this).prop('id'); // make sure there are no blank ids switch ($(this).prop('type') || $(this).prop('nodeName').toLowerCase()){ case 'label': strFor = $(this).prop('for'); origPrefix = strFor.prefix(); strFor = strFor.replace(origPrefix, element_id_prefix) + index; // change 'for' property for label $(this).prop('for', strFor); changeID = false; break; case 'select': case 'select-one': elID = templateID.replace(templateID.prefix(), element_id_prefix) + "[" + index + "]"; elName = templateID.replace(templateID.prefix(), element_id_prefix) + "[]"; // add new option to select menu based on parent id $(this) .addClass('required') .empty() .append(new Option("None", "")); tmpSelect = $(this); $.each(catCollection, function(idx, objCat){ cat = objCat.category; id = objCat.category_id; tmpSelect.append(new Option(cat, id)); }); break; case 'checkbox': elID = templateID.replace(templateID.prefix(), element_id_prefix) + index; elName = elID; break; default: changeID = false; } // only change the id of necessary elements if (changeID) { $(this).prop({"id":elID, "name": elName }); } }); element.parent().after(clone); $('#placeHolder').empty(); }else{ app.dMessage(status.capitlize() + ' - Template File', xhr.statusText); } }); }else{ // category is top-level msg = "No Sub-category found for: " + current_selection; title = "Selection Error: " + current_selection; msg += (element_is_top) ? " is a top-level category!" : " has no sub-categories"; app.dMessage(title, msg); } } }; function createLoginDialog(){ //load the signin/up template $('.test').load('templates.html .modal-container', function(response, status, xhr){ if (status != 'error'){ // hide password reset panel by default $("#reset-tab").toggle(); $(".modal-container") .tabs({ beforeActivate: function(event, ui){ // if going from reset password to signup... if (ui.newPanel[0].id === 'signup-tab'){ // reset signup tab to prevent...weirdness if ($('#reset-tab').is(':visible')) app.toggleSignIn(); } } }) .dialog({ // resizable: false, autoResize: true, autoOpen: false, minHeight: "auto", closeOnEscape: true, dialogClass: 'no-close', modal: true, width: 'auto', height: 'auto', buttons: { Close: function () { $(this).dialog("close"); } } }); $('.cd-form-bottom-message').click(app.toggleSignIn); app.showLoginDialog(); }else{ app.dMessageBox('Error', xhr); } }); } /** * @memberof app * @event Navigation click * @desc Handles click event for Signup/SignIn buttons * and determins whether to create login dialog and which tab to open */ $(document).on('click', '.main-nav',function(event){ user = app.getCookie('user'); signup = $(event.target).is('.cd-signup'); if (signup) app.agreement(); signin = $(event.target).is('.cd-signin'); // function helper to show signin panel if (signup || signin){ index = (signup) ? 1 : 0; // if the signup element has not been created if (!$('.modal-container').length){ createLoginDialog(); }else{ app.showLoginDialog(index); } } }); return app; }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"lib_pagesLib_appLib.js.html":{"id":"lib_pagesLib_appLib.js.html","title":"Source: lib/pagesLib/appLib.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: lib/pagesLib/appLib.js /** * @fileOverview *Library For: App *Contents: *- navigation pages hash *- skill levels hash *- Rules text *- JQuery addons *- JS prototypes * * When the module is loaded it will be referred to as "lib" * @author Tony Moses * @version 0.1 * @namespace app/appLib * @returns {Object} Returns library of config vars and functions */ define(['jquery','tooltipster'], function($) { /** * @name app/appLib#navPages * @readonly * @prop {string} key navPages.key * @prop {string} value navPages.value * @desc * For usage example see: * - [Navigation Bar]{@link module:app~loginNavBar} <a href='app.js.html#sunlight-1-line-348'> (app.js line 348)</a> * @example * // returns "index.html * lib.navPages.home; * @returns {string} Returns file name for alias */ var navPages = { 'home' : 'index.html', 'game' : 'game.html', 'feedback': 'feedback.html', 'profile': 'profile.html', 'about': 'about.html', 'admin': 'admin.html' }; /** * @name app/appLib#skillLevels * @readonly * @type {array} skillLevels[0] * @prop {string} title * @prop {string} description * @desc This is an array of objects containing skill title/desc. This object will be used to * refer to site pages and helps preserve DRY method. * For usage example see: {@link module:app~getLevelName} <a href='app.js.html#sunlight-1-line-407'> (app.js line 104)</a> * @returns {string} Returns file name for alias */ var skillLevels = [{ "title" : "Blowhard", "description" : "Look who hasn't even won eleven games....." },{ "title" : "Bigmouth", "description" : "Get some games under you belt and we'll talk" },{ "title" : "Conversationalist", "description" : "Looks like someone is making money" },{ "title" : "Commentator", "description" : "Gaining momentum" },{ "title" : "Scholar", "description" : "Look who can argue!" },{ "title" : "Lecturer", "description" : "Debater Spectacular" },{ "title" : "Advocate", "description" : "You know your stuff" },{ "title" : "Orator", "description" : "Basically, Winston Churchill." },{ "title" : "Elocutionist", "description" : "Straight winning" },{ "title" : "Rhetorician", "description" : "Apex" } ]; // rules div /** * @var tplRules * @memberof app/appLib * @desc template for site rules * @todo Move template string to site template html */ var tplRules = "<div class='agreement_text' style='display:none;'> \\ <div class='rules'> \\ <h2>Rules and Regulations</h2> \\ <ol> \\ <li> \\ While <b><i>Isaiditbest</b></i> allows great leniency regarding freedom of speech while debating, Isaiditbest reserves the right to suspend or revoke membership to any member for anything that <b><i>Isaiditbest</b></i> determines is hate speech. Similarly, any intimidating language towards other members is also strictly prohibited. By using this website, all users acknowledge that Wesaiditbest retains the right to make these decisions regarding who may debate on our website. \\ </li> \\ <li> \\ Group coordination, where there is a prearranged agreement between multiple members to vote for each other, is strictly prohibited.<br /> \\ <p> \\ By using this website, all users acknowledge that any attempt to perform these actions will result in a ban and potential forfeit of remaining credit, which may be used only for the purposes of reimbursing potentially harmed contestants. Any use of this website comes with the knowledge that Isaiditbest retains the right to determine whether group coordination occurred and take these listed actions. Any customers facing potential suspension or credit forfeit will be given a minimum of 72 hours to appeal our decision. By using this website, all users give their consent to <b><i>Isaiditbest</b></i> to determine if group coordination occurred and undertake the actions mentioned in this document. \\ </p><br /> \\ <p> \\ <b><i>Isaiditbest</i></b> retains the right to make any and all decisions regarding who may use this website and all game decisions, including retroactive game decisions in the case that group coordination is believed to have occurred. By signing up and participating in games, I agree to these terms. \\ </p> \\ </li> \\ </ol> \\ <br> \\ <p> \\ <a class='agreement_close' href='#'>Close this dialog</a> \\ </p> \\ </div>"; /** * @memberof app/appLib * @var txtFooter * @desc Visible footer text */ var txtFooter = "Use of this website constitutes acceptance of the ISaidItBest \\ <a class=\\"agreement\\" href=\\"#\\">Rules Agreement</a>"; /** * @global * @method tooltipster.setDefaults * @desc Set default values for tooltipster plugin */ $.fn.tooltipster('setDefaults',{ trigger: 'custom', onlyOne: false, positionTracker: true, position: 'right', updateAnimation: false, animation: 'swing', positionTrackerCallback: function(){ this.hide(); } }); /** * @global * @method between * @desc Extends javascript Number to have a between function * The function takes number and returns if that number is between the two * parameters * @param {number} min Minumum comparator * @param {number} max Maximum comparator * @example * //retuns true * 42.between(40, 50); * @return {Boolean} Boolean */ Number.prototype.between = function(min, max){ return this.valueOf() >= min && this.valueOf() <= max; }; /** * @global * @method pluralize * @desc Extends javascript String * The function takes string and returns pluralized version based on count * @param {number} count Thec count of items to base pluralization on * @param {string} [plural=s] Plural string * @example * //retuns cats * cat.pluralize(10); * @return {String} Pluralized string */ String.prototype.pluralize = function(count, plural){ if (plural == null){ plural = this + 's'; } return (count == 1 ? this : plural); }; /** * @global * @method capitalize * @desc Extends javascript String * The function takes string and returns capitalized string * @example * //returns Error * var status = "error"; * status.capitalize(); * @return {String} capitalized string */ String.prototype.capitlize = function(){ return this.toLowerCase().replace( /\\b\\w/g, function(m){ return m.toUpperCase(); }); }; /** * @global * @method prefix * @desc Extends javascript String * The function finds a prefix of a string based on a separator string * @param {string} [separator=_] String to mark prefix * @example * //retuns sub * var id = "sub_Category" * status.prefix(); * @return {String} prefix of string */ String.prototype.prefix = function (separator) { separator = (separator === undefined) ? '_' : separator; return this.substring(0, this.indexOf(separator) + 1); }; /** * @global * @method serializeForm * @desc Extends JQuery fn * Converts form data to js object * @example * //retuns form in js object * @return {object} formdata */ $.fn.serializeForm = function() { var o = {"id": this.prop('id')}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; }; /** * @global * @method toMMSS * @desc Extends Javascript String * Converts seconds as string/int to HH:MM:SS * @example * //returns * @return {string} string */ String.prototype.toMMSS = function () { var sec_num = parseInt(this, 10); // don't forget the second param var hours = Math.floor(sec_num / 3600); var minutes = Math.floor((sec_num - (hours * 3600)) / 60); var seconds = sec_num - (hours * 3600) - (minutes * 60); // if (hours < 10) {hours = "0"+hours;} if (minutes < 10) {minutes = "0"+minutes;} if (seconds < 10) {seconds = "0"+seconds;} // var time = hours+':'+minutes+':'+seconds; var time = minutes+':'+seconds; return time; }; return { navPages: navPages, skillLevels: skillLevels, /** * @method getFooterText * @memberof app/appLib * @see {@link txtFooter} * @see {@link app/appLogin~tplRules} */ getFooterText: function(){ return txtFooter + tplRules;} } }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"pages_game.js.html":{"id":"pages_game.js.html","title":"Source: pages/game.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: pages/game.js /** * @fileOverview Handles all functions for the game page * @module game * @author Tony Moses * @version 0.1 i* */ require([ 'jquery', 'app', 'gameLib', 'flipclock', 'validate', 'jqueryUI', 'livequery', 'cookie', 'blockUI' ], function($, app, lib){ // game parameters global var var user, timeout, params, timeLeft = 0, divVotePrefix = 'comment_', onStateClass = "ui-state-highlight", offStateClass = "ui-widget-content", disableStateClass = "ui-state-disabled", gamePanel = 'h3:contains("Debate Game")', paramPanel = 'h3:contains("Parameter Selection")', resultPanel = 'h3:contains("Game Results")', gameSubmitted = false, pollCounter = 0; // handle page setup upon arrival app.init('game'); user = app.getCookie('user'); /* * Add event to enable test buttons on page * TODO: following line must be commented for production */ $(document).on('click', '.test', function(){ app.toggleTestButtons(); }); /** * function loads meta data (eg. time options/wager options */ (function loadMeta(){ $.ajax({ data: {'function': "GMD", 'id': 'getMetaData'}, url: app.engine, type: 'POST', dataType: 'json', desc: 'utility (load metadata)', success: function(data){ $.each($('[id=wager]'), function(){ $(this) .empty() .append(new Option("None", "")); // load question selectmenu element = $(this); $.each(data.wagers, function(){ $(element) .append($('<option />') .val(this.credit_id) .text(this.credit_value + ' credit(s)')) .val("") .selectmenu('refresh'); }); }); $.each($('[id=timeLimit]'), function(){ $(this) .empty() .append(new Option("None", "")); element = $(this); // load question selectmenu $.each(data.times, function(){ $(element) .append($('<option />') .val(this.time_id) .text(this.time_in_seconds.toString().toMMSS())) .val("") .selectmenu('refresh'); }); }); } }); })(); /** * @method getGame @desc * Recursive poller of the db to get players and start game * - on success: loads the debate * - on error: gives the user another chance to search for a game */ function getGame(){ // create ajax poll game = function(){ $.ajax({ data: params, url: app.engine, type: 'POST', dataType: 'json', desc: 'Game Creation', global: false, success: function(data){ if (pollCounter <= 4){ pollCounter++; params.counter = pollCounter; if (data.status === 'pending'){ getGame(); }else if(data.status === 'complete'){ // update game ui clearTimeout(timeout); loadDebate(data); }else if(data.queue){ // set the created queue_id to params params.queue_id = data.queue.queue_id; matchText = 'Please stay with us while Isaiditbest finds you the best match up...'; $('#cancelSearch h1').html(matchText); getGame(); } }else{ $('#game_panel').unblock(); clearTimeout(timeout); pollCounter = 0; app.dMessage( "Alert", '<h2>Game Not Found</h2><p>Retry?</p>', { buttons: { Yes: function(){ $('#game_panel').block({ message: $('#cancelSearch'), css:{ width: '275px'} }); getGame(); $(this).dialog('close'); }, No: function(){ cancelGame(); // enable/disable appropriate panels toggleParams(); // go back to parameters openAccordionPanel('last'); $(this).dialog('close'); } } } ); } } }); }; // if this is the first time called immediately excute ajax if (params.counter === 0){ $('#cancelSearch h1').html('Submitting your parameters...'); // enable/disable appropriate panels toggleParams(); openAccordionPanel('next'); $('#game_panel').block({ message: $('#cancelSearch'), css:{ width: '275px'} }); game(); } else { // if polling timeout = setTimeout(game, 5000); } } /** set up parameter forms for validation */ (function(){ // retrieve a param forms forms = $('div.paramDiv').children('form'); // for each form $.each(forms, function(){ // add validation w/ handler $(this).validate({ submitHandler: function(){ params = $(this.currentForm).serializeForm(); params.user_id = user.user_id; params.function = 'GG'; params.counter = pollCounter; getGame(); } }); // for each of the selects in the form elSelects = $(this).find('select'); // add rule $.each(elSelects, function(){ $(this).rules("add", { required: true, selectNotEqual: "" }); }); }); })(); /** * validation for debate game ui @memberof game * @event Game submission of "gameUI" * */ $('#gameUI').validate({ submitHandler: function(){ data = $(this.currentForm).serializeForm(); data.user_id = user.user_id; submitGame(data); // get the time left on the clock to know // how long to wait for other users timeLeft = gameClock.getTime().time; gameClock.stop(); } }); /** * Submits game data * @method submitGame * @param {object} form data and current user id */ function submitGame(data){ gameSubmitted = true; data.function = 'SUG'; // app.dMessage('Submitting Game', data); $.ajax({ url: app.engine, data: data, type: 'POST', dataType: 'json', desc: 'Game Submission', success: function(result){ if (!result.error){ // reset counter for other uses pollCounter = 0; // start polling for comment data commentPoll(); }else{ app.dMessage(result.error, result.stm); } } }); } /** * @method getCommentPollData * @returns {object} object object containing function name, id, game id, counter */ function getCommentPollData(){ return { "function" : "GCG", // Get Comments from Game 'id' : 'commentPoll', 'game_id' : $('#game_id').val(), 'counter' : pollCounter }; } /** * Calls polling function with generated options * @method commentPoll */ function commentPoll(){ opts = { getData: getCommentPollData, desc: 'Comment Polling', strPending: 'Waiting on comments from {0} players ...', completeFunc: displayComments, strInitial: 'Gathering player comments...' }; poller(opts); } /** * Polling function * @method poller */ function poller(options){ data = options.getData(); // create ajax poll ajaxCall = function(){ $.ajax({ data: data, url: app.engine, type: 'POST', dataType: 'json', desc: options.desc, global: false, success: function(results){ if (pollCounter <= 400){ pollCounter++; data.counter = pollCounter; if (!results.status){ app.dMessage(data.error, data.stm);} if (results.status === 'pending'){ // update ui continue polling $('#game_panel').unblock(); msg = $.validator.format(options.strPending, [results.pending]); $('#game_panel').block({message: msg, css:{ width: '275px'}}); poller(options); }else if(results.status === 'complete'){ // update game ui clearTimeout(timeout); options.completeFunc(results.users); $('#game_panel').unblock(); } }else{ $('#game_panel').unblock(); pollCounter = 0; app.dMessage('Data', data); } } }); }; // if this is the first time called immediately excute ajax if (data.counter === 0){ $('#game_panel').block({message: options.strInitial, css:{ width: '275px'}}); ajaxCall(); } else { // if polling timeout = setTimeout(ajaxCall, 5000); } } /** * Displays game comments in jquery selectable format * @method displayComments * @param {array} users an array */ function displayComments(users){ // show vote/hide game toggleGame(); // build vote form // add a ul before the vote button $('#btnVote').before('<ul id="selectable" >'); // for each of the users in the data... $.each(users, function(){ $('#debateVote ul').append( // add user formatted info $('<li />') .append( $('<div id="' + divVotePrefix + this.user_id + '" />').append( $('<img class="avatar" src=' + app.getAvatar(this.avatar) + " />"), $('<div />') .addClass('votequote') .text(this.thoughts), $('<cite />').text(this.username) ) ) .addClass(offStateClass) .addClass('selectable') ); }); /** create selectable and disable current user as selection */ $('#selectable').selectable({ filter:'li.selectable', selected: function(event, ui){ // deselect selection if selected previously if ($.inArray(onStateClass, ui.selected.classList) > -1){ $(ui.selected).addClass(offStateClass).removeClass(onStateClass); }else{ $( ".ui-selected", this ).each(function() { // current user cannot vote for themselves selectedId = $(this).children().prop('id').substring(divVotePrefix.length); if (parseInt(selectedId) === user.user_id){ app.dMessage("Illegal Action", "You cannot vote for yourself!"); }else{ $(this).removeClass(offStateClass).addClass(onStateClass); } }); } $('li.selectable').not(".ui-selected").not(disableStateClass).each(function() { $(this).removeClass(onStateClass).addClass(offStateClass); }); } }); // disable current user comment from selection $('#' + divVotePrefix + user.user_id).parent() .removeClass(offStateClass) .addClass(disableStateClass); } /** * @memberof game * @struct {setupStructure} * @desc Validation for voting form "debateVote" * */ $('#debateVote').validate({ submitHandler: function(){ selectedComment = $('#selectable').find('li').hasClass(onStateClass); if (selectedComment){ selectedComment = $('#selectable').find('li.ui-state-highlight'); idText = selectedComment.children().prop('id'); vote_id = parseInt(idText.substring(divVotePrefix.length)); }else{ app.dMessage("Error", "You must select a comment."); return false; } //gather data data = $(this.currentForm).serializeForm(); data.game_id = $('#game_id').val(); data.function = 'SVG'; data.counter = pollCounter = 0; data.user_id = user.user_id; data.vote_id = vote_id; submitVote(data); } }); /** * Submit Vote to database and start polling for winner data * @method submitVote * @param {object} data Form data including vote and current user id */ function submitVote(data){ $.ajax({ url: app.engine, data: data, type: 'POST', dataType: 'json', desc: 'Vote Submission', success: function(result){ if (!result.error){ // reset counter for other uses pollCounter = 0; votePoll(); }else{ app.dMessage(result.error, result.stm); } } }); } /** * @method getVotePollData * @returns {object} object object containing function name, id, game id, counter */ function getVotePollData(){ return { "function" : "GVG", // Get votes from Game 'id' : 'votePoll', 'game_id' : $('#game_id').val(), 'counter' : pollCounter }; } /** * Calls polling function with generated options * @method votePoll */ function votePoll(){ opts = { getData: getVotePollData, desc: 'Vote Polling', strPending: 'Waiting on votes from {0} players ...', completeFunc: loadWinner, strInitial: 'Gathering player votes...' }; poller(opts); } /** * @method loadWinner * @param {array} users Array of objects represent vote data including user info * @returns {html} winnerDiv info */ function loadWinner(users){ // disable game, enable parameter selection toggleParams(); // show results if (!$(resultPanel).is(':visible')){ $(resultPanel).toggle(); } // build winner info var obj = lib.getWinner(users); strWinnerVote ='<p><b>{0}</b>, with <i>{1}</i> votes, won {2} credits</div></p>'; strVote ='<span><b>{0}</b>, with <i>{1}</i> votes</span>'; var winner = $('<div />') .addClass('winnerDiv') .append( $('<div />') .addClass('winnerTitle') .html('<b><i>Winner</i></b>'), $('<img src="/assets/avatars/' + obj.winner.avatar + '" class="avatar_large" />'), $($.validator.format(strWinnerVote, [obj.winner.username, obj.winner.votes, obj.pot])) ); // display winner info $(resultPanel).click(); $('#results_panel').find("p").remove(); $('#results_footer') .before( $('<p />').append(winner)); // display the rest of the players // $.each(users, function(){ // if (this.user_id !== obj.winner.user_id){ // $('#results_footer') // .before( // $('<div />') // .append( // $('<img src="/assets/avatars/' + this.avatar + '" class="avatar_icon" />'), // $($.validator.format(strVote, [this.username, this.votes])) // ) // ); // } // }); resTitle = (obj.winner.user_id == user.user_id) ? "Congratulations!!! You won!" : "Maybe next time"; $('#results_footer').html(resTitle); $('#results_footer') .append( $('<p />') .append( $('<a />') .prop('href', app.pages.game) .html('Play Again?') ) ); } $('#LD').click(function(){ // load data to display function $(gamePanel).click(); loadDebate(lib.sampleGameStartData); }); $('#LC').click(function(){ // load data to display function $(gamePanel).click(); $('#selectable').remove(); displayComments(lib.sampleCommentResultData[0].users); }); $('#TGV').click(function(){ toggleGame(); }); $('#TW').click(function(){ if (!$(resultPanel).is(':visible')){ loadWinner(lib.sampleVoteResultData); }else{ toggleParams(); $(resultPanel).toggle(); $(gamePanel).click(); } }); function toggleParams(){ // disable/enable params $(paramPanel).toggleClass('ui-state-disabled'); // disable/enable game $(gamePanel).toggleClass('ui-state-disabled'); } function toggleGame(){ $('#debate, .debateVote').toggle(); } /** * Game Clock instantiation * @type {FlipClock} */ gameClock = $('#game_timer').FlipClock({ autoStart: false, countdown: true, clockFace: 'MinuteCounter', callbacks: { stop: function(){ data = $('#gameUI').serializeForm(); data.user_id = user.user_id; if (!gameSubmitted) submitGame(data); } } }); /** * Wait Clock instantiation * @type {FlipClock} */ waitClock = $('#wait_timer').FlipClock(10,{ autoStart: false, countdown: true, clockFace: 'MinuteCounter', callbacks: { stop: function(){ $.unblockUI(); gameClock.start(); $('#gameWait').addClass('hidden'); } } }); function loadDebate(data, testing){ var runtimers = (testing !== undefined) // set game id $('#game_id').val(data.game_id); // load player avatars $('#players') .empty() .html("Players"); $.each(data.users, function(){ $('<div />') .attr({ id: this.username }) .appendTo('#players'); $('<img />') .attr({ class: 'avatar', src: app.getAvatar(this.avatar), title: this.username }) .appendTo('#' + this.username); $('<br />').appendTo('#players'); }); // disable waiting message $('#game_panel').unblock(); //set game title(question)/wager $("#question") .html(data.question) .append( $('<h5>') // .addClass('ui-state-active') .html("(Wager: " + data.wager + " credit".pluralize(data.wager) + ")") ); if (runtimers){ // set clock based on time limit parameter gameClock.setTime(data.time); // show waitclock $('#gameWait').removeClass('hidden'); $.blockUI({message: $('#gameWait'), css:{ width: '305px'}}); waitClock.start(); } } $('#cancel').click(function(){ $('#game_panel').unblock(); // enable/disable appropriate panels toggleParams(); openAccordionPanel('last'); cancelGame().success(function(data){ // cancel poll clearTimeout(timeout); if (!data.error){ func = function(){ params.counter = pollCounter = 0; $(this).dialog('close'); }; msgOpt = { buttons: { Yes: function(){ getGame(); func(); }, No: func } }; app.dMessage( "Alert", 'Cancellation Confirmed<p>Retry?</p>', msgOpt ); }else{ app.dMessage(data.error, data.stm); } }); }); function cancelGame(callback){ params.function = 'CG'; params.id = 'cancelGame'; return $.ajax({ url: app.engine, data: params, type: 'POST', dataType: 'json', desc: 'Game Cancellation' }); } function openAccordionPanel(position) { var current = app.accordion.accordion("option","active"); maximum = app.accordion.find("h3").length; if (position === 'next'){ position = current+1 === maximum ? 0 : current+1; }else{ position = current-1 < 0 ? 0 : current-1; } app.accordion.accordion("option","active",position); } // load question box with values based on category/subcategory function primeQBox(catID){ // destination selectmenu q_select = '#paramQuestions'; // reset questions list $(q_select) .empty() .selectmenu('destroy') .selectmenu({width: '100%', style: 'dropdown'}) .append(new Option("None", "")); // retrieve and load questions for selected id app.getCatQuestions(catID, q_select); } // set a watch for additions/removal on the dom for select boxes (not including template) $("select[id*=Category]:not([id*=temp])") .livequery(function(){ // id = $(this).prop('id'); id = '#' + $(this)[0].form.id + " " + $(this).prop('id'); // add validation $(this).closest('form').validate(); $(this).rules("add", { selectNotEqual : "" }); // selectmenu options mnuOpts = { change: function(){ // load appropriate questions for selection primeQBox($(this).val()); // validate select $(this).closest('form').validate().element(this); // bind change event to all select menus to enable subcategory menu selection boolSubs = $(this).siblings('input').prop("checked"); // get clones if present clones = $(this).parent().siblings('.clone'); hasClones = clones.length > 0; // remove clones if (hasClones){ // kill all clones below current check $.each(clones, function(){ $(this).remove(); }); } // if sub-categories are requested if (boolSubs) app.subCheck($(this)); } }; settings = $.extend({}, app.selectMenuOpt, mnuOpts); $(this).selectmenu(settings); }); // set watch for additions/removal on the dom for checkboxes (not including template) $("input[id*=CategoryChk]:not([id*=temp])") .livequery(function(){ $(this) .change(function(event){ event.stopPropagation(); if($(this).is(':checked')){ var select = $(this).siblings('select'); app.subCheck(select); }else{ // load appropriate questions for selection primeQBox("#" + $(this).siblings('select').prop('id')); // get all p tags that are not the original and do not contain the submit button cloneP = $(this).parent().siblings('.clone'); // kill all clones below current check $.each(cloneP, function(){ $(this).remove(); }); } } ); }); /* Facebook Code */ window.fbAsyncInit = function() { FB.init({ appId : '1518603065100165', xfbml : true, version : 'v2.5' }); }; (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5&appId=1518603065100165"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"lib_pagesLib_gameLib.js.html":{"id":"lib_pagesLib_gameLib.js.html","title":"Source: lib/pagesLib/gameLib.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: lib/pagesLib/gameLib.js /** * @fileOverview * Library: Game * Contents: * - Sample Data for testing * * When the module is loaded it will be referred to as "lib" * @author Tony Moses * @version 0.1 * @namespace game/gameLib * @returns {Object} Returns library of config vars and functions */ define(['jquery', 'app'], function($, app) { /** * @method getWinner * @memberof game/gameLib * @desc get winner with most votes * @param {object} data function takes data sample (vData) * @example * // Sample data var vData = [{ "votes": 1, "user_id": 36, "avatar": "36_avatar.jpg", "wager" : 10, "username": "tonym415" }, { "votes": 2, "user_id": 52, "avatar": "52_avatar.jpg", "wager" : 10, "username": "user" }, { "votes": 0, "user_id": 54, "avatar": "54_avatar.jpg", "wager" : 10, "username": "bobs" } ]; * @todo make function more generic * possible: able to search "obj" for max, min, etc based * on params * @returns {obj} the player object */ var getWinner = function(data){ // get the highest vote count of the users array var result = Math.max.apply(Math, data.map(function(o){return o.votes;})); // get the highest vote count of the users array var sumWager = 0; for (var i=data.length; i--;){ sumWager+=data[i].wager; } // get the object the matches the max // TODO: improve this function to handle ties or more than one object with // same result value returnObj = { "pot" : sumWager, "winner" : data.find(function(o){ return o.votes == result; }) }; return returnObj; }; var gsData = { "wager": 1, "users": [{ "username": "bobs", "avatar": "54_avatar.jpg" },{ "username": "user", "avatar": "52_avatar.jpg" },{ "username": "tonym415", "avatar": "36_avatar.jpg" }], "status": "complete", "time": 60, "question": "Is the introduction of $15 minimum wage good?", "game_id": 5 }; var comData = [ { "pending": 0, "status": "complete", "users": [ { "thoughts": "Bacon ipsum dolor amet jerky rump ham hock, shank shankle venison brisket kielbasa drumstick. Brisket swine short ribs ribeye ball tip spare ribs. Chicken pork loin shoulder pancetta pork ham venison drumstick chuck boudin kevin cow fatback porchetta pastrami. Shank pork belly ham, capicola beef kielbasa salami tail short ribs ground round cow shoulder turkey. Jerky pig doner, capicola kevin bresaola meatball tongue cow short loin ground round pork belly filet mignon. Ground round salami hamburger, beef picanha swine prosciutto bacon pork chop cow tongue ball tip. Pork chop rump porchetta t-bone, short ribs pork loin sausage filet mignon tri-tip picanha salami shoulder.", "avatar": "36_avatar.jpg", "username": "tonym415", "user_id": 36 }, { "thoughts": "Bresaola biltong chuck shank sirloin bacon venison ground round prosciutto short loin. Brisket venison jowl salami sirloin landjaeger. Short ribs ham hock filet mignon jowl. Bresaola pig porchetta tri-tip drumstick prosciutto tenderloin rump capicola bacon tongue flank short loin ham hock t-bone. Meatball venison chicken, cupim pork loin frankfurter sirloin tail. Drumstick chuck fatback turkey, bresaola ham shoulder meatball sausage biltong strip steak sirloin filet mignon beef.", "avatar": "52_avatar.jpg", "username": "user", "user_id": 52 }, { "thoughts": "sBeef ribs meatloaf kielbasa ham, rump tail flank doner ground round turducken t-bone. Doner turkey kevin tail, cupim shank bacon venison. Flank boudin pork chop, shoulder tenderloin picanha bresaola capicola leberkas pig shank fatback rump ball tip beef. Rump biltong pig, sirloin short loin jowl kevin tongue short ribs leberkas corned beef pancetta. ", "avatar": "54_avatar.jpg", "username": "bobs", "user_id": 54 } ] } ]; var vData = [{ "votes": 1, "user_id": 36, "avatar": "36_avatar.jpg", "wager" : 10, "username": "tonym415" }, { "votes": 2, "user_id": 52, "avatar": "52_avatar.jpg", "wager" : 10, "username": "user" }, { "votes": 0, "user_id": 54, "avatar": "54_avatar.jpg", "wager" : 10, "username": "bobs" } ]; return { sampleVoteResultData: vData, sampleCommentResultData: comData, sampleGameStartData: gsData, getWinner: getWinner // TODO: make generic }; }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"pages_feedback.js.html":{"id":"pages_feedback.js.html","title":"Source: pages/feedback.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: pages/feedback.js /** * Handles js interaction for the feedback page * @module feedback */ require(['jquery','app' , 'validate','jqueryUI'], function($, app){ app.init('feedback'); // load catagories for feedback (function(){ $.ajax({ data: {'function': "FBC", 'id': 'feedback_categories'}, url: app.engine, type: 'POST', dataType: 'json', desc: 'utility (load metadata)', success: function(results){ // load question selectmenu $('#category') .empty() .append(new Option("None", "0")); $.each(results, function(){ $('#category') .append(new Option(this.value, this.id)) .val("0") .selectmenu('refresh') }); } }); })(); // custom validation for category box...give user another chance to choose before submission function confirmCategory(valid){ // override validation of category field if (categoryValid){ valid = categoryValid; } if (!valid){ var validator = $('form').validate(); validator.showErrors({ 'category' : "Please select a category" }); msgOpt = { buttons: { Yes: function(){ categoryValid = true; validator.resetForm(); $(this).dialog('close'); $('form').submit(); $(this).dialog('destroy'); }, No: function(){ $(this).dialog('destroy'); } } }; title = "Message Category"; message = "Are you sure you can't find a category to describe your message"; settings = $.extend({}, app.mboxDefaults(title, message), msgOpt); $('<div id="confirmChoice" />').dialog(settings); } } // validate signup form on keyup and submit // calls submitFeedback on valid() var categoryValid = false; $("#frmFeedback").validate({ submitHandler: function(){ formData = $(this.currentForm).serializeForm(); formData.function = "FB"; submitFeedback(formData); }, rules: { category: { required: { depends: function(element){ // validate value var invalidValue = "0", currentValue = $(element).val(), valid = invalidValue != currentValue; // if not valid...are you sure? if (!categoryValid){ confirmCategory(valid); }else{ valid = categoryValid; } return valid; } } }, name: "required", email: { required: true, email: true }, message: { required: true, minlength: 2 } }, messages: { category: "Please select a category", name: "Please enter your name", message: "Please enter your message", email: { required: "Please enter a valid email address", email: "Your email address must be in the format of name@domain.com" } } }); /** * Submits an ajax call to send signup info to the database * * @method submitFeedback */ function submitFeedback(data){ $.ajax({ contentType: "application/x-www-form-urlencoded", desc: "Submit User request for feedback", data: data, type: "POST", url: app.engine }) .done(function(results){ // internal error handling if ('error' in results){ var validator = $("#frmFeedback").validate(); validator.showErrors({ "message": results.error }); }else{ app.dMessage(results.title, results.message); } }); } // formatting $('input[type!=submit], textarea').width($('#category-button').width()); }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"pages_signup.js.html":{"id":"pages_signup.js.html","title":"Source: pages/signup.js","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Source: pages/signup.js /** * @fileOverview Handles js interaction for the signup page * @module signup * @desc The signup module controls the signup/registration page on the site * It is separated so that the code can be called on any appropriate (pages * viewed by unauthorize access) * * This module handles: * - submission of registration data * - validation of the registration form * - username availability check * @author Tony Moses * @version 0.1 */ require(['jquery','app' , 'validate','jqueryUI', 'steps'], function($, app){ /** * @desc Submits an ajax call to send signup info to the database * @method submitUserInfo * @param {object} data Form info used to register user */ function submitUserInfo(data){ $.ajax({ contentType: "application/x-www-form-urlencoded", desc: "Submit User information for registration", data: data, type: "POST", url: app.engine }) .done(function(result){ if (typeof(result) !== 'object'){ result = JSON.parse(result)[0]; } // internal error handling if (result.error !== undefined){ var validator = $("#signup").validate(); validator.showErrors({ "paypal_account": result.error }); }else{ // set user name to login screen $('#login #username').val(result.username); // show login screen $('.modal-container') .tabs({ active: 0}) // show login with username filled in .dialog('open'); $('#login #password').focus(); } }) .fail(function(jqXHR, textStatus, errorThrown) { console.log('getJSON request failed! ' + textStatus); }) .always(function() { /*console.log('getJSON request ended!');*/ }); } // wizardify form and set up validation /** * @desc Setup for form styling (steps plugin w/ events) and validation setup */ $('#signup') /** * @desc Specific config options and event handling */ .steps({ headerTag: 'h1', bodyTag: 'fieldset', transitionEffect: 'slideLeft', stepsOrientation: 'vertical', onStepChanging: function (event, currentIndex, newIndex) { // Always allow going backward even if the current step contains invalid fields! if (currentIndex > newIndex) return true; var form = $(this); // Clean up if user went backward before if (currentIndex < newIndex) { // To remove error styles $(".body:eq(" + newIndex + ") label.error", form).remove(); $(".body:eq(" + newIndex + ") .error", form).removeClass("error"); } // Disable validation on fields that are disabled or hidden. form.validate().settings.ignore = ":disabled,:hidden"; // Start validation; Prevent going forward if false return form.valid(); }, onStepChanged: function (event, currentIndex, priorIndex) { }, onFinishing: function (event, currentIndex) { var form = $(this); // Disable validation on fields that are disabled. // At this point it's recommended to do an overall check (mean ignoring only disabled fields) form.validate().settings.ignore = ":disabled"; // check to see if player has read the rules and regulations if ($('#rulesChk').is(':disabled')){ app.dMessage("Alert", "You must read the rules and regulations first!"); return false; }else{ return $('#rulesChk').is(':checked'); } // Start validation; Prevent form submission if false return form.valid(); }, onFinished: function (event, currentIndex) {$(this).submit();} }) .validate({ debug: true, submitHandler: function(){ formData = $(this.currentForm).serializeForm(); formData['function'] = "SUI"; submitUserInfo(formData); }, rules: { first_name: "required", last_name: "required", username: { required: true, minlength: 3 }, password: { required: true, minlength: 5 }, confirm_password: { required: true, minlength: 5, equalTo: $("#signup #password") }, email: { required: true, email: true }, paypal_account: { required: true, minlength: 2 }, rulesChk: { required: { depends: function(element){ disabled = $('#rulesChk').is(':disabled'); checked = $('#rulesChk').is(':checked'); // return (!disabled && checked); return false; } } } }, messages: { first_name: "Please enter your first name", last_name: "Please enter your last name", username: { required: "Please enter a username", minlength: "Your username must consist of at least 3 characters" }, password: { required: "Please provide a password", minlength: "Your password must be at least 5 characters long" }, confirm_password: { required: "Please reenter password from above", minlength: "Your password must be at least 5 characters long", equalTo: "Please enter the same password as above" }, email: { required: "Please enter a valid email address", email: "Your email address must be in the format of name@domain.com" }, rulesChk: { required: "You must read the rules and regulations first!" } } }); //clear availibility validations $("#signup #username").on('blur', function(){ $('#username_availability_result').empty(); }); // check username availability $("#signup #username").on('keyup', function(){ username = $(this).val(); minChars = 3; // if the input is the correct length check for availability if (username.length >= minChars){ $("#username_availability_result").html('Checking availability...'); data = { "function": "UAC", "username" : username }; //use ajax to run the check $.ajax({ contentType: "application/x-www-form-urlencoded", desc: "UserName availability", data: data, type: "POST", url: app.engine }) .done(function(result){ availability = (result.available == "0") ? " is Available" : " is not Available"; $('#username_availability_result').html(username + availability); }) .fail(function(jqXHR, textStatus, error){ var err = textStatus + ", " + error; console.log("Response: " + jqXHR.responseText); console.log("Request Failed: " + err); }); } }); }); × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"global.html":{"id":"global.html","title":"Global","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Global Methods between(min, max) Extends javascript Number to have a between functionThe function takes number and returns if that number is between the twoparameters Parameters: Name Type Description min number Minumum comparator max number Maximum comparator Source: lib/pagesLib/appLib.js, line 141 Returns: Boolean Type Boolean Example //retuns true 42.between(40, 50); capitalize() Extends javascript StringThe function takes string and returns capitalized string Source: lib/pagesLib/appLib.js, line 177 Returns: capitalized string Type String Example //returns Error var status = "error"; status.capitalize(); pluralize(count, plural) Extends javascript StringThe function takes string and returns pluralized version based on count Parameters: Name Type Argument Default Description count number Thec count of items to base pluralization on plural string <optional> s Plural string Source: lib/pagesLib/appLib.js, line 158 Returns: Pluralized string Type String Example //retuns cats cat.pluralize(10); prefix(separator) Extends javascript StringThe function finds a prefix of a string based on a separator string Parameters: Name Type Argument Default Description separator string <optional> _ String to mark prefix Source: lib/pagesLib/appLib.js, line 194 Returns: prefix of string Type String Example //retuns sub var id = "sub_Category" status.prefix(); serializeForm() Extends JQuery fnConverts form data to js object Source: lib/pagesLib/appLib.js, line 211 Returns: formdata Type object Example //retuns form in js object setDefaults() Set default values for tooltipster plugin Source: lib/pagesLib/appLib.js, line 124 toMMSS() Extends Javascript StringConverts seconds as string/int to HH:MM:SS Source: lib/pagesLib/appLib.js, line 237 Returns: string Type string Example //returns × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"modules.list.html":{"id":"modules.list.html","title":"Modules","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Modules Namespaces app/appLib game/gameLib Events Navigation click Handles click event for Signup/SignIn buttonsand determins whether to create login dialog and which tab to open Source: app.js, line 996 Game submission of "gameUI" validation for debate game ui Source: pages/game.js, line 209 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"namespaces.list.html":{"id":"namespaces.list.html","title":"Namespaces","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Namespaces Namespaces app/appLib game/gameLib Events Navigation click Handles click event for Signup/SignIn buttonsand determins whether to create login dialog and which tab to open Source: app.js, line 996 Game submission of "gameUI" validation for debate game ui Source: pages/game.js, line 209 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"index.html":{"id":"index.html","title":"Index","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"app_appLib.html":{"id":"app_appLib.html","title":"Namespace: app/appLib","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Namespace: app/appLib app/appLib Library For: AppContents: navigation pages hash skill levels hash Rules text JQuery addons JS prototypes When the module is loaded it will be referred to as "lib" Version: 0.1 Author: Tony Moses Source: lib/pagesLib/appLib.js, line 1 Members <static> tplRules template for site rules Source: lib/pagesLib/appLib.js, line 86 To Do: Move template string to site template html <static> txtFooter Visible footer text Source: lib/pagesLib/appLib.js, line 116 <readonly> navPages For usage example see: Navigation Bar (app.js line 348) Properties: Name Type Description key string navPages.key value string navPages.value Source: lib/pagesLib/appLib.js, line 19 Example // returns "index.html lib.navPages.home; <readonly> skillLevels :array This is an array of objects containing skill title/desc. This object will be used torefer to site pages and helps preserve DRY method.For usage example see: module:app~getLevelName (app.js line 104) Type: array Properties: Name Type Description title string description string Source: lib/pagesLib/appLib.js, line 41 Methods <static> getFooterText() Source: lib/pagesLib/appLib.js, line 263 See: txtFooter app/appLogin~tplRules × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"game_gameLib.html":{"id":"game_gameLib.html","title":"Namespace: game/gameLib","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Namespace: game/gameLib game/gameLib Library: Game Contents: Sample Data for testing When the module is loaded it will be referred to as "lib" Version: 0.1 Author: Tony Moses Source: lib/pagesLib/gameLib.js, line 1 Methods <static> getWinner(data) get winner with most votes Parameters: Name Type Description data object function takes data sample (vData) Source: lib/pagesLib/gameLib.js, line 14 To Do: make function more generic possible: able to search "obj" for max, min, etc based on params Returns: the player object Type obj Example // Sample data var vData = [{ "votes": 1, "user_id": 36, "avatar": "36_avatar.jpg", "wager" : 10, "username": "tonym415" }, { "votes": 2, "user_id": 52, "avatar": "52_avatar.jpg", "wager" : 10, "username": "user" }, { "votes": 0, "user_id": 54, "avatar": "54_avatar.jpg", "wager" : 10, "username": "bobs" } ]; × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"module-app.html":{"id":"module-app.html","title":"Module: app","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Module: app This module sets up a global object used in the applicationIt also has the global non page-specific setup for the site pagesI contains function for: banner creation and event linking Places of interest as of 24Jan16 See module:app/appLib for all "lib" interaction Navigation Bar Source: app.js, line 1 Methods <inner> agreement() Shows agreement window Source: app.js, line 195 <inner> ensureLogin() Use window location information to determine if login flag is needed Source: app.js, line 122 <inner> getAvatar(avFilespec) Parameters: Name Type Description avFilespec string Name of file Source: app.js, line 310 Returns: Fully file specification of avatar Type string <inner> getCatQuestions(catID, elementID) Parameters: Name Type Description catID int Category ID elementID int Category ID Source: app.js, line 616 <inner> getCookie(name) gets cookies info Parameters: Name Type Description name string Cookie name Source: app.js, line 524 <inner> getLevelName(val) Base on this param, this function returns the correct skill level title using the skillLevel object Parameters: Name Type Description val number Source: app.js, line 407 <inner> init(page) Initialization function for all pages Parameters: Name Type Description page string code name for current pages Source: app.js, line 37 Returns: If true show the login window Type boolean <inner> loading(msg) Parameters: Name Type Description msg string Message string Source: app.js, line 418 <inner> loginNavBar(page) Uses parameter to appropriately set the navigation barSee module:app/appLib~navPages for param (page) reference Parameters: Name Type Description page string Page key from library Source: app.js, line 337 <inner> logout() Logout Source: app.js, line 324 <inner> rankInfo() Display rank info Source: app.js, line 286 <inner> setCookie(name, data) sets cookies with info Parameters: Name Type Description name string Cookie name data object Cookie data Source: app.js, line 484 <inner> setFooter() Universal function to create the footerUses template string from library to load footer module:app/appLib~getFooterText Source: app.js, line 144 <inner> setTheme(theme) Parameters: Name Type Description theme string JQuery ui theme string Source: app.js, line 500 <inner> showRanking() Build rankings element Source: app.js, line 229 <inner> showSkills() Show user rank Source: app.js, line 377 <inner> unloading() Unblock the ui Source: app.js, line 429 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"module-feedback.html":{"id":"module-feedback.html","title":"Module: feedback","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Module: feedback Handles js interaction for the feedback page Source: pages/feedback.js, line 1 Methods <inner> submitFeedback() Submits an ajax call to send signup info to the database Source: pages/feedback.js, line 113 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"module-game.html":{"id":"module-game.html","title":"Module: game","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Module: game Handles all functions for the game page Version: 0.1 i* Author: Tony Moses Source: pages/game.js, line 1 Members <inner> gameClock :FlipClock Game Clock instantiation Type: FlipClock Source: pages/game.js, line 577 <inner> waitClock :FlipClock Wait Clock instantiation Type: FlipClock Source: pages/game.js, line 593 Methods <inner> commentPoll() Calls polling function with generated options Source: pages/game.js, line 267 <inner> displayComments(users) Displays game comments in jquery selectable format Parameters: Name Type Description users array an array Source: pages/game.js, line 332 <inner> getCommentPollData() Source: pages/game.js, line 254 Returns: object object containing function name, id, game id, counter Type object <inner> getGame() Recursive poller of the db to get players and start game on success: loads the debate on error: gives the user another chance to search for a game Source: pages/game.js, line 95 <inner> getVotePollData() Source: pages/game.js, line 444 Returns: object object containing function name, id, game id, counter Type object <inner> loadWinner(users) Parameters: Name Type Description users array Array of objects represent vote data including user info Source: pages/game.js, line 471 Returns: winnerDiv info Type html <inner> poller() Polling function Source: pages/game.js, line 282 <inner> submitGame(form) Submits game data Parameters: Name Type Description form object data and current user id Source: pages/game.js, line 226 <inner> submitVote(data) Submit Vote to database and start polling for winner data Parameters: Name Type Description data object Form data including vote and current user id Source: pages/game.js, line 420 <inner> votePoll() Calls polling function with generated options Source: pages/game.js, line 456 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "},"module-signup.html":{"id":"module-signup.html","title":"Module: signup","body":" ISIB API Namespaces app/appLibgame/gameLib Modules appfeedbackgamesignup Events app.event:Navigation clickgame.event:Game submission of "gameUI" Global betweencapitalizepluralizeprefixserializeFormsetDefaultstoMMSS Module: signup The signup module controls the signup/registration page on the siteIt is separated so that the code can be called on any appropriate (pagesviewed by unauthorize access) This module handles: submission of registration data validation of the registration form username availability check Version: 0.1 Author: Tony Moses Source: pages/signup.js, line 1 Methods <inner> submitUserInfo(data) Submits an ajax call to send signup info to the database Parameters: Name Type Description data object Form info used to register user Source: pages/signup.js, line 16 × Search results Close Documentation generated by JSDoc 3.4.0 on Sun Jan 24th 2016 using the DocStrap template. "}}
</script>
<script type="text/javascript">
$(document).ready(function() {
Searcher.init();
});
$(window).on("message", function(msg) {
var msgData = msg.originalEvent.data;
if (msgData.msgid != "docstrap.quicksearch.start") {
return;
}
var results = Searcher.search(msgData.searchTerms);
window.parent.postMessage({"results": results, "msgid": "docstrap.quicksearch.done"}, "*");
});
</script>
</body>
</html>