var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var msgsLength = this.responseText; var msgCounter = $(msgsLength).find('tr > .alt1 img[title="رسالة لم تقرأ"]').length; if (msgCounter != '0') { document.querySelector('.msgs_count_unread').innerHTML = msgCounter; } } }; xhttp.open("GET", "/privmsg?folder=inbox", true); xhttp.send();
} </script>
ملاحظه : الكود اللي انا اديتهولك دا بيحسب عدد الرسايل الغير مقروءة في الصفحه الاولى من الرسائل الخاصه فقط يعني اذا كان عندك صفحتين او اكثر من الرسائل لن يتم حساب غير الرسائل التي لم تقراء في الصفحه الاولي فقط
عدل سابقا من قبل omarpop23 في 2019-06-08, 6:05 pm عدل 1 مرات
الكود:
<script>
var msgIcon = document.querySelector('.headermembernotification a[href="/privmsg?folder=inbox"]');
if (msgIcon) {
msgCounter = document.createElement('B');
msgCounter.className = 'msgs_count_unread';
msgIcon.appendChild(msgCounter);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var msgsLength = this.responseText;
var msgCounter = $(msgsLength).find('tr > .alt1 img[title="رسالة لم تقرأ"]').length;
if (msgCounter != '0') {
document.querySelector('.msgs_count_unread').innerHTML = msgCounter;
}
}
};
xhttp.open("GET", "/privmsg?folder=inbox", true);
xhttp.send();
}
</script>
ملاحظه :
الكود اللي انا اديتهولك دا بيحسب عدد الرسايل الغير مقروءة في الصفحه الاولى من الرسائل الخاصه فقط يعني اذا كان عندك صفحتين او اكثر من الرسائل لن يتم حساب غير الرسائل التي لم تقراء في الصفحه الاولي فقط
لكن اريد تغير رقم وحد الي الأحمر وتكبير حجمه قليلا
الكود:
.headermembernotification a[href="/privmsg?folder=inbox"] {
position: relative;
}
.msgs_count_unread {
position: absolute;
right: 0;
background: #F00;
color: #FFF;
border-radius: 5px;
padding: 0px 5px;
}