fix: rename remaining Muse comments/globals in autofill suppression script
Browse files
src-tauri/resources/scripts/autofill_suppress.js
CHANGED
|
@@ -1,71 +1,53 @@
|
|
| 1 |
-
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
* Disables native browser autofill (WebView2/WKWebView/WebKitGTK) so that
|
| 5 |
-
* the
|
| 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 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
// Watch for dynamically added forms/inputs (SPAs)
|
| 57 |
-
var observer = new MutationObserver(function(mutations) {
|
| 58 |
-
for (var i = 0; i < mutations.length; i++) {
|
| 59 |
-
var added = mutations[i].addedNodes;
|
| 60 |
-
for (var j = 0; j < added.length; j++) {
|
| 61 |
-
var node = added[j];
|
| 62 |
-
if (node.nodeType !== 1) continue;
|
| 63 |
-
suppress(node);
|
| 64 |
-
if (node.querySelectorAll) {
|
| 65 |
-
node.querySelectorAll('form, input').forEach(suppress);
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
}
|
| 69 |
-
});
|
| 70 |
-
observer.observe(document.documentElement, { childList: true, subtree: true });
|
| 71 |
-
})();
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* LumaRef Autofill Suppression
|
| 3 |
+
*
|
| 4 |
+
* Disables native browser autofill (WebView2/WKWebView/WebKitGTK) so that
|
| 5 |
+
* the LumaRef password vault is the only credential source for form fields.
|
| 6 |
+
*/
|
| 7 |
+
(function() {
|
| 8 |
+
if (window.__lumarefAutofillSuppressed) return;
|
| 9 |
+
window.__lumarefAutofillSuppressed = true;
|
| 10 |
+
|
| 11 |
+
function suppress(el) {
|
| 12 |
+
if (!el || !el.setAttribute) return;
|
| 13 |
+
var tag = el.tagName;
|
| 14 |
+
if (tag === 'FORM') {
|
| 15 |
+
el.setAttribute('autocomplete', 'off');
|
| 16 |
+
} else if (tag === 'INPUT') {
|
| 17 |
+
var type = (el.type || '').toLowerCase();
|
| 18 |
+
if (type === 'password') {
|
| 19 |
+
el.setAttribute('autocomplete', 'new-password');
|
| 20 |
+
} else if (type === 'email' || type === 'text' || type === 'tel') {
|
| 21 |
+
el.setAttribute('autocomplete', 'off');
|
| 22 |
+
}
|
| 23 |
+
el.setAttribute('data-lpignore', 'true');
|
| 24 |
+
el.setAttribute('data-form-type', 'other');
|
| 25 |
+
el.setAttribute('data-1p-ignore', 'true');
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function suppressAll() {
|
| 30 |
+
document.querySelectorAll('form, input').forEach(suppress);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
if (document.readyState === 'loading') {
|
| 34 |
+
document.addEventListener('DOMContentLoaded', suppressAll);
|
| 35 |
+
} else {
|
| 36 |
+
suppressAll();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
var observer = new MutationObserver(function(mutations) {
|
| 40 |
+
for (var i = 0; i < mutations.length; i++) {
|
| 41 |
+
var added = mutations[i].addedNodes;
|
| 42 |
+
for (var j = 0; j < added.length; j++) {
|
| 43 |
+
var node = added[j];
|
| 44 |
+
if (node.nodeType !== 1) continue;
|
| 45 |
+
suppress(node);
|
| 46 |
+
if (node.querySelectorAll) {
|
| 47 |
+
node.querySelectorAll('form, input').forEach(suppress);
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
});
|
| 52 |
+
observer.observe(document.documentElement, { childList: true, subtree: true });
|
| 53 |
+
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|