commit 40990a0a7caabe893424c866bd9e8fb476e1c88c Author: Quantum Date: Wed Dec 5 23:10:18 2018 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8209a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# WebStorm project files +/.idea + +# uwat.cf files +/dist diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c57f21 --- /dev/null +++ b/LICENSE @@ -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. + diff --git a/build.py b/build.py new file mode 100644 index 0000000..cca0f2d --- /dev/null +++ b/build.py @@ -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() diff --git a/src/assets/style.css b/src/assets/style.css new file mode 100644 index 0000000..bfefd95 --- /dev/null +++ b/src/assets/style.css @@ -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; +} \ No newline at end of file diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..1df6525 --- /dev/null +++ b/src/index.html @@ -0,0 +1,46 @@ + + + + + Useful UWaterloo Links + + + + + +
+

Useful UWaterloo Links

+

All /links can be accessed as uwat.cf/link.

+ +

General

+ + +

Faculty of Mathematics

+ + +

Faculty of Engineering

+ + +

Finances

+ + +

About

+

Want to add more links? Send us a pull request on GitHub!

+

Source code licensed under + the MIT license.

+
+ + diff --git a/src/redirects.conf b/src/redirects.conf new file mode 100644 index 0000000..58e4667 --- /dev/null +++ b/src/redirects.conf @@ -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";