First Local Commit - After Clean up.
Signed-off-by: Rick Hays <rhays@haysgang.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Rewrite engine
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Turning on the rewrite engine is necessary for the following rules and features.
|
||||
# FollowSymLinks must be enabled for this to work.
|
||||
<IfModule mod_rewrite.c>
|
||||
Options +FollowSymlinks
|
||||
RewriteEngine On
|
||||
|
||||
# If you installed CodeIgniter in a subfolder, you will need to
|
||||
# change the following line to match the subfolder you need.
|
||||
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
|
||||
# RewriteBase /
|
||||
|
||||
# Redirect Trailing Slashes...
|
||||
RewriteRule ^(.*)/$ /$1 [L,R=301]
|
||||
|
||||
# Rewrite "www.example.com -> example.com"
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
||||
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
|
||||
|
||||
# Checks to see if the user is attempting to access a valid file,
|
||||
# such as an image or css document, if this isn't true it sends the
|
||||
# request to the front controller, index.php
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]
|
||||
|
||||
# Ensure Authorization header is passed along
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_rewrite.c>
|
||||
# If we don't have mod_rewrite installed, all 404's
|
||||
# can be sent to index.php, and everything works as normal.
|
||||
ErrorDocument 404 index.php
|
||||
</IfModule>
|
||||
|
||||
# Disable server signature start
|
||||
ServerSignature Off
|
||||
# Disable server signature end
|
||||
+3719
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+331
@@ -0,0 +1,331 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2019 The Bootstrap Authors
|
||||
* Copyright 2011-2019 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
line-height: 1.15;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #212529;
|
||||
text-align: left;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
[tabindex="-1"]:focus {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title],
|
||||
abbr[data-original-title] {
|
||||
text-decoration: underline;
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
border-bottom: 0;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: .5rem;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #0056b3;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]) {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:not([href]):not([tabindex]):focus {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img {
|
||||
vertical-align: middle;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
svg {
|
||||
overflow: hidden;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
color: #6c757d;
|
||||
text-align: left;
|
||||
caption-side: bottom;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus {
|
||||
outline: 1px dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
input {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
|
||||
button,
|
||||
[type="button"],
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
button:not(:disabled),
|
||||
[type="button"]:not(:disabled),
|
||||
[type="reset"]:not(:disabled),
|
||||
[type="submit"]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
input[type="radio"],
|
||||
input[type="checkbox"] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
input[type="date"],
|
||||
input[type="time"],
|
||||
input[type="datetime-local"],
|
||||
input[type="month"] {
|
||||
-webkit-appearance: listbox;
|
||||
}
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: .5rem;
|
||||
font-size: 1.5rem;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type="search"] {
|
||||
outline-offset: -2px;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
template {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2019 The Bootstrap Authors
|
||||
* Copyright 2011-2019 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
|
||||
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
|
||||
File diff suppressed because one or more lines are too long
+10038
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,54 @@
|
||||
/* ********************************************************************************************************************
|
||||
RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
|
||||
|
||||
File: public/assets/css/game.css
|
||||
Description: Main CSS Page
|
||||
Author: Rick Hays
|
||||
Date: 11/15/2019
|
||||
License: MIT
|
||||
CopyRight: Copyright © 2019 - Rick Hays, All Rights Reserved.
|
||||
|
||||
Revisions:
|
||||
YYYY-MM-DD XX Description
|
||||
***************************************************************************************************************** */
|
||||
|
||||
.column
|
||||
{
|
||||
border-radius: 15px;
|
||||
float: left;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
width: 33.33%;
|
||||
}
|
||||
|
||||
.columnspanCountHeader
|
||||
{
|
||||
border-radius: 15px;
|
||||
display: inline-block;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin: 0 auto;
|
||||
vertical-align: middle;
|
||||
width: 80%
|
||||
}
|
||||
|
||||
.columnspanTryAgain,
|
||||
.columnspanNoThanks
|
||||
{
|
||||
border-radius: 15px;
|
||||
display: block;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
margin-left: 15px;
|
||||
vertical-align: middle;
|
||||
width: 60%
|
||||
}
|
||||
|
||||
/* Clear floats after the columns */
|
||||
.row:after
|
||||
{
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/* Custom page CSS -------------------------------------------------- */
|
||||
main > .container
|
||||
{
|
||||
padding: 60px 15px 0;
|
||||
}
|
||||
|
||||
.footer
|
||||
{
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.footer > .container
|
||||
{
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code
|
||||
{
|
||||
font-size: 80%;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Users":
|
||||
[{
|
||||
"UserName": "User One",
|
||||
"Wins": "1",
|
||||
"Loses": "1",
|
||||
"LastDate": "2019-11-08",
|
||||
"IP": "127.0.0.1",
|
||||
"City": "Dallas",
|
||||
"Country": "US"
|
||||
},
|
||||
{
|
||||
"UserName": "User Two",
|
||||
"Wins": "2",
|
||||
"Loses": "2",
|
||||
"LastDate": "2019-11-08",
|
||||
"IP": "127.0.0.1",
|
||||
"City": "Sofia",
|
||||
"Country": "BG"
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* Game - Main JS file for game play, user, and file save.
|
||||
*
|
||||
* @date 2019-11-08
|
||||
* @author Rick Hays
|
||||
*
|
||||
*/
|
||||
|
||||
let oUsers = null;
|
||||
let oCurrentUser = null;
|
||||
let userID = null;
|
||||
let userName = '';
|
||||
let userWins = 0;
|
||||
let userLoses = 0;
|
||||
let userLastPlayed = '';
|
||||
let userIP = '';
|
||||
let userCity = '';
|
||||
let userCountry = '';
|
||||
|
||||
// Get current JSON file and import into array
|
||||
$(document).ready(function ()
|
||||
{
|
||||
$.getJSON('data/users.json', function (data)
|
||||
{
|
||||
// Pass data out so it can be used.
|
||||
getUsersData(data.Users);
|
||||
// Start of game screen, determine if there is a cookie or not and display correct screen
|
||||
userID = readCookie('userID');
|
||||
userID !== null ? $("#game").toggleClass('d-none') : $("#getuser").toggleClass('d-none');
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
function getUsersData(data)
|
||||
{
|
||||
oUsers = data;
|
||||
}
|
||||
|
||||
function writeUserData(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function submitUserName()
|
||||
{
|
||||
UName = $("#UserName").val();
|
||||
if (UName === '')
|
||||
{
|
||||
$(".boxerror").html('You must enter a user name to play the game.');
|
||||
if ($(".boxerror").hasClass('d-none')) $(".boxerror").toggleClass('d-none');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(".boxerror").toggleClass('d-none');
|
||||
userID = checkUserName(oUsers, UName);
|
||||
// alert('User ID: ' + userID);
|
||||
if (userID === null)
|
||||
{
|
||||
createUser(UName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Confirm User before loading else ask for new name
|
||||
|
||||
// Load user info from userID
|
||||
userName = oUsers[userID].UserName;
|
||||
userWins = oUsers[userID].Wins;
|
||||
userLoses = oUsers[userID].Loses;
|
||||
userLastPlayed = oUsers[userID].LastDate;
|
||||
userIP = oIP.ip;
|
||||
userCity = oIP.city;
|
||||
userCountry = oIP.country_code;
|
||||
|
||||
alert('User: ' + userName + ' - City: ' + userCity);
|
||||
// userIP = GET IP ADDRESS
|
||||
// create cookie with userID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkUserName(oUsers, name)
|
||||
{
|
||||
for (let i = 0; i < oUsers.length; i++ )
|
||||
{
|
||||
if (oUsers[i].UserName === name)
|
||||
return i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param UName
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
function createUser(UName)
|
||||
{
|
||||
userName = UName;
|
||||
userWins = 0;
|
||||
userLoses = 0;
|
||||
userLastPlayed = getCurrentDate();
|
||||
userIP = oIP.ip;
|
||||
userCity = oIP.city;
|
||||
userCountry = oIP.country_code;
|
||||
|
||||
// Create User Object
|
||||
oCurrentUser =
|
||||
{
|
||||
'UserName': userName,
|
||||
"Wins": userWins,
|
||||
"Loses": userLoses,
|
||||
"LastDate": userLastPlayed,
|
||||
"IP": userIP,
|
||||
"City": userCity,
|
||||
"Country": userCountry
|
||||
};
|
||||
// Add to Users Object
|
||||
oUsers.push(oCurrentUser);
|
||||
|
||||
// Get ID of JSON User Position
|
||||
userID = checkUserName(oUsers, UName);
|
||||
|
||||
// Write JSON file back out.
|
||||
|
||||
// create cookie with userID
|
||||
alert('ID: ' + userID + ' - City: ' + oCurrentUser.City + ' - ' + oUsers[2].City);
|
||||
}
|
||||
|
||||
function updateUser(UName)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* createCookie - Creates a cookie with Name->Value pair, and will stay active for x hours
|
||||
*
|
||||
* @date 2019-11-08
|
||||
* @author Rick Hays
|
||||
* @param name
|
||||
* @param value
|
||||
* @param hours
|
||||
*/
|
||||
function createCookie(name, value, hours)
|
||||
{
|
||||
let expires = "";
|
||||
if (hours)
|
||||
{
|
||||
let date = new Date();
|
||||
date.setTime(date.getTime()+(hours*60*60*1000));
|
||||
expires='' + date.toUTCString(); //.toGMTString();
|
||||
}
|
||||
document.cookie = name + '=' + value + '; expires=' + expires + "; path=/";
|
||||
}
|
||||
|
||||
/**
|
||||
* readCookie - reads the value of the name->value pair using the name, returns NULL if not found.
|
||||
*
|
||||
* @date 2019-11-08
|
||||
* @author Rick Hays
|
||||
* @param name
|
||||
* @returns {string|null}
|
||||
*/
|
||||
function readCookie(name)
|
||||
{
|
||||
let nameEQ = name + "=";
|
||||
let ca = document.cookie.split(';');
|
||||
for(let i = 0; i < ca.length; i++)
|
||||
{
|
||||
let c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* eraseCookie - erases cookie with the name->vaule pair.
|
||||
*
|
||||
* @date 2019-11-08
|
||||
* @author Rick Hays
|
||||
* @param name
|
||||
*/
|
||||
function eraseCookie(name)
|
||||
{
|
||||
createCookie(name,"",-1);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
function getCurrentDate()
|
||||
{
|
||||
let today = new Date();
|
||||
let dd = String(today.getDate()).padStart(2, '0');
|
||||
let mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
||||
let yyyy = today.getFullYear();
|
||||
return mm + '/' + dd + '/' + yyyy;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
let oIP = null;
|
||||
|
||||
$(document).ready(function ()
|
||||
{
|
||||
$.getJSON("https://ip-api.io/api/json", function(data)
|
||||
{
|
||||
getIPData(data);
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
function getIPData(data)
|
||||
{
|
||||
oIP = data;
|
||||
}
|
||||
+7013
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4435
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,172 @@
|
||||
/***********************************************************************************************************************
|
||||
RPSLS - Rock, Paper, Scissors, Lizard, Spock Game
|
||||
|
||||
@file public/assets/js/game.js
|
||||
@description Handles all javascript for the game.
|
||||
@author Rick Hays
|
||||
@date 11-17-2019
|
||||
@license MIT
|
||||
@copyright Copyright © 2019 - Rick Hays, All Rights Reserved.
|
||||
|
||||
Revisions:
|
||||
YYYY-MM-DD XX Description
|
||||
***********************************************************************************************************************/
|
||||
|
||||
/**
|
||||
* ALL Processes that require the Document to be ready before running.
|
||||
*/
|
||||
$(document).ready(function ()
|
||||
{
|
||||
/**
|
||||
* Capture the Enter key when in User Name Form
|
||||
*/
|
||||
$("#UserName").keypress(function(e)
|
||||
{
|
||||
if (e.which == 13)
|
||||
{
|
||||
e.preventDefault(); // Stops Enter Key Action
|
||||
submitUserName();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* hideElements - Hides the game play elements from view.
|
||||
*/
|
||||
|
||||
function hideElements()
|
||||
{
|
||||
$('#textRock, #textPaper, #textScissors, #textLizard, #textSpock, #textComputerHas, #textComputerPick, #textWinLoseTie, #textTryAgain, #btnTryAgain, #btnNoThanks').each(function ()
|
||||
{
|
||||
$(this).hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* TryAgain Button - This is for phone (small) screens, hides game play elements and moves the screen back to the
|
||||
* top for user to play again.
|
||||
*/
|
||||
$("#btnTryAgain").click(function(evt)
|
||||
{
|
||||
hideElements();
|
||||
$('html, body').animate({scrollTop: $(".container").offset().top});
|
||||
});
|
||||
|
||||
/**
|
||||
* NoThanks Button - Runs endGame from Controller, this removes session and takes you back to home screen.
|
||||
*/
|
||||
$("#btnNoThanks").click(function(evt)
|
||||
{
|
||||
window.location.href = '/endGame';
|
||||
});
|
||||
|
||||
// Game Play Buttons..
|
||||
$(".gameButton").click(function(evt)
|
||||
{
|
||||
hideElements();
|
||||
|
||||
// Get Button Selected
|
||||
let gameButton = $(this).attr("id");
|
||||
|
||||
// AJAX - Play! Pass Option Selected.
|
||||
jQuery.ajax(
|
||||
{
|
||||
url: 'play/' + gameButton,
|
||||
type: 'get',
|
||||
dataType: "json",
|
||||
success: function(data)
|
||||
{
|
||||
$('#textComputerPick h2').text(data.ComputerPick);
|
||||
|
||||
$("#textWinLoseTie").removeAttr('class');
|
||||
switch(data.Result)
|
||||
{
|
||||
case 'WINNER':
|
||||
$("#textWinLoseTie").addClass("text-success");
|
||||
break;
|
||||
case 'LOSER':
|
||||
$("#textWinLoseTie").addClass("text-danger");
|
||||
break;
|
||||
case 'TIE':
|
||||
$("#textWinLoseTie").addClass("text-info");
|
||||
break;
|
||||
default:
|
||||
$("#textWinLoseTie").addClass("text-light");
|
||||
}
|
||||
$('#textWinLoseTie h2').text(data.Result + ' - ' + data.ResultText);
|
||||
$('#textRock, #textPaper, #textScissors, #textLizard, #textSpock, #textComputerHas, #textComputerPick, #textWinLoseTie, #textTryAgain, #btnTryAgain, #btnNoThanks').each(function(fadeInDiv)
|
||||
{
|
||||
$(this).delay(fadeInDiv * 500).fadeIn(1000);
|
||||
$('html, body').animate({scrollTop:$(document).height()}, '100');
|
||||
});
|
||||
// Scores
|
||||
$('#totalWins').html(data.Wins);
|
||||
$('#totalLoses').html(data.Loses);
|
||||
$('#totalTies').html(data.Ties);
|
||||
},
|
||||
error: function(e)
|
||||
{
|
||||
console.log(e.lineNumber + ' - ' + e.script + ': ERROR - ' + e.message);
|
||||
console.trace();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* validateUName
|
||||
* @description
|
||||
* Simple validation for user name.
|
||||
*
|
||||
* @param UName - User Name to validate.
|
||||
* @returns {boolean} True/False if the name validates to the regex
|
||||
*
|
||||
*/
|
||||
function validateUName(UName)
|
||||
{
|
||||
var regex = /^([0-9a-zA-Z-_@\.]*)$/;
|
||||
return (regex.test(UName)) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* submitUserName
|
||||
* @description
|
||||
* Handles the form submission.
|
||||
*
|
||||
*/
|
||||
function submitUserName()
|
||||
{
|
||||
UName = $("#UserName").val();
|
||||
if (UName === '')
|
||||
{
|
||||
$(".boxerror").html('You must enter a user name to play the game.');
|
||||
}
|
||||
else if(!validateUName(UName))
|
||||
{
|
||||
$(".boxerror").html('User Name can only contain characters: (a-z, A-Z, 0-9, - _ @ .) Only. ');
|
||||
}
|
||||
else
|
||||
{
|
||||
// AJAX to see if name exists and confirm before
|
||||
jQuery.ajax(
|
||||
{
|
||||
url: 'testUser/' + UName,
|
||||
type: 'get',
|
||||
async: false,
|
||||
success: function(data)
|
||||
{
|
||||
if (data !== '0')
|
||||
{
|
||||
let answer = confirm("User Name is already in the Database. \nPress: \nOK - To use this name. \nCANCEL - To pick a new name.");
|
||||
if (answer == true)
|
||||
window.location.href = 'createUser/'+UName+'/'+data;
|
||||
}
|
||||
else
|
||||
window.location.href = 'createUser/'+UName+'/'+data;
|
||||
},
|
||||
error: function(e)
|
||||
{
|
||||
alert('84-game.js: ERROR - ' + e.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+2
File diff suppressed because one or more lines are too long
+10598
File diff suppressed because it is too large
Load Diff
+2
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
// Valid PHP Version?
|
||||
$minPHPVersion = '7.2';
|
||||
if (phpversion() < $minPHPVersion)
|
||||
{
|
||||
die("Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " . phpversion());
|
||||
}
|
||||
unset($minPHPVersion);
|
||||
|
||||
// Path to the front controller (this file)
|
||||
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
|
||||
|
||||
// Location of the Paths config file.
|
||||
// This is the line that might need to be changed, depending on your folder structure.
|
||||
$pathsPath = FCPATH . '../app/Config/Paths.php';
|
||||
// ^^^ Change this if you move your application folder
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* BOOTSTRAP THE APPLICATION
|
||||
*---------------------------------------------------------------
|
||||
* This process sets up the path constants, loads and registers
|
||||
* our autoloader, along with Composer's, loads our constants
|
||||
* and fires up an environment-specific bootstrapping.
|
||||
*/
|
||||
|
||||
// Ensure the current directory is pointing to the front controller's directory
|
||||
chdir(__DIR__);
|
||||
|
||||
// Load our paths config file
|
||||
require $pathsPath;
|
||||
$paths = new Config\Paths();
|
||||
|
||||
// Location of the framework bootstrap file.
|
||||
$app = require rtrim($paths->systemDirectory, '/ ') . '/bootstrap.php';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* LAUNCH THE APPLICATION
|
||||
*---------------------------------------------------------------
|
||||
* Now that everything is setup, it's time to actually fire
|
||||
* up the engines and make this app do its thang.
|
||||
*/
|
||||
$app->run();
|
||||
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Reference in New Issue
Block a user