Upload files to 'addons/isattlinkCR'

This commit is contained in:
letssync 2020-07-31 01:11:37 +02:00
parent df01e6c36c
commit 8ac22cd5ac
4 changed files with 1247 additions and 0 deletions

1126
addons/isattlinkCR/cs.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,17 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>&#128452;</title>
</head>
<body style="display:none">
<br>
<meter id="pbr" value="0" min="0" max="100" style="width:50%"></meter><br><br>
<button type="button" id="ldb_i"> &#x1F4DD; <span tek="opximp"></span> </button>
<button type="button" id="ldb_c"> &#x1F5D1; <span tek="opxclr"></span> </button>
<span style="display:none">
<input type="file" id="f" accept="text/plain">
<span tek="opxdone"></span>
</span>
<script src="localdb.js"></script>
</body>
</html>

View File

@ -0,0 +1,67 @@
let irun = false;
document.addEventListener('DOMContentLoaded', () => {
chrome.storage.local.get(['mul'], g => {
let ul = g.mul || 'eo';
fetch('i18n/' + ul + '.json', {
method: 'GET'
}).then(j => j.json()).then(j => {
document.querySelectorAll('span[tek]').forEach(x => {
x.innerText = j[x.getAttribute('tek')];
});
document.body.style.display = 'block';
});
});
});
document.getElementById('f').addEventListener('change', e => {
let ff = e.target.files[0];
if (ff) {
let r = new FileReader();
r.addEventListener('load', e => {
if (ff.size > 4) {
let g = e.target.result.replace(/(?:\r\n|\r|\n)/g, "\n").split("\n");
if (g.length > 0) {
chrome.storage.local.get(['ldb'], gs => {
irun = true;
let cnt0, cnt1 = 0,
gc = 1,
db = JSON.parse(gs.ldb || '[]');
cnt0 = db.length;
document.getElementById('pbr').max = g.length;
g.forEach(x => {
document.getElementById('pbr').value = gc;
gc++;
if (/^([0-9a-z.-]{4,400})\.([a-z]{2,40})$/.test(x) && !db.includes(x)) {
db.push(x);
}
});
g = null;
cnt1 = db.length;
if (cnt1 != cnt0) {
chrome.storage.local.set({
'ldb': JSON.stringify(db)
});
}
chrome.runtime.sendMessage('dbmode,rl', () => {
alert(document.querySelector('span[tek=opxdone]').innerText + "\n\n" + cnt0 + " -> " + cnt1);
location.reload();
});
});
}
}
});
r.readAsText(ff);
}
});
document.getElementById('ldb_i').addEventListener('click', () => {
if (!irun) {
document.getElementById('f').click();
}
});
document.getElementById('ldb_c').addEventListener('click', () => {
if (!irun) {
chrome.runtime.sendMessage('dbmode,cl', () => {
alert(document.querySelector('span[tek=opxdone]').innerText);
location.reload();
});
}
});

View File

@ -0,0 +1,37 @@
{
"manifest_version": 2,
"name": "Ĉu ĉi tiuj ligoj blokos Tor-uzanton?",
"version": "1.0.2.2",
"minimum_chrome_version": "68",
"homepage_url": "https://ss.wodferndripvpe6ib4uz4rtngrnzichnirgn7t5x64gxcyroopbhsuqd.onion/",
"author": "Ss",
"incognito": "split",
"permissions": [
"storage",
"unlimitedStorage"
],
"icons": {
"72": "icons/72.png"
},
"background": {
"scripts": [
"bg.js"
]
},
"options_ui": {
"chrome_style": false,
"page": "cfg.html"
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"cs.js"
],
"run_at": "document_end"
}
]
}