Browse Source

Support medical imaging data with new dynamic form

pjc 5 years ago
parent
commit
8a785f0b71

+ 45
- 7
classes/torrent_form.class.php View File

@@ -12,7 +12,7 @@ class TorrentForm
12 12
     public $Media = [];
13 13
     public $MediaManga = [];
14 14
     public $Containers = [];
15
-    #var $ContainersGames = [];
15
+    public $ContainersGames = [];
16 16
     public $Codecs = [];
17 17
     public $Resolutions = [];
18 18
     #var $AudioFormats = [];
@@ -32,7 +32,7 @@ class TorrentForm
32 32
         $this->Torrent = $Torrent;
33 33
         $this->Error = $Error;
34 34
 
35
-        global $UploadForm, $Categories, $Media,  $MediaManga, $TorrentID, $Containers, $Codecs, $Resolutions, $Archives;
35
+        global $UploadForm, $Categories, $Media,  $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $Archives;
36 36
         #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
37 37
 
38 38
         $this->UploadForm = $UploadForm;
@@ -42,7 +42,7 @@ class TorrentForm
42 42
         $this->Media = $Media;
43 43
         $this->MediaManga = $MediaManga;
44 44
         $this->Containers = $Containers;
45
-        #$this->ContainersGames = $ContainersGames;
45
+        $this->ContainersGames = $ContainersGames;
46 46
         $this->Codecs = $Codecs;
47 47
         $this->Resolutions = $Resolutions;
48 48
         #$this->AudioFormats = $AudioFormats;
@@ -399,10 +399,29 @@ class TorrentForm
399 399
               echo ">$Media</option>\n";
400 400
           } ?>
401 401
       </select><br />
402
-      Class of sequencing technology used
402
+      Class of technology used
403 403
     </td>
404 404
   </tr>
405 405
 
406
+  <!-- Alternate media -->
407
+  <tr id="media_manga_tr">
408
+    <td class="label">Platform</td>
409
+      <td>
410
+        <select name="media">
411
+          <option>---</option>
412
+          <?php
413
+            foreach ($this->MediaManga as $Media) {
414
+                echo "\t\t\t\t\t\t<option value=\"$Media\"";
415
+                if ($Media === ($Torrent['Media'] ?? false)) {
416
+                    echo " selected";
417
+                }
418
+                echo ">$Media</option>\n";
419
+            } ?>
420
+          </select><br />
421
+          Class of technology used
422
+        </td>
423
+      </tr>
424
+
406 425
   <!-- Container -->
407 426
   <tr id="container_tr">
408 427
     <td class="label">Format</td>
@@ -422,6 +441,25 @@ class TorrentForm
422 441
     </td>
423 442
   </tr>
424 443
 
444
+  <!-- Alternate container -->
445
+  <tr id="container_games_tr">
446
+    <td class="label">Format</td>
447
+    <td>
448
+      <select id="container" name="container">
449
+        <option>---</option>
450
+        <?php
451
+          foreach ($this->ContainersGames as $Container) {
452
+              echo "\t\t\t\t\t\t<option value=\"$Container\"";
453
+              if ($Container === ($Torrent['Container'] ?? false)) {
454
+                  echo " selected";
455
+              }
456
+              echo ">$Container</option>\n";
457
+          } ?>
458
+          </select><br />
459
+          Data file format
460
+        </td>
461
+      </tr>
462
+
425 463
   <!-- Resolution -->
426 464
   <tr id="resolution_tr">
427 465
     <td class="label">Assembly Level</td>
@@ -542,7 +580,7 @@ class TorrentForm
542 580
     <td>
543 581
       <textarea rows="8" cols="60" name="screenshots"
544 582
         id="screenshots"><?= display_str($Torrent['Screenshots'])?></textarea>
545
-      Up to ten DOI numbers relevant to the torrent, one per line
583
+      Up to ten DOI numbers, one per line
546 584
     </tr>
547 585
   <?php } ?>
548 586
 
