diff --git a/package-lock.json b/package-lock.json
index 9c0eb32..d353e25 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
- "name": "copy-unicode-urls",
- "version": "0.0.22",
+ "name": "runet-censorship-bypass",
+ "version": "2.0.0-rc0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "copy-unicode-urls",
- "version": "0.0.22",
+ "name": "runet-censorship-bypass",
+ "version": "2.0.0-rc0",
"license": "ISC",
"dependencies": {
- "punycode": "^2.1.1"
+ "punycode": "^2.3.1"
},
"devDependencies": {
"merge": "^2.1.1",
diff --git a/package.json b/package.json
index 003198d..660c4a5 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
},
"license": "ISC",
"dependencies": {
+ "punycode": "^2.3.1"
},
"devDependencies": {
"merge": "^2.1.1",
diff --git a/src/pages/options/index.html b/src/pages/options/index.html
index 13f7f23..55165fc 100644
--- a/src/pages/options/index.html
+++ b/src/pages/options/index.html
@@ -187,10 +187,10 @@
ID
-
+
FOR
-
+
@@ -203,8 +203,8 @@
Антизапрет
antizapret
-
+ antizapret
+ antizapret
@@ -215,10 +215,6 @@
anticensority
-
diff --git a/src/pages/options/index.mjs b/src/pages/options/index.mjs
index 7cde5b5..57e0270 100644
--- a/src/pages/options/index.mjs
+++ b/src/pages/options/index.mjs
@@ -2,12 +2,17 @@ console.log('Options page is opening...');
customElements.define('pac-record',
class extends HTMLElement {
+ static formAssociated = true;
+ // static observedAttributes = ['data-checked'];
constructor() {
super();
+ this.internals = this.attachInternals();
const shadow = this.attachShadow({ mode: 'open' });
+ // const shadow = this.internals.shadowRoot;
+ console.log('Constructor');
const fragment = pacRecordTemplate.content.cloneNode(true);
shadow.appendChild(fragment);
- const templateAttrs = shadow.querySelectorAll('#attributes > slot[name]');
+ //const templateAttrs = shadow.querySelectorAll('#attributes > slot[name]');
const dataAttrs = shadow.querySelectorAll('*[data-attrs]');
dataAttrs.forEach(
(da) => {
@@ -16,13 +21,37 @@ customElements.define('pac-record',
console.log(shadow.querySelector(`#attributes > slot[name=${attr}]`));
da.setAttribute(
attr,
- shadow.querySelector(`#attributes > slot[name=${attr}]`).assignedNodes()[0].textContent,
+ shadow.querySelector(`#attributes > slot[name=${attr}]`).assignedNodes()?.[0].textContent,
);
},
);
}
);
+ const namedInputs = shadow.querySelectorAll('input[name]');
+ namedInputs.forEach((ni) => {
+ //this.internals.setFormValue(ni.name);
+ ni.addEventListener('click',
+ (event) => {
+ const t = event.target;
+ const entries = new FormData();
+ //entries.set(ni.getAttribute('name'), ni.getAttribute('value'));
+ entries.set('pacScript', 'antizapret');
+ this.internals.setFormValue(t.checked ? t.value : null);
+ ni.toggleAttribute('checked');
+ //this.internals.setFormValue(ni.value);
+ //this.toggleAttribute('checked');
+ //this.toggleAttribute('data-checked');
+ //ni.toggleAttribute('checked');
+ console.log('EVENT TARGET:', event.target);
+ console.log('THIS', this);
+ console.log(this.internals);
+ console.log('EEEE', entries);
+ console.log(`FFFF:${ni.name}=${ni.value}`);
+ return true;
+ })
+ });
+ /*
const input = fragment.querySelector('div > input');
const label = fragment.querySelector('div > label');
/*const node = pacRecordTemplate.content.cloneNode(true);
@@ -31,9 +60,16 @@ customElements.define('pac-record',
input.id = input.value = label.htmlFor = this.dataset.id;*/
}
+ /*
+ attributeChangedCallback(name, oldValue, newValue) {
+ console.log('attributeChangedCallback:', oldValue, '->', newValue);
+ const entries = new FormData();
+ entries.set('pacScript', 'antizapret');
+ this.internals.setFormValue(entries);
+ }*/
}
);
-
+/*
customPacUrl.addEventListener('change', function (event) {
console.log('ON CHANGE:', event);
pacChooserForm.reportValidity();
@@ -44,7 +80,7 @@ pacChooserForm.addEventListener('formdata', (event) => {
console.log('ON FORMDATA', event);
return false; // Prevent default action.
});
-*/
+*//*
let LAST_LOCKED_URL = '';
const lockUrl = () => {
@@ -55,7 +91,7 @@ const lockUrl = () => {
ownRadio.disabled = false;
// TODO: Save to storage.
} else {
- pacChooserForm.reportValidity();
+ //pacChooserForm.reportValidity();
ownRadio.disabled = true; // `ownRadio.checked` doesn't matter here.
}
};
@@ -82,7 +118,7 @@ cancelPacUrlButton.onclick = suppressDefaultHandler(
);
editPacUrlButton.onclick = suppressDefaultHandler(unlockUrl);
-/*
+*//*
import { storage } from '../../lib/common-apis.mjs';
donate.href = await storage.getAsync('donateUrl');
@@ -102,6 +138,7 @@ options.forEach(([key, value], i) => {
};
});
*/
+/*
await chrome.storage.local.get('options');
const textElements = document.querySelectorAll('[data-localize]');
@@ -113,4 +150,4 @@ textElements.forEach((e) => {
e.innerText = translated;
}
}
-});
\ No newline at end of file
+});*/
\ No newline at end of file