nodebb-plugin-niki-loyalty 1.3.12 → 1.3.13
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 +5 -49
package/package.json
CHANGED
package/static/lib/client.js
CHANGED
|
@@ -89,43 +89,13 @@ $(document).ready(function () {
|
|
|
89
89
|
window.showNikiToast = showNikiToast;
|
|
90
90
|
|
|
91
91
|
// -------------------------------------------------------------
|
|
92
|
-
// 🐱 FLOATING WIDGET -
|
|
93
|
-
// Widget
|
|
92
|
+
// 🐱 FLOATING WIDGET - DEVRE DIŞI
|
|
93
|
+
// Widget NodeBB widget sisteminden elle ekleniyor
|
|
94
94
|
// -------------------------------------------------------------
|
|
95
95
|
|
|
96
|
-
|
|
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
|
-
|
|
96
|
+
// Sadece puan güncelleme fonksiyonu
|
|
122
97
|
function updateFloatingWidget() {
|
|
123
|
-
//
|
|
124
|
-
if ($('#niki-floating-widget').length === 0) {
|
|
125
|
-
createFloatingWidget();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Puan gösterimi yoksa çık
|
|
98
|
+
// Custom widget'ta puan gösterimi varsa güncelle
|
|
129
99
|
if ($('#widget-user-points').length === 0) return;
|
|
130
100
|
|
|
131
101
|
// Kullanıcı giriş yapmamışsa API çağrısı yapma
|
|
@@ -141,19 +111,6 @@ $(document).ready(function () {
|
|
|
141
111
|
console.log('[Niki-Loyalty] Widget puanı yüklenemedi.');
|
|
142
112
|
});
|
|
143
113
|
}
|
|
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
|
-
|
|
157
114
|
// Fonksiyonu global yap
|
|
158
115
|
window.updateFloatingWidget = updateFloatingWidget;
|
|
159
116
|
|
|
@@ -164,11 +121,10 @@ $(document).ready(function () {
|
|
|
164
121
|
}
|
|
165
122
|
}, 1000);
|
|
166
123
|
|
|
167
|
-
// Her sayfa değişiminde widget puanını güncelle
|
|
124
|
+
// Her sayfa değişiminde widget puanını güncelle
|
|
168
125
|
$(window).on('action:ajaxify.end', function () {
|
|
169
126
|
if (app.user && app.user.uid) {
|
|
170
127
|
updateFloatingWidget();
|
|
171
|
-
checkWidgetVisibility();
|
|
172
128
|
}
|
|
173
129
|
});
|
|
174
130
|
|