Skip to content

Instantly share code, notes, and snippets.

@mathgeniuszach
Created February 6, 2023 04:27
Show Gist options
  • Save mathgeniuszach/81e866170ac4ba4f1d551c440cdb87ea to your computer and use it in GitHub Desktop.
Save mathgeniuszach/81e866170ac4ba4f1d551c440cdb87ea to your computer and use it in GitHub Desktop.
// ==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