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

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

139
           <td>
139
           <td>
140
             <input type="text" id="catalogue" name="cataloguenumber" size="15" value="<?=(isset($CatalogueNumber)?$CatalogueNumber:'') ?>" <?=$Disabled?>/>
140
             <input type="text" id="catalogue" name="cataloguenumber" size="15" value="<?=(isset($CatalogueNumber)?$CatalogueNumber:'') ?>" <?=$Disabled?>/>
141
 <? if (empty($Disabled)) { ?>
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
           </td>
144
           </td>
145
         </tr>
145
         </tr>

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

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
     }
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