`; $('.all-notification-wrapper').append(display); if(parseInt(payload.data.type) == 42){ localStorage.setItem('chatDot', true); $('.chat-li').html(' '); }else{ localStorage.setItem('notificationDot', true); $('.notification-li').html(' '); } setTimeout(function(){ $('#'+r).hide("slow", function(){ $(this).remove(); }); }, 3000); }); }catch(err){ console.log('Unable to get permission to notify.', err); saveToken(false); } function guid() { var nav = window.navigator; var screen = window.screen; var guid = nav.mimeTypes.length; guid += nav.userAgent.replace(/\D+/g, ''); guid += nav.plugins.length; guid += screen.height || ''; guid += screen.width || ''; guid += screen.pixelDepth || ''; return guid; } function saveToken(token) { let device_id = guid(); $('#browserToken').val(token); $('#browserId').val(device_id); $('.browserToken').val(token); $('.browserId').val(device_id); Cookies.set('device_token', token); Cookies.set('device_id', device_id); if(typeof userData != 'undefined' && userData.role_id !=3 && token != false){ $.ajax({ method: "get", dataType: "json", url: "/update/device/token", data: {device_id: device_id, device_token:token}, async: false, success: function(msg) { console.log(msg); return msg; } }); } } $(document).on('click', '.notify-container', function(){ location.href = $(this).data('url'); }); $(document).on('click', '.rm-notification', function(){ $(this).parent(".notify-wrapper").hide(); }); $(document).ready(function(){ let device_id = guid(); $('#browserId').val(device_id); $('.browserId').val(device_id); Cookies.set('device_id', device_id); });