mirror of
https://github.com/quantum5/uwat.cc.git
synced 2025-04-24 11:01:56 -04:00
Initial commit
This commit is contained in:
commit
40990a0a7c
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# WebStorm project files
|
||||||
|
/.idea
|
||||||
|
|
||||||
|
# uwat.cf files
|
||||||
|
/dist
|
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Guanzhong Chen.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
65
build.py
Normal file
65
build.py
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import errno
|
||||||
|
import os
|
||||||
|
from hashlib import sha256
|
||||||
|
|
||||||
|
from rcssmin import cssmin
|
||||||
|
|
||||||
|
DIR = os.path.dirname(__file__)
|
||||||
|
SRC_DIR = os.path.join(DIR, 'src')
|
||||||
|
DIST_DIR = os.path.join(DIR, 'dist')
|
||||||
|
ASSETS_SRC = os.path.join(SRC_DIR, 'assets')
|
||||||
|
ASSETS_DIST = os.path.join(DIST_DIR, 'assets')
|
||||||
|
|
||||||
|
bytes = type(b'')
|
||||||
|
|
||||||
|
|
||||||
|
def build_assets():
|
||||||
|
name_map = []
|
||||||
|
for asset in os.listdir(ASSETS_SRC):
|
||||||
|
name, ext = os.path.splitext(asset)
|
||||||
|
if not ext:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(os.path.join(ASSETS_SRC, asset), 'rb') as f:
|
||||||
|
content = f.read()
|
||||||
|
hash = sha256(content).hexdigest()[:20]
|
||||||
|
dist_name = '%s-%s%s' % (name, hash, ext)
|
||||||
|
|
||||||
|
if ext == '.css':
|
||||||
|
content = cssmin(content)
|
||||||
|
|
||||||
|
with open(os.path.join(ASSETS_DIST, dist_name), 'wb') as f:
|
||||||
|
f.write(content)
|
||||||
|
name_map.append((bytes(asset), bytes(dist_name)))
|
||||||
|
return name_map
|
||||||
|
|
||||||
|
|
||||||
|
def build_files(html_replace):
|
||||||
|
for name in os.listdir(SRC_DIR):
|
||||||
|
src_path = os.path.join(SRC_DIR, name)
|
||||||
|
if not os.path.isfile(src_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(os.path.join(SRC_DIR, name), 'rb') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
if name.endswith('.html'):
|
||||||
|
for old, new in html_replace:
|
||||||
|
content = content.replace(old, new)
|
||||||
|
|
||||||
|
with open(os.path.join(DIST_DIR, name), 'wb') as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
os.makedirs(ASSETS_DIST)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
|
name_map = build_assets()
|
||||||
|
build_files(name_map)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
227
src/assets/style.css
Normal file
227
src/assets/style.css
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
/* Selected style from https://github.com/twbs/bootstrap (MIT-licensed) */
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif;
|
||||||
|
line-height: 1.15;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
-ms-overflow-style: scrollbar;
|
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@-ms-viewport {
|
||||||
|
width: devicłe-width;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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: 0.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: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.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;
|
||||||
|
-ms-overflow-style: scrollbar;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6,
|
||||||
|
.h1, .h2, .h3, .h4, .h5, .h6 {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-family: inherit;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, .h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2, .h2 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, .h3 {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, .h4 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 576px) {
|
||||||
|
h1, .h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2, .h2 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, .h3 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, .h4 {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.lead {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin-top: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
small,
|
||||||
|
.small {
|
||||||
|
font-size: 80%;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark,
|
||||||
|
.mark {
|
||||||
|
padding: 0.2em;
|
||||||
|
background-color: #fcf8e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* uwat.cf styles */
|
||||||
|
body {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
max-width: 576px;
|
||||||
|
width: -webkit-fill-available;
|
||||||
|
width: -webkit-fit-content;
|
||||||
|
width: -moz-fit-content;
|
||||||
|
width: fit-content;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
46
src/index.html
Normal file
46
src/index.html
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Useful UWaterloo Links</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<link rel="stylesheet" href="assets/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="container">
|
||||||
|
<h1>Useful UWaterloo Links</h1>
|
||||||
|
<p><em>All <a href="/link">/link</a>s can be accessed as <a href="https://uwat.cf/link">uwat.cf/link</a>.</em></p>
|
||||||
|
|
||||||
|
<h2 id="general">General</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/learn">/learn</a> — UWaterloo Learn</li>
|
||||||
|
<li><a href="/quest">/quest</a> — Quest</li>
|
||||||
|
<li><a href="/watcard">/watcard</a> — Manage my WatCard</li>
|
||||||
|
<li><a href="/exams">/exams</a> — Exam seating and schedules</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="math">Faculty of Mathematics</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/marmoset">/marmoset</a> — Marmoset</li>
|
||||||
|
<li><a href="/mathexams">/mathexams</a> — MathSoc Exam Bank</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="eng">Faculty of Engineering</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/engexams">/engexams</a> — EngSoc Exam Bank</li>
|
||||||
|
<li><a href="/engrate">/engrate</a> — Undergrad student rankings</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="finance">Finances</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="/endow">/endow</a> — Endowment refund</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 id="about">About</h2>
|
||||||
|
<p>Want to add more links? Send us a pull request on <a href="https://github.com/quantum5/uwat.cf">GitHub</a>!</p>
|
||||||
|
<p class="small">Source code licensed under
|
||||||
|
<a href="https://github.com/quantum5/uwat.cf/blob/master/LICENSE">the MIT license</a>.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
10
src/redirects.conf
Normal file
10
src/redirects.conf
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/link "https://uwat.cf/";
|
||||||
|
/learn "https://learn.uwaterloo.ca/d2l/home";
|
||||||
|
/quest "https://quest.pecs.uwaterloo.ca/psp/SS/ACADEMIC/SA/?cmd=login&languageCd=ENG";
|
||||||
|
/watcard "https://watcard.uwaterloo.ca/OneWeb/Account/LogOn";
|
||||||
|
/exams "https://odyssey.uwaterloo.ca/teaching/schedule";
|
||||||
|
/marmoset "https://marmoset.student.cs.uwaterloo.ca/";
|
||||||
|
/mathexams "http://mathsoc.uwaterloo.ca/exambank";
|
||||||
|
/engexams "https://exams.engsoc.uwaterloo.ca/";
|
||||||
|
/engrate "https://engug.uwaterloo.ca/";
|
||||||
|
/endow "https://uwaterloo.ca/forms/finance/user?destination=endowment_request";
|
Loading…
Reference in a new issue