Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
kepstin committed Sep 22, 2024
2 parents 77a2554 + 9c31a18 commit b3b8356
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -699,21 +699,28 @@
restoreScrollPosition();
}

function parseISRC(str) {
const match = /[A-Za-z]{2}-?[A-Za-z0-9]{3}-?[0-9]{2}-?[0-9]{5}/.exec(str);
if (!match) { return ""; }
return match[0];
}

function handleISRCPaste(event) {
let text = event.clipboardData.getData("text").split(/\r\n|\r|\n/);
if (text.length == 1) { return; }
event.preventDefault();

let input = event.target;
let line = text.shift();
input.setRangeText(line, input.selectionStart, input.selectionEnd, "end");

input.setRangeText(parseISRC(line), input.selectionStart, input.selectionEnd, "end");

while (text.length > 0) {
line = text.shift();
input = getNextISRCInput(input);
if (!input) { return; }

input.value = line;
input.value = parseISRC(line);
input.focus();
}
}
Expand Down

0 comments on commit b3b8356

Please sign in to comment.