function newsPublished(n){var t=document.createElement("div");t.id="newsNotificationBar"+n.Id;t.className="notification";t.innerHTML='<a target="_blank" href="'+n.Url+'" class="img" style="background-image:url(\''+n.Image+"')\" onclick=\"closeNewsPublishedBar('"+t.id+'\')"><\/a><div class="right"><span class="top">YENİ DH HABERİ<\/span><a target="_blank" href="'+n.Url+'" class="title" onclick="closeNewsPublishedBar(\''+t.id+"')\">"+n.Title+'<\/a><span class="time" data-publish-date="'+Date.now()+'">Şimdi<\/span><div class="close-button" style="display:none" onclick="closeNewsPublishedBar(\''+t.id+'\')"><img src="/static/forum/img/orange-close.png"><\/div><\/div>';t.addEventListener("mouseover",function(){var n=this.querySelector(".close-button");this.classList.add("grey");n.style.display="inherit"});t.addEventListener("mouseleave",function(){var n=this.querySelector(".close-button");this.classList.remove("grey");n.style.display="none"});document.querySelector(".push-notification-content").innerHTML="";document.querySelector(".push-notification-content").appendChild(t)}function notificationSent(n){var i="https://www.donanimhaber.com/yonlen--"+n.NewsId,t=document.createElement("div");t.classList.add("push-notification");t.innerHTML='<div class="placeholder"><\/div><div class="content"><a target="_blank" href="'+i+'" onclick="clearPortalNotificationPanel()"><div class="right"><div class="img" style="background-image:url(\''+n.Image+'\')"><\/div><span>Anlık Bildirim<\/span><\/div><div class="left"><span class="title">'+n.Title+'<\/span><\/div><\/a><div class="close-button" onclick="clearPortalNotificationPanel()"><img src="/static/forum/img/close3.png"><\/div><\/div>';t.addEventListener("mouseover",function(){this.classList.add("grey")});t.addEventListener("mouseleave",function(){this.classList.remove("grey")});document.getElementById("portalNotificationContainer").innerHTML="";document.getElementById("portalNotificationContainer").appendChild(t)}function closeNewsPublishedBar(n){var t=document.getElementById(n);t&&t.parentNode.removeChild(t)}function clearPortalNotificationPanel(){document.getElementById("portalNotificationContainer").innerHTML=""}function updatePublishedNewsElaspedTime(){var n=document.querySelectorAll(".push-notification-content .notification"),t;if(n&&n.length>0)for(t=0;t<n.length;t++){var u=n[t],r=u.querySelector(".time"),f=parseInt(r.getAttribute("data-publish-date")),e=new Date(f),i=Math.floor((new Date-e)/6e4);r.innerHTML=i>60?Math.floor(i/60)+" saat Önce":i>0?i+" dk. Önce":"Şimdi"}}var portalNotificationContainerWrapper,portalNotificationContainer,portalPublishedNewsContainer;portalNewsSocket={init:function(n,t){if(window.socket||(window.socket=io("https://socket.donanimhaber.com",{path:"/v4/portal/",transports:["websocket","flashsocket","polling"]}),window.onbeforeunload=function(){window.socket.disconnect();window.socket.close()}),t)window.socket.on("notificationSent",t)}};portalNotificationContainerWrapper=document.querySelector("body .dhorta");portalNotificationContainerWrapper?(portalNotificationContainer=document.createElement("div"),portalNotificationContainer.id="portalNotificationContainer",portalNotificationContainerWrapper.insertBefore(portalNotificationContainer,portalNotificationContainerWrapper.firstChild)):console.log("bildirim paneli için container bulunamadı.");portalPublishedNewsContainer=document.createElement("div");portalPublishedNewsContainer.className="push-notification-content";document.querySelector("body").appendChild(portalPublishedNewsContainer);portalNewsSocket.init(newsPublished,notificationSent);$(document).scroll(function(){var t=$("#portalNotificationContainer").offset().top+$("#portalNotificationContainer").height(),n=document.querySelector(".push-notification");n&&(window.scrollY>t&&t>10?n.classList.add("mini"):n.classList.remove("mini"))});setInterval(updatePublishedNewsElaspedTime,3e3)