@@ -563,7 +601,7 @@ class TorrentForm
563 601
           array($this->Disabled)
564 602
       );
565 603
       ?><br />
566
-      General info about the gene or protein's function or significance
604
+      General info about the object of study's function or significance
567 605
     </td>
568 606
   </tr>
569 607
   <?php } # Ends if NewTorrent line 499?>
@@ -579,7 +617,7 @@ class TorrentForm
579 617
           display_str($Torrent['TorrentDescription'] ?? ''),
580 618
           60,
581 619
       ); ?><br />
582
-      Specific info about the protocols and equipment relevant to this data
620
+      Specific info about the protocols and equipment relevant to <em>this</em> data
583 621
     </td>
584 622
   </tr>
585 623
 

+ 9
- 10
sections/upload/upload_handle.php View File

@@ -168,23 +168,23 @@ switch ($Type) {
168 168
             'title',
169 169
             '0',
170 170
             'string',
171
-            'Sequence Name must be between 1 and 512 characters.',
172
-            array('maxlength'=>512, 'minlength'=>1)
171
+            'Sequence Name must be between 1 and 300 characters.', # `torrents_group` limits
172
+            array('maxlength'=>300, 'minlength'=>1)
173 173
         );
174 174
         $Validate->SetFields(
175 175
             'title_rj',
176 176
             '0',
177 177
             'string',
178
-            'Organism must be between 1 and 512 characters.',
179
-            array('maxlength'=>512, 'minlength'=>1)
178
+            'Organism must be between 1 and 300 characters.',
179
+            array('maxlength'=>300, 'minlength'=>1)
180 180
         );
181 181
 
182 182
         $Validate->SetFields(
183 183
             'title_jp',
184 184
             '0',
185 185
             'string',
186
-            'Strain/Variety must be between 1 and 512 characters.',
187
-            array('maxlength'=>512, 'minlength'=>1)
186
+            'Strain/Variety must be between 1 and 300 characters.',
187
+            array('maxlength'=>300, 'minlength'=>1)
188 188
         );
189 189
 
190 190
         $Validate->SetFields(
@@ -535,13 +535,12 @@ if ($DB->has_results()) {
535 535
     }
536 536
 }
537 537
 
538
-// Movie and anime ISOs are neutral leech, and receive a BP bounty
539
-/*
540
-if (($Type === 'Movies' || $Type === 'Anime') && ($T['Container'] === 'ISO' || $T['Container'] === 'M2TS' || $T['Container'] === 'VOB IFO')) {
538
+// Torrents over 100 GiB are neutral leech
539
+// Download doesn't count, upload does
540
+if (($TotalSize > 107374182400)) { # 100 GiB
541 541
   $T['FreeTorrent'] = '2';
542 542
   $T['FreeLeechType'] = '2';
543 543
 }
544
-*/
545 544
 
546 545
 // Torrent
