Browse Source

Fix some javascript

spaghetti 8 years ago
parent
commit
f8c6bd618d
2 changed files with 6 additions and 3 deletions
  1. 1
    1
      static/functions/global.js
  2. 5
    2
      static/functions/upload.js

+ 1
- 1
static/functions/global.js View File

@@ -84,7 +84,7 @@ var lightbox = {
84 84
 window.onkeydown = function(e) {
85 85
   e = e || window.event
86 86
   if (e.keyCode == 37 || e.keyCode == 39) {
87
-    if ($('#lightbox') && !$('#lightbox').raw().classList.contains('hidden')) {
87
+    if ($('#lightbox').raw() && !$('#lightbox').raw().classList.contains('hidden')) {
88 88
       ($('[id!="lightbox"] > [src="'+$('#lightbox > img').raw().src+'"]').raw()[((e.keyCode==39)?'next':'previous')+'Sibling'].onclick||function(){})()
89 89
     }
90 90
   }

+ 5
- 2
static/functions/upload.js View File

@@ -46,6 +46,7 @@ function Categories() {
46 46
       $('#resolution').gshow()
47 47
     }
48 48
     initAutocomplete()
49
+    initAutofill()
49 50
   });
50 51
 }
51 52
 
@@ -501,10 +502,12 @@ function MediaInfoExtract() {
501 502
   })
502 503
 }
503 504
 
504
-$(function() {
505
+function initAutofill() {
505 506
   document.querySelectorAll('[autofill]').forEach(function(el) {
506 507
     el.addEventListener('click', function(event) {
507 508
       ({'douj':DoujAutofill, 'anime':AnidbAutofill, 'jav':JavAutofill})[el.attributes['autofill'].value]()
508 509
     })
509 510
   })
510
-})
511
+}
512
+
513
+$(initAutofill)

Loading…
Cancel
Save