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