From 6e1828a5fd2ebfb9ea8d32c604f5176bdacadb25 Mon Sep 17 00:00:00 2001 From: wijtse Date: Wed, 25 Nov 2020 11:43:57 +0100 Subject: [PATCH] Initial commit --- .gitignore | 2 + README.md | 5 +- cli/htc-ranking-cli.zip | Bin 0 -> 1032 bytes cli/index.js | 70 +++++++++++++++++ cli/package.json | 12 +++ ranking/index.html | 169 ++++++++++++++++++++++++++++++++++++++++ ranking/styles.css | 81 +++++++++++++++++++ 7 files changed, 338 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 cli/htc-ranking-cli.zip create mode 100644 cli/index.js create mode 100644 cli/package.json create mode 100644 ranking/index.html create mode 100644 ranking/styles.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..94824ae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/node_modules/ + diff --git a/README.md b/README.md index 20d8b0d..fa7dfb6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # htc-ranking -De live ranking gebruikt voor de Haramvision Team Contest. \ No newline at end of file +De live ranking gebruikt voor de Haramvision Team Contest. + +Before you can use this for yourself you also need to setup your own Pusher channel. For +more information on how to do that go to [https://pusher.com/docs/channels/getting_started/javascript](https://pusher.com/docs/channels/getting_started/javascript). diff --git a/cli/htc-ranking-cli.zip b/cli/htc-ranking-cli.zip new file mode 100644 index 0000000000000000000000000000000000000000..fd48ba5f8dfb993f741f64bc9ffcacee9e1410cb GIT binary patch literal 1032 zcmWIWW@Zs#-~dABPSZdJC}?G20E#FuWag!$R_J9FhlcPnu=^d#i1!C#5M5fq&A`a= zf|-E%{+d zUS&q=5^X;cPWSg$^@~hR-QUu@er>%gJO6_Z>8oX)ol$EMU9BVdrgOo^3!6WG=W&SG zz3zRZ@3HQzK))Lu8)Wwh2AwT5jIX=Z^SoPJb9ri{|E>-0FAW5kSFf5i<@3#=;OVC$ zEoYx|nJTd(y;l;jmQ_Xt^=X`NJ zuvM+Mcft&=z+2l=PFX2mtbXUbwq%M~?hZZy5#^RQxoaK^Mm#@Zx`+AmzwrFi4Zp9%vuBBovexj!B<1~20F)a`#*f1QxGyo zG}^hi^t<%kCOawbDS|AY6pwm*=d-fuu*f`U<-zu&(L2V?dOgSd4&a~GVy z-RW8S+*|FHWR?1VeYrI!f7v{#xRtz7EFR=#kt8+7nLtm0JQm>1$Rxsy$V14%0m?%# vu%!{iA~r`Mn+gg_WE(+22?JXi{h1g@3fKT|RyL4sCLr7Zq@947n1KNRZ6cMB literal 0 HcmV?d00001 diff --git a/cli/index.js b/cli/index.js new file mode 100644 index 0000000..25bbed9 --- /dev/null +++ b/cli/index.js @@ -0,0 +1,70 @@ + + +var Pusher = require('pusher'); + +var pusher = new Pusher({ + // Go to https://pusher.com/docs/channels/getting_started/javascript#trigger-events-from-your-server + // for setting up the variables below. + appId: 'APP_ID', + key: 'KEY', + secret: 'SECRET', + cluster: 'CLUSTER', + encrypted: true +}); + +const readline = require('readline'); +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + prompt: '> ' +}); + +rl.prompt(); + +rl.on('line', (line) => { + words = line.trim().split(' '); + switch (words[0]) { + case 'p': + teamstr = words.slice(2).join(' '); + if (teamstr.length = 2) { + teamnr = teamstr.substr(1); + switch (teamstr.charAt(0)) { + case 'h': + teamstr = "Men's " + teamnr; + break; + case 'd': + teamstr = "Ladies " + teamnr; + break; + case 'r': + teamstr = "Recr. " + teamnr; + break; + case 'm': + teamstr = "Mix " + teamnr; + break; + default: + console.log('Incorrect team name: "' + teamstr + '"'); + } + } + pusher.trigger('ranking', 'points', { + 'points': parseInt(words[1]), + 'team': teamstr + }); + console.log('Added ' + words[1] + ' points to "' + teamstr + '"'); + break; + case 'undo': + pusher.trigger('ranking', 'undo', {}); + console.log('Triggered undo action.'); + break; + case 'reset': + pusher.trigger('ranking', 'reset', {}); + console.log('Triggered reset action.'); + break; + default: + console.log(`Incorrect command: '${line.trim()}'`); + break; + } + rl.prompt(); +}).on('close', () => { + console.log('Exiting...'); + process.exit(0); +}); diff --git a/cli/package.json b/cli/package.json new file mode 100644 index 0000000..a207894 --- /dev/null +++ b/cli/package.json @@ -0,0 +1,12 @@ +{ + "name": "ranking", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/ranking/index.html b/ranking/index.html new file mode 100644 index 0000000..33dda9d --- /dev/null +++ b/ranking/index.html @@ -0,0 +1,169 @@ + + +W3.CSS Template + + + + + + +
+ + + + + + diff --git a/ranking/styles.css b/ranking/styles.css new file mode 100644 index 0000000..5982163 --- /dev/null +++ b/ranking/styles.css @@ -0,0 +1,81 @@ +body { + --orange: #ff9d00; + --bg: #51198a; + --purple: #351159; + --team-height: 50px; + background: var(--bg); +} +.main-container { +} +.team-div { + background: var(--purple); + position: absolute; + width: 300px; + height: var(--team-height); + font-family: 'Exo 2'; + font-size: 30px; + color: white; + z-index: 1; +} + +.team-div::before { + position: absolute; + content: ""; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-image: linear-gradient(90deg, rgba(94,0,94,1) 0%, rgba(109,9,121,1) 23%, rgba(168,0,222,1) 100%); + z-index: -1; + transition: opacity 0.25s linear; + opacity: 0; +} + +.awarded::before { + opacity: 1; +} + +.team-name { + line-height: var(--team-height); + margin-left: 10px; +} + +.team-points { + float: right; + line-height: var(--team-height); + margin-right: 10px; +} + +.points { + z-index: 10; + font-weight: bold; + position: absolute; + top: 0px; + left: 200px; + width: var(--team-height); + height: var(--team-height); + line-height: var(--team-height); + text-align: center; + background: var(--orange); + -webkit-animation: fadeIn ease 0.5s; +} + +@-webkit-keyframes fadeIn { +0% {opacity:0;-webkit-transform: scale(0.5);} +80% {opacity:0.8;-webkit-transform: scale(1.2);} +100% {opacity:1;-webkit-transform: scale(1);} +} + +.buttons { + height: 100%; +} + +.buttons > div { + display: block; + position: relative; + height: 30px; +} +.inp > * { + position: absolute; + right: 0; +}