{"size": 820, "ext": "js", "max_stars_repo_path": "easy-webhook-discord/index.js", "max_stars_repo_name": "naoido/naoido.github.io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "easy-webhook-discord/index.js", "max_issues_repo_name": "naoido/naoido.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "easy-webhook-discord/index.js", "max_forks_repo_name": "naoido/naoido.github.io", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.3703703704, "max_line_length": 84, "alphanum_fraction": 0.5804878049}
function post(content, name, url) {
    let req = new XMLHttpRequest();
    req.open("POST", url);
    let form_data = new FormData();
    form_data.append("content", content);
    if (name) {
        form_data.append("username", name);
    }
    req.send(form_data);
    alert("complete!!!");
}

document.getElementById("send").addEventListener("click", function(){
    let content = document.getElementById("content").value;
    let name = document.getElementById("name").value;
    let url = document.getElementById("url").value;
    if (!content || !url) {
        alert("入力不足な箇所があります。");
        return;
    }
    if (!url.match(/^https:\/\/discord\.com\/api\/webhooks\/\d+\/[a-zA-Z0-9]+$/)) {
        alert("webhookURLが正しくありません。");
        return;
    }
    post(content, name, url);
});
