[musicbrainz] Source for "fix log text pasting"

This commit is contained in:
SuperSaltyGamer
2023-08-31 18:47:34 +03:00
parent 5f6fc48e68
commit 377af18179
2 changed files with 6 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
// ==UserScript==
// @namespace ame-musicbrainz
// @name Ame (MusicBrainz)
// @version 1.6.1
// @version 1.6.2
// @author SuperSaltyGamer
// @run-at document-end
// @match https://musicbrainz.org/*

View File

@@ -28,6 +28,9 @@ typeEl.options.add(fromHTML<HTMLOptionElement>(`<option value="toc">CD TOC</opti
typeEl.options.add(fromHTML<HTMLOptionElement>(`<option value="isrc">ISRC</option>`));
queryEl.addEventListener("input", () => {
const toc = parseTocFromLog(queryEl.value);
if (toc) queryEl.value = toc;
switch (identifyQuery(queryEl.value)) {
case QueryType.Barcode:
typeEl.value = "barcode";
@@ -60,10 +63,8 @@ formEl.addEventListener("drop", async e => {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = () => {
const toc = parseTocFromLog(reader.result as string);
if (!toc) return;
queryEl.value = toc;
typeEl.value = "toc";
queryEl.value = reader.result as string;
queryEl.dispatchEvent(new Event("input"));
submitEl.click();
};
});