Browse Source

Fix request JS

spaghetti 8 years ago
parent
commit
eec31b22c2
2 changed files with 3 additions and 3 deletions
  1. 0
    2
      sections/requests/new_edit.php
  2. 3
    1
      static/functions/requests.js

+ 0
- 2
sections/requests/new_edit.php View File

@@ -303,8 +303,6 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'reques
303 303
 <?  } ?>
304 304
       </table>
305 305
     </form>
306
-    <script type="text/javascript"><?=$NewRequest ? " Calculate();" : '' ?></script>
307
-    <script type="text/javascript">Categories();</script>
308 306
   </div>
309 307
 </div>
310 308
 <?

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

@@ -55,6 +55,7 @@ function Vote(amount, requestid) {
55 55
 }
56 56
 
57 57
 function Calculate() {
58
+  if (!$('#unit').raw()) { return; }
58 59
   var mul = (($('#unit').raw().options[$('#unit').raw().selectedIndex].value == 'mb') ? (1024*1024) : (1024*1024*1024));
59 60
   var amt = Math.floor($('#amount_box').raw().value * mul);
60 61
   if (amt > $('#current_uploaded').raw().value) {
@@ -232,9 +233,10 @@ function JavAutofill() {
232 233
 
233 234
 $(function() {
234 235
   Categories()
236
+  Calculate()
235 237
   document.querySelectorAll('[autofill]').forEach(function(el) {
236 238
     el.addEventListener('click', function(event) {
237
-      ({'douj':DoujAutofill, 'anime':AnidbAutofill, 'jav':JavAutofill})[el.attributes['autofill'].value]()
239
+      ({'jav':JavAutofill})[el.attributes['autofill'].value]()
238 240
     })
239 241
   })
240 242
 })

Loading…
Cancel
Save