diff --git a/public/js/alert.js b/public/js/alert.js new file mode 100644 index 0000000..babc0b6 --- /dev/null +++ b/public/js/alert.js @@ -0,0 +1,6 @@ +const alert = (level, text) => { + $('#alert').empty(); + const html = `
`; + $('#alert').append(html); + $("html, body").animate({ scrollTop: 0 }); +}; diff --git a/public/js/download.js b/public/js/download.js index c9ee07c..252254e 100644 --- a/public/js/download.js +++ b/public/js/download.js @@ -286,12 +286,3 @@ const buildTable = () => { }); $('#selection-controls').removeAttr('hidden'); }; -const alert = (level, text) => { - hideAlert(); - const html = ''; - $('#alert').append(html); - $("html, body").animate({ scrollTop: 0 }); -}; -const hideAlert = () => { - $('#alert').empty(); -}; diff --git a/public/js/title.js b/public/js/title.js index e2d236d..d309c1e 100644 --- a/public/js/title.js +++ b/public/js/title.js @@ -42,11 +42,3 @@ function updateProgress(titleID, entryID, page) { } }); } -function alert(level, text) { - hideAlert(); - var html = ''; - $('#alert').append(html); -} -function hideAlert() { - $('#alert').empty(); -} diff --git a/public/js/user-edit.js b/public/js/user-edit.js index 12e4aa4..650d785 100644 --- a/public/js/user-edit.js +++ b/public/js/user-edit.js @@ -1,16 +1,6 @@ -$(function(){ +$(() => { var target = '/admin/user/edit'; if (username) target += username; $('form').attr('action', target); - - function alert(level, text) { - hideAlert(); - var html = ''; - $('#alert').append(html); - } - function hideAlert() { - $('#alert').empty(); - } - if (error) alert('danger', error); }); diff --git a/public/js/user.js b/public/js/user.js index 9d6c111..0bce1c5 100644 --- a/public/js/user.js +++ b/public/js/user.js @@ -1,11 +1,3 @@ -function alert(level, text) { - hideAlert(); - var html = ''; - $('#alert').append(html); -} -function hideAlert() { - $('#alert').empty(); -} function remove(username) { $.post('/api/admin/user/delete/' + username, function(data) { if (data.success) { diff --git a/src/views/download.ecr b/src/views/download.ecr index 0ee3665..90e9fdd 100644 --- a/src/views/download.ecr +++ b/src/views/download.ecr @@ -1,4 +1,3 @@ -