function NotificationSetup()
{
	setInterval(NotificationUpdate, 60000);
	NotificationUpdate();
}

function NotificationUpdate()
{
	$.get( "/users/notifications", function(data) {
		var list = data.list;
    
    if (list == null) {
      return;
    }

		if(list.length === 0) {
			$("#notification-badge").addClass("hidden");
			return
		}

		$("#notification-list").empty();

		for(var i = 0; i < list.length; i++) {
			var container = document.createElement('li');
			var link = document.createElement('a');

			container.className = "notification";
			link.id = 'notification_' + list[i].id;
			link.href = list[i].link;
      link.textContent = list[i].text;
			link.innerText = list[i].text;
			link.onclick = function() {
				NotificationDismiss(this);
			};

			container.appendChild(link);

			$("#notification-list").append(container);
		}

		$("#notification-badge").removeClass("hidden");
		$("#notification-badge").text(list.length);
	});
}

function NotificationDismiss(e)
{
	var id = parseInt(e.id.match(/(\d)+/));

	$.ajax({
		url: "/users/notifications",
		type: "DELETE",
		data: {
			"id" : id,
			"authenticity_token" : AUTH_TOKEN
		}
	});
  
  NotificationUpdate();
}

NotificationSetup();

@@ -25,16 +25,18 @@
 up()%0A%7B%0A%09
+//
 setInter
@@ -1021,17 +1021,23 @@
 (/(%5Cd)+/
-)
+igm)%5B0%5D
 );%0A%0A%09$.a

fix notification bug of Safari