contents of zip

This commit is contained in:
transatoshi
2024-12-20 18:08:44 -08:00
parent aeb2b99db7
commit f03ed73d2b
261 changed files with 208197 additions and 0 deletions

48
scripts/clipboard.js Executable file
View File

@@ -0,0 +1,48 @@
// Use strict
"use strict";
// Classes
// Clipboard class
class Clipboard {
// Public
// Copy
copy(text) {
// Return promise
return new Promise(function(resolve, reject) {
// Check if clipboard API is supported
if(typeof navigator === "object" && navigator !== null && "clipboard" in navigator === true) {
// Return writing text to clipboard
return navigator["clipboard"].writeText(text).then(function() {
// Resolve
resolve();
// Catch errors
}).catch(function(error) {
// Reject error
reject("Writing to clipboard failed.");
});
}
// Otherwise
else
// Reject error
reject("Clipboard not supported.");
});
}
}
// Main function
// Set global object's clipboard
globalThis["Clipboard"] = Clipboard;