pjc 5 years ago
parent
commit
715aebc2a6

+ 12
- 11
classes/torrent_form.class.php View File

@@ -380,10 +380,10 @@ class TorrentForm
380 380
         if (!empty($Torrent['Artists'])) {
381 381
             foreach ($Torrent['Artists'] as $Num => $Artist) {
382 382
                 ?>
383
-      <input type="text" id="idols_<?= $Num ?>" name="idols[]"
383
+      <input type="text" id="idols_<?=$Num?>" name="idols[]"
384 384
         size="45"
385
-        value="<?= display_str($Artist['name']) ?>"
386
-        <?= $this->Disabled ?>/>
385
+        value="<?=display_str($Artist['name'])?>"
386
+        <?=$this->Disabled?><?php Users::has_autocomplete_enabled('other'); ?>/>
387 387
       <?php if ($Num === 0) { ?>
388 388
       <a class="add_artist_button brackets">+</a>
389 389
       <a class="remove_artist_button brackets">&minus;</a>
@@ -392,7 +392,7 @@ class TorrentForm
392 392
             }
393 393
         } else {
394 394
             ?>
395
-      <input type="text" id="idols_0" name="idols[]" size="45" value="" <?= $this->Disabled ?> />
395
+      <input type="text" id="idols_0" name="idols[]" size="45" value="" <?=$this->Disabled?><?php Users::has_autocomplete_enabled('other'); ?>/>
396 396
       <a class="add_artist_button brackets">+</a>
397 397
       <a class="remove_artist_button brackets">&minus;</a>
398 398
       <?php
@@ -564,8 +564,8 @@ class TorrentForm
564 564
     </td>
565 565
   </tr>
566 566
 
567
-    <!-- 4 -->
568
-    <tr id="container_extra_tr">
567
+  <!-- 4 -->
568
+  <tr id="container_extra_tr">
569 569
     <td class="label">
570 570
       Format
571 571
       <strong class="important_text">*</strong>
@@ -606,8 +606,8 @@ class TorrentForm
606 606
     </td>
607 607
   </tr>
608 608
 
609
-    <!-- Resolution -->
610
-    <tr id="resolution_tr">
609
+  <!-- Resolution -->
610
+  <tr id="resolution_tr">
611 611
     <td class="label">
612 612
       Assembly Level
613 613
       <strong class="important_text">*</strong>
@@ -695,11 +695,12 @@ class TorrentForm
695 695
     <td>
696 696
       <textarea rows="1" cols="60" name="mirrors"
697 697
         id="mirrors"><?= display_str($Torrent['Mirrors'])?></textarea>
698
-        <strong class="important_text">Experimental.</strong>
699
-      Up to two FTP/HTTP addresses that either point directly to a file, or for multi-file torrents, to the enclosing folder
698
+      <strong class="important_text">Experimental.</strong>
699
+      Up to two FTP/HTTP addresses that either point directly to a file, or for multi-file torrents, to the enclosing
700
+      folder
700 701
   </tr>
701 702
   <?php } ?>
702
-  
703
+
703 704
   <!-- Sample pictures/links -->
704 705
   <?php if (!$this->DisabledFlag && $this->NewTorrent) { ?>
705 706
   <tr id="screenshots_tr">

+ 3
- 5
classes/validate.class.php View File

@@ -192,16 +192,14 @@ class Validate
192 192
     {
193 193
         # Make $Tor->file_list() output manageable
194 194
         $UnNested = array_values($FileList[1]);
195
-        /*
196 195
         $Sorted = usort($UnNested, function ($a, $b) {
197
-            return $b[0] <=> $a[0];
196
+            return $b[0] > $a[0];
198 197
         });
199
-        */
200
-        $TopTen = array_slice($UnNested, 0, 10); # Good
198
+        $TopTen = array_slice($Sorted, 0, 10); # Good
201 199
         $Result = [];
202 200
 
203 201
         print_r('<pre>');
204
-        var_dump($TopTen);
202
+        var_dump($Sorted);
205 203
         print_r('</pre>');
206 204
 
207 205
 

+ 4
- 3
sections/torrents/browse.php View File

@@ -200,9 +200,10 @@ View::show_header('Browse Torrents', 'browse');
200 200
               <!--Artist name:-->
201 201
             </td>
202 202
             <td class="ft_artistname">
203
-              <input type="search" spellcheck="false" size="65" name="artistname" class="inputtext smaller fti_advanced"
204
-                placeholder="Author Name"
205
-                value="<?Format::form('artistname')?>" />
203
+              <input type="search" spellcheck="false" size="65" id="artist" name="artistname"
204
+                class="inputtext smaller fti_advanced" placeholder="Author Name"
205
+                value="<?Format::form('artistname')?>"
206
+                <?php Users::has_autocomplete_enabled('other'); ?>/>
206 207
             </td>
207 208
           </tr>
208 209
 

+ 3
- 2
sections/torrents/editgroup.php View File

@@ -196,8 +196,9 @@ if ($CategoryID == 1) {
196 196
 ?>
197 197
           </td>
198 198
           <td id="idolfields">
199
-            <input type="text" id="idol_0" name="idols[]" size="45"
200
-              value="<?=$Artists[0]['name']?>" />
199
+            <input type="text" id="idols_0" name="idols[]" size="45"
200
+              value="<?=$Artists[0]['name']?>"
201
+              <?php Users::has_autocomplete_enabled('other'); ?>/>
201 202
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
202 203
             <?php
203 204
   for ($i = 1; $i < count($Artists); $i++) {

+ 1
- 1
sections/upload/upload_handle.php View File

@@ -598,7 +598,7 @@ if (!isset($GroupID) || !$GroupID) {
598 598
         }
599 599
     }
600 600
 
601
-# Main if/else
601
+    # Main if/else
602 602
 } else {
603 603
     $DB->query("
604 604
     UPDATE torrents_group

+ 20
- 12
static/functions/autocomplete.js View File

@@ -5,7 +5,7 @@ $(document).ready(initAutocomplete)
5 5
 
6 6
 function initAutocomplete() {
7 7
   if (!$.Autocomplete) {
8
-    window.setTimeout(function() {
8
+    window.setTimeout(function () {
9 9
       initAutocomplete();
10 10
     }, 500)
11 11
     return;
@@ -13,37 +13,45 @@ function initAutocomplete() {
13 13
 
14 14
   var url = {
15 15
     path: window.location.pathname.split('/').reverse()[0].split(".")[0],
16
-    query: window.location.search.slice(1).split('&').reduce((a,b)=>Object.assign(a,{[b.split('=')[0]]:b.split('=')[1]}),{})
16
+    query: window.location.search.slice(1).split('&').reduce((a, b) => Object.assign(a, { [b.split('=')[0]]: b.split('=')[1] }), {})
17 17
   }
18 18
 
19 19
   $('#artistsearch' + SELECTOR).autocomplete({
20 20
     deferRequestBy: 300,
21
-    onSelect : function(suggestion) {
21
+    onSelect: function (suggestion) {
22 22
       window.location = 'artist.php?id=' + suggestion['data'];
23 23
     },
24
-    serviceUrl : ARTIST_AUTOCOMPLETE_URL,
24
+    serviceUrl: ARTIST_AUTOCOMPLETE_URL,
25 25
   });
26 26
 
27
-  if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new') || url.path == 'collages') {
27
+  if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new')) {
28 28
     $("#artist" + SELECTOR).autocomplete({
29 29
       deferRequestBy: 300,
30
-      serviceUrl : ARTIST_AUTOCOMPLETE_URL
31
-    });
32
-    $("#artistsimilar" + SELECTOR).autocomplete({
33
-      deferRequestBy: 300,
34
-      serviceUrl : ARTIST_AUTOCOMPLETE_URL
30
+      serviceUrl: ARTIST_AUTOCOMPLETE_URL
35 31
     });
36 32
   }
37 33
   if (url.path == 'torrents' || url.path == 'upload' || url.path == 'collages' || url.path == 'requests' || url.path == 'top10' || (url.path == 'requests' && url.query['action'] == 'new')) {
38 34
     $("#tags" + SELECTOR).autocomplete({
39 35
       deferRequestBy: 300,
40 36
       delimiter: ',',
41
-      serviceUrl : TAGS_AUTOCOMPLETE_URL
37
+      serviceUrl: TAGS_AUTOCOMPLETE_URL
42 38
     });
43 39
     $("#tagname" + SELECTOR).autocomplete({
44 40
       deferRequestBy: 300,
45 41
       delimiter: ',',
46
-      serviceUrl : TAGS_AUTOCOMPLETE_URL
42
+      serviceUrl: TAGS_AUTOCOMPLETE_URL
43
+    });
44
+  }
45
+  if (url.path == 'upload' || (url.path == 'torrents' && url.query['action'] == 'editgroup')) {
46
+    $("#idols_0" + SELECTOR).autocomplete({
47
+      deferRequestBy: 300,
48
+      serviceUrl: ARTIST_AUTOCOMPLETE_URL
49
+    });
50
+  }
51
+  if (url.path == 'requests' && url.query['action'] == 'new') {
52
+    $("#artist_0" + SELECTOR).autocomplete({
53
+      deferRequestBy: 300,
54
+      serviceUrl: ARTIST_AUTOCOMPLETE_URL
47 55
     });
48 56
   }
49 57
 

+ 5
- 6
static/functions/requests.js View File

@@ -95,10 +95,11 @@ function AddArtistField() {
95 95
   x.appendChild(document.createElement("br"));
96 96
   x.appendChild(ArtistField);
97 97
 
98
-  if ($("#artist").data("gazelle-autocomplete")) {
99
-    $(ArtistField).live('focus', function () {
98
+  if ($("#artist_0").data("gazelle-autocomplete")) {
99
+    $(ArtistField).on('focus', function () {
100 100
       $(ArtistField).autocomplete({
101
-        serviceUrl: 'artist.php?action=autocomplete'
101
+        deferRequestBy: 300,
102
+        serviceUrl: ARTIST_AUTOCOMPLETE_URL
102 103
       });
103 104
     });
104 105
   }
@@ -117,12 +118,11 @@ function RemoveArtistField() {
117 118
     x.removeChild(x.lastChild);
118 119
   }
119 120
   x.removeChild(x.lastChild);
120
-  x.removeChild(x.lastChild); // Remove trailing new line.
121
+  x.removeChild(x.lastChild); //Remove trailing new line.
121 122
   ArtistCount--;
122 123
 }
123 124
 
124 125
 function Categories() {
125
-  /*
126 126
   var cat = $('#categories').raw() ? $('#categories').raw().options[$('#categories').raw().selectedIndex].value : '';
127 127
   if (cat == "Movies") {
128 128
     $('#artist_tr').gshow();
@@ -149,7 +149,6 @@ function Categories() {
149 149
     $('#cataloguenumber_tr').ghide();
150 150
     $('#dlsiteid_tr').ghide();
151 151
   }
152
-  */
153 152
 }
154 153
 
155 154
 function add_tag() {

+ 60
- 59
static/functions/upload.js View File

@@ -10,51 +10,51 @@ function DisplayTrans() {
10 10
 
11 11
 function Categories() {
12 12
   let def = [
13
-      'javdb', // Accession Number
14
-      'audio', // Version
15
-      'title', // Torrent Title
16
-      'title_rj', // Organism
17
-      'title_jp', // Strain/Variety
18
-      'idols', // Authors(s)
19
-      'studio', // Department/Lab
20
-      'series', // Location
21
-      'year', // Year
22
-      'codec', // License
23
-      // Platform changes below
24
-      'resolution', // Assembly Level
25
-      // Format changes below
26
-      'archive', // Archive
27
-      'tags', // Tags
28
-      'cover', // Picture
29
-      'mirrors', // Mirrors
30
-      'screenshots', // Publications
31
-      'group_desc', // Torrent Group Description
32
-      'release_desc', // Torrent Description
33
-      'censored', // Aligned/Annotated
34
-      'anon', // Upload Anonymously
13
+    'javdb', // Accession Number
14
+    'audio', // Version
15
+    'title', // Torrent Title
16
+    'title_rj', // Organism
17
+    'title_jp', // Strain/Variety
18
+    'idols', // Authors(s)
19
+    'studio', // Department/Lab
20
+    'series', // Location
21
+    'year', // Year
22
+    'codec', // License
23
+    // Platform changes below
24
+    'resolution', // Assembly Level
25
+    // Format changes below
26
+    'archive', // Archive
27
+    'tags', // Tags
28
+    'cover', // Picture
29
+    'mirrors', // Mirrors
30
+    'screenshots', // Publications
31
+    'group_desc', // Torrent Group Description
32
+    'release_desc', // Torrent Description
33
+    'censored', // Aligned/Annotated
34
+    'anon', // Upload Anonymously
35 35
   ]
36 36
 
37 37
   let cats = [
38
-      { // DNA
39
-          'media': {}, // Platform
40
-          'container': {}, // Format
41
-      },
42
-      { // RNA
43
-          'media': {}, // Platform
44
-          'container': {}, // Format
45
-      },
46
-      { // Proteins
47
-          'media': {}, // Platform
48
-          'container_prot': {}, // Format
49
-      },
50
-      { // Imaging
51
-          'media_manga': {}, // Platform
52
-          'container_games': {}, // Format
53
-      },
54
-      { // Extras
55
-          'media': {}, // Platform
56
-          'container_extra': {}, // Format
57
-      }
38
+    { // DNA
39
+      'media': {}, // Platform
40
+      'container': {}, // Format
41
+    },
42
+    { // RNA
43
+      'media': {}, // Platform
44
+      'container': {}, // Format
45
+    },
46
+    { // Proteins
47
+      'media': {}, // Platform
48
+      'container_prot': {}, // Format
49
+    },
50
+    { // Imaging
51
+      'media_manga': {}, // Platform
52
+      'container_games': {}, // Format
53
+    },
54
+    { // Extras
55
+      'media': {}, // Platform
56
+      'container_extra': {}, // Format
57
+    }
58 58
   ]
59 59
 
60 60
   let active = {}
@@ -65,28 +65,28 @@ function Categories() {
65 65
   active = Object.assign(active, cats[category])
66 66
 
67 67
   let hide = el => {
68
-      Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = true)
69
-      $(el).ghide()
68
+    Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = true)
69
+    $(el).ghide()
70 70
   }
71 71
 
72 72
   let show = el => {
73
-      Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = false)
74
-      $(el).gshow()
73
+    Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = false)
74
+    $(el).gshow()
75 75
   }
76 76
 
77 77
   let trs = $('#dynamic_form tr')
78 78
   for (let tr of trs) {
79
-      let field = tr.id.slice(0, -3)
80
-      if (active[field]) {
81
-          if (active[field].name) {
82
-              tr.children[0].innerHTML = active[field].name
83
-          }
84
-          let notes = $(`#${tr.id} p.notes`).raw()
85
-          if (notes) notes.innerHTML = active[field].notes || ''
86
-          show(tr)
87
-      } else {
88
-          hide(tr)
79
+    let field = tr.id.slice(0, -3)
80
+    if (active[field]) {
81
+      if (active[field].name) {
82
+        tr.children[0].innerHTML = active[field].name
89 83
       }
84
+      let notes = $(`#${tr.id} p.notes`).raw()
85
+      if (notes) notes.innerHTML = active[field].notes || ''
86
+      show(tr)
87
+    } else {
88
+      hide(tr)
89
+    }
90 90
   }
91 91
 }
92 92
 
@@ -283,10 +283,11 @@ function AddArtistField() {
283 283
   x.appendChild(ArtistField);
284 284
   x.appendChild(document.createTextNode('\n'));
285 285
 
286
-  if ($("#idol").data("gazelle-autocomplete")) {
287
-    $(ArtistField).live('focus', function () {
286
+  if ($("#idols_0").data("gazelle-autocomplete")) {
287
+    $(ArtistField).on('focus', function () {
288 288
       $(ArtistField).autocomplete({
289
-        serviceUrl: 'artist.php?action=autocomplete'
289
+        deferRequestBy: 300,
290
+        serviceUrl: ARTIST_AUTOCOMPLETE_URL
290 291
       });
291 292
     });
292 293
   }

Loading…
Cancel
Save