PHP Classes

File: html/js/boothelp-demo.js

Recommend this page to a friend!
  Classes of Jorge Cobis   Boot Help Demo   html/js/boothelp-demo.js   Download  
File: html/js/boothelp-demo.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Boot Help Demo
Hidden word and hidden number games with Bootstrap
Author: By
Last change:
Date: 8 years ago
Size: 3,527 bytes
 

Contents

Class file image Download
/* * BootHelpDemo * * (The MIT License) * * Copyright (c) 2015 Jorge Cobis <jcobis@gmail.com / http://twitter.com/cobisja>. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ $(function(){ $("#about-link").click(function(event){ event.preventDefault(); var url = $(this).attr("href").replace(/.+?\?(.*)$/, "$1"); $.ajax({ type: "get", url: url, success: function(response) { $("#about").length > 0 ? null : $("#main").append(response); } }).done(function(){ $("button[data-target='#about-modal']").click(); }); }); $("a.game-item").click(function(event){ event.preventDefault(); $("#main-nav").siblings().remove(); var url = $(this).attr("href"); $.ajax({ type: "get", url: url, success: function(response) { $("#demo-info").remove(); $("#main").append(response); } }).done(function(){ $("#user-entry").focus(); }); }); $(document).on('click', '#game form button[type=submit]', function(e) { var letter = { 'value': $('input[name=ud]').val().trim() }; var url = $("#game form").attr("action").replace(/.+?\?(.*)$/, "$1"); e.preventDefault(); if (0 !== letter.value.length) { $.ajax({ url: url, data: letter, type: "get", datatype: "json", encode: true }).done(function(response){ response = JSON.parse(response); if (!response.winner) { $("#game-action").html(response.game); $("#user-entry").val("").focus(); $("#prev-items").removeClass("disabled"); $("#modal-prev-entries div.modal-body").text(response.prev_items_list); } else { $("#game").html(response.game); } $("#game-progress").html(response.progress); }); } }); $(document).on('click', "button.toggle-desc", function(){ $("#game-description").slideToggle(); $("button.toggle-desc").text(function(){ return "Hide desc" === $(this).text() ? "Show desc" : "Hide desc";; }); }); });