Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: manifest v3 #39

Open
wants to merge 43 commits into
base: legacy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1aa31b2
Initial Commit
Lukas-Zenick Jul 31, 2022
4eaac83
getCurrentSemesters() progress
Lukas-Zenick Jul 31, 2022
335b0c4
add and remove
Lukas-Zenick Aug 1, 2022
22be515
a lot is working
Lukas-Zenick Aug 1, 2022
cf96ca6
GetCurrentDepartments works now
Lukas-Zenick Aug 23, 2022
dc846ce
KEEPALIVE WORKS FOR SEMESTERS
Lukas-Zenick Aug 23, 2022
40013fc
Keepalive for getDepartments() now works too
Lukas-Zenick Aug 23, 2022
fb763ac
Revert "Keepalive for getDepartments() now works too"
Lukas-Zenick Aug 23, 2022
f24e680
Small bugfix
Lukas-Zenick Aug 23, 2022
1cc3c71
Hotfix: cache bug
Lukas-Zenick Aug 24, 2022
dfc0fa7
MoveFilesToDesktop
Lukas-Zenick Aug 27, 2022
ec2a4eb
GRADES LOADING WORKS
Lukas-Zenick Aug 27, 2022
d8ea4c4
Cleanup and merged master
Lukas-Zenick Aug 27, 2022
722d6f4
Merge remote-tracking branch 'upstream/master' into Alternate-Course-…
Lukas-Zenick Aug 28, 2022
04e8b25
Merge remote-tracking branch 'upstream/master' into manifest-v3
Lukas-Zenick Aug 28, 2022
ce84b0a
Merge remote-tracking branch 'upstream/master' into manifest-v3
Lukas-Zenick Aug 28, 2022
1de5b92
most fixes done
Lukas-Zenick Aug 28, 2022
c85d258
Update manifest.json
Lukas-Zenick Aug 28, 2022
6781acb
Revert "Update manifest.json"
Lukas-Zenick Aug 28, 2022
1b94c35
updateTabs() function
Lukas-Zenick Aug 29, 2022
20f478e
Merge remote-tracking branch 'upstream/master' into Alternate-Course-…
Lukas-Zenick Aug 29, 2022
7fdeed5
some changes
Lukas-Zenick Oct 24, 2022
8b18b74
Merge branch 'manifest-v3' into Alternate-Course-Search-Method
Lukas-Zenick Oct 24, 2022
464895e
Button actually switches now
Lukas-Zenick Oct 24, 2022
cdbf583
Actually works for course lookup
Lukas-Zenick Oct 24, 2022
a5ad1d3
style fix
Lukas-Zenick Oct 24, 2022
28f3c65
wrap hotfix
Lukas-Zenick Oct 24, 2022
b663c99
button switches to unfinished popup page
Lukas-Zenick Oct 25, 2022
7b8fcec
donates!
Lukas-Zenick Oct 25, 2022
a6488e7
Back btn
Lukas-Zenick Oct 25, 2022
a3e5d90
!excitement
Lukas-Zenick Oct 25, 2022
5b8700e
addMyTag
Lukas-Zenick Oct 25, 2022
19a439d
hotfix
Lukas-Zenick Oct 25, 2022
3f21f80
color change
Lukas-Zenick Oct 25, 2022
50bd612
Donate Button: loading icon, smooth
Lukas-Zenick Oct 27, 2022
8a781c7
hotfix: 0 Courses caused bug
Lukas-Zenick Nov 27, 2022
0ee3a8c
redundant line
Lukas-Zenick Nov 27, 2022
bf06e18
cleanup
Lukas-Zenick Nov 27, 2022
627ef01
Tiny bugfix on semester name
Lukas-Zenick Dec 12, 2022
bf6a187
fixed importing waitlist and importing courses from WL page
Lukas-Zenick Dec 13, 2022
2827363
Location fix for near-identical class-days
Lukas-Zenick Dec 13, 2022
8db6a99
removed search for now (buggy)
sghsri May 28, 2024
5f5eb20
removed wrong comment
sghsri May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 171 additions & 126 deletions js/background.js → background.js

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
text-align: center;
}

.maintainer-tag {
margin: 10px 5px 5px 0px;
text-align: center;
}

.options-card {
width: 400px;
margin-left: auto;
Expand Down Expand Up @@ -65,8 +70,30 @@
margin: 0;
}

.creator-contributor-name {
font-weight: bold;
margin: 0;
border-style: outset;
border-color: goldenrod;
background-color: gold;
}

.mv3-contributor-name {
font-weight: bold;
margin: 0;
border-style: outset;
border-color: grey;
background-color: silver;
}

.title {
font-weight: bold;
font-size: small;
margin: -0.4rem;
}

