mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
60 lines
No EOL
2.1 KiB
JavaScript
60 lines
No EOL
2.1 KiB
JavaScript
|
|
var avideoNotifications = [
|
|
{title: 'test 1', text: 'text 1', image: 'http://192.168.1.4/YouPHPTube/videos/userPhoto/photo1.png', link: 'https://google.com'},
|
|
{title: 'test 2', text: 'text 2', image: 'http://192.168.1.4/YouPHPTube/videos/userPhoto/photo2.png', link: 'https://yahoo.com'}
|
|
];
|
|
|
|
$(document).ready(function () {
|
|
var avideoNotificationsCookie = Cookies.get('avideoNotifications');
|
|
if (typeof avideoNotificationsCookie !== 'undefined') {
|
|
//avideoNotifications = avideoNotificationsCookie;
|
|
}
|
|
processNotifications();
|
|
});
|
|
|
|
function processNotifications() {
|
|
console.log('processNotifications', avideoNotifications);
|
|
$('.LayoutNotificationCount').text(avideoNotifications.length);
|
|
$('#LayoutNotificationItems').empty();
|
|
for (var item in avideoNotifications) {
|
|
if (typeof avideoNotifications[item] == 'function') {
|
|
continue;
|
|
}
|
|
|
|
var html = '<li>';
|
|
html += '<a href="'+avideoNotifications[item].link+'" class="notificationLink">';
|
|
html += '<img src="'+avideoNotifications[item].image+'" class="img img-circle img-responsive">';
|
|
html += '<div>'+avideoNotifications[item].text+'</div>';
|
|
html += '</a></li>';
|
|
|
|
$('#LayoutNotificationItems').prepend(html);
|
|
console.log('processNotifications item', item);
|
|
console.log('processNotifications', avideoNotifications[item]);
|
|
}
|
|
}
|
|
|
|
function addNotification(title, text, image, link) {
|
|
var obj = {title: title, text: text, image: image, link:link};
|
|
console.log('addNotification type', typeof avideoNotifications);
|
|
console.log('addNotification=', avideoNotifications);
|
|
console.log('addNotification', obj);
|
|
avideoNotifications.push(obj);
|
|
/*
|
|
Cookies.set('avideoNotifications', avideoNotifications, {
|
|
path: '/',
|
|
expires: 365
|
|
});
|
|
*
|
|
*/
|
|
}
|
|
|
|
function removeNotification(index) {
|
|
avideoNotifications.splice(index, 1);
|
|
/*
|
|
Cookies.set('avideoNotifications', avideoNotifications, {
|
|
path: '/',
|
|
expires: 365
|
|
});
|
|
*
|
|
*/
|
|
} |