Add SPV Safari 16 toArray fix userscript
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
eb9aa78c07
2 files changed
+23
No files matched your search
@@ -0,0 +1,8 @@
|
||||
# SPV-fix til iPadOS 16
|
||||
|
||||
Sprogvurdering (spvafvikler.sprogvurdering.dk) kalder `Map.prototype.entries().toArray()`, som først findes fra Safari 18.4. På iPads med iPadOS 16 bliver svar derfor ikke gemt, og testen går ikke videre efter et tryk på et svar.
|
||||
|
||||
`spv-fix.user.js` tilføjer den manglende `Iterator.prototype.toArray` via Safari-udvidelsen [Userscripts](https://apps.apple.com/app/userscripts/id1463298887). Scriptet gør ingenting, hvis funktionen allerede findes.
|
||||
|
||||
Installationslink (raw):
|
||||
https://git.fejl40.nu/Fejl40.nu/spv-fix/raw/branch/main/spv-fix.user.js
|
||||
@@ -0,0 +1,15 @@
|
||||
// ==UserScript==
|
||||
// @name SPV Safari 16 fix
|
||||
// @description Adds Iterator.prototype.toArray missing in Safari < 18.4 (Sprogvurdering)
|
||||
// @match https://*.sprogvurdering.dk/*
|
||||
// @run-at document-start
|
||||
// @inject-into page
|
||||
// @version 1.0
|
||||
// ==/UserScript==
|
||||
(() => {
|
||||
const P = Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()));
|
||||
if (!P.toArray) Object.defineProperty(P, 'toArray', {
|
||||
value: function () { const a = []; for (const x of this) a.push(x); return a; },
|
||||
writable: true, configurable: true
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user