document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).setAttribute('src','https://code.jquery.com/jquery-3.2.1.min.js');

function deleteall() {
    while($(".delete-message").length > 0) {
        $(".delete-message")[0].click();
        $(".kuma-dialog-confirm").click();    
    }
    $(".prev").click();
    setTimeout(deleteall, 1000);
}

deleteall();