.contributor-username {
margin: 0 0 5px 0;
margin: -2px 0 5px 0;
font-style: italic;
}

Expand Down
45 changes: 43 additions & 2 deletions css/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,36 @@ i {
background: #FF0000;
}

.donate_button {
background: #de6c0f;
border: none;
outline: none;
cursor: pointer;
color: white;
margin: 7px 8px 5px 0px;
padding: 5px 8px;
border-radius: 4px;
font-size: medium;
font-style: bold;
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
position: relative;
overflow: hidden;
}

.donate_button:focus {
outline: 0;
}

.donate_button:hover {
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.16), 0 4px 15px 0 rgba(0, 0, 0, 0.12);
opacity: 1;
}

.donate_button:focus:after:hover {
outline: 0;
transition: 0.3s;
}

.settings {
position: absolute;
bottom: 0px;
Expand Down Expand Up @@ -408,13 +438,23 @@ input[type=number]::-webkit-outer-spin-button {
.flex-container {
display: flex;
flex-direction: column;
white-space: nowrap
}

.item {
flex: 1 1 auto;
}

.select-style {
.select-button {
margin: 0 0 6px 0;
}

.ButtonState{display:none}
.Button{background:#fff; padding: 1px 1.5px 1px 1.5px; border:1px solid #333;
cursor:pointer;}
.ButtonState:checked + .Button{background:#CCC;}

.dropdown-style {
border: 1px solid #979797;
margin: 5px 0px;
border-radius: 5px;
Expand Down Expand Up @@ -525,7 +565,7 @@ input[type=number]::-webkit-outer-spin-button {
}

.hide {
display: none !important;
display: none;
}

.meta{
Expand Down Expand Up @@ -556,6 +596,7 @@ input[type=number]::-webkit-outer-spin-button {
padding: 5px;
border-radius: 7px;
width: 90%;
margin: 4px 0px 0px 0px;
}

.input-box::placeholder {
Expand Down
Binary file added images/loading-gif.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion js/Template.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Template.Main = class {
</div>`;
}
static extension_button() {
return `<td data-th="Plus"><input type="image" class="distButton" id="distButton" width="20" height="20" src='${chrome.extension.getURL("images/disticon.png")}'/></td>`;
return `<td data-th="Plus"><input type="image" class="distButton" id="distButton" width="20" height="20" src='${chrome.runtime.getURL("images/disticon.png")}'/></td>`;
}
};
Template.Catalog = class {
Expand Down Expand Up @@ -187,6 +187,22 @@ Template.Options = class {
}

static contributor_card(username, name, image_url, profile_url) {
if(name === "Sriram Hariharan") {
return `<div class='card contributor-card' id="${username}" data-url="${profile_url}">
<img class='contributor-image' src="${image_url}"></img>
${name ? `<p class='creator-contributor-name'>${name}</p>` : ""}
<p class='title'>Creator of UTRP</p>
<p class='contributor-username'>${username}</p>
</div>`;
} else if (name === "Lukas Zenick") {
return `<div class='card contributor-card' id="${username}" data-url="${profile_url}">
<img class='contributor-image' src="${image_url}"></img>
${name ? `<p class='mv3-contributor-name'>${name}</p>` : ""}
<p class='title'>Manifest V3</p>
<p class='contributor-username'>${username}</p>
</div>`;
}

return `<div class='card contributor-card' id="${username}" data-url="${profile_url}">
<img class='contributor-image' src="${image_url}"></img>
${name ? `<p class='contributor-name'>${name}</p>` : ""}
Expand Down
2 changes: 1 addition & 1 deletion js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Export.png_options = {
};

class Popup {}
Popup.num_semesters = 2;
Popup.num_semesters = 3;

class Text {}
Text.emptyText = function () {
Expand Down
3 changes: 3 additions & 0 deletions js/courseCatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ if (!$("#kw_results_table").length) {
// now add to the table
$("table thead th:last-child").after('<th scope=col>Plus</th>');
$('table').find('tr').each(function () {



if (!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0) {
$(this).append(Template.Main.extension_button());
}
Expand Down
20 changes: 11 additions & 9 deletions js/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ $(function () {
$("#import").click(function () {
search_nodes = waitlist ? $(".tbg").last().find(".tbon>td:first-child") : $("tr>td:first-child");
$(search_nodes).each(function () {
importCourse($(this));
importCourse($(this), true);
})
importButtonAnimation($(this));
});

$("#import_waitlist").click(function () {
search_nodes = $("tr.tb span:first-child");
$(search_nodes).each(function () {
importCourse($(this));
importCourse($(this), false);
})
importButtonAnimation($(this));
});
Expand Down Expand Up @@ -61,17 +61,17 @@ function importButtonAnimation(button) {
}, 1000);
}

function importCourse(unique_node) {
let unique = $(unique_node).text().replace(/\s/g, '');
function importCourse(unique_node, force) {
let unique = $(unique_node).text().replace(/\s/g, '').substring(0,5);
link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`;
buildAddCourse(link);
buildAddCourse(link, force)
}


function buildAddCourse(link) {
function buildAddCourse(link, force) {
$.get(link, function (response) {
if (response) {
let simp_course = buildSimplifiedCourseObject(response, link);
let simp_course = buildSimplifiedCourseObject(response, link, force);
chrome.runtime.sendMessage({
command: "courseStorage",
course: simp_course,
Expand All @@ -86,7 +86,7 @@ function buildAddCourse(link) {
}


function buildSimplifiedCourseObject(response, link) {
function buildSimplifiedCourseObject(response, link, force) {
let imported_course = getCourseObject(htmlToNode(response), link);
let {
full_name,
Expand All @@ -97,7 +97,9 @@ function buildSimplifiedCourseObject(response, link) {
register
} = curr_course;
let dtarr = getDayTimeArray(undefined, curr_course);

if(force === true) {
status = "open" //forces the green status for courses a user is already registered for
}
return new Course(full_name, unique, prof_name, dtarr, status, individual, register);
}

Expand Down
118 changes: 118 additions & 0 deletions js/install-popup-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
(function (w, d) {
'use strict';

if (w.DBOX_INSTALLED) return;
w.DBOX_INSTALLED = true;

var UTM_PARAMS = extractUtmParams();

function extractUtmParams() {
var data = {};
var queryString = window.location.href.split('?')[1];
if(queryString) {
var supportedUtmParams = ['utm_source', 'utm_campaign', 'utm_medium', 'utm_term', 'utm_content'];
var params = queryString.split('&');
params.map(function(p){
var splitted = p.split('='), key = splitted[0], value = splitted[1];

if(supportedUtmParams.indexOf(key) >= 0) {
data[key] = value;
}
});
}

return data;
}

var buttonClass = 'dbox-donation-button',
frameID = 'donorbox_widget_frame',
setFrameStyles = function (style) {
style.position = 'fixed';
style.display = 'block';
style.left = '0px';
style.top = '0px';
style.width = '100%';
style.height = '100%';
style.margin = '0px';
style.padding = '0px';
style.border = 'none';
style.overflowX = 'hidden';
style.overflowY = 'auto';
style.visibility = 'visible';
style.backgroundColor = 'transparent';
style.zIndex = 2147483647;
};

function toggleScrolling(disable) {
d.body.style.overflow = disable ? 'hidden' : 'auto';
}

function remove(el) {
el.parentNode.removeChild(el);
toggleScrolling()
}

function queryButtons() {
var links = d.getElementsByClassName(buttonClass), arr = function (arrayLike) {
return Array.prototype.slice.call(arrayLike)
};
if (typeof w.DonorBox == 'object' && w.DonorBox.widgetLinkClassName)
links = arr(links).concat(arr(d.getElementsByClassName(w.DonorBox.widgetLinkClassName)));
return links;
}

function shouldOpenNewTab() {
var agent = navigator.userAgent.toLowerCase();
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(agent)||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(agent.substr(0,4));
}

function addEventListener(target, ev, listener) {
if (target.addEventListener)
target.addEventListener(ev, listener, false);
else if (target.attachEvent)
target.attachEvent('on' + ev, listener);
else target['on' + ev] = ev
}

function openTheModal(e) {
e.preventDefault();
var target = e.currentTarget || e.target,
frame = d.createElement('iframe');

toggleScrolling(true);
frame.id = frameID;
frame.frameborder = 0;
frame.setAttribute('allowpaymentrequest', true);
frame.src = target.href + (target.href.indexOf('?') == -1 ? '?' : '&') + 'modal=true';
setFrameStyles(frame.style);
d.body.appendChild(frame);
frame.focus();

// Send UTM Params to donorbox iframes
if(Object.keys(UTM_PARAMS).length > 0) {
frame.onload = function(){
frame.contentWindow.postMessage({action: 'set-utm-params', msg: UTM_PARAMS}, '*');
};
}
}

w.dw_open = function () {
var buttons = queryButtons(), i = 0, len = buttons.length;
if(len == 0) return;

if (shouldOpenNewTab())
for(; i < len; i++)
buttons[i].setAttribute('target', '_blank');
else
for(; i < len; i++)
addEventListener(buttons[i], 'click', openTheModal)
};

addEventListener(w, 'message', function (e) {
typeof e.data == 'object' && e.data.from == 'dbox' &&
e.data.close === true && remove(d.getElementById(frameID))
});

w.dw_open();
}(window, document));
Loading