Browse Source

Do QuoteJump in comments.js instead of onclicks

spaghetti 8 years ago
parent
commit
a2914ff6ae
3 changed files with 23 additions and 17 deletions
  1. 1
    1
      classes/text.class.php
  2. 21
    15
      static/functions/comments.js
  3. 1
    1
      static/styles/global.css

+ 1
- 1
classes/text.class.php View File

827
             if (isset($Exploded[1]) && (is_numeric($Exploded[1]) || (in_array($Exploded[1][0], array('a', 't', 'c', 'r')) && is_numeric(substr($Exploded[1], 1))))) {
827
             if (isset($Exploded[1]) && (is_numeric($Exploded[1]) || (in_array($Exploded[1][0], array('a', 't', 'c', 'r')) && is_numeric(substr($Exploded[1], 1))))) {
828
               // the part after | is either a number or starts with a, t, c or r, followed by a number (forum post, artist comment, torrent comment, collage comment or request comment, respectively)
828
               // the part after | is either a number or starts with a, t, c or r, followed by a number (forum post, artist comment, torrent comment, collage comment or request comment, respectively)
829
               $PostID = trim($Exploded[1]);
829
               $PostID = trim($Exploded[1]);
830
-              $Str .= '<a href="#" onclick="QuoteJump(event, \''.$PostID.'\'); return false;"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
830
+              $Str .= '<a quote-jump="'.$PostID.'"><strong class="quoteheader">'.$Exploded[0].'</strong> wrote: </a>';
831
             }
831
             }
832
             else {
832
             else {
833
               $Str .= '<strong class="quoteheader">'.$Exploded[0].'</strong> wrote: ';
833
               $Str .= '<strong class="quoteheader">'.$Exploded[0].'</strong> wrote: ';

+ 21
- 15
static/functions/comments.js View File

391
 };
391
 };
392
 
392
 
393
 $(document).ready(function() {
393
 $(document).ready(function() {
394
-  var fadeSpeed = 0;
395
-  var avatars = new Array();
394
+  var fadeSpeed = 0
395
+  var avatars = new Array()
396
   $(".double_avatar").each(function() {
396
   $(".double_avatar").each(function() {
397
     if ($(this).data("gazelle-second-avatar")) {
397
     if ($(this).data("gazelle-second-avatar")) {
398
-      var secondAvatar = $(this).data("gazelle-second-avatar");
399
-      var originalAvatar = $(this).attr("src");
398
+      var secondAvatar = $(this).data("gazelle-second-avatar")
399
+      var originalAvatar = $(this).attr("src")
400
       if ($.inArray(secondAvatar, avatars) == -1) {
400
       if ($.inArray(secondAvatar, avatars) == -1) {
401
-        avatars.push(secondAvatar);
402
-        image = new Image();
403
-        image.src = secondAvatar;
401
+        avatars.push(secondAvatar)
402
+        image = new Image()
403
+        image.src = secondAvatar
404
       }
404
       }
405
       var that = $(this)
405
       var that = $(this)
406
       $($(this).raw().parentNode.parentNode).hover(
406
       $($(this).raw().parentNode.parentNode).hover(
407
         function() {
407
         function() {
408
-          that.attr("src", secondAvatar);
408
+          that.attr("src", secondAvatar)
409
         },
409
         },
410
         function() {
410
         function() {
411
-          that.attr("src", originalAvatar);
411
+          that.attr("src", originalAvatar)
412
         }
412
         }
413
       );
413
       );
414
       $(this).one("load", function() {
414
       $(this).one("load", function() {
415
-          var par = $(this).parents('.avatar');
415
+          var par = $(this).parents('.avatar')
416
           if (par.height()) {
416
           if (par.height()) {
417
-              par.raw().style.height = par.height()-2+'px';
417
+              par.raw().style.height = par.height()-2+'px'
418
           }
418
           }
419
-      });
420
-      if(this.complete) $(this).load();
419
+      })
420
+      if (this.complete) $(this).load()
421
     }
421
     }
422
 
422
 
423
-  });
424
-});
423
+  })
424
+
425
+  document.querySelectorAll('[quote-jump]').forEach(function(el) {
426
+    el.addEventListener('click', function(event) {
427
+      QuoteJump(event, el.attributes['quote-jump'].value)
428
+    })
429
+  })
430
+})

+ 1
- 1
static/styles/global.css View File

96
   width: 20%;
96
   width: 20%;
97
 }
97
 }
98
 
98
 
99
-[toggle-target] {
99
+[toggle-target], [quote-jump] {
100
   cursor: pointer;
100
   cursor: pointer;
101
 }
101
 }
102
 
102
 

Loading…
Cancel
Save