Skip to content

Commit

Permalink
Merge pull request #3 from brandoningli/trublock
Browse files Browse the repository at this point in the history
Trublock UI
  • Loading branch information
brandoningli authored Nov 20, 2019
2 parents 27f0b7d + aeb88ad commit 7db19c3
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 0 deletions.
Binary file added truBlock/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added truBlock/icons/icon.psd
Binary file not shown.
Binary file added truBlock/icons/icon96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions truBlock/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{

"description": "Attempts to block advertisements using a master filter list.",
"manifest_version": 2,
"name": "truBlock",
"version": "1.0",
"icons": {
"48": "icons/icon.png",
"96": "icons/icon96.png"
},

"background": {
"scripts": ["trublock.js"]
},

"permissions": [
"webRequest",
"webRequestBlocking",
"http://*/*",
"https://*/*"
],

"browser_action": {
"default_popup": "popup.html"
}

}
32 changes: 32 additions & 0 deletions truBlock/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<script src="popup.js"></script>
</head>

<body>
<img src="icons/icon96.png" alt="TruBlock Icon">
<h2>truBlock</h2>
<div id="status">Active</div>
<div class="button" id="toggle">Disable</div>
<div id="attr">

<div id="team_name">
Written by Team <code>'; DROP TABLE team_names;</code>
</div>

<div id="indl_names">
Brandon Ingli, Chase Anderson, Andrew Flynn, Trey Reinheimer
</div>

<div id="institution">
Truman State University, CS 455, Computer Security Fundamentals
</div>

</div>
</body>

</html>
23 changes: 23 additions & 0 deletions truBlock/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
window.onload = function() {
function updateLabel(page) {
var enabled = page.getEnabled();
document.getElementById('toggle').innerHTML = enabled ? "Disable" : "Enable";
document.getElementById('status').innerHTML = enabled ? "Active" : "Stopped";
document.getElementById('status').className = enabled ? "running" : "stopped";
}

function toggleEnabled(page) {
page.toggleEnabled();
updateLabel(page);
}

function onError(error) {
console.log(`Error: ${error}`);
}
document.getElementById('toggle').onclick = function() {
var background = browser.runtime.getBackgroundPage();
background.then(toggleEnabled, onError);
};
var background = browser.runtime.getBackgroundPage();
background.then(updateLabel, onError);
}
84 changes: 84 additions & 0 deletions truBlock/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* Truman Official Color Palette (and Friends):
Purple: #510b76;
Dark Purple: #430b61;
Darker Purple: #36084f;
White: #ffffff;
Gold: #8e774d;
Light Gold: #bda06c;
*/

@import url('https://fonts.googleapis.com/css?family=Abel|Inconsolata|Playfair+Display&display=swap');
* {
margin: 0;
padding: 0;
}

@keyframes fade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

html {
padding-bottom: 30px;
}

body {
font-family: Abel, sans-serif;
font-size: 14pt;
margin: 15px;
background: #510b76;
background: linear-gradient(to right, #36084f, #510b76, #36084f);
background-size: cover;
color: white;
word-wrap: break-word;
text-align: center;
}

h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Playfair Display", serif;
margin-bottom: 8px;
margin-top: 8px;
}

.stopped {
color: red;
}

.running {
color: greenyellow;
}

.button {
display: inline-block;
text-decoration: none;
border: 2px solid #bda06c;
padding: 5px;
margin-bottom: 15px;
background: #8e774d;
color: white;
text-align: center;
font-weight: normal;
transition: background-color 0.5s, text-decoration 0.5s;
}

.button:hover {
text-decoration: underline;
background-color: #bda06c;
}

#attr {
font-size: medium;
}

#status {
margin-bottom: 10px;
}
11 changes: 11 additions & 0 deletions truBlock/trublock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var enabled = true;

function getEnabled() {
return enabled;
}

function toggleEnabled() {
enabled = !enabled;
}

/* BLOCKING CODE GOES HERE */

0 comments on commit 7db19c3

Please sign in to comment.