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
     public $Media = [];
12
     public $Media = [];
13
     public $MediaManga = [];
13
     public $MediaManga = [];
14
     public $Containers = [];
14
     public $Containers = [];
15
-    #var $ContainersGames = [];
15
+    public $ContainersGames = [];
16
     public $Codecs = [];
16
     public $Codecs = [];
17
     public $Resolutions = [];
17
     public $Resolutions = [];
18
     #var $AudioFormats = [];
18
     #var $AudioFormats = [];
32
         $this->Torrent = $Torrent;
32
         $this->Torrent = $Torrent;
33
         $this->Error = $Error;
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
         #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
36
         #global $UploadForm, $Categories, $Formats, $Bitrates, $Media, $MediaManga, $TorrentID, $Containers, $ContainersGames, $Codecs, $Resolutions, $AudioFormats, $Subbing, $Languages, $Platform, $Archives, $ArchivesManga;
37
 
37
 
38
         $this->UploadForm = $UploadForm;
38
         $this->UploadForm = $UploadForm;
42
         $this->Media = $Media;
42
         $this->Media = $Media;
43
         $this->MediaManga = $MediaManga;
43
         $this->MediaManga = $MediaManga;
44
         $this->Containers = $Containers;
44
         $this->Containers = $Containers;
45
-        #$this->ContainersGames = $ContainersGames;
45
+        $this->ContainersGames = $ContainersGames;
46
         $this->Codecs = $Codecs;
46
         $this->Codecs = $Codecs;
47
         $this->Resolutions = $Resolutions;
47
         $this->Resolutions = $Resolutions;
48
         #$this->AudioFormats = $AudioFormats;
48
         #$this->AudioFormats = $AudioFormats;
399
               echo ">$Media</option>\n";
399
               echo ">$Media</option>\n";
400
           } ?>
400
           } ?>
401
       </select><br />
401
       </select><br />
402
-      Class of sequencing technology used
402
+      Class of technology used
403
     </td>
403
     </td>
404
   </tr>
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
   <!-- Container -->
425
   <!-- Container -->
407
   <tr id="container_tr">
426
   <tr id="container_tr">
408
     <td class="label">Format</td>
427
     <td class="label">Format</td>
422
     </td>
441
     </td>
423
   </tr>
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
   <!-- Resolution -->
463
   <!-- Resolution -->
426
   <tr id="resolution_tr">
464
   <tr id="resolution_tr">
427
     <td class="label">Assembly Level</td>
465
     <td class="label">Assembly Level</td>
542
     <td>
580
     <td>
543
       <textarea rows="8" cols="60" name="screenshots"
581
       <textarea rows="8" cols="60" name="screenshots"
544
         id="screenshots"><?= display_str($Torrent['Screenshots'])?></textarea>
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
     </tr>
584
     </tr>
547
   <?php } ?>
585
   <?php } ?>
548
 
586
 
563
           array($this->Disabled)
601
           array($this->Disabled)
564
       );
602
       );
565
       ?><br />
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
     </td>
605
     </td>
568
   </tr>
606
   </tr>
569
   <?php } # Ends if NewTorrent line 499?>
607
   <?php } # Ends if NewTorrent line 499?>
579
           display_str($Torrent['TorrentDescription'] ?? ''),
617
           display_str($Torrent['TorrentDescription'] ?? ''),
580
           60,
618
           60,
581
       ); ?><br />
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
     </td>
621
     </td>
584
   </tr>
622
   </tr>
585
 
623
 

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

168
             'title',
168
             'title',
169
             '0',
169
             '0',
