document.onclick = (eve) => {
    let elm  = eve.target;
    let data = "";

    if (eve.which == 1) {  // Left click
        if (elm.className.includes("xButton")) {
            let tag  = elm.parentElement.childNodes[1];
            let type = tag.name;

            if (type == "a") {
                data = tag.childNodes[0].href;
            } else if (type == "text") {
                data = btoa(tag.childNodes[0].innerHTML);
            } else if (type == "img") {
                data = btoa(tag.childNodes[0].src);
            }

            if (confirm('Are you sure you want to delete this?\nType: ' +
                                              type + '\nData: ' + data)) {
                deleteItem(type, data, elm.parentElement);
            }
        }
    }
}
