adecksibility-widget 2.5.5 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/adecksibility-widget-pro.umd.js +258 -178
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Premium standalone accessibility widget bundle for WordPress and non-WordPress s
|
|
|
11
11
|
platform: "standalone"
|
|
12
12
|
};
|
|
13
13
|
</script>
|
|
14
|
-
<script src="https://cdn.jsdelivr.net/npm/adecksibility-widget@2.5.
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/adecksibility-widget@2.5.7/dist/adecksibility-widget-pro.umd.js" defer></script>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Notes
|
|
@@ -978,6 +978,11 @@ var ALLOWED_FEATURE_CLASSES;
|
|
|
978
978
|
var activeFeatures;
|
|
979
979
|
var editionMeta;
|
|
980
980
|
var featureFlags;
|
|
981
|
+
var darkModeEnhancementObserver;
|
|
982
|
+
var mediaObserver;
|
|
983
|
+
var hideImagesObserver;
|
|
984
|
+
var typographyObserver;
|
|
985
|
+
var typographyObserverTimeout;
|
|
981
986
|
|
|
982
987
|
function isFeatureEnabled(featureName) {
|
|
983
988
|
return !featureFlags || featureFlags[featureName] !== false;
|
|
@@ -1056,7 +1061,48 @@ function init(options) {
|
|
|
1056
1061
|
DARK_MODE_HOVER_BG_IMAGE_ATTR = 'data-adeck-dark-hover-bg-image';
|
|
1057
1062
|
DARK_MODE_HOVER_BG_IMAGE_PRIORITY_ATTR = 'data-adeck-dark-hover-bg-image-priority';
|
|
1058
1063
|
HIDE_IMG_BG_CLASS = 'adeck-hide-bg-image';
|
|
1059
|
-
ALLOWED_FEATURE_CLASSES = Object.keys(classMap).map(function(key) { return classMap[key]; });
|
|
1064
|
+
ALLOWED_FEATURE_CLASSES = Object.keys(classMap).map(function(key) { return classMap[key]; });
|
|
1065
|
+
|
|
1066
|
+
function isDarkModeActive() {
|
|
1067
|
+
return document.documentElement.classList.contains(DARK_MODE_CLASS);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
function ensureDarkModeEnhancementObserver() {
|
|
1071
|
+
if (darkModeEnhancementObserver || typeof MutationObserver === 'undefined' || !document.body) return;
|
|
1072
|
+
|
|
1073
|
+
darkModeEnhancementObserver = new MutationObserver(function(mutations) {
|
|
1074
|
+
if (!isDarkModeActive()) return;
|
|
1075
|
+
|
|
1076
|
+
for (var index = 0; index < mutations.length; index++) {
|
|
1077
|
+
var mutation = mutations[index];
|
|
1078
|
+
|
|
1079
|
+
if (mutation.type === 'childList') {
|
|
1080
|
+
mutation.addedNodes.forEach(function(node) {
|
|
1081
|
+
if (node.nodeType === 1) refreshDarkModeEnhancements(node);
|
|
1082
|
+
});
|
|
1083
|
+
continue;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if (mutation.target && mutation.target.nodeType === 1) {
|
|
1087
|
+
if (mutation.target.hasAttribute(DARK_MODE_AUTO_SURFACE_ATTR) || mutation.target.hasAttribute(DARK_MODE_AUTO_TEXT_ATTR)) continue;
|
|
1088
|
+
refreshDarkModeEnhancements(mutation.target);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
darkModeEnhancementObserver.observe(document.body, {
|
|
1094
|
+
childList: true,
|
|
1095
|
+
subtree: true,
|
|
1096
|
+
attributes: true,
|
|
1097
|
+
attributeFilter: ['class', 'style']
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
function disconnectDarkModeEnhancementObserver() {
|
|
1102
|
+
if (!darkModeEnhancementObserver) return;
|
|
1103
|
+
darkModeEnhancementObserver.disconnect();
|
|
1104
|
+
darkModeEnhancementObserver = null;
|
|
1105
|
+
}
|
|
1060
1106
|
/* ============================================================
|
|
1061
1107
|
Visual Filter Overlay
|
|
1062
1108
|
============================================================ */
|
|
@@ -1069,42 +1115,16 @@ function init(options) {
|
|
|
1069
1115
|
var wrapperEl = document.querySelector('.adeck-wrapper');
|
|
1070
1116
|
document.body.insertBefore(overlay, wrapperEl || null);
|
|
1071
1117
|
}
|
|
1072
|
-
injectFilterOverlay();
|
|
1073
|
-
registerVisualFilterTargets();
|
|
1074
|
-
window.addEventListener('load', registerVisualFilterTargets);
|
|
1075
|
-
window.addEventListener('load', function() {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
if (!document.documentElement.classList.contains(DARK_MODE_CLASS)) return;
|
|
1083
|
-
|
|
1084
|
-
for (var index = 0; index < mutations.length; index++) {
|
|
1085
|
-
var mutation = mutations[index];
|
|
1086
|
-
|
|
1087
|
-
if (mutation.type === 'childList') {
|
|
1088
|
-
mutation.addedNodes.forEach(function(node) {
|
|
1089
|
-
if (node.nodeType === 1) refreshDarkModeEnhancements(node);
|
|
1090
|
-
});
|
|
1091
|
-
continue;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
if (mutation.target && mutation.target.nodeType === 1) {
|
|
1095
|
-
if (mutation.target.hasAttribute(DARK_MODE_AUTO_SURFACE_ATTR) || mutation.target.hasAttribute(DARK_MODE_AUTO_TEXT_ATTR)) continue;
|
|
1096
|
-
refreshDarkModeEnhancements(mutation.target);
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
});
|
|
1100
|
-
|
|
1101
|
-
darkModeEnhancementObserver.observe(document.body, {
|
|
1102
|
-
childList: true,
|
|
1103
|
-
subtree: true,
|
|
1104
|
-
attributes: true,
|
|
1105
|
-
attributeFilter: ['class', 'style']
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1118
|
+
injectFilterOverlay();
|
|
1119
|
+
registerVisualFilterTargets();
|
|
1120
|
+
window.addEventListener('load', registerVisualFilterTargets);
|
|
1121
|
+
window.addEventListener('load', function() {
|
|
1122
|
+
if (!isDarkModeActive()) return;
|
|
1123
|
+
rebuildDarkModeEnhancements();
|
|
1124
|
+
window.setTimeout(function() {
|
|
1125
|
+
if (isDarkModeActive()) rebuildDarkModeEnhancements();
|
|
1126
|
+
}, 250);
|
|
1127
|
+
});
|
|
1108
1128
|
|
|
1109
1129
|
activeFeatures = [];
|
|
1110
1130
|
try { activeFeatures = JSON.parse(storage.getItem(storageKeys.features)) || []; }
|
|
@@ -1230,55 +1250,79 @@ function init(options) {
|
|
|
1230
1250
|
if (d) d.textContent = fontScale + '%';
|
|
1231
1251
|
document.querySelectorAll(FONT_SELECTOR).forEach(function(el){ snapshotEl(el); scaleEl(el); });
|
|
1232
1252
|
}
|
|
1233
|
-
function resetFontScale() {
|
|
1234
|
-
fontScale = 100;
|
|
1235
|
-
var d = document.getElementById('adeck-font-val');
|
|
1236
|
-
if (d) d.textContent = '100%';
|
|
1237
|
-
document.querySelectorAll('[' + ORIG_ATTR + ']').forEach(function(el){
|
|
1238
|
-
el.style.removeProperty('font-size'); el.removeAttribute(ORIG_ATTR);
|
|
1239
|
-
});
|
|
1240
|
-
document.body.style.removeProperty('font-size');
|
|
1241
|
-
storage.removeItem(storageKeys.fontScale);
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if (fontScale
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1253
|
+
function resetFontScale() {
|
|
1254
|
+
fontScale = 100;
|
|
1255
|
+
var d = document.getElementById('adeck-font-val');
|
|
1256
|
+
if (d) d.textContent = '100%';
|
|
1257
|
+
document.querySelectorAll('[' + ORIG_ATTR + ']').forEach(function(el){
|
|
1258
|
+
el.style.removeProperty('font-size'); el.removeAttribute(ORIG_ATTR);
|
|
1259
|
+
});
|
|
1260
|
+
document.body.style.removeProperty('font-size');
|
|
1261
|
+
storage.removeItem(storageKeys.fontScale);
|
|
1262
|
+
syncRuntimeObservers();
|
|
1263
|
+
}
|
|
1264
|
+
function saveAndApplyFont() {
|
|
1265
|
+
if (fontScale < 70) fontScale = 70;
|
|
1266
|
+
if (fontScale > 200) fontScale = 200;
|
|
1267
|
+
storage.setItem(storageKeys.fontScale, fontScale);
|
|
1268
|
+
applyFontScale();
|
|
1269
|
+
syncRuntimeObservers();
|
|
1270
|
+
announce(fontScale + '%');
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
function ensureMediaObserver() {
|
|
1274
|
+
if (mediaObserver || typeof MutationObserver === 'undefined' || !document.body) return;
|
|
1275
|
+
|
|
1276
|
+
mediaObserver = new MutationObserver(function(mutations) {
|
|
1277
|
+
if (!document.documentElement.classList.contains('adeck-mute-media')) return;
|
|
1278
|
+
mutations.forEach(function(m) {
|
|
1279
|
+
m.addedNodes.forEach(function(node) {
|
|
1280
|
+
if (node.nodeType !== 1 || (node.closest && node.closest('.adeck-wrapper'))) return;
|
|
1281
|
+
if (node.matches && node.matches('audio, video')) setMediaMutedState(node, true);
|
|
1282
|
+
if (node.querySelectorAll) {
|
|
1283
|
+
node.querySelectorAll('audio, video').forEach(function(mediaEl) {
|
|
1284
|
+
setMediaMutedState(mediaEl, true);
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
mediaObserver.observe(document.body, { childList: true, subtree: true });
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
function disconnectMediaObserver() {
|
|
1295
|
+
if (!mediaObserver) return;
|
|
1296
|
+
mediaObserver.disconnect();
|
|
1297
|
+
mediaObserver = null;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
function ensureHideImagesObserver() {
|
|
1301
|
+
if (hideImagesObserver || typeof MutationObserver === 'undefined' || !document.body) return;
|
|
1302
|
+
|
|
1303
|
+
hideImagesObserver = new MutationObserver(function(mutations) {
|
|
1304
|
+
if (!document.documentElement.classList.contains('adeck-hide-images')) return;
|
|
1305
|
+
mutations.forEach(function(m) {
|
|
1306
|
+
m.addedNodes.forEach(function(node) {
|
|
1307
|
+
if (node.nodeType !== 1 || (node.closest && node.closest('.adeck-wrapper'))) return;
|
|
1308
|
+
if (shouldTrackBackgroundImage(node)) node.classList.add(HIDE_IMG_BG_CLASS);
|
|
1309
|
+
if (node.querySelectorAll) {
|
|
1310
|
+
node.querySelectorAll('*').forEach(function(el) {
|
|
1311
|
+
if (shouldTrackBackgroundImage(el)) el.classList.add(HIDE_IMG_BG_CLASS);
|
|
1312
|
+
});
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
});
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
hideImagesObserver.observe(document.body, { childList: true, subtree: true });
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
function disconnectHideImagesObserver() {
|
|
1322
|
+
if (!hideImagesObserver) return;
|
|
1323
|
+
hideImagesObserver.disconnect();
|
|
1324
|
+
hideImagesObserver = null;
|
|
1325
|
+
}
|
|
1282
1326
|
|
|
1283
1327
|
/* ============================================================
|
|
1284
1328
|
LINE HEIGHT & TEXT SPACING SLIDER
|
|
@@ -1306,15 +1350,16 @@ function init(options) {
|
|
|
1306
1350
|
if (d) d.textContent = lhScale + '%';
|
|
1307
1351
|
document.querySelectorAll(LH_SELECTOR).forEach(function(el){ snapshotLhEl(el); scaleLhEl(el); });
|
|
1308
1352
|
}
|
|
1309
|
-
function resetLineHeight() {
|
|
1310
|
-
lhScale = 100;
|
|
1311
|
-
var d = document.getElementById('adeck-lh-val');
|
|
1312
|
-
if (d) d.textContent = '100%';
|
|
1313
|
-
document.querySelectorAll('[' + LH_ORIG_ATTR + ']').forEach(function(el){
|
|
1314
|
-
el.style.removeProperty('line-height'); el.removeAttribute(LH_ORIG_ATTR);
|
|
1315
|
-
});
|
|
1316
|
-
storage.removeItem(storageKeys.lineHeight);
|
|
1317
|
-
|
|
1353
|
+
function resetLineHeight() {
|
|
1354
|
+
lhScale = 100;
|
|
1355
|
+
var d = document.getElementById('adeck-lh-val');
|
|
1356
|
+
if (d) d.textContent = '100%';
|
|
1357
|
+
document.querySelectorAll('[' + LH_ORIG_ATTR + ']').forEach(function(el){
|
|
1358
|
+
el.style.removeProperty('line-height'); el.removeAttribute(LH_ORIG_ATTR);
|
|
1359
|
+
});
|
|
1360
|
+
storage.removeItem(storageKeys.lineHeight);
|
|
1361
|
+
syncRuntimeObservers();
|
|
1362
|
+
}
|
|
1318
1363
|
|
|
1319
1364
|
var TS_LS_ATTR = 'data-adeck-orig-ls', TS_WS_ATTR = 'data-adeck-orig-ws';
|
|
1320
1365
|
var TS_STEP = 10, TS_MIN = 100, TS_MAX = 200;
|
|
@@ -1344,23 +1389,24 @@ function init(options) {
|
|
|
1344
1389
|
if (d) d.textContent = tsScale + '%';
|
|
1345
1390
|
document.querySelectorAll(TS_SELECTOR).forEach(function(el){ snapshotTsEl(el); scaleTsEl(el); });
|
|
1346
1391
|
}
|
|
1347
|
-
function resetTextSpacing() {
|
|
1348
|
-
tsScale = 100;
|
|
1349
|
-
var d = document.getElementById('adeck-ts-val');
|
|
1350
|
-
if (d) d.textContent = '100%';
|
|
1351
|
-
document.querySelectorAll('[' + TS_LS_ATTR + ']').forEach(function(el){
|
|
1352
|
-
el.style.removeProperty('letter-spacing'); el.style.removeProperty('word-spacing');
|
|
1353
|
-
el.removeAttribute(TS_LS_ATTR); el.removeAttribute(TS_WS_ATTR);
|
|
1354
|
-
});
|
|
1355
|
-
storage.removeItem(storageKeys.textSpacing);
|
|
1356
|
-
|
|
1392
|
+
function resetTextSpacing() {
|
|
1393
|
+
tsScale = 100;
|
|
1394
|
+
var d = document.getElementById('adeck-ts-val');
|
|
1395
|
+
if (d) d.textContent = '100%';
|
|
1396
|
+
document.querySelectorAll('[' + TS_LS_ATTR + ']').forEach(function(el){
|
|
1397
|
+
el.style.removeProperty('letter-spacing'); el.style.removeProperty('word-spacing');
|
|
1398
|
+
el.removeAttribute(TS_LS_ATTR); el.removeAttribute(TS_WS_ATTR);
|
|
1399
|
+
});
|
|
1400
|
+
storage.removeItem(storageKeys.textSpacing);
|
|
1401
|
+
syncRuntimeObservers();
|
|
1402
|
+
}
|
|
1357
1403
|
|
|
1358
1404
|
function hasActiveTypographyAdjustments() {
|
|
1359
1405
|
return fontScale !== 100 || lhScale !== 100 || tsScale !== 100;
|
|
1360
1406
|
}
|
|
1361
1407
|
|
|
1362
|
-
function applyTypographyToSubtree(root) {
|
|
1363
|
-
if (!root || root.nodeType !== 1 || (root.closest && root.closest('.adeck-wrapper'))) return;
|
|
1408
|
+
function applyTypographyToSubtree(root) {
|
|
1409
|
+
if (!root || root.nodeType !== 1 || (root.closest && root.closest('.adeck-wrapper'))) return;
|
|
1364
1410
|
|
|
1365
1411
|
if (fontScale !== 100) {
|
|
1366
1412
|
if (root.matches && root.matches(FONT_SELECTOR)) { snapshotEl(root); scaleEl(root); }
|
|
@@ -1372,26 +1418,51 @@ function init(options) {
|
|
|
1372
1418
|
if (root.querySelectorAll) root.querySelectorAll(LH_SELECTOR).forEach(function(el){ snapshotLhEl(el); scaleLhEl(el); });
|
|
1373
1419
|
}
|
|
1374
1420
|
|
|
1375
|
-
if (tsScale !== 100) {
|
|
1376
|
-
if (root.matches && root.matches(TS_SELECTOR)) { snapshotTsEl(root); scaleTsEl(root); }
|
|
1377
|
-
if (root.querySelectorAll) root.querySelectorAll(TS_SELECTOR).forEach(function(el){ snapshotTsEl(el); scaleTsEl(el); });
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1421
|
+
if (tsScale !== 100) {
|
|
1422
|
+
if (root.matches && root.matches(TS_SELECTOR)) { snapshotTsEl(root); scaleTsEl(root); }
|
|
1423
|
+
if (root.querySelectorAll) root.querySelectorAll(TS_SELECTOR).forEach(function(el){ snapshotTsEl(el); scaleTsEl(el); });
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
function ensureTypographyObserver() {
|
|
1428
|
+
if (typographyObserver || typeof MutationObserver === 'undefined' || !document.body) return;
|
|
1429
|
+
|
|
1430
|
+
typographyObserver = new MutationObserver(function(mutations) {
|
|
1431
|
+
if (!hasActiveTypographyAdjustments()) return;
|
|
1432
|
+
clearTimeout(typographyObserverTimeout);
|
|
1433
|
+
typographyObserverTimeout = setTimeout(function() {
|
|
1434
|
+
mutations.forEach(function(m) {
|
|
1435
|
+
m.addedNodes.forEach(function(node) {
|
|
1436
|
+
applyTypographyToSubtree(node);
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
}, 250);
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
typographyObserver.observe(document.body, { childList: true, subtree: true });
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
function disconnectTypographyObserver() {
|
|
1446
|
+
if (!typographyObserver) return;
|
|
1447
|
+
typographyObserver.disconnect();
|
|
1448
|
+
typographyObserver = null;
|
|
1449
|
+
clearTimeout(typographyObserverTimeout);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
function syncRuntimeObservers() {
|
|
1453
|
+
if (isDarkModeActive()) ensureDarkModeEnhancementObserver();
|
|
1454
|
+
else disconnectDarkModeEnhancementObserver();
|
|
1455
|
+
|
|
1456
|
+
if (document.documentElement.classList.contains('adeck-mute-media')) ensureMediaObserver();
|
|
1457
|
+
else disconnectMediaObserver();
|
|
1458
|
+
|
|
1459
|
+
if (document.documentElement.classList.contains('adeck-hide-images')) ensureHideImagesObserver();
|
|
1460
|
+
else disconnectHideImagesObserver();
|
|
1461
|
+
|
|
1462
|
+
if (hasActiveTypographyAdjustments()) ensureTypographyObserver();
|
|
1463
|
+
else disconnectTypographyObserver();
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1395
1466
|
/* ============================================================
|
|
1396
1467
|
Utilities and Reset State
|
|
1397
1468
|
============================================================ */
|
|
@@ -1504,13 +1575,14 @@ function init(options) {
|
|
|
1504
1575
|
});
|
|
1505
1576
|
}
|
|
1506
1577
|
|
|
1507
|
-
function clearPersistedFeatureState() {
|
|
1508
|
-
activeFeatures.forEach(function(cls){ document.documentElement.classList.remove(cls); });
|
|
1509
|
-
activeFeatures = [];
|
|
1510
|
-
storage.removeItem(storageKeys.features);
|
|
1511
|
-
setDarkModeState(false, { clearTheme: true, skipTransition: true });
|
|
1512
|
-
clearActiveFeatureButtons();
|
|
1513
|
-
|
|
1578
|
+
function clearPersistedFeatureState() {
|
|
1579
|
+
activeFeatures.forEach(function(cls){ document.documentElement.classList.remove(cls); });
|
|
1580
|
+
activeFeatures = [];
|
|
1581
|
+
storage.removeItem(storageKeys.features);
|
|
1582
|
+
setDarkModeState(false, { clearTheme: true, skipTransition: true });
|
|
1583
|
+
clearActiveFeatureButtons();
|
|
1584
|
+
syncRuntimeObservers();
|
|
1585
|
+
}
|
|
1514
1586
|
|
|
1515
1587
|
function resetFeatureAdjustments() {
|
|
1516
1588
|
resetFontScale();
|
|
@@ -1592,11 +1664,12 @@ function init(options) {
|
|
|
1592
1664
|
if (preset.fontScale !== null) { fontScale = preset.fontScale; storage.setItem(storageKeys.fontScale, fontScale); applyFontScale(); }
|
|
1593
1665
|
if (isFeatureEnabled('lineHeight') && preset.lhScale !== null) { lhScale = preset.lhScale; storage.setItem(storageKeys.lineHeight, lhScale); applyLineHeight(); }
|
|
1594
1666
|
if (isFeatureEnabled('textSpacing') && preset.tsScale !== null) { tsScale = preset.tsScale; storage.setItem(storageKeys.textSpacing, tsScale); applyTextSpacing(); }
|
|
1595
|
-
|
|
1596
|
-
saveActiveFeatures();
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1667
|
+
|
|
1668
|
+
saveActiveFeatures();
|
|
1669
|
+
syncRuntimeObservers();
|
|
1670
|
+
syncHideImagesState();
|
|
1671
|
+
updateDynamicLabels();
|
|
1672
|
+
}
|
|
1600
1673
|
|
|
1601
1674
|
function setActiveProfile(profileKey) {
|
|
1602
1675
|
activeProfile = profileKey;
|
|
@@ -1719,30 +1792,34 @@ function init(options) {
|
|
|
1719
1792
|
if (!isTicking) { window.requestAnimationFrame(function(){ updateGuide(e.touches[0].clientY); isTicking=false; }); isTicking=true; }
|
|
1720
1793
|
}, {passive:true});
|
|
1721
1794
|
|
|
1722
|
-
document.addEventListener('mouseover', function(e) {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
if (!
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1795
|
+
document.addEventListener('mouseover', function(e) {
|
|
1796
|
+
if (!isDarkModeActive()) return;
|
|
1797
|
+
var candidate = getDarkHoverSurfaceCandidate(e.target);
|
|
1798
|
+
if (!candidate) return;
|
|
1799
|
+
syncDarkHoverSurface(candidate);
|
|
1800
|
+
}, true);
|
|
1801
|
+
|
|
1802
|
+
document.addEventListener('mouseout', function(e) {
|
|
1803
|
+
if (!isDarkModeActive()) return;
|
|
1804
|
+
var candidate = getDarkHoverSurfaceCandidate(e.target);
|
|
1805
|
+
if (!candidate) return;
|
|
1806
|
+
if (e.relatedTarget && candidate.contains(e.relatedTarget)) return;
|
|
1807
|
+
unlockDarkHoverSurface(candidate);
|
|
1808
|
+
}, true);
|
|
1809
|
+
|
|
1810
|
+
document.addEventListener('focusin', function(e) {
|
|
1811
|
+
if (!isDarkModeActive()) return;
|
|
1812
|
+
var candidate = getDarkHoverSurfaceCandidate(e.target);
|
|
1813
|
+
if (!candidate) return;
|
|
1814
|
+
syncDarkHoverSurface(candidate);
|
|
1815
|
+
});
|
|
1816
|
+
|
|
1817
|
+
document.addEventListener('focusout', function(e) {
|
|
1818
|
+
if (!isDarkModeActive()) return;
|
|
1819
|
+
var candidate = getDarkHoverSurfaceCandidate(e.target);
|
|
1820
|
+
if (!candidate) return;
|
|
1821
|
+
if (e.relatedTarget && candidate.contains(e.relatedTarget)) return;
|
|
1822
|
+
unlockDarkHoverSurface(candidate);
|
|
1746
1823
|
});
|
|
1747
1824
|
|
|
1748
1825
|
/* ============================================================
|
|
@@ -1947,10 +2024,12 @@ function init(options) {
|
|
|
1947
2024
|
/* ============================================================
|
|
1948
2025
|
Restore Saved State
|
|
1949
2026
|
============================================================ */
|
|
1950
|
-
activeFeatures.forEach(function(cls){ setFeatureVisualState(cls, true); });
|
|
1951
|
-
setDarkModeState(getStoredTheme() === 'dark', { skipTransition: true });
|
|
1952
|
-
|
|
1953
|
-
applyLanguage(currentLang); updateDynamicLabels();
|
|
2027
|
+
activeFeatures.forEach(function(cls){ setFeatureVisualState(cls, true); });
|
|
2028
|
+
setDarkModeState(getStoredTheme() === 'dark', { skipTransition: true });
|
|
2029
|
+
syncRuntimeObservers();
|
|
2030
|
+
applyLanguage(currentLang); updateDynamicLabels(); checkHideStatus();
|
|
2031
|
+
if (document.documentElement.classList.contains('adeck-hide-images')) syncHideImagesState();
|
|
2032
|
+
if (document.documentElement.classList.contains('adeck-mute-media')) toggleMuteMedia();
|
|
1954
2033
|
|
|
1955
2034
|
if (fontScale !== 100) applyFontScale(); else { var df2 = document.getElementById('adeck-font-val'); if (df2) df2.textContent = '100%'; }
|
|
1956
2035
|
if (lhScale !== 100) applyLineHeight(); else { var dl2 = document.getElementById('adeck-lh-val'); if (dl2) dl2.textContent = '100%'; }
|
|
@@ -2047,13 +2126,14 @@ function init(options) {
|
|
|
2047
2126
|
setFeatureVisualState(cls, isNow);
|
|
2048
2127
|
}
|
|
2049
2128
|
|
|
2050
|
-
if (!isNow && cls === 'adeck-read-aloud') {
|
|
2051
|
-
window.speechSynthesis.cancel();
|
|
2052
|
-
cleanHighlights();
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
saveActiveFeatures();
|
|
2056
|
-
|
|
2129
|
+
if (!isNow && cls === 'adeck-read-aloud') {
|
|
2130
|
+
window.speechSynthesis.cancel();
|
|
2131
|
+
cleanHighlights();
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
saveActiveFeatures();
|
|
2135
|
+
syncRuntimeObservers();
|
|
2136
|
+
updateDynamicLabels();
|
|
2057
2137
|
|
|
2058
2138
|
var fname = (i18n[currentLang] && i18n[currentLang][labelKeys[btn.id]]) || btn.id;
|
|
2059
2139
|
var statusText = (isNow ? (i18n[currentLang]['status_enable'] || 'Enabled') : (i18n[currentLang]['status_disable'] || 'Disabled')) + ': ' + fname;
|
|
@@ -2119,10 +2199,10 @@ function init(options) {
|
|
|
2119
2199
|
|
|
2120
2200
|
if (e.target.closest('#adeck-font-plus')) { fontScale += 10; saveAndApplyFont(); return; }
|
|
2121
2201
|
if (e.target.closest('#adeck-font-min')) { fontScale -= 10; saveAndApplyFont(); return; }
|
|
2122
|
-
if (isFeatureEnabled('lineHeight') && e.target.closest('#adeck-lh-plus')) { lhScale = Math.min(LH_MAX, lhScale + LH_STEP); storage.setItem(storageKeys.lineHeight, lhScale); applyLineHeight(); announce(lhScale+'%'); return; }
|
|
2123
|
-
if (isFeatureEnabled('lineHeight') && e.target.closest('#adeck-lh-min')) { lhScale = Math.max(LH_MIN, lhScale - LH_STEP); if (lhScale === LH_MIN) resetLineHeight(); else { storage.setItem(storageKeys.lineHeight, lhScale); applyLineHeight(); announce(lhScale+'%'); } return; }
|
|
2124
|
-
if (isFeatureEnabled('textSpacing') && e.target.closest('#adeck-ts-plus')) { tsScale = Math.min(TS_MAX, tsScale + TS_STEP); storage.setItem(storageKeys.textSpacing, tsScale); applyTextSpacing(); announce(tsScale+'%'); return; }
|
|
2125
|
-
if (isFeatureEnabled('textSpacing') && e.target.closest('#adeck-ts-min')) { tsScale = Math.max(TS_MIN, tsScale - TS_STEP); if (tsScale === TS_MIN) resetTextSpacing(); else { storage.setItem(storageKeys.textSpacing, tsScale); applyTextSpacing(); announce(tsScale+'%'); } return; }
|
|
2202
|
+
if (isFeatureEnabled('lineHeight') && e.target.closest('#adeck-lh-plus')) { lhScale = Math.min(LH_MAX, lhScale + LH_STEP); storage.setItem(storageKeys.lineHeight, lhScale); applyLineHeight(); syncRuntimeObservers(); announce(lhScale+'%'); return; }
|
|
2203
|
+
if (isFeatureEnabled('lineHeight') && e.target.closest('#adeck-lh-min')) { lhScale = Math.max(LH_MIN, lhScale - LH_STEP); if (lhScale === LH_MIN) resetLineHeight(); else { storage.setItem(storageKeys.lineHeight, lhScale); applyLineHeight(); syncRuntimeObservers(); announce(lhScale+'%'); } return; }
|
|
2204
|
+
if (isFeatureEnabled('textSpacing') && e.target.closest('#adeck-ts-plus')) { tsScale = Math.min(TS_MAX, tsScale + TS_STEP); storage.setItem(storageKeys.textSpacing, tsScale); applyTextSpacing(); syncRuntimeObservers(); announce(tsScale+'%'); return; }
|
|
2205
|
+
if (isFeatureEnabled('textSpacing') && e.target.closest('#adeck-ts-min')) { tsScale = Math.max(TS_MIN, tsScale - TS_STEP); if (tsScale === TS_MIN) resetTextSpacing(); else { storage.setItem(storageKeys.textSpacing, tsScale); applyTextSpacing(); syncRuntimeObservers(); announce(tsScale+'%'); } return; }
|
|
2126
2206
|
if (e.target.closest('#adeck-reset-typography')) { resetTypographyControls(); return; }
|
|
2127
2207
|
|
|
2128
2208
|
if (e.target.closest('#btn-reset')) { handleResetButton(); return; }
|
package/package.json
CHANGED