Skip to content

Commit

Permalink
Add autofixed changes from prettier (see 46e7630)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 authored and krishnans2006 committed Jun 1, 2024
1 parent 46e7630 commit 45cb712
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 431 deletions.
424 changes: 221 additions & 203 deletions tin/static/css/base.css

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions tin/static/css/edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ button.collapsible:hover {

button.collapsible.active {
border-radius: 10px 10px 0px 0px;
box-shadow: 6px 0 12px #777,
-6px -6px 12px #ffffff;
box-shadow: 6px 0 12px #777, -6px -6px 12px #ffffff;
}

button.collapsible:not(.active) {
border-radius: 10px;
box-shadow: 6px 6px 12px #777,
-6px -6px 12px #ffffff;
box-shadow: 6px 6px 12px #777, -6px -6px 12px #ffffff;
}

.content {
Expand All @@ -34,10 +32,9 @@ button.collapsible:not(.active) {
width: 90%;
padding-top: 18px;
overflow: hidden;
background-color: #F2F2F4;
background-color: #f2f2f4;
border-radius: 0px 0px 10px 10px;
box-shadow: 6px 6px 12px #777,
-6px 0 12px #ffffff;
box-shadow: 6px 6px 12px #777, -6px 0 12px #ffffff;
}

.block {
Expand All @@ -53,7 +50,7 @@ button.collapsible:not(.active) {
}

button.collapsible.active:after {
content: "-"; /* Unicode character for "minus" sign (-) */
content: '-'; /* Unicode character for "minus" sign (-) */
color: white;
font-size: 20px;
}
Expand Down Expand Up @@ -88,7 +85,6 @@ textarea {
}

@media (max-width: 900.02px) {

.right-col {
width: 90%;
float: left;
Expand Down
68 changes: 34 additions & 34 deletions tin/static/css/login.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
.btn.btn-ion {
text-decoration: none;
color: #484848;
display: inline-block;
line-height: 18px;
padding: 7px 10px;
margin: 2px 0;
font-size: 13px;
font-weight: bold;
text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
white-space: nowrap;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: #f7f7f4;
background: -moz-linear-gradient(top, #f7f7f4 0%, #eaeaea 100%);
background: -webkit-linear-gradient(top, #f7f7f4 0%, #eaeaea 100%);
background: linear-gradient(to bottom, #f7f7f4 0%, #eaeaea 100%);
border: 1px solid #ddd;
border-bottom-color: #c5c5c5;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
-pie-box-shadow: none;
box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
vertical-align: middle;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
appearance: none;
text-decoration: none;
color: #484848;
display: inline-block;
line-height: 18px;
padding: 7px 10px;
margin: 2px 0;
font-size: 13px;
font-weight: bold;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
white-space: nowrap;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: #f7f7f4;
background: -moz-linear-gradient(top, #f7f7f4 0%, #eaeaea 100%);
background: -webkit-linear-gradient(top, #f7f7f4 0%, #eaeaea 100%);
background: linear-gradient(to bottom, #f7f7f4 0%, #eaeaea 100%);
border: 1px solid #ddd;
border-bottom-color: #c5c5c5;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
-pie-box-shadow: none;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
vertical-align: middle;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-appearance: none;
-moz-appearance: none;
-o-appearance: none;
appearance: none;
}

.login-box {
text-align: center;
text-align: center;
}
20 changes: 10 additions & 10 deletions tin/static/js/assignment-actions.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
function updateAssignmentActionHrefs() {
const period = $("#assignment-action-period-select").val();
$(".assignment-action").each(function() {
const dataHref = $(this).data("href");
$(this).attr("href", dataHref + "?period=" + period);
});
const period = $('#assignment-action-period-select').val();
$('.assignment-action').each(function () {
const dataHref = $(this).data('href');
$(this).attr('href', dataHref + '?period=' + period);
});
}

$(document).ready(function() {
$("#assignment-action-period-select").change(function() {
updateAssignmentActionHrefs();
});

$(document).ready(function () {
$('#assignment-action-period-select').change(function () {
updateAssignmentActionHrefs();
});

updateAssignmentActionHrefs();
});
111 changes: 55 additions & 56 deletions tin/static/js/incomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,48 @@ function join_url(base, url) {
}

function filter_incomplete_by_endpoint(endpoint) {
return $(".incomplete").filter((i, elem) => ($(elem).data("endpoint") == endpoint));
return $('.incomplete').filter(
(i, elem) => $(elem).data('endpoint') == endpoint
);
}

var websockets = {};

function create_websocket(endpoint) {
var ws_endpoint = join_url(location.protocol + "//" + location.host, endpoint).replace(/^http(s?):/, "ws$1:");
var ws_endpoint = join_url(
location.protocol + '//' + location.host,
endpoint
).replace(/^http(s?):/, 'ws$1:');
var sock = new WebSocket(ws_endpoint);
sock.onmessage = function(e) {
sock.onmessage = function (e) {
data = JSON.parse(e.data);
handle_data(endpoint, data);
if(filter_incomplete_by_endpoint(endpoint).get().length == 0) {
if (filter_incomplete_by_endpoint(endpoint).get().length == 0) {
sock.close();
}
};
sock.onclose = function(e) {
sock.onclose = function (e) {
websockets[endpoint] = false;
};
websockets[endpoint] = sock;
}

function update() {
var endpoints = new Set();
$(".incomplete").each(function(i, obj) {
endpoint = $(obj).data("endpoint")
if(!endpoints.has(endpoint)) {
if($(obj).data("no-websocket") == true) {
$.get(endpoint, function(data) {
$('.incomplete').each(function (i, obj) {
endpoint = $(obj).data('endpoint');
if (!endpoints.has(endpoint)) {
if ($(obj).data('no-websocket') == true) {
$.get(endpoint, function (data) {
handle_data(endpoint, data);
});
}
else {
if(websockets[endpoint] === undefined) {
} else {
if (websockets[endpoint] === undefined) {
// Just not created yet
create_websocket(endpoint);
}
else if(websockets[endpoint] == false) {
} else if (websockets[endpoint] == false) {
// Connection closed
$.get(endpoint, function(data) {
$.get(endpoint, function (data) {
handle_data(endpoint, data);
create_websocket(endpoint);
});
Expand All @@ -55,75 +58,71 @@ function update() {
}

function handle_data(endpoint, res) {
filter_incomplete_by_endpoint(endpoint).each(function(i, obj) {
filter_incomplete_by_endpoint(endpoint).each(function (i, obj) {
obj = $(obj);
if(res.complete) {
obj.removeClass("incomplete");
obj.addClass("complete");
if (res.complete) {
obj.removeClass('incomplete');
obj.addClass('complete');
}
var result_obj = obj;
if(obj.children().length) {
if (obj.children().length) {
var result_div = null;
var other_result_div = null;

if(res.complete) {
result_div = obj.find(".result-complete");
other_result_div = obj.find(".result-incomplete");
}
else {
result_div = obj.find(".result-incomplete");
other_result_div = obj.find(".result-complete");
if (res.complete) {
result_div = obj.find('.result-complete');
other_result_div = obj.find('.result-incomplete');
} else {
result_div = obj.find('.result-incomplete');
other_result_div = obj.find('.result-complete');
}

if(!result_div.length) {
if(res.has_been_graded) {
result_div = obj.find(".result-graded");
other_result_div = obj.find(".result-not-graded");
}
else {
result_div = obj.find(".result-not-graded");
other_result_div = obj.find(".result-graded");
if (!result_div.length) {
if (res.has_been_graded) {
result_div = obj.find('.result-graded');
other_result_div = obj.find('.result-not-graded');
} else {
result_div = obj.find('.result-not-graded');
other_result_div = obj.find('.result-graded');
}
}

if(!result_div.length) {
result_div = obj.find(".result");
if (!result_div.length) {
result_div = obj.find('.result');
}

if(result_div.length) {
if (result_div.length) {
result_obj = result_div;
}

if(other_result_div.length) {
other_result_div.text("");
if (other_result_div.length) {
other_result_div.text('');
}
}
var value = res[obj.data("endpoint-key")];
if(obj.hasClass("code-result")) {
result_obj.text("");
$("<pre>").appendTo($("<code>").appendTo(result_obj)).text(value);
}
else if(obj.hasClass("conditional-result")) {
var value = res[obj.data('endpoint-key')];
if (obj.hasClass('code-result')) {
result_obj.text('');
$('<pre>').appendTo($('<code>').appendTo(result_obj)).text(value);
} else if (obj.hasClass('conditional-result')) {
var show = Boolean(value);
if(obj.data("resultNegate") == true) {
if (obj.data('resultNegate') == true) {
show = !show;
}
result_obj.css("display", (show ? "initial" : "none"));
}
else {
if(typeof value == "boolean") {
value = (value ? "Yes": "No");
result_obj.css('display', show ? 'initial' : 'none');
} else {
if (typeof value == 'boolean') {
value = value ? 'Yes' : 'No';
}
result_obj.text(value);
}

if(res.complete && obj.data("hideWhenComplete") == true) {
result_obj.css("display", "none");
if (res.complete && obj.data('hideWhenComplete') == true) {
result_obj.css('display', 'none');
}
});
}

$(function() {
$(function () {
update();
setInterval(update, 3000);
});
Loading

0 comments on commit 45cb712

Please sign in to comment.