Browse Source

Resurrected a old project. Plan: use basic Jquery for dom manipulation rather than the react framework.

master
jrtechs 5 years ago
parent
commit
4d98290b43
8 changed files with 151 additions and 17 deletions
  1. +7
    -0
      googletrendsgame/JQueryReWork/README.md
  2. +1
    -5
      googletrendsgame/JQueryReWork/css/app.css
  3. +84
    -0
      googletrendsgame/JQueryReWork/html/home.html
  4. +44
    -0
      googletrendsgame/JQueryReWork/server.js
  5. +6
    -2
      googletrendsgame/package.json
  6. +1
    -1
      googletrendsgame/public/index.html
  7. +7
    -8
      googletrendsgame/server/package.json
  8. +1
    -1
      googletrendsgame/src/App.js

+ 7
- 0
googletrendsgame/JQueryReWork/README.md View File

@ -0,0 +1,7 @@
```bash
npm install express --save
npm install express-session --save
npm install url --save
npm install whiskers --save
npm install fs --save
```

googletrendsgame/src/App.css → googletrendsgame/JQueryReWork/css/app.css View File

@ -7,7 +7,7 @@ body {
.logo {
width: auto;
flex: 0;
padding: 20px;
padding: 5px;
color: #0459ed;
font-size: 50px;
text-transform: uppercase;
@ -285,7 +285,6 @@ a {
.game__phrase--entry,
.game__phrase--clue {
float: left;
padding: 0 0 15px 0;
padding-left: 0;
font-size: 100px;
@ -293,9 +292,6 @@ a {
vertical-align: baseline; }
.game__phrase--entry {
min-width: 100px;
margin: 0 15px 10px 0;
border-right: none;
background: transparent;
box-shadow: 0;
text-align: right;

+ 84
- 0
googletrendsgame/JQueryReWork/html/home.html View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta -->
<meta charset="UTF-8" />
<title>Trend Spotter | Game</title>
<!-- / -->
<!-- Styles -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:100,300,400,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:100,300,400,500,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="app.css">
<!-- / -->
</head>
<body>
<div class="">
<div class="row w-100">
<div class="col-12">
<div class="logo w-100">trend spot</div>
</div>
</div>
<div class="row">
<!-- Main -->
<div class="col-8 game__main">
<div class="game__round">Round 4/7</div>
<div class="row w-100">
<div class="col-8">
<input class="w-100 game__phrase--entry" type="text">
</div>
<div class="col-4">
<div class="game__phrase--clue">car</div>
</div>
</div>
<button class="game__submit">Submit my answer!</button>
<!--<div class="game__user-score">jesseg89: 20,005 points</div>-->
<div class="game__room">You're in <em>dave61's room</em> | 12/20 players</div>
<a href="lobby.html" class="game__exit">Leave Game</a>
</div>
<!-- / -->
<div class="col-4 col-sm-3 game__sidebar">
<div class="game__timer">60 seconds</div>
<ol class="game__players">
<li class="game__player">
<span class="game__player-name">John Daniels</span>
<span class="game__player-score">10,000 points</span>
<span class="game__player-ready">X</span>
</li>
<li class="game__player">
<span class="game__player-name">John Daniels</span>
<span class="game__player-score">10,000 points</span>
<span class="game__player-ready">X</span>
</li>
<li class="game__player">
<span class="game__player-name">John Daniels</span>
<span class="game__player-score">10,000 points</span>
<span class="game__player-ready">X</span>
</li>
</ol>
</div>
</div>
</div>
<!-- Scripts -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="scripts/index.js"></script>
<!-- / -->
</body>
</html>

+ 44
- 0
googletrendsgame/JQueryReWork/server.js View File

@ -0,0 +1,44 @@
/** express app */
const express = require("express");
/**session data for login */
const session = require('express-session');
/** used to parse the request URL */
const url = require('url');
const app = express();
const fs = require('fs');
app.use(express.urlencoded());
app.use(express.json()); // if needed
/**Initializes sessions for login */
app.use(session({ secret: "changeWithConfigLater", cookie: { maxAge: 6000000 }}));
const PORT = 5000;
const whiskers = require('whiskers');
function fetchHTML(templateContext, templateKey, filename)
{
templateContext[templateKey] = fs.readFileSync(filename)
}
app.get('/', (requst, result) =>
{
result.write(fs.readFileSync("./html/home.html"));
result.end();
});
app.use(express.static('css'));
app.use(express.static('js'));
app.listen(PORT, () => console.log(`App listening on port ${PORT}!`));

+ 6
- 2
googletrendsgame/package.json View File

@ -3,7 +3,9 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"express": "^4.16.2",
"express": "^4.16.4",
"express-session": "^1.15.6",
"fs": "0.0.2",
"google-trends-api": "^4.4.0",
"mysql": "^2.15.0",
"promise": "^8.0.1",
@ -13,7 +15,9 @@
"react-scripts": "1.1.0",
"sanitizer": "^0.1.3",
"socket.io": "^2.0.4",
"socket.io-client": "^2.0.4"
"socket.io-client": "^2.0.4",
"url": "^0.11.0",
"whiskers": "^0.4.0"
},
"scripts": {
"start": "react-scripts start",

+ 1
- 1
googletrendsgame/public/index.html View File

@ -11,7 +11,7 @@
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="stylesheet" href="../src/base.css" />
<link rel="stylesheet" href="../src/App.css" />
<link rel="stylesheet" href="../JQueryReWork/css/app.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Poppins:500,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:300" rel="stylesheet">

+ 7
- 8
googletrendsgame/server/package.json View File

@ -1,7 +1,6 @@
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "server.js",
"directories": {
"test": "test"
@ -15,14 +14,14 @@
"author": "",
"license": "ISC",
"dependencies": {
"async": "^2.6.0",
"express": "^4.16.2",
"google-trends-api": "^4.5.0",
"morgan": "^1.9.0",
"mysql": "^2.15.0",
"promise": "^8.0.1",
"async": "^2.6.1",
"express": "^4.16.4",
"google-trends-api": "^4.8.0",
"morgan": "^1.9.1",
"mysql": "^2.16.0",
"promise": "^8.0.2",
"sanitizer": "^0.1.3",
"socket.io": "^2.0.4"
"socket.io": "^2.2.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",

+ 1
- 1
googletrendsgame/src/App.js View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import '../JQueryReWork/css/app.css';
import openSocket from 'socket.io-client';
import NicknameInput from './components/nicknameInput';
import CreateRoomInput from './components/createRoomInput';

Loading…
Cancel
Save