170
             'string',
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
         $Validate->SetFields(
174
         $Validate->SetFields(
175
             'title_rj',
175
             'title_rj',
176
             '0',
176
             '0',
177
             'string',
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
         $Validate->SetFields(
182
         $Validate->SetFields(
183
             'title_jp',
183
             'title_jp',
184
             '0',
184
             '0',
185
             'string',
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
         $Validate->SetFields(
190
         $Validate->SetFields(
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
   $T['FreeTorrent'] = '2';
541
   $T['FreeTorrent'] = '2';
542
   $T['FreeLeechType'] = '2';
542
   $T['FreeLeechType'] = '2';
543
 }
543
 }
544
-*/
545
 
544
 
546
 // Torrent
545
 // Torrent
547
 $DB->query(
546
 $DB->query(

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


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

1
 function DisplayTrans() {
1
 function DisplayTrans() {
2
+  /*
2
   if (['Softsubs','Hardsubs'].indexOf($('select[name="sub"]').raw().value) != -1) {
3
   if (['Softsubs','Hardsubs'].indexOf($('select[name="sub"]').raw().value) != -1) {
3
     $('#subber').raw().parentNode.parentNode.style.display = 'table-row'
4
     $('#subber').raw().parentNode.parentNode.style.display = 'table-row'
4
   } else {
5
   } else {
5
     $('#subber').raw().parentNode.parentNode.style.display = 'none'
6
     $('#subber').raw().parentNode.parentNode.style.display = 'none'
6
   }
7
   }
8
+  */
7
 }
9
 }
8
 
10
 
9
 function Categories() {
11
 function Categories() {
10
-  /*
11
   let def = ['title', 'title_rj', 'title_jp', 'year', 'lang', 'censored', 'tags', 'cover', 'group_desc', 'release_desc', 'anon']
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
   let active = {}
92
   let active = {}
90
   for (let field of def) active[field] = {}
93
   for (let field of def) active[field] = {}
91
   let category = 0
94
   let category = 0
104
 
107
 
105
   let trs = $('#dynamic_form tr')
108
   let trs = $('#dynamic_form tr')
106
   for (let tr of trs) {
109
   for (let tr of trs) {
107
-    let field = tr.id.slice(0,-3)
110
+    let field = tr.id.slice(0, -3)
108
     if (active[field]) {
111
     if (active[field]) {
109
       if (active[field].name) {
112
       if (active[field].name) {
110
         tr.children[0].innerHTML = active[field].name
113
         tr.children[0].innerHTML = active[field].name
111
       }
114
       }
112
       let notes = $(`#${tr.id} p.notes`).raw()
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
       show(tr)
117
       show(tr)
115
     } else {
118
     } else {
116
       hide(tr)
119
       hide(tr)
117
     }
120
     }
118
   }
121
   }
119
-  */
120
 }
122
 }
121
 
123
 
122
 function Bitrate() {
124
 function Bitrate() {
212
   $('#extras').raw().value = FormatCount;
214
   $('#extras').raw().value = FormatCount;
213
 
215
 
214
   var NewRow = document.createElement("tr");
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
   var NewCell1 = document.createElement("td");
220
   var NewCell1 = document.createElement("td");
219
-  NewCell1.setAttribute("class","label");
221
+  NewCell1.setAttribute("class", "label");
220
   NewCell1.innerHTML = "Extra Torrent File";
222
   NewCell1.innerHTML = "Extra Torrent File";
221
 
223
 
222
   var NewCell2 = document.createElement("td");
224
   var NewCell2 = document.createElement("td");
223
   var TorrentField = document.createElement("input");
225
   var TorrentField = document.createElement("input");
224
   TorrentField.type = "file";
226
   TorrentField.type = "file";
225
-  TorrentField.id = "extra_torrent_file"+FormatCount;
227
+  TorrentField.id = "extra_torrent_file" + FormatCount;
226
   TorrentField.name = "extra_torrent_files[]";
228
   TorrentField.name = "extra_torrent_files[]";
227
   TorrentField.size = 50;
229
   TorrentField.size = 50;
228
   NewCell2.appendChild(TorrentField);
230
   NewCell2.appendChild(TorrentField);
231
   NewRow.appendChild(NewCell2);
233
   NewRow.appendChild(NewCell2);
232
 
234
 
233
   NewRow = document.createElement("tr");
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
   NewCell1 = document.createElement("td");
238
   NewCell1 = document.createElement("td");
237
-  NewCell1.setAttribute("class","label");
239
+  NewCell1.setAttribute("class", "label");
238
   NewCell1.innerHTML = "Extra Format / Bitrate";
240
   NewCell1.innerHTML = "Extra Format / Bitrate";
239
 
241
 
240
   NewCell2 = document.createElement("td");
242
   NewCell2 = document.createElement("td");
241
   tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
243
   tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
242
-  var formats=["Saab","Volvo","BMW"];
244
+  var formats = ["Saab", "Volvo", "BMW"];
243
   for (var i in formats) {
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
   tmp += "</select>";
248
   tmp += "</select>";
247
-  var bitrates=["1","2","3"];
249
+  var bitrates = ["1", "2", "3"];
248
   tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
250
   tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
249
   for (var i in bitrates) {
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
   tmp += "</select>";
254
   tmp += "</select>";
253
 
255
 
257
 
259
 
258
 
260
 
259
   NewRow = document.createElement("tr");
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
   NewCell1 = document.createElement("td");
264
   NewCell1 = document.createElement("td");
263
-  NewCell1.setAttribute("class","label");
265
+  NewCell1.setAttribute("class", "label");
264
   NewCell1.innerHTML = "Extra Release Description";
266
   NewCell1.innerHTML = "Extra Release Description";
265
 
267
 
266
   NewCell2 = document.createElement("td");
268
   NewCell2 = document.createElement("td");
276
   }
278
   }
277
   $('#extras').raw().value = FormatCount;
279
   $('#extras').raw().value = FormatCount;
278
 
280
 
279
-  var x = $('#new_torrent_row'+FormatCount).raw();
281
+  var x = $('#new_torrent_row' + FormatCount).raw();
280
   x.parentNode.removeChild(x);
282
   x.parentNode.removeChild(x);
281
 
283
 
282
-  x = $('#new_format_row'+FormatCount).raw();
284
+  x = $('#new_format_row' + FormatCount).raw();
283
   x.parentNode.removeChild(x);
285
   x.parentNode.removeChild(x);
284
 
286
 
285
-  x = $('#new_description_row'+FormatCount).raw();
287
+  x = $('#new_description_row' + FormatCount).raw();
286
   x.parentNode.removeChild(x);
288
   x.parentNode.removeChild(x);
287
 
289
 
288
   FormatCount--;
290
   FormatCount--;
289
 }
291
 }
290
 
292
 
291
-
292
 var ArtistCount = 1;
293
 var ArtistCount = 1;
293
 
294
 
294
 function AddArtistField() {
295
 function AddArtistField() {
310
   x.appendChild(document.createTextNode('\n'));
311
   x.appendChild(document.createTextNode('\n'));
311
 
312
 
312
   if ($("#idol").data("gazelle-autocomplete")) {
313
   if ($("#idol").data("gazelle-autocomplete")) {
313
-    $(ArtistField).live('focus', function() {
314
+    $(ArtistField).live('focus', function () {
314
       $(ArtistField).autocomplete({
315
       $(ArtistField).autocomplete({
315
-        serviceUrl : 'artist.php?action=autocomplete'
316
+        serviceUrl: 'artist.php?action=autocomplete'
316
       });
317
       });
317
     });
318
     });
318
   }
319
   }
345
   var a = document.createElement("a")
346
   var a = document.createElement("a")
346
   a.className = "brackets"
347
   a.className = "brackets"
347
   a.innerHTML = "−"
348
   a.innerHTML = "−"
348
-  a.onclick = function(){RemoveScreenshotField(this)}
349
+  a.onclick = function () { RemoveScreenshotField(this) }
349
 
350
 
350
   var x = $('#screenshots').raw()
351
   var x = $('#screenshots').raw()
351
   var y = document.createElement("div")
352
   var y = document.createElement("div")
359
   el.parentElement.remove()
360
   el.parentElement.remove()
360
 }
361
 }
361
 
362
 
362
-function CheckVA () {
363
+function CheckVA() {
363
   if ($('#artist').raw().value.toLowerCase().trim().match(/^(va|various(\sa|a)rtis(t|ts)|various)$/)) {
364
   if ($('#artist').raw().value.toLowerCase().trim().match(/^(va|various(\sa|a)rtis(t|ts)|various)$/)) {
364
     $('#vawarning').gshow();
365
     $('#vawarning').gshow();
365
   } else {
366
   } else {
416
 }
417
 }
417
 
418
 
418
 function AnimeAutofill() {
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
   var aid = $('#anidb').raw().value
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
     if (data.status != "success") return
430
     if (data.status != "success") return
428
     for (i in data.response) {
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
 function JavAutofill() {
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
   var cn = $('#javdb_tr #catalogue').raw().value.toUpperCase()
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
     if (data.status != "success") {
453
     if (data.status != "success") {
449
       $('#catalogue').raw().value = 'Failed'
454
       $('#catalogue').raw().value = 'Failed'
450
       return
455
       return
455
       if (Array.isArray(data.response[i])) {
460
       if (Array.isArray(data.response[i])) {
456
         for (j in data.response[i]) {
461
         for (j in data.response[i]) {
457
           if (i == 'idols') {
462
           if (i == 'idols') {
458
-            if (!($('#'+map[i]+'_'+j).raw())) {
463
+            if (!($('#' + map[i] + '_' + j).raw())) {
459
               AddArtistField()
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
     if (data.response.screens.length) {
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
 function MangaAutofill() {
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
   var nh = $('#ehentai_tr #catalogue').raw().value
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
     if (data.status != "success") {
498
     if (data.status != "success") {
492
       $('#catalogue').raw().value = 'Failed'
499
       $('#catalogue').raw().value = 'Failed'
493
       return
500
       return
496
       if (Array.isArray(data.response[i])) {
503
       if (Array.isArray(data.response[i])) {
497
         for (j in data.response[i]) {
504
         for (j in data.response[i]) {
498
           if (i == 'artists') {
505
           if (i == 'artists') {
499
-            if (!($('#'+map[i]+'_'+j).raw())) {
506
+            if (!($('#' + map[i] + '_' + j).raw())) {
500
               AddArtistField()
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
 function MediaInfoExtract() {
534
 function MediaInfoExtract() {
528
   const mi = $('#mediainfo').raw().value
535
   const mi = $('#mediainfo').raw().value
529
   function getval(mi, key) {
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
     return (match && match[1]) ? match[1] : false
538
     return (match && match[1]) ? match[1] : false
532
   }
539
   }
533
   ['container', 'codec', 'resolution', 'audioformat', 'lang'].forEach((sel) => {
540
   ['container', 'codec', 'resolution', 'audioformat', 'lang'].forEach((sel) => {
546
       else if (width == '3840') { ressel.value = '4K' }
553
       else if (width == '3840') { ressel.value = '4K' }
547
       else {
554
       else {
548
         ressel.value = 'Other'
555
         ressel.value = 'Other'
549
-        $('[name=resolution]').raw().value = width+'x'+height
556
+        $('[name=resolution]').raw().value = width + 'x' + height
550
       }
557
       }
551
     } else if (sel == 'lang') {
558
     } else if (sel == 'lang') {
552
       var val1 = getval(mi.slice(mi.search(/^Audio$/m)), 'Language')
559
       var val1 = getval(mi.slice(mi.search(/^Audio$/m)), 'Language')
553
       var val2 = getval(mi.slice(mi.search(/^Audio\nID.*[^1]/m)), 'Language')
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
       if (val) { $('[name=lang]').raw().value = val }
562
       if (val) { $('[name=lang]').raw().value = val }
556
     } else if (sel == 'container') {
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
       var cont = getval(mi, 'Format')
565
       var cont = getval(mi, 'Format')
559
       if (containerTable[cont]) { $('[name=container]').raw().value = containerTable[cont] }
566
       if (containerTable[cont]) { $('[name=container]').raw().value = containerTable[cont] }
560
     } else if (sel == 'codec') {
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
       var codec = getval(mi.slice(mi.search(/^Video$/m)), 'Format')
569
       var codec = getval(mi.slice(mi.search(/^Video$/m)), 'Format')
563
       var formatProfile = getval(mi.slice(mi.search(/^Video$/m)), 'Format profile')
570
       var formatProfile = getval(mi.slice(mi.search(/^Video$/m)), 'Format profile')
564
       var codecID = getval(mi, 'Codec ID')
571
       var codecID = getval(mi, 'Codec ID')
577
 }
584
 }
578
 
585
 
579
 function initAutofill() {
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
   Categories();
595
   Categories();
589
   initAutofill();
596
   initAutofill();
590
   $(document).on('click', '.add_artist_button', AddArtistField);
597
   $(document).on('click', '.add_artist_button', AddArtistField);

Loading…
Cancel
Save