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
// taken from https://stackoverflow.com/questions/11849562/how-to-save-the-output-of-a-console-logobject-to-a-file | |
(function(console){ | |
console.save = function(data, filename){ | |
if(!data) { | |
console.error('Console.save: No data') | |
return; | |
} |
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
// Context https://stackoverflow.com/a/72640597/861615 | |
// Save the original `Date` function | |
const OriginalDate = Date; | |
const fakeDateArgs = [2022, 5, 3]; // beware month is 0 based | |
let fakeDate; | |
// Replace it with our own | |
Date = function Date(...args) { | |
// Called via `new`? | |
if (!new.target) { |
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
// Mouse vs touch detection, supporting devices which are capable of both | |
// by default set using touch for all touch enabled devices | |
let userUsesTouch = | |
'ontouchstart' in document.documentElement || | |
navigator.maxTouchPoints > 0 || | |
navigator.msMaxTouchPoints > 0; | |
if (userUsesTouch) { | |
catchMouse(); |
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 execute(action, callback) { | |
// create real promise, because execute method does not return the real one | |
// (missing documentation what actually returns) | |
const promise = new Promise((resolve, reject) => { | |
grecaptcha.ready(() => | |
grecaptcha.execute(key, { action }).then(token => { | |
resolve(token); | |
}, | |
reject) | |
); |
OlderNewer