Added workarounds for Apple's iOS browser

master
Gordon Williams 2020-05-23 13:28:06 +01:00
parent 793b5d6361
commit 6b09377414
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,9 @@
if (typeof btoa==="undefined") if (typeof btoa==="undefined") {
function btoa(d) { return Buffer.from(d).toString('base64'); } // Don't define btoa as a function here because Apple's
// iOS browser defines the function even though it's in
// an IF statement that is never executed!
btoa = function(d) { return BufferA.from(d).toString('base64'); }
}
// Converts a string into most efficient way to send to Espruino (either json, base64, or compressed base64) // Converts a string into most efficient way to send to Espruino (either json, base64, or compressed base64)
function toJS(txt) { function toJS(txt) {

View File

@ -24,8 +24,8 @@ httpGet("appdates.csv").then(csv=>{
document.querySelector(".sort-nav").classList.remove("hidden"); document.querySelector(".sort-nav").classList.remove("hidden");
csv.split("\n").forEach(line=>{ csv.split("\n").forEach(line=>{
var l = line.split(","); var l = line.split(",");
appSortInfo[l[0]] = { appSortInfo[l[0]] = {
created : Date.parse(l[1]), created : Date.parse(l[1]),
modified : Date.parse(l[2]) modified : Date.parse(l[2])
}; };
}); });
@ -196,7 +196,8 @@ function showTab(tabname) {
// =========================================== Library // =========================================== Library
var chips = Array.from(document.querySelectorAll('.filter-nav .chip')).map(chip => chip.attributes.filterid.value); // Can't use chip.attributes.filterid.value here because Safari/Apple's WebView doesn't handle it
var chips = Array.from(document.querySelectorAll('.filter-nav .chip')).map(chip => chip.getAttribute("filterid"));
var hash = window.location.hash ? window.location.hash.slice(1) : ''; var hash = window.location.hash ? window.location.hash.slice(1) : '';
var activeFilter = !!~chips.indexOf(hash) ? hash : ''; var activeFilter = !!~chips.indexOf(hash) ? hash : '';