settings option for loading
This commit is contained in:
@@ -9,8 +9,15 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='calendar' style=" width: 75%; margin-left:auto; margin-right:auto;"></div>
|
||||
<button id="export" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;">Export Schedule</button>
|
||||
<div style='display:flex'>
|
||||
<div id='calendar' style="flex-grow: 1"></div>
|
||||
<div>
|
||||
<button id="export" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;white-space: nowrap;text-align: center;">Export
|
||||
Schedule</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||
if (details.reason == "install") {
|
||||
chrome.storage.sync.get('savedCourses', function (data) {
|
||||
if (!data.savedCourses) {
|
||||
console.log(data.savedCourses);
|
||||
var arr = new Array();
|
||||
chrome.storage.sync.set({
|
||||
savedCourses: arr
|
||||
@@ -57,6 +56,11 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||
}, function () {
|
||||
console.log('initial highlighting: true');
|
||||
});
|
||||
chrome.storage.sync.set({
|
||||
loadAll: true
|
||||
}, function () {
|
||||
console.log('initial loadAll: true');
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (details.reason == "update") {
|
||||
|
||||
@@ -29,8 +29,8 @@ const butdelay = 75;
|
||||
//This extension may be super lit, but you know what's even more lit?
|
||||
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
|
||||
$(function () {
|
||||
|
||||
loadNextPages($("html").html());
|
||||
$('[title*="next listing"]').remove();
|
||||
loadDataBase();
|
||||
//make heading and modal
|
||||
if (!$("#kw_results_table").length) {
|
||||
@@ -139,6 +139,9 @@ $(function () {
|
||||
});
|
||||
|
||||
function loadNextPages(inHTML) {
|
||||
chrome.storage.sync.get('loadAll', function (data) {
|
||||
if (data.loadAll) {
|
||||
$('[title*="next listing"]').remove();
|
||||
var html = $('<div/>').html(inHTML).contents();
|
||||
let next = html.find("#next_nav_link");
|
||||
if (next.length) {
|
||||
@@ -171,6 +174,8 @@ function loadNextPages(inHTML) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveCourse() {
|
||||
var c = new Course(coursename, uniquenum, profname, datetimearr, status, profurl, registerlink);
|
||||
|
||||
@@ -2,37 +2,69 @@ var manifestData = chrome.runtime.getManifest();
|
||||
$("#version").text(manifestData.version);
|
||||
chrome.storage.sync.get('courseConflictHighlight', function (data) {
|
||||
if (data.courseConflictHighlight) {
|
||||
off();
|
||||
off('courseConflictHighlight');
|
||||
} else {
|
||||
on('courseConflictHighlight');
|
||||
}
|
||||
else {
|
||||
on();
|
||||
});
|
||||
chrome.storage.sync.get('loadAll', function (data) {
|
||||
if (data.loadAll) {
|
||||
off('loadAll');
|
||||
} else {
|
||||
on('loadAll');
|
||||
}
|
||||
});
|
||||
|
||||
$("#toggleConflictHighlighting").click(function(){
|
||||
var action = $("#toggleConflictHighlighting").text();
|
||||
$("#togglecourseConflictHighlight").click(function () {
|
||||
var action = $("#togglecourseConflictHighlight").text();
|
||||
if (action == "Turn Off") {
|
||||
chrome.storage.sync.set({courseConflictHighlight: false}, function() {
|
||||
on();
|
||||
chrome.storage.sync.set({
|
||||
courseConflictHighlight: false
|
||||
}, function () {
|
||||
on('courseConflictHighlight');
|
||||
});
|
||||
} else {
|
||||
chrome.storage.sync.set({courseConflictHighlight: true}, function() {
|
||||
off();
|
||||
chrome.storage.sync.set({
|
||||
courseConflictHighlight: true
|
||||
}, function () {
|
||||
off('courseConflictHighlight');
|
||||
});
|
||||
}
|
||||
chrome.tabs.query({}, function (tabs) {
|
||||
for (var i = 0; i < tabs.length; i++) {
|
||||
chrome.tabs.sendMessage(tabs[i].id, {command: "updateCourseList"});
|
||||
chrome.tabs.sendMessage(tabs[i].id, {
|
||||
command: "updateCourseList"
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function on(){
|
||||
$("#toggleConflictHighlighting").text("Turn On");
|
||||
$("#toggleConflictHighlighting").css("background","#4CAF50");
|
||||
$("#toggleloadAll").click(function () {
|
||||
var action = $("#toggleloadAll").text();
|
||||
if (action == "Turn Off") {
|
||||
chrome.storage.sync.set({
|
||||
loadAll: false
|
||||
}, function () {
|
||||
on('loadAll');
|
||||
});
|
||||
} else {
|
||||
chrome.storage.sync.set({
|
||||
loadAll: true
|
||||
}, function () {
|
||||
off('loadAll');
|
||||
});
|
||||
}
|
||||
function off(){
|
||||
$("#toggleConflictHighlighting").text("Turn Off");
|
||||
$("#toggleConflictHighlighting").css("background","#F44336");
|
||||
});
|
||||
|
||||
|
||||
|
||||
function on(setting) {
|
||||
$("#toggle" + setting).text("Turn On");
|
||||
$("#toggle" + setting).css("background", "#4CAF50");
|
||||
}
|
||||
|
||||
function off(setting) {
|
||||
$("#toggle" + setting).text("Turn Off");
|
||||
$("#toggle" + setting).css("background", "#F44336");
|
||||
}
|
||||
17
options.html
17
options.html
@@ -1,17 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="card" style="width: 400px; margin-left:auto;margin-right: auto; height:auto;" id="header">
|
||||
<h2 style="padding:16px 16px 0px 16px;font-size: 20px"> <u>Options</u> </h2>
|
||||
<h2 style="padding: 5px 16px 16px 16px; font-weight: normal;display: inline-block;text-align:left;">Conflict Highlighting</h2>
|
||||
<button id="toggleConflictHighlighting" class="matbut" style="margin-left: 20%;text-align:right;display:inline-block;font-size:medium;background:#F44336;">Turn Off</button>
|
||||
<div>
|
||||
<h2 style="padding: 5px 16px 5px 16px; font-weight: normal;display: inline-block;text-align:left;">Conflict
|
||||
Highlighting</h2>
|
||||
<button id="togglecourseConflictHighlight" class="matbut" style="float:right; display:inline-block;font-size:medium;background:#F44336;">Turn
|
||||
Off</button>
|
||||
<h2 style="padding: 5px 16px 16px 16px; font-weight: normal;display: inline-block;text-align:left;">All Courses
|
||||
on First Page</h2>
|
||||
<button id="toggleloadAll" class="matbut" style="float: right;display:inline-block;font-size:medium;background:#F44336;">Turn
|
||||
Off</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="padding:0px 5px 5px 0px; float: right">(v<span id="version"></span>), Sriram Hariharan, 2018<p>
|
||||
<script src="js/jquery-3.3.1.min.js"></script>
|
||||
<script src="js/options.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user