-
Notifications
You must be signed in to change notification settings - Fork 27
/
timeline-updates.min.js
1 lines (1 loc) · 1.9 KB
/
timeline-updates.min.js
1
$(function(){var e=doT.template($("#notificationFn").html()),t=doT.template($("#dateFn").html()),n=doT.template($("#todaysDateFn").html()),r=doT.template($("#titleFn").html());$("#container").masonry({itemSelector:".item"});$.getJSON("notification/notifications",function(i){var s;var o=new Date;var u=["January","February","March","April","May","June","July","August","September","October","November","December"];var a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];$.each(i,function(r,i){var f=i.date;var l=f.split(" ");var c=l[0].split("-");var h=l[1].split(":");c=new Date(c[0],c[1]-1,c[2],h[0],h[1],h[2]);var p=new Date(c[0],c[1]-1,c[2],h[0],h[1],h[2]);var d;d=i.date.split(" ");if(s!=d[0]){var v=c,m=a[v.getDay()]+" "+v.getDate()+" "+u[v.getMonth()]+" "+v.getFullYear();if(p.setHours(0,0,0,0)==o.setHours(0,0,0,0)){$("#container").append(n({date:m}))}else{$("#container").append(t({date:m}))}}var g,y=c.getHours(),b=c.getMinutes();if(y>12){y=y-12;if(b<10){b="0"+b}if(y<10){y="0"+y}g=y+":"+b+"PM"}else{if(b<10){b="0"+b}if(y<10){y="0"+y}g=y+":"+b+"AM"}i.date=g;$("#container").append(e(i));s=d[0]});$("#removeMe").remove();$("#container").prepend(r({}));$("#dummyItem").hide();$("#dummtItem").addClass("dummyItem");$("#container").masonry({itemSelector:".item"});$(".rightCorner").hide();$(".leftCorner").hide();var f=$("#container").find(".item");$.each(f,function(e,t){if(!$(t).hasClass("dateItem")&&!$(t).hasClass("dummyItem")){var n=$(t).css("left");$(t).addClass("borderclass");if(n=="0px"){if(Math.random()>.7){$(t).addClass("stagger")}}else{if(Math.random()<.3){$(t).addClass("stagger")}}}});$("#container").masonry("reload");f=$("#container").find(".item");$.each(f,function(e,t){if(!$(t).hasClass("dateItem")){var n=$(t).css("left");$(t).addClass("borderclass");if(n=="0px"){html="<span class='rightCorner'></span>";$(t).prepend(html)}else{html="<span class='leftCorner'></span>";$(t).prepend(html)}}})})})