forked from jonatasrs/sei
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
45 lines (38 loc) · 1.76 KB
/
background.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
/******************************************************************************
SEI ++: Script que adiciona novas funcionalidades ao SEI
Autor: Jonatas Evaristo
*******************************************************************************/
/******************************************************************************
* Executa ao instalar ou atualizar o complemento. *
******************************************************************************/
function handleInstalled(details) {
console.log(details.reason);
function onError(error) { console.log(`Error: ${error}`); }
function AbrirUrlSeipp(item) {
// Ao instalar ou atualizar.
item.InstallOrUpdate = true;
browser.storage.local.set(item);
if (item.CheckTypes == undefined) {
browser.tabs.create({ url: "https://jonatasrs.github.io/sei/" });
} else if (item.CheckTypes.indexOf("hidemsgupdate") == -1) {
browser.tabs.create({ url: "https://jonatasrs.github.io/sei/" });
}
}
if (isChrome) { /* Chrome: */
browser.storage.local.get("CheckTypes", AbrirUrlSeipp);
} else {
var gettingItem = browser.storage.local.get("CheckTypes");
gettingItem.then(AbrirUrlSeipp, onError);
}
}
/******************************************************************************
* Inicio *
******************************************************************************/
const isChrome = (typeof browser === "undefined"); /* Chrome: */
if (isChrome) { var browser = chrome; } /* Chrome: */
browser.runtime.onInstalled.addListener(handleInstalled);
if(!isChrome) {
browser.runtime.getBrowserInfo().then(function (info) {
browser.storage.local.set({version: info.version}).then(null, null);
});
}