nodebb-plugin-niki-loyalty 1.3.10 → 1.3.12
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 +1 -1
- package/static/lib/client.js +48 -6
- package/static/widget-niki-floating.html +0 -132
package/package.json
CHANGED
package/static/lib/client.js
CHANGED
|
@@ -89,14 +89,43 @@ $(document).ready(function () {
|
|
|
89
89
|
window.showNikiToast = showNikiToast;
|
|
90
90
|
|
|
91
91
|
// -------------------------------------------------------------
|
|
92
|
-
// 🐱 FLOATING WIDGET -
|
|
93
|
-
//
|
|
94
|
-
// Bu nedenle client.js widget'ı oluşturmuyor
|
|
92
|
+
// 🐱 FLOATING WIDGET - AKTİF
|
|
93
|
+
// Widget doğrudan client.js'ten oluşturuluyor (NodeBB widget sistemi bypass)
|
|
95
94
|
// -------------------------------------------------------------
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
function createFloatingWidget() {
|
|
97
|
+
// Zaten varsa oluşturma
|
|
98
|
+
if ($('#niki-floating-widget').length > 0) return;
|
|
99
|
+
|
|
100
|
+
// Giriş yapmamış kullanıcılara gösterme
|
|
101
|
+
if (!app.user || !app.user.uid) return;
|
|
102
|
+
|
|
103
|
+
// Chat sayfasında gösterme
|
|
104
|
+
if (window.location.pathname.includes('/chats')) return;
|
|
105
|
+
|
|
106
|
+
var widgetHtml = `
|
|
107
|
+
<div id="niki-floating-widget">
|
|
108
|
+
<a href="javascript:void(0);" class="niki-widget-content" onclick="ajaxify.go('niki-wallet'); return false;">
|
|
109
|
+
<img src="${config.relative_path}/plugins/nodebb-plugin-niki-loyalty/static/logo.png" alt="Niki" class="niki-widget-logo">
|
|
110
|
+
<span class="niki-widget-text">
|
|
111
|
+
<span class="niki-lbl">PUAN</span>
|
|
112
|
+
<span class="niki-val" id="widget-user-points">0</span>
|
|
113
|
+
</span>
|
|
114
|
+
</a>
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
$('body').append(widgetHtml);
|
|
119
|
+
console.log('[Niki-Loyalty] Floating widget oluşturuldu.');
|
|
120
|
+
}
|
|
121
|
+
|
|
98
122
|
function updateFloatingWidget() {
|
|
99
|
-
//
|
|
123
|
+
// Widget yoksa oluştur
|
|
124
|
+
if ($('#niki-floating-widget').length === 0) {
|
|
125
|
+
createFloatingWidget();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Puan gösterimi yoksa çık
|
|
100
129
|
if ($('#widget-user-points').length === 0) return;
|
|
101
130
|
|
|
102
131
|
// Kullanıcı giriş yapmamışsa API çağrısı yapma
|
|
@@ -113,6 +142,18 @@ $(document).ready(function () {
|
|
|
113
142
|
});
|
|
114
143
|
}
|
|
115
144
|
|
|
145
|
+
// Chat sayfasında widget'ı gizle/göster
|
|
146
|
+
function checkWidgetVisibility() {
|
|
147
|
+
var $widget = $('#niki-floating-widget');
|
|
148
|
+
if ($widget.length === 0) return;
|
|
149
|
+
|
|
150
|
+
if (window.location.pathname.includes('/chats')) {
|
|
151
|
+
$widget.hide();
|
|
152
|
+
} else {
|
|
153
|
+
$widget.show();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
116
157
|
// Fonksiyonu global yap
|
|
117
158
|
window.updateFloatingWidget = updateFloatingWidget;
|
|
118
159
|
|
|
@@ -123,10 +164,11 @@ $(document).ready(function () {
|
|
|
123
164
|
}
|
|
124
165
|
}, 1000);
|
|
125
166
|
|
|
126
|
-
// Her sayfa değişiminde widget puanını güncelle
|
|
167
|
+
// Her sayfa değişiminde widget puanını güncelle ve chat kontrolü yap
|
|
127
168
|
$(window).on('action:ajaxify.end', function () {
|
|
128
169
|
if (app.user && app.user.uid) {
|
|
129
170
|
updateFloatingWidget();
|
|
171
|
+
checkWidgetVisibility();
|
|
130
172
|
}
|
|
131
173
|
});
|
|
132
174
|
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
NİKİ FLOATING WIDGET - NodeBB Widget Alanına Ekleyin
|
|
3
|
-
|
|
4
|
-
KULLANIM:
|
|
5
|
-
1. NodeBB Admin Panel → Widgets
|
|
6
|
-
2. "HTML Widget" veya "Text/HTML" widget'ını seçin
|
|
7
|
-
3. Bu kodu yapıştırın
|
|
8
|
-
4. İstediğiniz alana sürükleyin (Footer, Global, vb.)
|
|
9
|
-
-->
|
|
10
|
-
|
|
11
|
-
<!-- Niki Floating Widget Container -->
|
|
12
|
-
<div id="niki-floating-widget" class="niki-floating-widget">
|
|
13
|
-
<a href="/niki-wallet" class="niki-widget-content">
|
|
14
|
-
<img src="/plugins/nodebb-plugin-niki-loyalty/static/logo.png" alt="Niki" class="niki-widget-logo">
|
|
15
|
-
<span class="niki-widget-points">
|
|
16
|
-
<span id="widget-user-points">0</span>
|
|
17
|
-
<small>Puan</small>
|
|
18
|
-
</span>
|
|
19
|
-
</a>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
/* Niki Floating Widget Stilleri */
|
|
24
|
-
.niki-floating-widget {
|
|
25
|
-
position: fixed !important;
|
|
26
|
-
bottom: 25px;
|
|
27
|
-
left: 25px;
|
|
28
|
-
z-index: 9998;
|
|
29
|
-
animation: nikiFloat 3s ease-in-out infinite;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.niki-widget-content {
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
gap: 10px;
|
|
36
|
-
background: linear-gradient(135deg, #4E342E 0%, #3E2723 100%);
|
|
37
|
-
padding: 10px 16px 10px 12px;
|
|
38
|
-
border-radius: 50px;
|
|
39
|
-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
|
|
40
|
-
text-decoration: none !important;
|
|
41
|
-
color: #fff !important;
|
|
42
|
-
transition: all 0.3s ease;
|
|
43
|
-
border: 2px solid rgba(255, 255, 255, 0.1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.niki-widget-content:hover {
|
|
47
|
-
transform: scale(1.05);
|
|
48
|
-
box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
|
|
49
|
-
text-decoration: none !important;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.niki-widget-logo {
|
|
53
|
-
width: 40px;
|
|
54
|
-
height: 40px;
|
|
55
|
-
border-radius: 50%;
|
|
56
|
-
object-fit: cover;
|
|
57
|
-
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.niki-widget-points {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
align-items: flex-start;
|
|
64
|
-
line-height: 1.2;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.niki-widget-points #widget-user-points {
|
|
68
|
-
font-size: 18px;
|
|
69
|
-
font-weight: 700;
|
|
70
|
-
color: #ffd700;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.niki-widget-points small {
|
|
74
|
-
font-size: 11px;
|
|
75
|
-
opacity: 0.8;
|
|
76
|
-
color: #fff;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* Floating Animasyonu */
|
|
80
|
-
@keyframes nikiFloat {
|
|
81
|
-
|
|
82
|
-
0%,
|
|
83
|
-
100% {
|
|
84
|
-
transform: translateY(0);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
50% {
|
|
88
|
-
transform: translateY(-5px);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* Mobilde Küçült */
|
|
93
|
-
@media (max-width: 768px) {
|
|
94
|
-
.niki-floating-widget {
|
|
95
|
-
bottom: 15px;
|
|
96
|
-
left: 15px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.niki-widget-content {
|
|
100
|
-
padding: 8px 12px 8px 8px;
|
|
101
|
-
gap: 8px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.niki-widget-logo {
|
|
105
|
-
width: 32px;
|
|
106
|
-
height: 32px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.niki-widget-points #widget-user-points {
|
|
110
|
-
font-size: 16px;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* Giriş yapmamış kullanıcılar için gizle */
|
|
115
|
-
body:not(.loggedIn) .niki-floating-widget {
|
|
116
|
-
display: none !important;
|
|
117
|
-
}
|
|
118
|
-
</style>
|
|
119
|
-
|
|
120
|
-
<script>
|
|
121
|
-
// Widget puanını güncelle (client.js zaten bunu yapıyor)
|
|
122
|
-
(function () {
|
|
123
|
-
// client.js'deki updateFloatingWidget fonksiyonu widget-user-points'i güncelleyecek
|
|
124
|
-
// Ekstra bir işlem gerekmez, sadece ID'nin doğru olduğundan emin olun
|
|
125
|
-
|
|
126
|
-
// Giriş yapmamış kullanıcılar için widget'ı gizle
|
|
127
|
-
if (typeof app !== 'undefined' && (!app.user || !app.user.uid)) {
|
|
128
|
-
var widget = document.getElementById('niki-floating-widget');
|
|
129
|
-
if (widget) widget.style.display = 'none';
|
|
130
|
-
}
|
|
131
|
-
})();
|
|
132
|
-
</script>
|