pjc 5 years ago
parent
commit
715aebc2a6

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

380
         if (!empty($Torrent['Artists'])) {
380
         if (!empty($Torrent['Artists'])) {
381
             foreach ($Torrent['Artists'] as $Num => $Artist) {
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
         size="45"
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
       <?php if ($Num === 0) { ?>
387
       <?php if ($Num === 0) { ?>
388
       <a class="add_artist_button brackets">+</a>
388
       <a class="add_artist_button brackets">+</a>
389
       <a class="remove_artist_button brackets">&minus;</a>
389
       <a class="remove_artist_button brackets">&minus;</a>
392
             }
392
             }
393
         } else {
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
       <a class="add_artist_button brackets">+</a>
396
       <a class="add_artist_button brackets">+</a>
397
       <a class="remove_artist_button brackets">&minus;</a>
397
       <a class="remove_artist_button brackets">&minus;</a>
398
       <?php
398
       <?php
564
     </td>
564
     </td>
565
   </tr>
565
   </tr>
566
 
566
 
567
-    <!-- 4 -->
568
-    <tr id="container_extra_tr">
567
+  <!-- 4 -->
568
+  <tr id="container_extra_tr">
569
     <td class="label">
569
     <td class="label">
570
       Format
570
       Format
571
       <strong class="important_text">*</strong>
571
       <strong class="important_text">*</strong>
606
     </td>
606
     </td>
607
   </tr>
607
   </tr>
608
 
608
 
609
-    <!-- Resolution -->
610
-    <tr id="resolution_tr">
609
+  <!-- Resolution -->
610
+  <tr id="resolution_tr">
611
     <td class="label">
611
     <td class="label">
612
       Assembly Level
612
       Assembly Level
613
       <strong class="important_text">*</strong>
613
       <strong class="important_text">*</strong>
695
     <td>
695
     <td>
696
       <textarea rows="1" cols="60" name="mirrors"
696
       <textarea rows="1" cols="60" name="mirrors"
697
         id="mirrors"><?= display_str($Torrent['Mirrors'])?></textarea>
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
   </tr>
701
   </tr>
701
   <?php } ?>
702
   <?php } ?>
702
-  
703
+
703
   <!-- Sample pictures/links -->
704
   <!-- Sample pictures/links -->
704
   <?php if (!$this->DisabledFlag && $this->NewTorrent) { ?>
705
   <?php if (!$this->DisabledFlag && $this->NewTorrent) { ?>
705
   <tr id="screenshots_tr">
706
   <tr id="screenshots_tr">

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

192
     {
192
     {
193
         # Make $Tor->file_list() output manageable
193
         # Make $Tor->file_list() output manageable
194
         $UnNested = array_values($FileList[1]);
194
         $UnNested = array_values($FileList[1]);
195
-        /*
196
         $Sorted = usort($UnNested, function ($a, $b) {
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
         $Result = [];
199
         $Result = [];
202
 
200
 
203
         print_r('<pre>');
201
         print_r('<pre>');
204
-        var_dump($TopTen);
202
+        var_dump($Sorted);
205
         print_r('</pre>');
203
         print_r('</pre>');
206
 
204
 
207
 
205
 

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

200
               <!--Artist name:-->
200
               <!--Artist name:-->
201
             </td>
201
             </td>
202
             <td class="ft_artistname">
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
             </td>
207
             </td>
207
           </tr>
208
           </tr>
208
 
209
 

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

196
 ?>
196
 ?>
197
           </td>
197
           </td>
198
           <td id="idolfields">
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
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
202
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
202
             <?php
203
             <?php
203
   for ($i = 1; $i < count($Artists); $i++) {
204
   for ($i = 1; $i < count($Artists); $i++) {

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

598
         }
598
         }
599
     }
599
     }
600
 
600
 
601
-# Main if/else
601
+    # Main if/else
602
 } else {
602
 } else {
603
     $DB->query("
603
     $DB->query("
604
     UPDATE torrents_group
604
     UPDATE torrents_group

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

5
 
5
 
6
 function initAutocomplete() {
6
 function initAutocomplete() {
7
   if (!$.Autocomplete) {
7
   if (!$.Autocomplete) {
8
-    window.setTimeout(function() {
8
+    window.setTimeout(function () {
9
       initAutocomplete();
9
       initAutocomplete();
10
     }, 500)
10
     }, 500)
11
     return;
11
     return;
13
 
13
 
14
   var url = {
14
   var url = {
15
     path: window.location.pathname.split('/').reverse()[0].split(".")[0],
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
   $('#artistsearch' + SELECTOR).autocomplete({
19
   $('#artistsearch' + SELECTOR).autocomplete({
20
     deferRequestBy: 300,
20
     deferRequestBy: 300,
21
-    onSelect : function(suggestion) {
21
+    onSelect: function (suggestion) {
22
       window.location = 'artist.php?id=' + suggestion['data'];
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
     $("#artist" + SELECTOR).autocomplete({
28
     $("#artist" + SELECTOR).autocomplete({
29
       deferRequestBy: 300,
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
   if (url.path == 'torrents' || url.path == 'upload' || url.path == 'collages' || url.path == 'requests' || url.path == 'top10' || (url.path == 'requests' && url.query['action'] == 'new')) {
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
     $("#tags" + SELECTOR).autocomplete({
34
     $("#tags" + SELECTOR).autocomplete({
39
       deferRequestBy: 300,
35
       deferRequestBy: 300,
40
       delimiter: ',',
36
       delimiter: ',',
41
-      serviceUrl : TAGS_AUTOCOMPLETE_URL
37
+      serviceUrl: TAGS_AUTOCOMPLETE_URL
42
     });
38
     });
43
     $("#tagname" + SELECTOR).autocomplete({
39
     $("#tagname" + SELECTOR).autocomplete({
44
       deferRequestBy: 300,
40
       deferRequestBy: 300,
45
       delimiter: ',',
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
   x.appendChild(document.createElement("br"));
95
   x.appendChild(document.createElement("br"));
96
   x.appendChild(ArtistField);
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
       $(ArtistField).autocomplete({
100
       $(ArtistField).autocomplete({
101
-        serviceUrl: 'artist.php?action=autocomplete'
101
+        deferRequestBy: 300,
102
+        serviceUrl: ARTIST_AUTOCOMPLETE_URL
102
       });
103
       });
103
     });
104
     });
104
   }
105
   }
117
     x.removeChild(x.lastChild);
118
     x.removeChild(x.lastChild);
118
   }
119
   }
119
   x.removeChild(x.lastChild);
120
   x.removeChild(x.lastChild);
120
-  x.removeChild(x.lastChild); // Remove trailing new line.
121
+  x.removeChild(x.lastChild); //Remove trailing new line.
121
   ArtistCount--;
122
   ArtistCount--;
122
 }
123
 }
123
 
124
 
124
 function Categories() {
125
 function Categories() {
125
-  /*
126
   var cat = $('#categories').raw() ? $('#categories').raw().options[$('#categories').raw().selectedIndex].value : '';
126
   var cat = $('#categories').raw() ? $('#categories').raw().options[$('#categories').raw().selectedIndex].value : '';
127
   if (cat == "Movies") {
127
   if (cat == "Movies") {
128
     $('#artist_tr').gshow();
128
     $('#artist_tr').gshow();
149
     $('#cataloguenumber_tr').ghide();
149
     $('#cataloguenumber_tr').ghide();
150
     $('#dlsiteid_tr').ghide();
150
     $('#dlsiteid_tr').ghide();
151
   }
151
   }
152
-  */
153
 }
152
 }
154
 
153
 
155
 function add_tag() {
154
 function add_tag() {

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

10
 
10
 
11
 function Categories() {
11
 function Categories() {
12
   let def = [
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
   let cats = [
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
   let active = {}
60
   let active = {}
65
   active = Object.assign(active, cats[category])
65
   active = Object.assign(active, cats[category])
66
 
66
 
67
   let hide = el => {
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
   let show = el => {
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
   let trs = $('#dynamic_form tr')
77
   let trs = $('#dynamic_form tr')
78
   for (let tr of trs) {
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
   x.appendChild(ArtistField);
283
   x.appendChild(ArtistField);
284
   x.appendChild(document.createTextNode('\n'));
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
       $(ArtistField).autocomplete({
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