Browse Source

Do autofill in upload.js instead of onclicks

spaghetti 8 years ago
parent
commit
f86e3e2b19

+ 3
- 3
classes/torrent_form.class.php View File

@@ -205,7 +205,7 @@ class TORRENT_FORM {
205 205
         <td>
206 206
           <input type="text" id="catalogue" name="catalogue" size="10" value="<?=display_str($Torrent['CatalogueNumber']) ?>" <?=$this->Disabled?>/>
207 207
 <? if (!$this->DisabledFlag) { ?>
208
-          <input type="button" onclick="JavAutofill()" value="Autofill"></input>
208
+          <input type="button" autofill="jav" value="Autofill"></input>
209 209
 <? } ?>
210 210
         </td>
211 211
       </tr>
@@ -463,7 +463,7 @@ class TORRENT_FORM {
463 463
         <td>
464 464
           <input type="text" id="anidb" size="10" <?=$this->Disabled?>/>
465 465
 <? if (!$this->DisabledFlag) { ?>
466
-          <input type="button" onclick="AnidbAutofill()" value="Autofill"/>
466
+          <input type="button" autofill="anime" value="Autofill"/>
467 467
 <? } ?>
468 468
         </td>
469 469
       </tr>
@@ -712,7 +712,7 @@ class TORRENT_FORM {
712 712
         <td>
713 713
           <input type="text" id="catalogue" size="50" <?=$this->Disabled?> />
714 714
 <? if (!$this->DisabledFlag) { ?>
715
-          <input type="button" onclick="DoujAutofill()" value="Autofill"/>
715
+          <input type="button" autofill="douj" value="Autofill"/>
716 716
 <? } ?>
717 717
         </td>
718 718
       </tr>

+ 1
- 1
sections/requests/new_edit.php View File

@@ -139,7 +139,7 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'reques
139 139
           <td>
140 140
             <input type="text" id="catalogue" name="cataloguenumber" size="15" value="<?=(isset($CatalogueNumber)?$CatalogueNumber:'') ?>" <?=$Disabled?>/>
141 141
 <? if (empty($Disabled)) { ?>
142
-            ( <input type="button" onclick="JavAutofill()" value="Autofill" style="font-size:0.8em;"></input> )
142
+            ( <input type="button" autofill="jav" value="Autofill" style="font-size:0.8em;"></input> )
143 143
 <? } ?>
144 144
           </td>
145 145
         </tr>

+ 8
- 1
static/functions/requests.js View File

@@ -230,4 +230,11 @@ function JavAutofill() {
230 230
   })
231 231
 }
232 232
 
233
-$(document).ready(function() { Categories(); });
233
+$(function() {
234
+  Categories()
235
+  document.querySelectorAll('[autofill]').forEach(function(el) {
236
+    el.addEventListener('click', function(event) {
237
+      ({'douj':DoujAutofill, 'anime':AnidbAutofill, 'jav':JavAutofill})[el.attributes['autofill'].value]()
238
+    })
239
+  })
240
+})

+ 8
- 0
static/functions/upload.js View File

@@ -500,3 +500,11 @@ function MediaInfoExtract() {
500 500
     }
501 501
   })
502 502
 }
503
+
504
+$(function() {
505
+  document.querySelectorAll('[autofill]').forEach(function(el) {
506
+    el.addEventListener('click', function(event) {
507
+      ({'douj':DoujAutofill, 'anime':AnidbAutofill, 'jav':JavAutofill})[el.attributes['autofill'].value]()
508
+    })
509
+  })
510
+})

Loading…
Cancel
Save