547 546
 $DB->query(

BIN
static/common/bioicons/other.png View File


+ 162
- 155
static/functions/upload.js View File

@@ -1,91 +1,94 @@
1 1
 function DisplayTrans() {
2
+  /*
2 3
   if (['Softsubs','Hardsubs'].indexOf($('select[name="sub"]').raw().value) != -1) {
3 4
     $('#subber').raw().parentNode.parentNode.style.display = 'table-row'
4 5
   } else {
5 6
     $('#subber').raw().parentNode.parentNode.style.display = 'none'
6 7
   }
8
+  */
7 9
 }
8 10
 
9 11
 function Categories() {
10
-  /*
11 12
   let def = ['title', 'title_rj', 'title_jp', 'year', 'lang', 'censored', 'tags', 'cover', 'group_desc', 'release_desc', 'anon']
12
-  let cats = [{
13
-    'javdb': {},
14
-    'idols': {name: 'Idol(s)'},
15
-    'studio': {name: 'Studio'},
16
-    'series': {name: 'Series'},
17
-    'media': {},
18
-    'container': {},
19
-    'codec': {},
20
-    'resolution': {},
21
-    'audio': {},
22
-    'sub': {},
23
-    'mediainfo': {},
24
-    'screenshots': {name: 'Screenshots'},
25
-    'group_desc': {notes: 'Contains information such as a description of the movie, a link to a JAV catalogue, etc.'},
26
-    'release_desc': {notes: 'Contains information such as encoder settings or watermarks'}
27
-  }, {
28
-    'anidb': {},
29
-    'idols': {name: 'Artist/Studio'},
30
-    'studio': false,
31
-    'series': {name: 'Circle (Optional)'},
32
-    'media': {},
33
-    'container': {},
34
-    'codec': {},
35
-    'resolution': {},
36
-    'audio': {},
37
-    'sub': {},
38
-    'trans': {name: 'Translation Group (optional)'},
39
-    'mediainfo': {},
40
-    'tags': {notes: 'Remember to use the \'3d\' tag if your upload is 3DCG!'},
41
-    'screenshots': {name: 'Screenshots'},
42
-    'group_desc': {notes: 'Contains information such as a description of the anime, a link to AniDB, etc.'},
43
-    'release_desc': {notes: 'Contains information such as encoder settings or episode source differences'}
44
-  }, {
45
-    'ehentai': {},
46
-    'idols': {name: 'Artist'},
47
-    'studio': {name: 'Publisher (Optional)'},
48
-    'series': {name: 'Circle (Optional)'},
49
-    'pages': {},
50
-    'media_manga': {},
51
-    'archive_manga': {},
52
-    'trans': {name: 'Translation Group (optional)'},
53
-    'screenshots': {name: 'Samples'},
54
-    'group_desc': {notes: 'Contains information such as a description of the doujin.'},
55
-    'release_desc': {notes: 'Contains information such as formatting information.'}
56
-  }, {
57
-    'idols': {name: 'Developer'},
58
-    'series': {name: 'Circle (Optional)'},
59
-    'studio': {name: 'Publisher (Optional)'},
60
-    'dlsite': {},
61
-    'media_games': {},
62
-    'container_games': {},
63
-    'archive': {},
64
-    'trans': {name: 'Translation/Release Group (optional)'},
65
-    'tags': {notes: 'Tags you should consider, if appropriate: <strong>visual.novel</strong>, <strong>nukige</strong>'},
66
-    'screenshots': {name: 'Screenshots', notes: '<strong class="important_text">Promotional materials from a game\'s store page are NOT screenshots</strong>'},
67
-    'group_desc': {notes: 'Contains information such as a description of the game, its mechanics, etc.'},
68
-    'release_desc': {notes: 'Contains information such as <strong>version</strong>, install instructions, patching instructions, etc.'}
69
-  }, {
70
-    'idols': {name: 'Voices (Optional)'},
71
-    'studio': {name: 'Publisher (Optional)'},
72
-    'mediainfo': {},
73
-    'audio': {},
74
-    'year': false,
75
-    'lang': false,
76
-    'dlsite': {},
77
-    'screenshots': {name: 'Samples'},
78
-    'group_desc': {notes: 'Contains information such as a description of the audio work.'},
79
-    'release_desc': {notes: 'Contains information specific to the release.'}
80
-  }, {
81
-    'idols': {name: 'Creators/Authors (Optional)'},
82
-    'studio': {name: 'Publisher (Optional)'},
83
-    'year': false,
84
-    'lang': false,
85
-    'dlsite': {},
86
-    'screenshots': {name: 'Screenshots'},
87
-    'release_desc': false
88
-  }]
13
+  let cats = [
14
+    { // DNA
15
+      'javdb': {},
16
+      'idols': {},
17
+      'studio': {},
18
+      'series': {},
19
+      'media': {},
20
+      'container': {},
21
+      'codec': {},
22
+      'resolution': {},
23
+      'audio': {},
24
+      'sub': {},
25
+      'mediainfo': {},
26
+      'screenshots': {},
27
+      'group_desc': {},
28
+      'release_desc': {}
29
+    }, { // RNA
30
+      'javdb': {},
31
+      'idols': {},
32
+      'studio': {},
33
+      'series': {},
34
+      'media': {},
35
+      'container': {},
36
+      'codec': {},
37
+      'resolution': {},
38
+      'audio': {},
39
+      'sub': {},
40
+      'mediainfo': {},
41
+      'screenshots': {},
42
+      'group_desc': {},
43
+      'release_desc': {}
44
+    }, { // Protein
45
+      'javdb': {},
46
+      'idols': {},
47
+      'studio': {},
48
+      'series': {},
49
+      'media': {},
50
+      'container': {},
51
+      'codec': {},
52
+      'resolution': {},
53
+      'audio': {},
54
+      'sub': {},
55
+      'mediainfo': {},
56
+      'screenshots': {},
57
+      'group_desc': {},
58
+      'release_desc': {}
59
+    }, { // Imaging
60
+      //'javdb': {},
61
+      'idols': {},
62
+      'studio': {},
63
+      'series': {},
64
+      'media_manga': {},
65
+      'container_games': {},
66
+      'codec': {},
67
+      'resolution': {},
68
+      'audio': {},
69
+      'sub': {},
70
+      'mediainfo': {},
71
+      'screenshots': {},
72
+      'group_desc': {},
73
+      'release_desc': {}
74
+    }, { // Other
75
+      //'javdb': {},
76
+      'idols': {},
77
+      'studio': {},
78
+      'series': {},
79
+      'media': {},
80
+      'container': {},
81
+      'codec': {},
82
+      'resolution': {},
83
+      'audio': {},
84
+      'sub': {},
85
+      'mediainfo': {},
86
+      'screenshots': {},
87
+      'group_desc': {},
88
+      'release_desc': {}
89
+    }
90
+  ]
91
+
89 92
   let active = {}
90 93
   for (let field of def) active[field] = {}
91 94
   let category = 0
@@ -104,19 +107,18 @@ function Categories() {
104 107
 
105 108
   let trs = $('#dynamic_form tr')
106 109
   for (let tr of trs) {
107
-    let field = tr.id.slice(0,-3)
110
+    let field = tr.id.slice(0, -3)
108 111
     if (active[field]) {
109 112
       if (active[field].name) {
110 113
         tr.children[0].innerHTML = active[field].name
111 114
       }
112 115
       let notes = $(`#${tr.id} p.notes`).raw()
113
-      if (notes) notes.innerHTML = active[field].notes||''
116
+      if (notes) notes.innerHTML = active[field].notes || ''
114 117
       show(tr)
115 118
     } else {
116 119
       hide(tr)
117 120
     }
118 121
   }
119
-  */
120 122
 }
121 123
 
122 124
 function Bitrate() {
@@ -212,17 +214,17 @@ function AddFormat() {
212 214
   $('#extras').raw().value = FormatCount;
213 215
 
214 216
   var NewRow = document.createElement("tr");
215
-  NewRow.id = "new_torrent_row"+FormatCount;
216
-  NewRow.setAttribute("style","border-top-width: 5px; border-left-width: 5px; border-right-width: 5px;");
217
+  NewRow.id = "new_torrent_row" + FormatCount;
218
+  NewRow.setAttribute("style", "border-top-width: 5px; border-left-width: 5px; border-right-width: 5px;");
217 219
 
218 220
   var NewCell1 = document.createElement("td");
219
-  NewCell1.setAttribute("class","label");
221
+  NewCell1.setAttribute("class", "label");
220 222
   NewCell1.innerHTML = "Extra Torrent File";
221 223
 
222 224
   var NewCell2 = document.createElement("td");
223 225
   var TorrentField = document.createElement("input");
224 226
   TorrentField.type = "file";
225
-  TorrentField.id = "extra_torrent_file"+FormatCount;
227
+  TorrentField.id = "extra_torrent_file" + FormatCount;
226 228
   TorrentField.name = "extra_torrent_files[]";
227 229
   TorrentField.size = 50;
228 230
   NewCell2.appendChild(TorrentField);
@@ -231,23 +233,23 @@ function AddFormat() {
231 233
   NewRow.appendChild(NewCell2);
232 234
 
233 235
   NewRow = document.createElement("tr");
234
-  NewRow.id = "new_format_row"+FormatCount;
235
-  NewRow.setAttribute("style","border-left-width: 5px; border-right-width: 5px;");
236
+  NewRow.id = "new_format_row" + FormatCount;
237
+  NewRow.setAttribute("style", "border-left-width: 5px; border-right-width: 5px;");
236 238
   NewCell1 = document.createElement("td");
237
-  NewCell1.setAttribute("class","label");
239
+  NewCell1.setAttribute("class", "label");
238 240
   NewCell1.innerHTML = "Extra Format / Bitrate";
239 241
 
240 242
   NewCell2 = document.createElement("td");
241 243
   tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
242
-  var formats=["Saab","Volvo","BMW"];
244
+  var formats = ["Saab", "Volvo", "BMW"];
243 245
   for (var i in formats) {
244
-    tmp += '<option value="'+formats[i]+'">'+formats[i]+"</option>\n";
246
+    tmp += '<option value="' + formats[i] + '">' + formats[i] + "</option>\n";
245 247
   }
246 248
   tmp += "</select>";
247
-  var bitrates=["1","2","3"];
249
+  var bitrates = ["1", "2", "3"];
248 250
   tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
249 251
   for (var i in bitrates) {
250
-    tmp += '<option value="'+bitrates[i]+'">'+bitrates[i]+"</option>\n";
252
+    tmp += '<option value="' + bitrates[i] + '">' + bitrates[i] + "</option>\n";
251 253
   }
252 254
   tmp += "</select>";
253 255
 
@@ -257,10 +259,10 @@ function AddFormat() {
257 259
 
258 260
 
259 261
   NewRow = document.createElement("tr");
260
-  NewRow.id = "new_description_row"+FormatCount;
261
-  NewRow.setAttribute("style","border-bottom-width: 5px; border-left-width: 5px; border-right-width: 5px;");
262
+  NewRow.id = "new_description_row" + FormatCount;
263
+  NewRow.setAttribute("style", "border-bottom-width: 5px; border-left-width: 5px; border-right-width: 5px;");
262 264
   NewCell1 = document.createElement("td");
263
-  NewCell1.setAttribute("class","label");
265
+  NewCell1.setAttribute("class", "label");
264 266
   NewCell1.innerHTML = "Extra Release Description";
265 267
 
266 268
   NewCell2 = document.createElement("td");
@@ -276,19 +278,18 @@ function RemoveFormat() {
276 278
   }
277 279
   $('#extras').raw().value = FormatCount;
278 280
 
279
-  var x = $('#new_torrent_row'+FormatCount).raw();
281
+  var x = $('#new_torrent_row' + FormatCount).raw();
280 282
   x.parentNode.removeChild(x);
281 283
 
282
-  x = $('#new_format_row'+FormatCount).raw();
284
+  x = $('#new_format_row' + FormatCount).raw();
283 285
   x.parentNode.removeChild(x);
284 286
 
285
-  x = $('#new_description_row'+FormatCount).raw();
287
+  x = $('#new_description_row' + FormatCount).raw();
286 288
   x.parentNode.removeChild(x);
287 289
 
288 290
   FormatCount--;
289 291
 }
290 292
 
291
-
292 293
 var ArtistCount = 1;
293 294
 
294 295
 function AddArtistField() {
@@ -310,9 +311,9 @@ function AddArtistField() {
310 311
   x.appendChild(document.createTextNode('\n'));
311 312
 
312 313
   if ($("#idol").data("gazelle-autocomplete")) {
313
-    $(ArtistField).live('focus', function() {
314
+    $(ArtistField).live('focus', function () {
314 315
       $(ArtistField).autocomplete({
315
-        serviceUrl : 'artist.php?action=autocomplete'
316
+        serviceUrl: 'artist.php?action=autocomplete'
316 317
       });
317 318
     });
318 319
   }
@@ -345,7 +346,7 @@ function AddScreenshotField() {
345 346
   var a = document.createElement("a")
346 347
   a.className = "brackets"
347 348
   a.innerHTML = "−"
348
-  a.onclick = function(){RemoveScreenshotField(this)}
349
+  a.onclick = function () { RemoveScreenshotField(this) }
349 350
 
350 351
   var x = $('#screenshots').raw()
351 352
   var y = document.createElement("div")
@@ -359,7 +360,7 @@ function RemoveScreenshotField(el) {
359 360
   el.parentElement.remove()
360 361
 }
361 362
 
362
-function CheckVA () {
363
+function CheckVA() {
363 364
   if ($('#artist').raw().value.toLowerCase().trim().match(/^(va|various(\sa|a)rtis(t|ts)|various)$/)) {
364 365
     $('#vawarning').gshow();
365 366
   } else {
@@ -416,35 +417,39 @@ function ToggleUnknown() {
416 417
 }
417 418
 
418 419
 function AnimeAutofill() {
419
-  var map = { artist: 'idols_0',
420
-              title: 'title',
421
-              title_rj: 'title_rj',
422
-              title_jp: 'title_jp',
423
-              year: 'year',
424
-              description: 'album_desc' }
420
+  var map = {
421
+    artist: 'idols_0',
422
+    title: 'title',
423
+    title_rj: 'title_rj',
424
+    title_jp: 'title_jp',
425
+    year: 'year',
426
+    description: 'album_desc'
427
+  }
425 428
   var aid = $('#anidb').raw().value
426
-  $.getJSON('/ajax.php?action=autofill&cat=anime&aid='+aid, function(data) {
429
+  $.getJSON('/ajax.php?action=autofill&cat=anime&aid=' + aid, function (data) {
427 430
     if (data.status != "success") return
428 431
     for (i in data.response) {
429
-      if (map[i] && !($('#'+map[i]).raw().value)) {
430
-        $('#'+map[i]).raw().value = data.response[i]
432
+      if (map[i] && !($('#' + map[i]).raw().value)) {
433
+        $('#' + map[i]).raw().value = data.response[i]
431 434
       }
432 435
     }
433 436
   })
434 437
 }
435 438
 
436 439
 function JavAutofill() {
437
-  var map = { cn: 'javdb',
438
-              idols: 'idols',
439
-              title: 'title',
440
-              title_jp: 'title_jp',
441
-              year: 'year',
442
-              studio: 'studio',
443
-              image: 'image',
444
-              tags: 'tags',
445
-              description: 'album_desc' }
440
+  var map = {
441
+    cn: 'javdb',
442
+    idols: 'idols',
443
+    title: 'title',
444
+    title_jp: 'title_jp',
445
+    year: 'year',
446
+    studio: 'studio',
447
+    image: 'image',
448
+    tags: 'tags',
449
+    description: 'album_desc'
450
+  }
446 451
   var cn = $('#javdb_tr #catalogue').raw().value.toUpperCase()
447
-  $.getJSON('/ajax.php?action=autofill&cat=jav&cn='+cn, function(data) {
452
+  $.getJSON('/ajax.php?action=autofill&cat=jav&cn=' + cn, function (data) {
448 453
     if (data.status != "success") {
449 454
       $('#catalogue').raw().value = 'Failed'
450 455
       return
@@ -455,39 +460,41 @@ function JavAutofill() {
455 460
       if (Array.isArray(data.response[i])) {
456 461
         for (j in data.response[i]) {
457 462
           if (i == 'idols') {
458
-            if (!($('#'+map[i]+'_'+j).raw())) {
463
+            if (!($('#' + map[i] + '_' + j).raw())) {
459 464
               AddArtistField()
460 465
             }
461
-            $('#'+map[i]+'_'+j).raw().value = data.response[i][j]
466
+            $('#' + map[i] + '_' + j).raw().value = data.response[i][j]
462 467
           }
463
-          if (map[i] == 'tags' && !($('#'+map[i]).raw().value)) {
464
-            $('#'+map[i]).raw().value = data.response[i].join(', ')
468
+          if (map[i] == 'tags' && !($('#' + map[i]).raw().value)) {
469
+            $('#' + map[i]).raw().value = data.response[i].join(', ')
465 470
           }
466 471
         }
467 472
       }
468
-      if (map[i] && $('#'+map[i]).raw() && !($('#'+map[i]).raw().value)) {
469
-        $('#'+map[i]).raw().value = data.response[i]
473
+      if (map[i] && $('#' + map[i]).raw() && !($('#' + map[i]).raw().value)) {
474
+        $('#' + map[i]).raw().value = data.response[i]
470 475
       }
471 476
     }
472 477
     if (data.response.screens.length) {
473
-      $('#album_desc').raw().value = ('[spoiler=Automatically located thumbs][img]'+data.response.screens.join('[/img][img]')+'[/img][/spoiler]\n\n') + $('#album_desc').raw().value
478
+      $('#album_desc').raw().value = ('[spoiler=Automatically located thumbs][img]' + data.response.screens.join('[/img][img]') + '[/img][/spoiler]\n\n') + $('#album_desc').raw().value
474 479
     }
475 480
   })
476 481
 }
477 482
 
478 483
 function MangaAutofill() {
479
-  var map = {  artists: 'idols',
480
-              title: 'title',
481
-              title_jp: 'title_jp',
482
-              year: 'year',
483
-              tags: 'tags',
484
-              lang: 'lang',
485
-              cover: 'image',
486
-              circle: 'series',
487
-              pages: 'pages',
488
-              description: 'release_desc' }
484
+  var map = {
485
+    artists: 'idols',
486
+    title: 'title',
487
+    title_jp: 'title_jp',
488
+    year: 'year',
489
+    tags: 'tags',
490
+    lang: 'lang',
491
+    cover: 'image',
492
+    circle: 'series',
493
+    pages: 'pages',
494
+    description: 'release_desc'
495
+  }
489 496
   var nh = $('#ehentai_tr #catalogue').raw().value
490
-  $.getJSON('/ajax.php?action=autofill&cat=manga&url='+nh, function(data) {
497
+  $.getJSON('/ajax.php?action=autofill&cat=manga&url=' + nh, function (data) {
491 498
     if (data.status != "success") {
492 499
       $('#catalogue').raw().value = 'Failed'
493 500
       return
@@ -496,18 +503,18 @@ function MangaAutofill() {
496 503
       if (Array.isArray(data.response[i])) {
497 504
         for (j in data.response[i]) {
498 505
           if (i == 'artists') {
499
-            if (!($('#'+map[i]+'_'+j).raw())) {
506
+            if (!($('#' + map[i] + '_' + j).raw())) {
500 507
               AddArtistField()
501 508
             }
502
-            $('#'+map[i]+'_'+j).raw().value = data.response[i][j]
509
+            $('#' + map[i] + '_' + j).raw().value = data.response[i][j]
503 510
           }
504
-          if (map[i] == 'tags' && !($('#'+map[i]).raw().value)) {
505
-            $('#'+map[i]).raw().value = data.response[i].join(', ')
511
+          if (map[i] == 'tags' && !($('#' + map[i]).raw().value)) {
512
+            $('#' + map[i]).raw().value = data.response[i].join(', ')
506 513
           }
507 514
         }
508 515
       }
509
-      if (map[i] && $('#'+map[i]).raw() && (!($('#'+map[i]).raw().value) || $('#'+map[i]).raw().value == '---')) {
510
-        $('#'+map[i]).raw().value = data.response[i]
516
+      if (map[i] && $('#' + map[i]).raw() && (!($('#' + map[i]).raw().value) || $('#' + map[i]).raw().value == '---')) {
517
+        $('#' + map[i]).raw().value = data.response[i]
511 518
       }
512 519
     }
513 520
   })
@@ -527,7 +534,7 @@ function SetResolution() {
527 534
 function MediaInfoExtract() {
528 535
   const mi = $('#mediainfo').raw().value
529 536
   function getval(mi, key) {
530
-    var match = mi.match(new RegExp('^'+key+'\\s*:\\s*(.*)', 'mi'))
537
+    var match = mi.match(new RegExp('^' + key + '\\s*:\\s*(.*)', 'mi'))
531 538
     return (match && match[1]) ? match[1] : false
532 539
   }
533 540
   ['container', 'codec', 'resolution', 'audioformat', 'lang'].forEach((sel) => {
@@ -546,19 +553,19 @@ function MediaInfoExtract() {
546 553
       else if (width == '3840') { ressel.value = '4K' }
547 554
       else {
548 555
         ressel.value = 'Other'
549
-        $('[name=resolution]').raw().value = width+'x'+height
556
+        $('[name=resolution]').raw().value = width + 'x' + height
550 557
       }
551 558
     } else if (sel == 'lang') {
552 559
       var val1 = getval(mi.slice(mi.search(/^Audio$/m)), 'Language')
553 560
       var val2 = getval(mi.slice(mi.search(/^Audio\nID.*[^1]/m)), 'Language')
554
-      var val = (val2 && val2 != val1 && (val1+val2 == 'EnglishJapanese' || val1+val2 == 'JapaneseEnglish')) ? 'Dual Language' : val1
561
+      var val = (val2 && val2 != val1 && (val1 + val2 == 'EnglishJapanese' || val1 + val2 == 'JapaneseEnglish')) ? 'Dual Language' : val1
555 562
       if (val) { $('[name=lang]').raw().value = val }
556 563
     } else if (sel == 'container') {
557
-      var containerTable = {'Matroska': 'MKV','MPEG-4': 'MP4','AVI': 'AVI','OGG': 'OGM','Windows Media': 'WMV'}
564
+      var containerTable = { 'Matroska': 'MKV', 'MPEG-4': 'MP4', 'AVI': 'AVI', 'OGG': 'OGM', 'Windows Media': 'WMV' }
558 565
       var cont = getval(mi, 'Format')
559 566
       if (containerTable[cont]) { $('[name=container]').raw().value = containerTable[cont] }
560 567
     } else if (sel == 'codec') {
561
-      var codecTable = {'WMV1':'WMV','VC-1':'WMV','HEVC':'HEVC'}
568
+      var codecTable = { 'WMV1': 'WMV', 'VC-1': 'WMV', 'HEVC': 'HEVC' }
562 569
       var codec = getval(mi.slice(mi.search(/^Video$/m)), 'Format')
563 570
       var formatProfile = getval(mi.slice(mi.search(/^Video$/m)), 'Format profile')
564 571
       var codecID = getval(mi, 'Codec ID')
@@ -577,14 +584,14 @@ function MediaInfoExtract() {
577 584
 }
578 585
 
579 586
 function initAutofill() {
580
-  $('[autofill]').each(function(i, el) {
581
-    el.addEventListener('click', function(event) {
582
-      ({'douj':MangaAutofill, 'anime':AnimeAutofill, 'jav':JavAutofill})[el.attributes['autofill'].value]()
587
+  $('[autofill]').each(function (i, el) {
588
+    el.addEventListener('click', function (event) {
589
+      ({ 'douj': MangaAutofill, 'anime': AnimeAutofill, 'jav': JavAutofill })[el.attributes['autofill'].value]()
583 590
     })
584 591
   })
585 592
 }
586 593
 
587
-$(function() {
594
+$(function () {
588 595
   Categories();
589 596
   initAutofill();
590 597
   $(document).on('click', '.add_artist_button', AddArtistField);

Loading…
Cancel
Save