This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isMobile() { | |
let isMobile = false; | |
const isScreenLTE480px = window.matchMedia("only screen and (max-width: 480px)").matches; | |
const hasCoursePointer = window.matchMedia("(pointer:coarse)").matches; | |
if (isScreenLTE480px && hasCoursePointer) isMobile = true; | |
return isMobile; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUniqueId(numChars = 5) { | |
const chars = | |
"1234567890" + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
const charsLen = chars.length; | |
const id = []; | |
for (let i = 0; i < numChars; i++) { | |
id.push(chars[Math.round(Math.random() * 100) % charsLen]); | |
} | |
const uniqueId = id.join(""); | |
return uniqueId; |