-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.js
52 lines (51 loc) · 1.92 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var data = document.getElementById('data');
chrome.tabs.query({
active: true,
lastFocusedWindow: true
}, function (tabs) {
if (tabs[0].url.startsWith('://blocked.goguardian.com/', 5)) {
showdata(tabs[0].url);
} else {
document.body.style.minWidth = "275px";
document.body.style.maxWidth = "275px";
data.innerHTML = `<h1 style="text-align: center;">This page isn't blocked.</h1>`
}
});
const ctxprops = {
oi: "orgID",
ou: "originalURL",
st: "sourceType",
rs: "reason",
sci: "siteCategoryID",
api: "adminPolicyID",
afi: "adminFilterID",
pfi: "parentFilterID",
x3rpi: "x3ReportPublicID",
tsi: "teacherSceneID",
tsfi: "teacherSceneFilterID",
tsans: "teacherSessionAdminNames",
v: "v"
};
const rsprops = {
BlockWebProxies: "BlockWebProxies",
BLOCK_WEB_PROXIES: "BlockWebProxies",
BLOCK_DIRECT_IP_ACCESS: "BlockDirectIPAccess",
BLOCK_CONSUMER_ACCOUNTS: "BlockConsumerAccounts",
ADMIN_SITE_FILTER: "AdminSiteFilter",
ADMIN_SITE_CATEGORY_FILTER: "AdminSiteCategoryFilter",
ADMIN_SAFE_MODE: "AdminSafeMode",
PARENT_SITE_FILTER: "ParentSiteFilter",
PARENT_PAUSE: "ParentPause",
PARENT_SCHEDULED_PAUSE: "ParentScheduledPause",
X3_REPORT: "X3Report",
TEACHER_SCENE: "TeacherScene",
UNKNOWN: "Unknown"
}
function showdata(taburl) {
var ctx = new URLSearchParams(atob(decodeURI(new URLSearchParams(taburl.split('?')[1]).get('ctx'))));
var tmpdata = '';
for (var pair of ctx.entries()) {
tmpdata += `<strong>${ctxprops[pair[0]] ? ctxprops[pair[0]] : pair[0]}: </strong>${pair[0] == 'ou' ? decodeURI(pair[1]) : pair[0] == 'rs' ? rsprops[pair[1]] : pair[1]}<br>`;
}
data.innerHTML = `<p id="prefix" style="font-weight: 500;"><strong style="font-weight: bold;">GoGuardian Blocked Page Info</strong></p><div id="innerdatacontainer">${tmpdata}</div>`;
}