├── .gitignore
├── .DS_Store
├── src
├── .DS_Store
├── screenshots
│ ├── .DS_Store
│ ├── mobile.png
│ ├── reload.png
│ └── homepage.png
├── modules
│ ├── generateScores.js
│ └── api.js
├── index.html
├── index.js
└── styles.css
├── .hintrc
├── .eslintrc.json
├── .stylelintrc.json
├── package.json
├── webpack.config.js
├── LICENSE
├── dist
├── index.html
├── runtime.bundle.js
└── index.bundle.js
├── .github
└── workflows
│ └── linters.yml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/.DS_Store
--------------------------------------------------------------------------------
/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/src/.DS_Store
--------------------------------------------------------------------------------
/src/screenshots/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/src/screenshots/.DS_Store
--------------------------------------------------------------------------------
/src/screenshots/mobile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/src/screenshots/mobile.png
--------------------------------------------------------------------------------
/src/screenshots/reload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/src/screenshots/reload.png
--------------------------------------------------------------------------------
/src/screenshots/homepage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tumainimaganiko/Leaderboard/HEAD/src/screenshots/homepage.png
--------------------------------------------------------------------------------
/src/modules/generateScores.js:
--------------------------------------------------------------------------------
1 | // Creating lists for displaying Data
2 | const generateScores = (score) => {
3 | const ul = document.querySelector('.content');
4 | ul.innerHTML = '';
5 | score.forEach((element) => {
6 | const li = document.createElement('li');
7 | li.innerHTML = `${element.user} : ${element.score}`;
8 | ul.appendChild(li);
9 | });
10 | };
11 |
12 | export default generateScores;
--------------------------------------------------------------------------------
/.hintrc:
--------------------------------------------------------------------------------
1 | {
2 | "connector": {
3 | "name": "local",
4 | "options": {
5 | "pattern": ["**", "!.git/**", "!node_modules/**"]
6 | }
7 | },
8 | "extends": ["development"],
9 | "formatters": ["stylish"],
10 | "hints": [
11 | "button-type",
12 | "disown-opener",
13 | "html-checker",
14 | "meta-charset-utf-8",
15 | "meta-viewport",
16 | "no-inline-styles:error"
17 | ]
18 | }
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "browser": true,
4 | "es6": true,
5 | "jest": true
6 | },
7 | "parser": "babel-eslint",
8 | "parserOptions": {
9 | "ecmaVersion": 2018,
10 | "sourceType": "module"
11 | },
12 | "extends": ["airbnb-base"],
13 | "rules": {
14 | "no-shadow": "off",
15 | "no-param-reassign": "off",
16 | "eol-last": "off",
17 | "import/extensions": [ 1, {
18 | "js": "always", "json": "always"
19 | }]
20 | },
21 | "ignorePatterns": [
22 | "dist/",
23 | "build/"
24 | ]
25 | }
--------------------------------------------------------------------------------
/.stylelintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["stylelint-config-standard"],
3 | "plugins": ["stylelint-scss", "stylelint-csstree-validator"],
4 | "rules": {
5 | "at-rule-no-unknown": [
6 | true,
7 | {
8 | "ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
9 | }
10 | ],
11 | "scss/at-rule-no-unknown": [
12 | true,
13 | {
14 | "ignoreAtRules": ["tailwind", "apply", "variants", "responsive", "screen"]
15 | }
16 | ],
17 | "csstree/validator": true
18 | },
19 | "ignoreFiles": ["build/**", "dist/**", "**/reset*.css", "**/bootstrap*.css", "**/*.js", "**/*.jsx"]
20 | }
--------------------------------------------------------------------------------
/src/modules/api.js:
--------------------------------------------------------------------------------
1 | const leaderboardApi = 'https://us-central1-js-capstone-backend.cloudfunctions.net/api/';
2 |
3 | // Sending name and score Data
4 | const submitData = async (name, score, gameID) => {
5 | const submitData = await fetch(`${leaderboardApi}games/${gameID}/scores/`, {
6 | method: 'POST',
7 | body: JSON.stringify({
8 | user: name,
9 | score,
10 | }),
11 | headers: {
12 | 'content-type': 'application/json; charset=UTF-8',
13 | },
14 | });
15 |
16 | const response = await submitData.json();
17 | return response;
18 | };
19 |
20 | // Retrieving the names and scores
21 | const refreshScore = async (gameID) => {
22 | const receiveData = await fetch(`${leaderboardApi}games/${gameID}/scores/`, {
23 | method: 'GET',
24 | headers: {
25 | 'Content-Type': 'application/json',
26 | },
27 | });
28 |
29 | const result = await receiveData.json();
30 | return result;
31 | };
32 |
33 | export { submitData, refreshScore };
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "leaderboard",
3 | "version": "1.0.0",
4 | "description": "",
5 | "private": "true",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "build": "webpack",
9 | "start": "webpack serve --open"
10 | },
11 | "keywords": [],
12 | "author": "",
13 | "license": "ISC",
14 | "devDependencies": {
15 | "babel-eslint": "^10.1.0",
16 | "css-loader": "^6.7.3",
17 | "eslint": "^7.32.0",
18 | "eslint-config-airbnb-base": "^14.2.1",
19 | "eslint-plugin-import": "^2.27.5",
20 | "hint": "^7.1.8",
21 | "html-webpack-plugin": "^5.5.1",
22 | "sass": "^1.62.1",
23 | "sass-loader": "^13.3.1",
24 | "style-loader": "^3.3.2",
25 | "stylelint": "^13.13.1",
26 | "stylelint-config-standard": "^21.0.0",
27 | "stylelint-csstree-validator": "^1.9.0",
28 | "stylelint-scss": "^3.21.0",
29 | "webpack": "^5.85.0",
30 | "webpack-cli": "^5.1.1",
31 | "webpack-dev-server": "^4.15.0"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const HtmlWebpackPlugin = require('html-webpack-plugin');
3 |
4 | module.exports = {
5 | entry: {
6 | index: './src/index.js',
7 | },
8 | mode: 'development',
9 | devServer: {
10 | static: './dist',
11 | },
12 | plugins: [
13 | new HtmlWebpackPlugin({
14 | template: './src/index.html',
15 | }),
16 | ],
17 | output: {
18 | filename: '[name].bundle.js',
19 | path: path.resolve(__dirname, 'dist'),
20 | },
21 | optimization: {
22 | runtimeChunk: 'single',
23 | },
24 | module: {
25 | rules: [
26 | {
27 | test: /\.css$/i,
28 | use: ['style-loader', 'css-loader'],
29 | },
30 | {
31 | test: /\.s[ac]ss$/i,
32 | use: [
33 | // Creates `style` nodes from JS strings
34 | 'style-loader',
35 | // Translates CSS into CommonJS
36 | 'css-loader',
37 | // Compiles Sass to CSS
38 | 'sass-loader',
39 | ],
40 | },
41 | ],
42 | },
43 | };
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Tumaini Maganiko
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Leaderboard
8 |
9 |
10 |
13 |
14 |
15 |
16 |
Recent scores
17 |
Refresh
18 |
19 |
22 |
23 |
24 | Add your Scores
25 |
30 |
31 |
32 |
33 |
34 | Built from scratch by Tumaini Maganiko
35 |
36 |
37 |
--------------------------------------------------------------------------------
/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Leaderboard
8 |
9 |
10 |
13 |
14 |
15 |
16 |
Recent scores
17 |
Refresh
18 |
19 |
22 |
23 |
24 | Add your Scores
25 |
30 |
31 |
32 |
33 |
34 | Built from scratch by Tumaini Maganiko
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import './styles.css';
2 | import { refreshScore, submitData } from './modules/api.js';
3 | import generateScores from './modules/generateScores.js';
4 |
5 | const leaderboardApi = 'https://us-central1-js-capstone-backend.cloudfunctions.net/api/';
6 | const gameID = 'vtL6cvMOxCyImcJYZjbt';
7 |
8 | const gameName = async () => {
9 | const response = await fetch(`${leaderboardApi}games/`, {
10 | method: 'POST',
11 | body: JSON.stringify({
12 | name: 'Tumaini Maganiko Game',
13 | }),
14 | headers: {
15 | 'content-type': 'application/json; charset=UTF-8',
16 | },
17 | });
18 |
19 | const id = await response.json();
20 | return id;
21 | };
22 |
23 | const showingScrores = async () => {
24 | const retrieve = await refreshScore(gameID);
25 | generateScores(retrieve.result);
26 | };
27 |
28 | gameName();
29 | const submitButton = document.getElementById('submitBtn');
30 | submitButton.addEventListener('click', (e) => {
31 | e.preventDefault();
32 | const name = document.getElementById('name');
33 | const score = document.getElementById('score');
34 | const errDiv = document.getElementById('errDiv');
35 | if (name.value !== '' && score.value !== '') {
36 | submitData(name.value, score.value, gameID);
37 | name.value = '';
38 | score.value = '';
39 | showingScrores();
40 | errDiv.style.display = 'none';
41 | } else if (name.value === '' && score.value === '') {
42 | errDiv.textContent = 'Name and Score field are required';
43 | errDiv.style.display = 'block';
44 | } else if (name.value === '') {
45 | errDiv.textContent = 'Please fill in your name please';
46 | errDiv.style.display = 'block';
47 | } else if (score.value === '') {
48 | errDiv.textContent = 'Please fill in your score';
49 | errDiv.style.display = 'block';
50 | }
51 | });
52 |
53 | const aLink = document.querySelector('a');
54 | aLink.addEventListener('click', (e) => {
55 | e.preventDefault();
56 | showingScrores();
57 | });
58 |
59 | function askReload() {
60 | return false;
61 | }
62 |
63 | window.onbeforeunload = askReload;
64 | window.onload = () => {
65 | showingScrores();
66 | askReload();
67 | };
68 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: bisque;
3 | }
4 |
5 | h1 {
6 | text-align: center;
7 | }
8 |
9 | .flex {
10 | display: flex;
11 | }
12 |
13 | main {
14 | justify-content: center;
15 | }
16 |
17 | .left-part {
18 | margin: 20px;
19 | width: 30%;
20 | }
21 |
22 | .right-part {
23 | margin: 20px;
24 | }
25 |
26 | form {
27 | flex-direction: column;
28 | align-items: flex-end;
29 | }
30 |
31 | .left-part a {
32 | text-decoration: none;
33 | border: 3px solid black;
34 | padding: 3px 7px;
35 | color: black;
36 | }
37 |
38 | .head-container {
39 | justify-content: space-around;
40 | }
41 |
42 | .head-container h2 {
43 | margin: 0 20px 0 0;
44 | padding-left: 0;
45 | }
46 |
47 | input {
48 | border: 3px solid black;
49 | }
50 |
51 | input::placeholder {
52 | color: black;
53 | font-weight: 900;
54 | }
55 |
56 | input[type="submit"] {
57 | color: black;
58 | font-weight: 900;
59 | background-color: white;
60 | }
61 |
62 | ul {
63 | list-style-type: none;
64 | padding: 0;
65 | border: 3px solid black;
66 | }
67 |
68 | ul li {
69 | margin: 0;
70 | padding: 5px;
71 | }
72 |
73 | ul li:nth-child(even) { background-color: #fff; }
74 |
75 | ul li:hover:nth-child(even) {
76 | background-color: gray;
77 | color: #fff;
78 | }
79 |
80 | ul li:hover:nth-child(odd) {
81 | background-color: rgb(147, 129, 96);
82 | color: #fff;
83 | }
84 |
85 | footer {
86 | position: fixed;
87 | bottom: 0;
88 | right: 0;
89 | }
90 |
91 | #errDiv {
92 | display: none;
93 | padding: 5px;
94 | color: red;
95 | }
96 |
97 | @media only screen and (max-width: 768px) {
98 | h1 {
99 | margin: 0;
100 | }
101 |
102 | main {
103 | flex-direction: column-reverse;
104 | }
105 |
106 | .right-part h2 {
107 | text-align: center;
108 | margin-top: 0;
109 | }
110 |
111 | form {
112 | align-items: center;
113 | }
114 |
115 | .left-part {
116 | width: 100%;
117 | margin: 0;
118 | }
119 |
120 | ul {
121 | width: 90%;
122 | margin: 3.5%;
123 | }
124 |
125 | footer {
126 | position: relative;
127 | text-align: center;
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/.github/workflows/linters.yml:
--------------------------------------------------------------------------------
1 | name: Linters
2 |
3 | on: pull_request
4 |
5 | env:
6 | FORCE_COLOR: 1
7 |
8 | jobs:
9 | lighthouse:
10 | name: Lighthouse
11 | runs-on: ubuntu-22.04
12 | steps:
13 | - uses: actions/checkout@v3
14 | - uses: actions/setup-node@v3
15 | with:
16 | node-version: "18.x"
17 | - name: Setup Lighthouse
18 | run: npm install -g @lhci/cli@0.11.x
19 | - name: Lighthouse Report
20 | run: lhci autorun --upload.target=temporary-public-storage --collect.staticDistDir=.
21 | webhint:
22 | name: Webhint
23 | runs-on: ubuntu-22.04
24 | steps:
25 | - uses: actions/checkout@v3
26 | - uses: actions/setup-node@v3
27 | with:
28 | node-version: "18.x"
29 | - name: Setup Webhint
30 | run: |
31 | npm install --save-dev hint@7.x
32 | [ -f .hintrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.hintrc
33 | - name: Webhint Report
34 | run: npx hint .
35 | stylelint:
36 | name: Stylelint
37 | runs-on: ubuntu-22.04
38 | steps:
39 | - uses: actions/checkout@v3
40 | - uses: actions/setup-node@v3
41 | with:
42 | node-version: "18.x"
43 | - name: Setup Stylelint
44 | run: |
45 | npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x
46 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.stylelintrc.json
47 | - name: Stylelint Report
48 | run: npx stylelint "**/*.{css,scss}"
49 | eslint:
50 | name: ESLint
51 | runs-on: ubuntu-22.04
52 | steps:
53 | - uses: actions/checkout@v3
54 | - uses: actions/setup-node@v3
55 | with:
56 | node-version: "18.x"
57 | - name: Setup ESLint
58 | run: |
59 | npm install --save-dev eslint@7.x eslint-config-airbnb-base@14.x eslint-plugin-import@2.x babel-eslint@10.x
60 | [ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.eslintrc.json
61 | - name: ESLint Report
62 | run: npx eslint .
63 | nodechecker:
64 | name: node_modules checker
65 | runs-on: ubuntu-22.04
66 | steps:
67 | - uses: actions/checkout@v3
68 | - name: Check node_modules existence
69 | run: |
70 | if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Tumaini Maganiko
9 |
10 |
11 |
12 |
13 |
14 | # 📗 Table of Contents
15 |
16 | - [📗 Table of Contents](#-table-of-contents)
17 | - [📖 Leaderboard Project ](#--leaderboard-project-)
18 | - [🛠 Built With ](#-built-with-)
19 | - [Languages](#languages)
20 | - [Tech Stack ](#tech-stack-)
21 | - [Key Features ](#key-features-)
22 | - [🚀 Project Screenshot ](#-project-screenshot-)
23 | - [🚀 Live Demo ](#-live-demo-)
24 | - [💻 Getting Started ](#-getting-started-)
25 | - [Prerequisites](#prerequisites)
26 | - [Setup](#setup)
27 | - [Usage](#usage)
28 | - [`npm start`](#npm-start)
29 | - [Run tests](#run-tests)
30 | - [Deployment ](#deployment-)
31 | - [`npm run build`](#npm-run-build)
32 | - [👥 Author ](#-author-)
33 | - [🤝 Contributing ](#-contributing-)
34 | - [⭐️ Show your support ](#️-show-your-support-)
35 | - [🙏 Acknowledgments ](#-acknowledgments-)
36 | - [📝 License ](#-license-)
37 |
38 |
39 |
40 | # 📖 Leaderboard Project
41 |
42 | ## 🛠 Built With
43 | ##### Languages
44 | 1. HTML
45 | 2. CSS
46 | 3. JAVASCRIPT
47 | 4. Modules
48 | 5. Webpack
49 |
50 | ### Tech Stack
51 |
52 |
53 | Client
54 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | ### Key Features
66 |
67 |
68 | - User can add a name.
69 | - User can add a score.
70 |
71 | (back to top )
72 |
73 |
74 | ## 🚀 Project Screenshot
75 | 
76 |
77 | 
78 |
79 | 
80 |
81 |
82 |
83 | ## 🚀 Live Demo
84 |
85 | - [Live Demo Link](https://tumainimaganiko.github.io/Leaderboard/dist/)
86 |
87 | (back to top )
88 |
89 |
90 |
91 | ## 💻 Getting Started
92 |
93 |
94 | To get a local copy up and running, follow these steps.
95 |
96 | ### Prerequisites
97 |
98 | 1. Web browser
99 | 2. Code editor
100 | 3. Git-smc
101 |
102 | ### Setup
103 |
104 |
105 | To get a local copy up and running follow these simple example steps.
106 |
107 |
108 | - git clone https://github.com/tumainimaganiko/Leaderboard
109 | - cd Leaderboard
110 | - npm install
111 |
112 |
113 | ### Usage
114 |
115 | To run the project, execute the following command:
116 | ### `npm start`
117 | Open [http://localhost:8080](http://localhost:8080) to view it in your browser.
118 |
119 | ```
120 | The page will ask you before reloading when you make changes on the browser.
121 |
122 | You may also see any lint errors in the console if you modify the code.
123 | ```
124 |
125 | ### Run tests
126 |
127 | Coming soon
128 |
129 |
130 | ## Deployment
131 |
132 | ### `npm run build`
133 |
134 | ```
135 | Builds the app for production to the build folder.
136 |
137 | It correctly bundles the project in production mode and optimizes the build for the best performance.
138 |
139 | The build is minified and the filenames include the hashes.
140 | Your app is ready to be deployed!
141 | ```
142 |
143 |
144 |
145 | (back to top )
146 |
147 |
148 |
149 | ## 👥 Author
150 |
151 |
152 | 👤 Tumaini Maganiko
153 |
154 | - GitHub: [@githubhandle](https://github.com/tumainimaganiko)
155 | - Twitter: [@twitterhandle](https://twitter.com/Chief2maini)
156 | - LinkedIn: [LinkedIn](https://www.linkedin.com/in/tumaini-maganiko-991b30262/)
157 |
158 |
159 | (back to top )
160 |
161 |
162 |
163 |
164 |
165 | ## 🤝 Contributing
166 |
167 | Contributions, issues, and feature requests are welcome!
168 |
169 | 1. Fork the Project
170 | 2. Create your Feature Branch (`git checkout -b 'branchname'`)
171 | 3. Commit your Changes (`git commit -m 'Add some branchname'`)
172 | 4. Push to the Branch (`git push origin branchname`)
173 | 5. Open a Pull Request
174 |
175 | Feel free to check the [issues page](../../issues/).
176 |
177 | (back to top )
178 |
179 |
180 |
181 | ## ⭐️ Show your support
182 |
183 |
184 | If you like this project rate me star
185 |
186 | (back to top )
187 |
188 |
189 |
190 | ## 🙏 Acknowledgments
191 |
192 |
193 | I would like to thank Microverse for accelerating my growth
194 |
195 | (back to top )
196 |
197 |
198 |
199 | ## 📝 License
200 |
201 | This project is [MIT](./LICENSE) licensed.
202 |
203 | (back to top )
--------------------------------------------------------------------------------
/dist/runtime.bundle.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
3 | * This devtool is neither made for production nor for readable output files.
4 | * It uses "eval()" calls to create a separate source file in the browser devtools.
5 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
6 | * or disable the default devtool with "devtool: false".
7 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
8 | */
9 | /******/ (() => { // webpackBootstrap
10 | /******/ "use strict";
11 | /******/ var __webpack_modules__ = ({});
12 | /************************************************************************/
13 | /******/ // The module cache
14 | /******/ var __webpack_module_cache__ = {};
15 | /******/
16 | /******/ // The require function
17 | /******/ function __webpack_require__(moduleId) {
18 | /******/ // Check if module is in cache
19 | /******/ var cachedModule = __webpack_module_cache__[moduleId];
20 | /******/ if (cachedModule !== undefined) {
21 | /******/ return cachedModule.exports;
22 | /******/ }
23 | /******/ // Create a new module (and put it into the cache)
24 | /******/ var module = __webpack_module_cache__[moduleId] = {
25 | /******/ id: moduleId,
26 | /******/ // no module.loaded needed
27 | /******/ exports: {}
28 | /******/ };
29 | /******/
30 | /******/ // Execute the module function
31 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
32 | /******/
33 | /******/ // Return the exports of the module
34 | /******/ return module.exports;
35 | /******/ }
36 | /******/
37 | /******/ // expose the modules object (__webpack_modules__)
38 | /******/ __webpack_require__.m = __webpack_modules__;
39 | /******/
40 | /************************************************************************/
41 | /******/ /* webpack/runtime/chunk loaded */
42 | /******/ (() => {
43 | /******/ var deferred = [];
44 | /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
45 | /******/ if(chunkIds) {
46 | /******/ priority = priority || 0;
47 | /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
48 | /******/ deferred[i] = [chunkIds, fn, priority];
49 | /******/ return;
50 | /******/ }
51 | /******/ var notFulfilled = Infinity;
52 | /******/ for (var i = 0; i < deferred.length; i++) {
53 | /******/ var [chunkIds, fn, priority] = deferred[i];
54 | /******/ var fulfilled = true;
55 | /******/ for (var j = 0; j < chunkIds.length; j++) {
56 | /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
57 | /******/ chunkIds.splice(j--, 1);
58 | /******/ } else {
59 | /******/ fulfilled = false;
60 | /******/ if(priority < notFulfilled) notFulfilled = priority;
61 | /******/ }
62 | /******/ }
63 | /******/ if(fulfilled) {
64 | /******/ deferred.splice(i--, 1)
65 | /******/ var r = fn();
66 | /******/ if (r !== undefined) result = r;
67 | /******/ }
68 | /******/ }
69 | /******/ return result;
70 | /******/ };
71 | /******/ })();
72 | /******/
73 | /******/ /* webpack/runtime/compat get default export */
74 | /******/ (() => {
75 | /******/ // getDefaultExport function for compatibility with non-harmony modules
76 | /******/ __webpack_require__.n = (module) => {
77 | /******/ var getter = module && module.__esModule ?
78 | /******/ () => (module['default']) :
79 | /******/ () => (module);
80 | /******/ __webpack_require__.d(getter, { a: getter });
81 | /******/ return getter;
82 | /******/ };
83 | /******/ })();
84 | /******/
85 | /******/ /* webpack/runtime/define property getters */
86 | /******/ (() => {
87 | /******/ // define getter functions for harmony exports
88 | /******/ __webpack_require__.d = (exports, definition) => {
89 | /******/ for(var key in definition) {
90 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
91 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
92 | /******/ }
93 | /******/ }
94 | /******/ };
95 | /******/ })();
96 | /******/
97 | /******/ /* webpack/runtime/hasOwnProperty shorthand */
98 | /******/ (() => {
99 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
100 | /******/ })();
101 | /******/
102 | /******/ /* webpack/runtime/make namespace object */
103 | /******/ (() => {
104 | /******/ // define __esModule on exports
105 | /******/ __webpack_require__.r = (exports) => {
106 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
107 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
108 | /******/ }
109 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
110 | /******/ };
111 | /******/ })();
112 | /******/
113 | /******/ /* webpack/runtime/jsonp chunk loading */
114 | /******/ (() => {
115 | /******/ // no baseURI
116 | /******/
117 | /******/ // object to store loaded and loading chunks
118 | /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
119 | /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
120 | /******/ var installedChunks = {
121 | /******/ "runtime": 0
122 | /******/ };
123 | /******/
124 | /******/ // no chunk on demand loading
125 | /******/
126 | /******/ // no prefetching
127 | /******/
128 | /******/ // no preloaded
129 | /******/
130 | /******/ // no HMR
131 | /******/
132 | /******/ // no HMR manifest
133 | /******/
134 | /******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
135 | /******/
136 | /******/ // install a JSONP callback for chunk loading
137 | /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
138 | /******/ var [chunkIds, moreModules, runtime] = data;
139 | /******/ // add "moreModules" to the modules object,
140 | /******/ // then flag all "chunkIds" as loaded and fire callback
141 | /******/ var moduleId, chunkId, i = 0;
142 | /******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
143 | /******/ for(moduleId in moreModules) {
144 | /******/ if(__webpack_require__.o(moreModules, moduleId)) {
145 | /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
146 | /******/ }
147 | /******/ }
148 | /******/ if(runtime) var result = runtime(__webpack_require__);
149 | /******/ }
150 | /******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
151 | /******/ for(;i < chunkIds.length; i++) {
152 | /******/ chunkId = chunkIds[i];
153 | /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
154 | /******/ installedChunks[chunkId][0]();
155 | /******/ }
156 | /******/ installedChunks[chunkId] = 0;
157 | /******/ }
158 | /******/ return __webpack_require__.O(result);
159 | /******/ }
160 | /******/
161 | /******/ var chunkLoadingGlobal = self["webpackChunkleaderboard"] = self["webpackChunkleaderboard"] || [];
162 | /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
163 | /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
164 | /******/ })();
165 | /******/
166 | /******/ /* webpack/runtime/nonce */
167 | /******/ (() => {
168 | /******/ __webpack_require__.nc = undefined;
169 | /******/ })();
170 | /******/
171 | /************************************************************************/
172 | /******/
173 | /******/
174 | /******/ })()
175 | ;
--------------------------------------------------------------------------------
/dist/index.bundle.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | /*
3 | * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
4 | * This devtool is neither made for production nor for readable output files.
5 | * It uses "eval()" calls to create a separate source file in the browser devtools.
6 | * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
7 | * or disable the default devtool with "devtool: false".
8 | * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
9 | */
10 | (self["webpackChunkleaderboard"] = self["webpackChunkleaderboard"] || []).push([["index"],{
11 |
12 | /***/ "./node_modules/css-loader/dist/cjs.js!./src/styles.css":
13 | /*!**************************************************************!*\
14 | !*** ./node_modules/css-loader/dist/cjs.js!./src/styles.css ***!
15 | \**************************************************************/
16 | /***/ ((module, __webpack_exports__, __webpack_require__) => {
17 |
18 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/noSourceMaps.js */ \"./node_modules/css-loader/dist/runtime/noSourceMaps.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);\n// Imports\n\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"body {\\n background-color: bisque;\\n}\\n\\nh1 {\\n text-align: center;\\n}\\n\\n.flex {\\n display: flex;\\n}\\n\\nmain {\\n justify-content: center;\\n}\\n\\n.left-part {\\n margin: 20px;\\n width: 30%;\\n}\\n\\n.right-part {\\n margin: 20px;\\n}\\n\\nform {\\n flex-direction: column;\\n align-items: flex-end;\\n}\\n\\n.left-part a {\\n text-decoration: none;\\n border: 3px solid black;\\n padding: 3px 7px;\\n color: black;\\n}\\n\\n.head-container {\\n justify-content: space-around;\\n}\\n\\n.head-container h2 {\\n margin: 0 20px 0 0;\\n padding-left: 0;\\n}\\n\\ninput {\\n border: 3px solid black;\\n}\\n\\ninput::placeholder {\\n color: black;\\n font-weight: 900;\\n}\\n\\ninput[type=\\\"submit\\\"] {\\n color: black;\\n font-weight: 900;\\n background-color: white;\\n}\\n\\nul {\\n list-style-type: none;\\n padding: 0;\\n border: 3px solid black;\\n}\\n\\nul li {\\n margin: 0;\\n padding: 5px;\\n}\\n\\nul li:nth-child(even) { background-color: #fff; }\\n\\nul li:hover:nth-child(even) {\\n background-color: gray;\\n color: #fff;\\n}\\n\\nul li:hover:nth-child(odd) {\\n background-color: rgb(147, 129, 96);\\n color: #fff;\\n}\\n\\nfooter {\\n position: fixed;\\n bottom: 0;\\n right: 0;\\n}\\n\\n#errDiv {\\n display: none;\\n padding: 5px;\\n color: red;\\n}\\n\\n@media only screen and (max-width: 768px) {\\n h1 {\\n margin: 0;\\n }\\n\\n main {\\n flex-direction: column-reverse;\\n }\\n\\n .right-part h2 {\\n text-align: center;\\n margin-top: 0;\\n }\\n\\n form {\\n align-items: center;\\n }\\n\\n .left-part {\\n width: 100%;\\n margin: 0;\\n }\\n\\n ul {\\n width: 90%;\\n margin: 3.5%;\\n }\\n\\n footer {\\n position: relative;\\n text-align: center;\\n }\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://leaderboard/./src/styles.css?./node_modules/css-loader/dist/cjs.js");
19 |
20 | /***/ }),
21 |
22 | /***/ "./node_modules/css-loader/dist/runtime/api.js":
23 | /*!*****************************************************!*\
24 | !*** ./node_modules/css-loader/dist/runtime/api.js ***!
25 | \*****************************************************/
26 | /***/ ((module) => {
27 |
28 | eval("\n\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\nmodule.exports = function (cssWithMappingToString) {\n var list = [];\n\n // return the list of modules as css string\n list.toString = function toString() {\n return this.map(function (item) {\n var content = \"\";\n var needLayer = typeof item[5] !== \"undefined\";\n if (item[4]) {\n content += \"@supports (\".concat(item[4], \") {\");\n }\n if (item[2]) {\n content += \"@media \".concat(item[2], \" {\");\n }\n if (needLayer) {\n content += \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\");\n }\n content += cssWithMappingToString(item);\n if (needLayer) {\n content += \"}\";\n }\n if (item[2]) {\n content += \"}\";\n }\n if (item[4]) {\n content += \"}\";\n }\n return content;\n }).join(\"\");\n };\n\n // import a list of modules into the list\n list.i = function i(modules, media, dedupe, supports, layer) {\n if (typeof modules === \"string\") {\n modules = [[null, modules, undefined]];\n }\n var alreadyImportedModules = {};\n if (dedupe) {\n for (var k = 0; k < this.length; k++) {\n var id = this[k][0];\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n }\n for (var _k = 0; _k < modules.length; _k++) {\n var item = [].concat(modules[_k]);\n if (dedupe && alreadyImportedModules[item[0]]) {\n continue;\n }\n if (typeof layer !== \"undefined\") {\n if (typeof item[5] === \"undefined\") {\n item[5] = layer;\n } else {\n item[1] = \"@layer\".concat(item[5].length > 0 ? \" \".concat(item[5]) : \"\", \" {\").concat(item[1], \"}\");\n item[5] = layer;\n }\n }\n if (media) {\n if (!item[2]) {\n item[2] = media;\n } else {\n item[1] = \"@media \".concat(item[2], \" {\").concat(item[1], \"}\");\n item[2] = media;\n }\n }\n if (supports) {\n if (!item[4]) {\n item[4] = \"\".concat(supports);\n } else {\n item[1] = \"@supports (\".concat(item[4], \") {\").concat(item[1], \"}\");\n item[4] = supports;\n }\n }\n list.push(item);\n }\n };\n return list;\n};\n\n//# sourceURL=webpack://leaderboard/./node_modules/css-loader/dist/runtime/api.js?");
29 |
30 | /***/ }),
31 |
32 | /***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
33 | /*!**************************************************************!*\
34 | !*** ./node_modules/css-loader/dist/runtime/noSourceMaps.js ***!
35 | \**************************************************************/
36 | /***/ ((module) => {
37 |
38 | eval("\n\nmodule.exports = function (i) {\n return i[1];\n};\n\n//# sourceURL=webpack://leaderboard/./node_modules/css-loader/dist/runtime/noSourceMaps.js?");
39 |
40 | /***/ }),
41 |
42 | /***/ "./src/styles.css":
43 | /*!************************!*\
44 | !*** ./src/styles.css ***!
45 | \************************/
46 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
47 |
48 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ \"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleDomAPI.js */ \"./node_modules/style-loader/dist/runtime/styleDomAPI.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertBySelector.js */ \"./node_modules/style-loader/dist/runtime/insertBySelector.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js */ \"./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/insertStyleElement.js */ \"./node_modules/style-loader/dist/runtime/insertStyleElement.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../node_modules/style-loader/dist/runtime/styleTagTransform.js */ \"./node_modules/style-loader/dist/runtime/styleTagTransform.js\");\n/* harmony import */ var _node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _node_modules_css_loader_dist_cjs_js_styles_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../node_modules/css-loader/dist/cjs.js!./styles.css */ \"./node_modules/css-loader/dist/cjs.js!./src/styles.css\");\n\n \n \n \n \n \n \n \n \n \n\nvar options = {};\n\noptions.styleTagTransform = (_node_modules_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());\noptions.setAttributes = (_node_modules_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());\n\n options.insert = _node_modules_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, \"head\");\n \noptions.domAPI = (_node_modules_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());\noptions.insertStyleElement = (_node_modules_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());\n\nvar update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_node_modules_css_loader_dist_cjs_js_styles_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"], options);\n\n\n\n\n /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_css_loader_dist_cjs_js_styles_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"] && _node_modules_css_loader_dist_cjs_js_styles_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals ? _node_modules_css_loader_dist_cjs_js_styles_css__WEBPACK_IMPORTED_MODULE_6__[\"default\"].locals : undefined);\n\n\n//# sourceURL=webpack://leaderboard/./src/styles.css?");
49 |
50 | /***/ }),
51 |
52 | /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
53 | /*!****************************************************************************!*\
54 | !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
55 | \****************************************************************************/
56 | /***/ ((module) => {
57 |
58 | eval("\n\nvar stylesInDOM = [];\nfunction getIndexByIdentifier(identifier) {\n var result = -1;\n for (var i = 0; i < stylesInDOM.length; i++) {\n if (stylesInDOM[i].identifier === identifier) {\n result = i;\n break;\n }\n }\n return result;\n}\nfunction modulesToDom(list, options) {\n var idCountMap = {};\n var identifiers = [];\n for (var i = 0; i < list.length; i++) {\n var item = list[i];\n var id = options.base ? item[0] + options.base : item[0];\n var count = idCountMap[id] || 0;\n var identifier = \"\".concat(id, \" \").concat(count);\n idCountMap[id] = count + 1;\n var indexByIdentifier = getIndexByIdentifier(identifier);\n var obj = {\n css: item[1],\n media: item[2],\n sourceMap: item[3],\n supports: item[4],\n layer: item[5]\n };\n if (indexByIdentifier !== -1) {\n stylesInDOM[indexByIdentifier].references++;\n stylesInDOM[indexByIdentifier].updater(obj);\n } else {\n var updater = addElementStyle(obj, options);\n options.byIndex = i;\n stylesInDOM.splice(i, 0, {\n identifier: identifier,\n updater: updater,\n references: 1\n });\n }\n identifiers.push(identifier);\n }\n return identifiers;\n}\nfunction addElementStyle(obj, options) {\n var api = options.domAPI(options);\n api.update(obj);\n var updater = function updater(newObj) {\n if (newObj) {\n if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {\n return;\n }\n api.update(obj = newObj);\n } else {\n api.remove();\n }\n };\n return updater;\n}\nmodule.exports = function (list, options) {\n options = options || {};\n list = list || [];\n var lastIdentifiers = modulesToDom(list, options);\n return function update(newList) {\n newList = newList || [];\n for (var i = 0; i < lastIdentifiers.length; i++) {\n var identifier = lastIdentifiers[i];\n var index = getIndexByIdentifier(identifier);\n stylesInDOM[index].references--;\n }\n var newLastIdentifiers = modulesToDom(newList, options);\n for (var _i = 0; _i < lastIdentifiers.length; _i++) {\n var _identifier = lastIdentifiers[_i];\n var _index = getIndexByIdentifier(_identifier);\n if (stylesInDOM[_index].references === 0) {\n stylesInDOM[_index].updater();\n stylesInDOM.splice(_index, 1);\n }\n }\n lastIdentifiers = newLastIdentifiers;\n };\n};\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js?");
59 |
60 | /***/ }),
61 |
62 | /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
63 | /*!********************************************************************!*\
64 | !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
65 | \********************************************************************/
66 | /***/ ((module) => {
67 |
68 | eval("\n\nvar memo = {};\n\n/* istanbul ignore next */\nfunction getTarget(target) {\n if (typeof memo[target] === \"undefined\") {\n var styleTarget = document.querySelector(target);\n\n // Special case to return head of iframe instead of iframe itself\n if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = styleTarget.contentDocument.head;\n } catch (e) {\n // istanbul ignore next\n styleTarget = null;\n }\n }\n memo[target] = styleTarget;\n }\n return memo[target];\n}\n\n/* istanbul ignore next */\nfunction insertBySelector(insert, style) {\n var target = getTarget(insert);\n if (!target) {\n throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n }\n target.appendChild(style);\n}\nmodule.exports = insertBySelector;\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/insertBySelector.js?");
69 |
70 | /***/ }),
71 |
72 | /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
73 | /*!**********************************************************************!*\
74 | !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
75 | \**********************************************************************/
76 | /***/ ((module) => {
77 |
78 | eval("\n\n/* istanbul ignore next */\nfunction insertStyleElement(options) {\n var element = document.createElement(\"style\");\n options.setAttributes(element, options.attributes);\n options.insert(element, options.options);\n return element;\n}\nmodule.exports = insertStyleElement;\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/insertStyleElement.js?");
79 |
80 | /***/ }),
81 |
82 | /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
83 | /*!**********************************************************************************!*\
84 | !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
85 | \**********************************************************************************/
86 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
87 |
88 | eval("\n\n/* istanbul ignore next */\nfunction setAttributesWithoutAttributes(styleElement) {\n var nonce = true ? __webpack_require__.nc : 0;\n if (nonce) {\n styleElement.setAttribute(\"nonce\", nonce);\n }\n}\nmodule.exports = setAttributesWithoutAttributes;\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js?");
89 |
90 | /***/ }),
91 |
92 | /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
93 | /*!***************************************************************!*\
94 | !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
95 | \***************************************************************/
96 | /***/ ((module) => {
97 |
98 | eval("\n\n/* istanbul ignore next */\nfunction apply(styleElement, options, obj) {\n var css = \"\";\n if (obj.supports) {\n css += \"@supports (\".concat(obj.supports, \") {\");\n }\n if (obj.media) {\n css += \"@media \".concat(obj.media, \" {\");\n }\n var needLayer = typeof obj.layer !== \"undefined\";\n if (needLayer) {\n css += \"@layer\".concat(obj.layer.length > 0 ? \" \".concat(obj.layer) : \"\", \" {\");\n }\n css += obj.css;\n if (needLayer) {\n css += \"}\";\n }\n if (obj.media) {\n css += \"}\";\n }\n if (obj.supports) {\n css += \"}\";\n }\n var sourceMap = obj.sourceMap;\n if (sourceMap && typeof btoa !== \"undefined\") {\n css += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), \" */\");\n }\n\n // For old IE\n /* istanbul ignore if */\n options.styleTagTransform(css, styleElement, options.options);\n}\nfunction removeStyleElement(styleElement) {\n // istanbul ignore if\n if (styleElement.parentNode === null) {\n return false;\n }\n styleElement.parentNode.removeChild(styleElement);\n}\n\n/* istanbul ignore next */\nfunction domAPI(options) {\n if (typeof document === \"undefined\") {\n return {\n update: function update() {},\n remove: function remove() {}\n };\n }\n var styleElement = options.insertStyleElement(options);\n return {\n update: function update(obj) {\n apply(styleElement, options, obj);\n },\n remove: function remove() {\n removeStyleElement(styleElement);\n }\n };\n}\nmodule.exports = domAPI;\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/styleDomAPI.js?");
99 |
100 | /***/ }),
101 |
102 | /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
103 | /*!*********************************************************************!*\
104 | !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
105 | \*********************************************************************/
106 | /***/ ((module) => {
107 |
108 | eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElement) {\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText = css;\n } else {\n while (styleElement.firstChild) {\n styleElement.removeChild(styleElement.firstChild);\n }\n styleElement.appendChild(document.createTextNode(css));\n }\n}\nmodule.exports = styleTagTransform;\n\n//# sourceURL=webpack://leaderboard/./node_modules/style-loader/dist/runtime/styleTagTransform.js?");
109 |
110 | /***/ }),
111 |
112 | /***/ "./src/index.js":
113 | /*!**********************!*\
114 | !*** ./src/index.js ***!
115 | \**********************/
116 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
117 |
118 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _styles_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./styles.css */ \"./src/styles.css\");\n/* harmony import */ var _modules_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/api.js */ \"./src/modules/api.js\");\n/* harmony import */ var _modules_generateScores_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/generateScores.js */ \"./src/modules/generateScores.js\");\n\n\n\n\nconst leaderboardApi = 'https://us-central1-js-capstone-backend.cloudfunctions.net/api/';\nconst gameID = 'vtL6cvMOxCyImcJYZjbt';\n\nconst gameName = async () => {\n const response = await fetch(`${leaderboardApi}games/`, {\n method: 'POST',\n body: JSON.stringify({\n name: 'Tumaini Maganiko Game',\n }),\n headers: {\n 'content-type': 'application/json; charset=UTF-8',\n },\n });\n\n const id = await response.json();\n return id;\n};\n\nconst showingScrores = async () => {\n const retrieve = await (0,_modules_api_js__WEBPACK_IMPORTED_MODULE_1__.refreshScore)(gameID);\n (0,_modules_generateScores_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(retrieve.result);\n};\n\ngameName();\nconst submitButton = document.getElementById('submitBtn');\nsubmitButton.addEventListener('click', (e) => {\n e.preventDefault();\n const name = document.getElementById('name');\n const score = document.getElementById('score');\n const errDiv = document.getElementById('errDiv');\n if (name.value !== '' && score.value !== '') {\n (0,_modules_api_js__WEBPACK_IMPORTED_MODULE_1__.submitData)(name.value, score.value, gameID);\n name.value = '';\n score.value = '';\n showingScrores();\n errDiv.style.display = 'none';\n } else if (name.value === '' && score.value === '') {\n errDiv.textContent = 'Name and Score field are required';\n errDiv.style.display = 'block';\n } else if (name.value === '') {\n errDiv.textContent = 'Please fill in your name please';\n errDiv.style.display = 'block';\n } else if (score.value === '') {\n errDiv.textContent = 'Please fill in your score';\n errDiv.style.display = 'block';\n }\n});\n\nconst aLink = document.querySelector('a');\naLink.addEventListener('click', (e) => {\n e.preventDefault();\n showingScrores();\n});\n\nfunction askReload() {\n return false;\n}\n\nwindow.onbeforeunload = askReload;\nwindow.onload = () => {\n showingScrores();\n askReload();\n};\n\n\n//# sourceURL=webpack://leaderboard/./src/index.js?");
119 |
120 | /***/ }),
121 |
122 | /***/ "./src/modules/api.js":
123 | /*!****************************!*\
124 | !*** ./src/modules/api.js ***!
125 | \****************************/
126 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
127 |
128 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ refreshScore: () => (/* binding */ refreshScore),\n/* harmony export */ submitData: () => (/* binding */ submitData)\n/* harmony export */ });\nconst leaderboardApi = 'https://us-central1-js-capstone-backend.cloudfunctions.net/api/';\n\n// Sending name and score Data\nconst submitData = async (name, score, gameID) => {\n const submitData = await fetch(`${leaderboardApi}games/${gameID}/scores/`, {\n method: 'POST',\n body: JSON.stringify({\n user: name,\n score,\n }),\n headers: {\n 'content-type': 'application/json; charset=UTF-8',\n },\n });\n\n const response = await submitData.json();\n return response;\n};\n\n// Retrieving the names and scores\nconst refreshScore = async (gameID) => {\n const receiveData = await fetch(`${leaderboardApi}games/${gameID}/scores/`, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n const result = await receiveData.json();\n return result;\n};\n\n\n\n//# sourceURL=webpack://leaderboard/./src/modules/api.js?");
129 |
130 | /***/ }),
131 |
132 | /***/ "./src/modules/generateScores.js":
133 | /*!***************************************!*\
134 | !*** ./src/modules/generateScores.js ***!
135 | \***************************************/
136 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
137 |
138 | eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Creating lists for displaying Data\nconst generateScores = (score) => {\n const ul = document.querySelector('.content');\n ul.innerHTML = '';\n score.forEach((element) => {\n const li = document.createElement('li');\n li.innerHTML = `${element.user} : ${element.score}`;\n ul.appendChild(li);\n });\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (generateScores);\n\n//# sourceURL=webpack://leaderboard/./src/modules/generateScores.js?");
139 |
140 | /***/ })
141 |
142 | },
143 | /******/ __webpack_require__ => { // webpackRuntimeModules
144 | /******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
145 | /******/ var __webpack_exports__ = (__webpack_exec__("./src/index.js"));
146 | /******/ }
147 | ]);
--------------------------------------------------------------------------------