Compare commits

..

No commits in common. "1ebd2708e3f1d55e1faad8d298f882755ace8294" and "d66b7300f860eeee2aa5795415a3716d7d74fbff" have entirely different histories.

View File

@ -49,7 +49,7 @@ function createAnimationStyleSelect() {
addbtn.onclick = async () => {
var fileHandles = await showOpenFilePicker({
var fsfhs = await showOpenFilePicker({
id: "add",
multiple: true,
types: [
@ -61,31 +61,12 @@ addbtn.onclick = async () => {
}
]
});
if (!fileHandles.length) return;
var files = [];
for (let fileHandle of fileHandles) {
try {
files.push(await fileHandle.getFile());
} catch (error) {
displayError(error);
}
}
await addFiles(files);
};
document.body.onpaste = event => {
if (event.clipboardData.files.length) {
addFiles(event.clipboardData.files);
}
};
async function addFiles(files) {
if (!fsfhs.length) return;
var newEmojis = [];
var errors = [];
for (let file of files) {
for (let fsfh of fsfhs) {
try {
let file = await fsfh.getFile();
let image = await loadImage(URL.createObjectURL(file));
let width = image.width;
let height = image.height;
@ -138,10 +119,7 @@ async function addFiles(files) {
emojis ||= [];
emojis = emojis.concat(newEmojis);
await chrome.storage.local.set({emojis});
}
};
var deleteMode = false;
@ -283,7 +261,6 @@ function createEmojiSquare(emoji, url) {
if (this.dataset.state == "pending") return;
var selectedState = this.dataset.state;
this.dataset.state = "pending";
div.querySelector("select").disabled = true;
errorDiv.innerText = "";
if (deleteMode) {
@ -309,7 +286,6 @@ function createEmojiSquare(emoji, url) {
// disable
callContentScript("deleteEmoji", this.dataset.currentId).then(() => {
this.dataset.state = "disabled";
div.querySelector("select").disabled = false;
}).catch(error => {
displayError(error);
this.dataset.state = selectedState;
@ -324,7 +300,6 @@ function createEmojiSquare(emoji, url) {
chrome.storage.local.set({emojis});
this.dataset.currentId = newEmoji.id;
this.dataset.state = "enabled";
div.querySelector("select").disabled = false;
});
}).catch(error => {
this.dataset.state = selectedState;