nodebb-plugin-niki-loyalty 1.3.1 → 1.3.2

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": "nodebb-plugin-niki-loyalty",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Niki The Cat Coffee Loyalty System - Earn points while studying on IEU Forum.",
5
5
  "main": "library.js",
6
6
  "nbbpm": {
@@ -487,105 +487,5 @@ $(document).ready(function () {
487
487
  });
488
488
  });
489
489
  }
490
- // -------------------------------------------------------------
491
- // 📢 DUYURU SİSTEMİ (Marquee + Günlük Limit + Kapat Butonu)
492
- // -------------------------------------------------------------
493
- try {
494
- const TARGET_CATEGORY_ID = 1; // Duyuruların çekileceği kategori ID
495
- const MAX_DAILY_SHOW = 5; // Günde en fazla kaç kere gösterilecek
496
-
497
- function checkAnnouncements() {
498
- // Widget elementlerini bul veya oluştur
499
- let $widget = $('.niki-marquee-widget');
500
- if ($widget.length === 0) {
501
- // Henüz yoksa oluştur (Başlangıçta gizli)
502
- const widgetHtml = `
503
- <div class="niki-marquee-widget" style="display:none;">
504
- <div class="nm-content">
505
- <div class="nm-icon">📢</div>
506
- <div class="nm-text-container">
507
- <span class="nm-text" id="niki-marquee-text">Duyuru Yükleniyor...</span>
508
- </div>
509
- <button class="nm-close" id="niki-marquee-close" title="Kapat">✖</button>
510
- </div>
511
- </div>
512
- <style>
513
- .niki-marquee-widget {
514
- position: fixed; bottom: 85px; right: 20px; z-index: 9999;
515
- background: #1a1a1a; border: 1px solid #C5A065; border-radius: 50px;
516
- box-shadow: 0 5px 20px rgba(0,0,0,0.4); padding: 5px 15px;
517
- width: 320px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
518
- animation: slideInUp 0.5s ease-out;
519
- }
520
- .nm-content { display: flex; align-items: center; justify-content: space-between; height: 36px; }
521
- .nm-icon { font-size: 18px; margin-right: 10px; animation: pulse 2s infinite; }
522
- .nm-text-container { flex: 1; overflow: hidden; white-space: nowrap; position: relative; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
523
- .nm-text {
524
- display: inline-block; color: #fff; font-size: 13px; font-weight: 500;
525
- padding-left: 100%; animation: marquee 10s linear infinite;
526
- }
527
- .nm-close {
528
- background: none; border: none; color: #888; cursor: pointer; font-size: 14px;
529
- margin-left: 10px; padding: 0 5px; transition: 0.2s;
530
- }
531
- .nm-close:hover { color: #ff5252; transform: scale(1.1); }
532
- @keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }
533
- @keyframes slideInUp { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
534
- @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
535
- </style>
536
- `;
537
- $('body').append(widgetHtml);
538
- $widget = $('.niki-marquee-widget');
539
-
540
- // Kapatma butonu olayı
541
- $('#niki-marquee-close').on('click', function () {
542
- $widget.fadeOut();
543
- sessionStorage.setItem('niki_session_closed', 'true'); // Bu oturumda bir daha açma
544
- });
545
- }
546
-
547
- // Eğer bu oturumda kullanıcı kapattıysa gösterme
548
- if (sessionStorage.getItem('niki_session_closed') === 'true') return;
549
-
550
- // Günlük limit kontrolü
551
- const today = new Date().toISOString().slice(0, 10);
552
- const storageKey = 'niki_announce_count_' + today;
553
- let count = parseInt(localStorage.getItem(storageKey) || '0');
554
-
555
- if (count >= MAX_DAILY_SHOW) return; // Limit dolmuş
556
-
557
- // API'den son konuyu çek
558
- $.getJSON('/api/category/' + TARGET_CATEGORY_ID, function (data) {
559
- if (data && data.topics && data.topics.length > 0) {
560
- const topic = data.topics[0]; // En son konu
561
- const lastTid = localStorage.getItem('niki_last_seen_tid');
562
-
563
- // Yeni konu varsa veya henüz limit dolmadıysa göster
564
- // (Kullanıcı "sürekli akmasını istiyorum" dediği için her sayfa yenilemede göstereceğiz, limite kadar)
565
- const text = topic.title;
566
- const url = config.relative_path + '/topic/' + topic.slug;
567
-
568
- $('#niki-marquee-text').html(`<a href="${url}" style="color:#fff;text-decoration:none;">${text}</a>`);
569
- $widget.fadeIn();
570
-
571
- // Sayacı artır (Sadece görünür olduğunda)
572
- if ($widget.is(':visible')) {
573
- localStorage.setItem(storageKey, count + 1);
574
- // Yeni konuyu gördü olarak işaretle
575
- localStorage.setItem('niki_last_seen_tid', topic.tid);
576
- }
577
- }
578
- });
579
- }
580
-
581
- // Başlat (Sayfa yüklendikten biraz sonra)
582
- setTimeout(checkAnnouncements, 2000);
583
-
584
- // Sayfa geçişlerinde de kontrol et
585
- $(window).on('action:ajaxify.end', function () {
586
- setTimeout(checkAnnouncements, 2000);
587
- });
588
-
589
- } catch (e) { console.warn("[Niki] Duyuru hatası:", e); }
590
490
 
591
491
  });