diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ee701..6da9c6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,5 +4,11 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/), and Past versions will link to their respective commit. Current versions will not due to temporal paradoxes. -## 2023-01-07 - 1.0.0 +## 2023-01-10 - 1.0.1 +Fixed: + - Only counts files once if multiple events are fired from one asset + - Assets are no longer shown in a11y tree + - Assets are no longer focusable + +## 2023-01-07 - [1.0.0](https://github.com/Commenter25/YAPL/blob/cc3600cc1c7ed7c3f2eac171fceb687a1e11dfff/yapl.js) Initial release diff --git a/yapl.js b/yapl.js index 88566d1..6e8a625 100644 --- a/yapl.js +++ b/yapl.js @@ -1,4 +1,4 @@ -/*! @license Yet Another PreLoader v1.0.0 | Copyright (c) 2023 Commenter25 | MIT License */ +/*! @license Yet Another PreLoader v1.0.1 | Copyright (c) 2023 Commenter25 | MIT License */ /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT License */ /* jshint esversion: 6, browser: true, devel: true, strict: global */ "use strict"; @@ -35,7 +35,8 @@ try { return new Promise( (resolve)=> { const tagLoader = document.createElement("div"); tagLoader.id = "yet-another-preloader"; - tagLoader.style = "position: fixed; top: 99.9vh; left: 0; display: flex; opacity: 0.01"; + tagLoader.style = "position: fixed; top: 99.9vh; left: 0; display: flex; opacity: 0.01; user-select: none; pointer-events: none"; + tagLoader.setAttribute('aria-hidden', 'true'); document.body.prepend(tagLoader); const increment = worked => { @@ -50,19 +51,25 @@ try { return new Promise( (resolve)=> { }; const loadTag =(tag, file)=> { + let done = false; function good() { + if (done) return; // console.log(`YAPL: ${file} loaded successfully!`); tagLoader.appendChild(tag); - increment(true); + increment(true); done = true; } function bad() { + if (done) return; console.error(`YAPL: ${file} couldn't load!`); - increment(false); + increment(false); done = true; } tag.src = file; + tag.style.width = "1px"; tag.style.height = "1px"; + tag.tabIndex = -1; + tag.setAttribute('aria-hidden', 'true'); + tag.alt = ""; tag.controls = true; - tag.style = "width: 1px; height: 1px"; tag.addEventListener("load", good); tag.addEventListener("canplay", good); tag.addEventListener("error", bad);