Skip to content

Commit

Permalink
Merge pull request #188 from aopell/develop
Browse files Browse the repository at this point in the history
Version 6.3
  • Loading branch information
aopell authored Jun 4, 2020
2 parents 013fd27 + b994d42 commit 673e418
Show file tree
Hide file tree
Showing 14 changed files with 359 additions and 91 deletions.
4 changes: 3 additions & 1 deletion .build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def copyFileOrDirectory(src, dst):
try:
os.makedirs(f".build/{target}")
except FileExistsError:
pass
print("Deleting existing directory")
shutil.rmtree(f".build/{target}")
os.makedirs(f".build/{target}")

for path in os.listdir():
if path not in EXCLUDED_FILES and path not in rules.excluded_files:
Expand Down
99 changes: 98 additions & 1 deletion css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,101 @@ the selector matches inside notifications in the new notifs dropdown
display: var(--upcoming-assignments-display) !important;
}

.quick-access-wrapper {
display: var(--quick-access-display) !important;
}

.quick-link-wrapper {
padding-top: 5px;
}

.quick-course-link {
max-width: 250px;
display: inline-block;
}

.quick-access-course .splus-course-icon {
width: 18px;
height: 18px;
margin-right: 4px;
border: none !important;
display: inline-block;
vertical-align: top;
}

.quick-link:not(:first-of-type)::before,
.quick-link:not(:first-of-type):hover::before {
content: "•";
padding: 0 4px;
display: inline-block;
}

.quick-right-link {
float: right;
text-transform: none !important;
font-weight: normal !important;
font-size: 12px !important;
}

.quick-access-course .icon {
width: 22px;
height: 22px;
padding-left: 3px;
background-image: url(https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_med.png);
background-repeat: no-repeat;
display: inline-block;
vertical-align: middle;
}

.quick-access-course .icons-container {
float: right;
}

.quick-access-course .icon.icon-grades {
background-position: 5px -125px;
}

.quick-access-course .icon.icon-mastery {
background-position: 5px -1325px;
}

.quick-access-course .icon.icon-settings {
background-position: 5px -475px;
}

.quick-access-course .icon.icon-grades:hover {
background-position: 5px -100px;
}

.quick-access-course .icon.icon-mastery:hover {
background-position: 5px -1300px;
}

.quick-access-course .icon.icon-settings:hover {
background-position: 5px -450px;
}

.quick-access-no-courses {
padding-top: 5px;
}

.quick-access-course {
padding-top: 5px;
}

.splus-logo-inline {
height: 22px;
filter: brightness(0.4);
vertical-align: middle;
padding-right: 3px;
}

.courses-kabob-menu {
float: right;
font-size: 20px;
cursor: pointer;
}

body a,
body .clickable,
body .smart-box .filter-block li a,
Expand Down Expand Up @@ -534,12 +629,14 @@ body #sidebar-left .action-links a:hover,
body .search-toggle:hover,
#edit-course-switcher-select-nid-menu .ui-selectmenu-group li a:hover,
body #primary-settings .unfold:hover,
ul.tabs li a.active,
#nav ul li a:hover {
background-color: var(--hover-color) !important;
color: white !important;
}

body a.link-btn {
body a.link-btn,
ul.tabs li a {
color: #333333 !important;
}

Expand Down
7 changes: 7 additions & 0 deletions css/grades.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ input#enable-modify {
display: none;
}

.grades-kabob-menu {
font-size: 20px;
vertical-align: sub;
padding-left: 10px;
cursor: pointer;
}

/* undo exception's .no-grade styling for unknown .max-grade elements */
.exception-grade-wrapper .max-grade.no-grade {
width: unset !important;
Expand Down
26 changes: 25 additions & 1 deletion js/all-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,28 @@
document.documentElement.style.overflow = "";
}
}).observe(document.getElementById("body"), { attributes: true, attributeFilter: ["aria-hidden"] });
})();
})();

function parseSettingsHash() {
let hashes = location.hash.split('#');
if (hashes.length > 1 && hashes[1] === "splus-settings") {
openModal("settings-modal");
if (hashes.length > 2) {
setTimeout(() => {
location.hash = hashes[2];
document.getElementById(hashes[2]).parentElement.parentElement.style.backgroundColor = "lightyellow";
location.hash = "";
}, 500);
}
else {
location.hash = "";
}
}
}

