|
@@ -1,28 +1,29 @@
|
1
|
|
-(function () {
|
2
|
|
- $(document).ready(function () {
|
3
|
|
- // Upload button is clicked
|
4
|
|
- $("#post").click(function(e) {
|
5
|
|
- // Make sure "Music" category is selected.
|
6
|
|
- if ($("#categories").find(":selected").val() == 0) {
|
7
|
|
- //checkHasMainArtist(e);
|
|
1
|
+$(() => {
|
|
2
|
+ $("#post").click(e => {
|
|
3
|
+ let hard_error = m => {
|
|
4
|
+ if (e.isDefaultPrevented()) return
|
|
5
|
+ alert(m)
|
|
6
|
+ e.preventDefault()
|
|
7
|
+ }
|
|
8
|
+ let soft_error = m => {
|
|
9
|
+ if (e.isDefaultPrevented()) return
|
|
10
|
+ if (!confirm(`${m}\n\nPress OK to upload anyway`)) {
|
|
11
|
+ e.preventDefault()
|
8
|
12
|
}
|
9
|
|
- });
|
|
13
|
+ }
|
10
|
14
|
|
11
|
|
- /**
|
12
|
|
- * Make sure a main artist is selected.
|
13
|
|
- */
|
14
|
|
- /*function checkHasMainArtist(e) {
|
15
|
|
- var has_main = false;
|
16
|
|
- $("select[id^=importance]").each(function() {
|
17
|
|
- if ($(this).find(":selected").val() == 1) {
|
18
|
|
- has_main = true;
|
19
|
|
- }
|
20
|
|
- });
|
21
|
|
- if (!has_main) {
|
22
|
|
- alert('A "Main" artist is required');
|
23
|
|
- // Don't POST the form.
|
24
|
|
- e.preventDefault();
|
25
|
|
- }
|
26
|
|
- }*/
|
27
|
|
- });
|
28
|
|
-})();
|
|
15
|
+ if (!$('#file').raw().value) {
|
|
16
|
+ hard_error('No torrent file is selected')
|
|
17
|
+ }
|
|
18
|
+ if ($('#file').raw().value.slice(-8).toLowerCase() != '.torrent') {
|
|
19
|
+ soft_error('The file selected does not appear to be a .torrent file')
|
|
20
|
+ }
|
|
21
|
+ let mi = $('#mediainfo').raw().value
|
|
22
|
+ if (mi && (!mi.includes('General') || !mi.includes('Video'))) {
|
|
23
|
+ soft_error('Your MediaInfo does not appear to be from a valid MediaInfo utility')
|
|
24
|
+ }
|
|
25
|
+ if (!$('#image').raw().value) {
|
|
26
|
+ soft_error('You did not include a cover image, which is mandatory if one exists')
|
|
27
|
+ }
|
|
28
|
+ })
|
|
29
|
+})
|