improve accessibility

This commit is contained in:
ChunkyProgrammer 2023-03-23 18:10:53 -04:00
parent 8a44bd11d2
commit a3da03bee9
12 changed files with 45 additions and 29 deletions

View file

@ -6,6 +6,7 @@
Array.prototype.find = Array.prototype.find || function (condition) {
return this.filter(condition)[0];
};
Array.from = Array.from || function (source) {
return Array.prototype.slice.call(source);
};
@ -201,15 +202,16 @@ window.helpers = window.helpers || {
if (localStorageIsUsable) {
return {
get: function (key) {
if (!localStorage[key]) return;
let storageItem = localStorage.getItem(key)
if (!storageItem) return;
try {
return JSON.parse(decodeURIComponent(localStorage[key]));
return JSON.parse(decodeURIComponent(storageItem));
} catch(e) {
// Erase non parsable value
helpers.storage.remove(key);
}
},
set: function (key, value) { localStorage[key] = encodeURIComponent(JSON.stringify(value)); },
set: function (key, value) { localStorage.setItem(key, encodeURIComponent(JSON.stringify(value))); },
remove: function (key) { localStorage.removeItem(key); }
};
}

View file

@ -137,7 +137,7 @@
if (focused_tag === 'textarea') return;
if (focused_tag === 'input') {
let focused_type = document.activeElement.type.toLowerCase();
if (!focused_type.match(allowed)) return;
if (!allowed.test(focused_type)) return;
}
// Focus search bar on '/'

View file

@ -261,7 +261,7 @@ function updateCookie(newVolume, newSpeed) {
var date = new Date();
date.setFullYear(date.getFullYear() + 2);
var ipRegex = /^((\d+\.){3}\d+|[A-Fa-f0-9]*:[A-Fa-f0-9:]*:[A-Fa-f0-9:]+)$/;
var ipRegex = /^((\d+\.){3}\d+|[\dA-Fa-f]*:[\d:A-Fa-f]*:[\d:A-Fa-f]+)$/;
var domainUsed = location.hostname;
// Fix for a bug in FF where the leading dot in the FQDN is not ignored