parseSettingsHash();

// Handle opening Schoology Plus Settings
window.addEventListener("hashchange", event => {
parseSettingsHash();
});
2 changes: 1 addition & 1 deletion js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ document.body.onkeydown = (data) => {
video.style.visibility = "visible";
video.currentTime = 0;
video.play();
trackEvent("Easter Egg", "play");
trackEvent("Easter Egg", "play", "Easter Egg");
} else if (data.altKey && data.key === "b") {
openModal("beta-modal");
}
Expand Down
21 changes: 12 additions & 9 deletions js/analytics.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Tracks an event using Google Analytics if the user did not opt out
* NOTE: The Firefox version of the extension has no support for Google Analytics
* @param {string} target The target of the event
* @param {string} action The action of the event
* @param {string} [label] Used to group related events
* @param {string} target (Event Category) The target of the event
* @param {string} action (Event Action) The action of the event
* @param {string} [label] (Event Label) Used to group related events
* @param {number} [value] Numeric value associated with the event
*/
var trackEvent = function (target, action, label = undefined, value = undefined) {
Expand Down Expand Up @@ -54,26 +54,23 @@ var trackEvent = function (target, action, label = undefined, value = undefined)

function trackClick(event) {
let target = event.currentTarget || event.target;
trackEvent(target.dataset.splusTrackingTarget || target.id || "Unlabeled Button", "click", target.dataset.splusTrackingLabel, target.dataset.splusTrackingValue);
trackEvent(target.dataset.splusTrackingTarget || target.id || "Unlabeled Button", "click", target.dataset.splusTrackingLabel || "Tracking Link", target.dataset.splusTrackingValue || event.button);
}

let trackedElements = new Set();
let observer = new MutationObserver((mutations, mutationObserver) => {
for (let m of mutations) {
for (let n of m.addedNodes) {
if (n.classList && n.classList.contains("splus-track-clicks") && !trackedElements.has(n)) {
Logger.debug("Added node", n);
n.addEventListener("click", trackClick);
n.addEventListener("auxclick", trackClick);
trackedElements.add(n);
}
}
}
});

observer.observe(document.body, {
childList: true,
subtree: true
});

var readyStateCheckInterval = setInterval(function () {
if (document.readyState === "complete") {
clearInterval(readyStateCheckInterval);
Expand All @@ -82,9 +79,15 @@ var trackEvent = function (target, action, label = undefined, value = undefined)
}, 10);

function init() {
observer.observe(document.body, {
childList: true,
subtree: true
});

for (let elem of document.querySelectorAll(".splus-track-clicks")) {
if (!trackedElements.has(elem)) {
elem.addEventListener("click", trackClick);
elem.addEventListener("auxclick", trackClick);
trackedElements.add(elem);
}
}
Expand Down
9 changes: 9 additions & 0 deletions js/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ for (let course of document.querySelectorAll("li.course-item.list-item")) {
parent.replaceChild(wrapper, course);
wrapper.appendChild(course);
course.prepend(createElement("img", ["course-list-icon"], { src: Theme.getIcon(course.querySelector(".course-title").textContent) || chrome.runtime.getURL("imgs/fallback-course-icon.svg") }));

let kabobMenuButton = createElement("span", ["courses-kabob-menu"], {
textContent: "⠇",
onclick: function (event) {
$(course).contextMenu({ x: event.pageX, y: event.pageY });
}
});
course.querySelector("p.course-info").appendChild(kabobMenuButton);
}

$.contextMenu({
Expand All @@ -12,6 +20,7 @@ $.contextMenu({
options: {
name: "Course Options",
callback: function (key, opt) {
trackEvent("Course Options", "click", "Courses Context Menu");
openModal("course-settings-modal", {
courseId: this[0].querySelector(".section-item").id.match(/\d+/)[0],
courseName: `${this[0].querySelector(".course-title").textContent}: ${this[0].querySelector(".section-item").textContent}`
Expand Down
Loading

0 comments on commit 673e418

Please sign in to comment.