From 477f19e3136df77637a6e162ab07a8f6d7163e9c Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Fri, 21 Jun 2019 02:40:55 +0200 Subject: [PATCH] First commit --- LICENSE | 19 +++++++++++++++++++ README.md | 29 +++++++++++++++++++++++++++++ background.js | 23 +++++++++++++++++++++++ css/main.css | 4 ++++ css/review.css | 31 +++++++++++++++++++++++++++++++ css/solution.css | 12 ++++++++++++ manifest.json | 25 +++++++++++++++++++++++++ 7 files changed, 143 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 background.js create mode 100644 css/main.css create mode 100644 css/review.css create mode 100644 css/solution.css create mode 100644 manifest.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..93b5717 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 Felix Stupp + +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/README.md b/README.md new file mode 100644 index 0000000..8dd350e --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# LEZ + CSS + +Improves the "Lösungseinzugszentrale" of KIT via CSS. +Contains only usable improvements for tutors. + +**This project is not officially supported by KIT or any other institutions assigned to KIT.** + +## Improvements + +- Enable horizontal scrollbars +- Monospace fonts for numbers / checksums +- Improves review table + - Hides names of students (keeps the students number) +- Improves solution table + - Hides status column (status indicated by color by default) + +## Repository + +- Original Repository: https://git.banananet.work/zocker/lez-plus-css +- Official Clone: https://git.scc.kit.edu/urwai/lez-plus-css +- Issue Tracker: https://git.scc.kit.edu/urwai/lez-plus-css/issues + +### License + +Released under MIT License, see file `LICENSE`. + +### Notes + +CSS Injection Code inspired by https://github.com/iamdiogo/DarkCloud (also released under MIT). diff --git a/background.js b/background.js new file mode 100644 index 0000000..b9bcfe7 --- /dev/null +++ b/background.js @@ -0,0 +1,23 @@ +(function() { + function injectCSS(id, file) { + if (!file) return; + window.addEventListener("DOMNodeRemoved", function() { + if (document.getElementById(id) == null) { + const head = document.getElementsByTagName("head")[0]; + const link = document.createElement("link"); + link.id = id; + link.rel = "stylesheet"; + link.type = "text/css"; + link.href = chrome.extension.getURL("css/" + file + ".css"); + link.media = "all"; + head.appendChild(link); + } + }); + } + injectCSS("lezpluscss_main", "main"); + const stylesheets = { + "/lez/tutor/review": "review", + "/lez/tutor/solution": "solution", + } + injectCSS("lezpluscss_special", stylesheets[window.location.pathname]); +})() diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..2399cbb --- /dev/null +++ b/css/main.css @@ -0,0 +1,4 @@ +/* Enable horizontal scrollbars */ +div#content { + overflow: auto !important; +} diff --git a/css/review.css b/css/review.css new file mode 100644 index 0000000..5364c07 --- /dev/null +++ b/css/review.css @@ -0,0 +1,31 @@ +/* Improve inputs */ +input { + color: black !important; +} +tr > td > div > input.form-control { + background-color: #ffffff !important; + text-align: left !important; + width: 60px !important; + font-family: monospace; + font-size: 1.1em; +} +tr > td > div > input.form-control[style] { + border: 2px solid orange; +} + +/* Style students numbers */ +tr > th:nth-child(1) { + max-width: 120px; +} +tr > td:nth-child(1) { + font-family: monospace; + font-size: 1.05em; +} + +/* Hides names of students, keeping student numbers */ +tr > td:nth-child(2), +tr > td:nth-child(3), +tr > th:nth-child(2), +tr > th:nth-child(3) { + display: none; +} diff --git a/css/solution.css b/css/solution.css new file mode 100644 index 0000000..92b22ac --- /dev/null +++ b/css/solution.css @@ -0,0 +1,12 @@ +/* Style students numbers & checksum */ +tr > td:nth-child(2) > div, +tr > td:nth-child(6) > div { + font-family: monospace; + font-size: 1.05em; +} + +/* Hides status */ +tr > td:nth-child(4), +tr > th:nth-child(4) { + display: none; +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..8526092 --- /dev/null +++ b/manifest.json @@ -0,0 +1,25 @@ +{ + "manifest_version": 2, + "name": "LEZ + CSS", + "description": "LEZ mit ein bisschen CSS verfeinert", + "version": "0.0.1", + "permissions": [ + "activeTab" + ], + "icons": { + "128": "icon.png" + }, + "background": { + "scripts": ["background.js"] + }, + "content_scripts": [ + { + "matches": ["https://lez.ipd.kit.edu/*"], + "js": ["background.js"], + "run_at": "document_start" + } + ], + "web_accessible_resources": [ + "css/*.css" + ] +}