Refactor widget.js to remove unnecessary whitespace and improve code readability.
This commit is contained in:
@@ -523,7 +523,7 @@ const domCache = {
|
||||
documentElement: document.documentElement,
|
||||
images: null,
|
||||
lastImageUpdate: 0,
|
||||
getImages: function() {
|
||||
getImages: function () {
|
||||
const now = Date.now();
|
||||
if (!this.images || now - this.lastImageUpdate > 5000) {
|
||||
this.images = document.querySelectorAll('img');
|
||||
@@ -1005,7 +1005,7 @@ const screenReader = {
|
||||
window.speechSynthesis.cancel();
|
||||
const speech = new SpeechSynthesisUtterance(content);
|
||||
speech.lang = 'en-US';
|
||||
speech.onerror = function(event) {
|
||||
speech.onerror = function (event) {
|
||||
console.warn('Speech synthesis error:', event.error);
|
||||
};
|
||||
window.speechSynthesis.speak(speech);
|
||||
@@ -1029,7 +1029,7 @@ const screenReader = {
|
||||
document.addEventListener('focusin', screenReader.handleFocus);
|
||||
const feedbackSpeech = new SpeechSynthesisUtterance(WIDGET_CONFIG.lang.screenReaderOn);
|
||||
feedbackSpeech.lang = 'en-US';
|
||||
feedbackSpeech.onerror = function(event) {
|
||||
feedbackSpeech.onerror = function (event) {
|
||||
console.warn('Speech synthesis feedback error:', event.error);
|
||||
};
|
||||
window.speechSynthesis.speak(feedbackSpeech);
|
||||
@@ -1038,7 +1038,7 @@ const screenReader = {
|
||||
window.speechSynthesis.cancel();
|
||||
const feedbackSpeech = new SpeechSynthesisUtterance(WIDGET_CONFIG.lang.screenReaderOff);
|
||||
feedbackSpeech.lang = 'en-US';
|
||||
feedbackSpeech.onerror = function(event) {
|
||||
feedbackSpeech.onerror = function (event) {
|
||||
console.warn('Speech synthesis feedback error:', event.error);
|
||||
};
|
||||
window.speechSynthesis.speak(feedbackSpeech);
|
||||
@@ -1398,7 +1398,7 @@ const menuCache = {
|
||||
menu: null,
|
||||
button: null,
|
||||
closeButton: null,
|
||||
init: function() {
|
||||
init: function () {
|
||||
this.menu = document.getElementById('snn-accessibility-menu');
|
||||
this.button = document.getElementById('snn-accessibility-button');
|
||||
this.closeButton = this.menu?.querySelector('.snn-close');
|
||||
@@ -1447,7 +1447,7 @@ function closeMenu() {
|
||||
let keyboardCache = {
|
||||
focusableElements: null,
|
||||
lastUpdate: 0,
|
||||
getFocusableElements: function() {
|
||||
getFocusableElements: function () {
|
||||
const now = Date.now();
|
||||
if (!this.focusableElements || now - this.lastUpdate > 1000) {
|
||||
if (menuCache.menu) {
|
||||
|
||||
Reference in New Issue
Block a user