Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chrome extension for keeping feri lspo system user logged in

* as title says
18 changes: 10 additions & 8 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ const second = 1000;
const variate = second * 10;

function httpGetAsync(url, callback) {
let xmlHttp = new XMLHttpRequest();
const xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = () => {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
return callback(xmlHttp.responseText);
}
}
xmlHttp.open('GET', url, true);
xmlHttp.send(null);
}

function trySendRequestLoop() {
let time = second * 50 + Math.floor(Math.random() * variate);
// 50 seconds + [0, 10) seconds
const time = second * 50 + Math.floor(Math.random() * variate);
chrome.tabs.query({
}, (tabs) => {
for (let tab of tabs) {
let url = tab.url;
}, tabs => {
for (const tab of tabs) {
const url = tab.url;
if (url.includes('vaje.um.si') || url.includes('vaje.uni-mb.si')) {
httpGetAsync('https://vaje.um.si/vaje/new/vaje.jsp', (data) => console.log('ping send!'));
httpGetAsync('https://vaje.um.si/vaje/new/vaje.jsp', () => console.log('ping send!'));
return;
}
}
Expand Down