function addcharacter() {
    var value = document.getElementById("addcharacter").value
    var test = testregex.exec(value);
    if (value && !test) {
        var showcharacter = document.getElementById("showcharacter");
        var character = document.createElement("a");
        var characterremove = document.createElement("span");
        titled = document.getElementById("modaldoujinshi").alt
        doujinshiinfo = doujinshi.find( ({ folder }) => folder === titled );
        var doujinshiinfoindex = doujinshi.indexOf(doujinshiinfo)
        var doujinshiinfotestcharacter = doujinshi[doujinshiinfoindex].character.indexOf(value)
        document.getElementById("addcharacter").value = ""
        if (doujinshiinfotestcharacter < 0) {
            characterremove.innerHTML = "X"
            characterremove.style = "color:#ffffff;vertical-align: middle;font-size: 13px;margin-right: 6px;margin-left: 6px;font-weight: bold;display: inline-block;cursor: pointer;"
            characterremove.className = "charactercross"
            character.id = "charactercross"+e
            characterremove.setAttribute('onclick',`removecharacter("${titled}", "${value}");this.remove();document.getElementById("charactercross${e}").remove();`)
            character.style = "color:#e0e0e0;background-color:#000000;border-radius: 5px;margin-right: 6px"
            character.innerHTML = value
            character.className = "tagclass"
            character.appendChild(characterremove)
            showcharacter.appendChild(character)
            doujinshi[doujinshiinfoindex].character.push(value)
            var jsonoutput = JSON.stringify(doujinshi, null, '\t')
            fs.writeFile('data/doujinshi.json', jsonoutput, function (err) {if (err) throw err;});
            var tagjson = require('../data/placeholder.json')
            var tagjsonindex = tagjson.character.doujinshi.indexOf(value)
            if (tagjsonindex < 0) {
                tagjson.character.doujinshi.push(value)
                var tagjsonoutput = JSON.stringify(tagjson, null, '\t')
                fs.writeFile('data/placeholder.json', tagjsonoutput, function (err) {if (err) throw err;});
            }
            e++
        }
    }
}
// function used to add a character
function used to add a character
function used to add a character
function addcharacter() {
    var value = document.getElementById("addcharacter").value
    var test = testregex.exec(value);
    if (value && !test) {
        var showcharacter = document.getElementById("showcharacter");
        var character = document.createElement("a");
        var characterremove = document.createElement("span");
        titled = document.getElementById("modaldoujinshi").alt
        doujinshiinfo = doujinshi.find( ({ folder }) => folder === titled );
        var doujinshiinfoindex = doujinshi.indexOf(doujinshiinfo)
        var doujinshiinfotestcharacter = doujinshi[doujinshiinfoindex].character.indexOf(value)
        document.getElementById("addcharacter").value = ""
        if (doujinshiinfotestcharacter < 0) {
            characterremove.innerHTML = "X"
            characterremove.style = "color:#ffffff;vertical-align: middle;font-size: 13px;margin-right: 6px;margin-left: 6px;font-weight: bold;display: inline-block;cursor: pointer;"
            characterremove.className = "charactercross"
            character.id = "charactercross"+e
            characterremove.setAttribute('onclick',`removecharacter("${titled}", "${value}");this.remove();document.getElementById("charactercross${e}").remove();`)
            character.style = "color:#e0e0e0;background-color:#000000;border-radius: 5px;margin-right: 6px"
            character.innerHTML = value
            character.className = "tagclass"
            character.appendChild(characterremove)
            showcharacter.appendChild(character)
            doujinshi[doujinshiinfoindex].character.push(value)
            var jsonoutput = JSON.stringify(doujinshi, null, '\t')
            fs.writeFile('data/doujinshi.json', jsonoutput, function (err) {if (err) throw err;});
            var tagjson = require('../data/placeholder.json')
            var tagjsonindex = tagjson.character.doujinshi.indexOf(value)
            if (tagjsonindex < 0) {
                tagjson.character.doujinshi.push(value)
                var tagjsonoutput = JSON.stringify(tagjson, null, '\t')
                fs.writeFile('data/placeholder.json', tagjsonoutput, function (err) {if (err) throw err;});
            }
            e++
        }
    }
}
function addcharacter ( ) { var value = document . getElementById ( "addcharacter" ) . value var test = testregex . exec ( value ) ; if ( value && ! test ) { var showcharacter = document . getElementById ( "showcharacter" ) ; var character = document . createElement ( "a" ) ; var characterremove = document . createElement ( "span" ) ; titled = document . getElementById ( "modaldoujinshi" ) . alt doujinshiinfo = doujinshi . find ( ( { folder } ) => folder === titled ) ; var doujinshiinfoindex = doujinshi . indexOf ( doujinshiinfo ) var doujinshiinfotestcharacter = doujinshi [ doujinshiinfoindex ] . character . indexOf ( value ) document . getElementById ( "addcharacter" ) . value = "" if ( doujinshiinfotestcharacter < 0 ) { characterremove . innerHTML = "X" characterremove . style = "color:#ffffff;vertical-align: middle;font-size: 13px;margin-right: 6px;margin-left: 6px;font-weight: bold;display: inline-block;cursor: pointer;" characterremove . className = "charactercross" character . id = "charactercross" + e characterremove . setAttribute ( 'onclick' , ` ${ titled } ${ value } ${ e } ` ) character . style = "color:#e0e0e0;background-color:#000000;border-radius: 5px;margin-right: 6px" character . innerHTML = value character . className = "tagclass" character . appendChild ( characterremove ) showcharacter . appendChild ( character ) doujinshi [ doujinshiinfoindex ] . character . push ( value ) var jsonoutput = JSON . stringify ( doujinshi , null , '\t' ) fs . writeFile ( 'data/doujinshi.json' , jsonoutput , function ( err ) { if ( err ) throw err ; } ) ; var tagjson = require ( '../data/placeholder.json' ) var tagjsonindex = tagjson . character . doujinshi . indexOf ( value ) if ( tagjsonindex < 0 ) { tagjson . character . doujinshi . push ( value ) var tagjsonoutput = JSON . stringify ( tagjson , null , '\t' ) fs . writeFile ( 'data/placeholder.json' , tagjsonoutput , function ( err ) { if ( err ) throw err ; } ) ; } e ++ } } }
function used to add a character
function used to add a character