resolve #1 add ignore and block strategy for privacy purpose

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 09f30d2a81
commit 86beabd2bb
6 changed files with 324 additions and 2 deletions

View File

@@ -291,6 +291,7 @@ const HOOK_PROPERTIES: Array<[HTMLElement, string]> = [
[HTMLSelectElement.prototype, 'value'],
[HTMLTextAreaElement.prototype, 'value'],
];
const IGNORE_CLASS = 'rr-ignore';
const lastInputValueMap: WeakMap<EventTarget, inputValue> = new WeakMap();
function initInputObserver(cb: inputCallback): listenerHandler {
function eventHandler(event: Event) {
@@ -303,6 +304,12 @@ function initInputObserver(cb: inputCallback): listenerHandler {
return;
}
const type: string | undefined = (target as HTMLInputElement).type;
if (
type === 'password' ||
(target as HTMLElement).classList.contains(IGNORE_CLASS)
) {
return;
}
const text = (target as HTMLInputElement).value;
let isChecked = false;
if (type === 'radio' || type === 'checkbox') {

View File

@@ -1,5 +1,5 @@
const rules: string[] = [
'iframe { background: #ccc }',
'iframe, .rr-block { background: #ccc }',
'noscript { display: none !important; }',
];