Skip to content

Commit

Permalink
refactoring, images added
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgHoffmeyer committed Oct 6, 2018
1 parent 78d601e commit f060c5d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 21 deletions.
Binary file added img/kiosk.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 img/kiosk.xcf
Binary file not shown.
Binary file added img/kiosk_pause.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 img/kiosk_play.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: 7 additions & 20 deletions background.js → js/background.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@

var urls;
/* = [{
url: "https://www.google.de",
duration: 5000
},
{
url: "https://www.bing.com",
duration: 5000
},
{
url: "https://www.yahoo.com",
duration: 5000
}];
*/

var settings;
var currentIndex = 0;
var activeTabId = null;
const alarmName = "switchSite";
var settingsUrl = "https://georghoffmeyer.files.wordpress.com/2018/10/url_sample2.pdf";

chrome.browserAction.onClicked.addListener(function (tab) {
debug("Button clicked");
Expand All @@ -39,8 +26,8 @@ chrome.runtime.onInstalled.addListener(() => {

chrome.alarms.onAlarm.addListener(function (alarm) {

if (alarm.name == alarmName && activeTabId) {
var urlObj = urls[currentIndex];
if (alarm.name == alarmName && activeTabId && settings) {
var urlObj = settings.urls[currentIndex];

debug("URL: " + urlObj.url + " duration: " + urlObj.duration);

Expand Down Expand Up @@ -76,7 +63,7 @@ function log(message) {

function increseCurrentIndex() {
currentIndex++;
if (currentIndex >= urls.length) {
if (currentIndex >= settings.urls.length) {
currentIndex = 0;
}
debug("CurrentIndex: " + currentIndex);
Expand All @@ -90,11 +77,11 @@ function init() {

function loadSettings() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://georghoffmeyer.files.wordpress.com/2018/10/url_sample.pdf", true);
xhr.open("GET", settingsUrl, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
// JSON.parse does not evaluate the attacker's scripts.
urls = JSON.parse(xhr.responseText);
settings = JSON.parse(xhr.responseText);
}
}
xhr.send();
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"background": {
"scripts": [
"background.js"
"js/background.js"
]
},
"permissions": [
Expand Down
Binary file modified url_sample.pdf
Binary file not shown.

0 comments on commit f060c5d

Please sign in to comment.