@okjavis/nodebb-theme-javis 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okjavis/nodebb-theme-javis",
3
- "version": "3.0.7",
3
+ "version": "3.0.9",
4
4
  "description": "Modern, premium NodeBB theme for JAVIS Community - Extends Harmony with custom styling",
5
5
  "main": "theme.js",
6
6
  "scripts": {
@@ -414,10 +414,14 @@ html.composing .composer .formatting-group {
414
414
  gap: 2px !important;
415
415
  flex-wrap: nowrap !important;
416
416
  overflow-x: auto !important;
417
+ overflow-y: visible !important; // Allow badges to overflow vertically
418
+ padding-top: 8px !important; // Space for badges that overflow upward
417
419
 
418
420
  li {
419
421
  flex-shrink: 0 !important;
420
422
  list-style: none !important;
423
+ position: relative !important; // For badge positioning
424
+ overflow: visible !important; // Allow badges to show
421
425
 
422
426
  .btn {
423
427
  color: $jv-text-muted !important;
@@ -430,11 +434,27 @@ html.composing .composer .formatting-group {
430
434
  justify-content: center !important;
431
435
  background: transparent !important;
432
436
  border: none !important;
437
+ position: relative !important; // For badge positioning
438
+ overflow: visible !important; // Allow badges to show
433
439
 
434
440
  &:hover {
435
441
  background: $jv-hover-bg !important;
436
442
  color: $jv-text-main !important;
437
443
  }
444
+
445
+ // Badge on buttons (like thumbnail count)
446
+ .badge {
447
+ position: absolute !important;
448
+ top: -4px !important;
449
+ right: -4px !important;
450
+ transform: none !important;
451
+ left: auto !important;
452
+ font-size: 10px !important;
453
+ min-width: 16px !important;
454
+ height: 16px !important;
455
+ padding: 0 4px !important;
456
+ line-height: 16px !important;
457
+ }
438
458
  }
439
459
  }
440
460
 
@@ -555,15 +555,33 @@
555
555
  // Remove downvoted if it was set
556
556
  $downvoteBtn.removeClass('downvoted');
557
557
 
558
- // Update vote count
559
- if (response && response.response) {
560
- var votes = response.response.post ? response.response.post.votes : response.response.votes;
561
- if (votes !== undefined) {
562
- $voteCount.text(votes);
563
- $voteCount.attr('data-votes', votes);
564
- $voteCount.attr('title', votes);
558
+ // Update vote count - handle various response structures
559
+ var votes = null;
560
+ if (response) {
561
+ if (response.response && response.response.post) {
562
+ votes = response.response.post.votes;
563
+ } else if (response.response && response.response.votes !== undefined) {
564
+ votes = response.response.votes;
565
+ } else if (response.post && response.post.votes !== undefined) {
566
+ votes = response.post.votes;
567
+ } else if (response.votes !== undefined) {
568
+ votes = response.votes;
565
569
  }
566
570
  }
571
+
572
+ if (votes !== null) {
573
+ $voteCount.text(votes);
574
+ $voteCount.attr('data-votes', votes);
575
+ $voteCount.attr('title', votes);
576
+ } else {
577
+ // Fallback: manually calculate from current state
578
+ var currentVotes = parseInt($voteCount.attr('data-votes') || $voteCount.text()) || 0;
579
+ var wasUpvoted = !$upvoteBtn.hasClass('upvoted'); // toggled already
580
+ votes = wasUpvoted ? currentVotes - 1 : currentVotes + 1;
581
+ $voteCount.text(votes);
582
+ $voteCount.attr('data-votes', votes);
583
+ $voteCount.attr('title', votes);
584
+ }
567
585
  },
568
586
  error: function(xhr) {
569
587
  var msg = xhr.responseJSON && xhr.responseJSON.status && xhr.responseJSON.status.message;
@@ -601,15 +619,33 @@
601
619
  // Remove upvoted if it was set
602
620
  $upvoteBtn.removeClass('upvoted');
603
621
 
604
- // Update vote count
605
- if (response && response.response) {
606
- var votes = response.response.post ? response.response.post.votes : response.response.votes;
607
- if (votes !== undefined) {
608
- $voteCount.text(votes);
609
- $voteCount.attr('data-votes', votes);
610
- $voteCount.attr('title', votes);
622
+ // Update vote count - handle various response structures
623
+ var votes = null;
624
+ if (response) {
625
+ if (response.response && response.response.post) {
626
+ votes = response.response.post.votes;
627
+ } else if (response.response && response.response.votes !== undefined) {
628
+ votes = response.response.votes;
629
+ } else if (response.post && response.post.votes !== undefined) {
630
+ votes = response.post.votes;
631
+ } else if (response.votes !== undefined) {
632
+ votes = response.votes;
611
633
  }
612
634
  }
635
+
636
+ if (votes !== null) {
637
+ $voteCount.text(votes);
638
+ $voteCount.attr('data-votes', votes);
639
+ $voteCount.attr('title', votes);
640
+ } else {
641
+ // Fallback: manually calculate from current state
642
+ var currentVotes = parseInt($voteCount.attr('data-votes') || $voteCount.text()) || 0;
643
+ var wasDownvoted = !$downvoteBtn.hasClass('downvoted'); // toggled already
644
+ votes = wasDownvoted ? currentVotes + 1 : currentVotes - 1;
645
+ $voteCount.text(votes);
646
+ $voteCount.attr('data-votes', votes);
647
+ $voteCount.attr('title', votes);
648
+ }
613
649
  },
614
650
  error: function(xhr) {
615
651
  var msg = xhr.responseJSON && xhr.responseJSON.status && xhr.responseJSON.status.message;