Revision 261548ff
Added by koszko about 2 years ago
common/gen_unique.js | ||
---|---|---|
5 | 5 |
* Redistribution terms are gathered in the `copyright' file. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
"use strict"; |
|
9 |
|
|
10 |
(() => { |
|
11 |
const sha256 = window.sha256; |
|
12 |
const browser = window.browser; |
|
13 |
const is_chrome = window.is_chrome; |
|
8 |
/* |
|
9 |
* IMPORTS_START |
|
10 |
* IMPORT sha256 |
|
11 |
* IMPORT browser |
|
12 |
* IMPORT is_chrome |
|
13 |
* IMPORTS_END |
|
14 |
*/ |
|
14 | 15 |
|
15 |
function get_id()
|
|
16 |
{
|
|
17 |
if (is_chrome)
|
|
18 |
return browser.runtime.getManifest().key.substring(0, 50);
|
|
19 |
else
|
|
20 |
return browser.runtime.getURL("dummy");
|
|
21 |
}
|
|
16 |
function get_id() |
|
17 |
{ |
|
18 |
if (is_chrome)
|
|
19 |
return browser.runtime.getManifest().key.substring(0, 50); |
|
20 |
else
|
|
21 |
return browser.runtime.getURL("dummy"); |
|
22 |
} |
|
22 | 23 |
|
23 |
function gen_unique(url)
|
|
24 |
{
|
|
25 |
return "#" + sha256(get_id() + url);
|
|
26 |
}
|
|
24 |
function gen_unique(url) |
|
25 |
{ |
|
26 |
return "#" + sha256(get_id() + url);
|
|
27 |
} |
|
27 | 28 |
|
28 |
window.gen_unique = gen_unique; |
|
29 |
})(); |
|
29 |
/* |
|
30 |
* EXPORTS_START |
|
31 |
* EXPORT gen_unique |
|
32 |
* EXPORTS_END |
|
33 |
*/ |
Also available in: Unified diff
emply an sh-based build system; make some changes to blocking