Created
February 6, 2023 04:27
-
-
Save mathgeniuszach/81e866170ac4ba4f1d551c440cdb87ea to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Bingosync Custom Input | |
// @author mathgeniuszach | |
// @description Enables you to paste lines of text from a spreadsheet or list into Bingosync. | |
// @version 1.0 | |
// @match https://bingosync.com/ | |
// @run-at document-start | |
// ==/UserScript== | |
window.addEventListener("DOMContentLoaded", () => { | |
json_box = document.getElementById("id_custom_json") | |
if (json_box) { | |
json_box.addEventListener("focusout", () => { | |
if (!json_box.value) return | |
if (json_box.value[0] == "[" || json_box.value[0] == "{") return | |
json_box.value = JSON.stringify(json_box.value | |
.trim() | |
.split(/[\n\t]+/g) | |
.map(e => {return {"name": e}})).replace(/,/g, ",\n") | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment