X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=6ffa7ed359df29a24b8ee5133847ff3238d89f08;hb=233e75f9b59f1f3bed73422d5958d07bf659ad27;hp=3088aff09af951d3ef6bdf1543f85a01aa64a249;hpb=c5e641893a2656ebf2c2c8c369fe75eaf3061b52;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 3088aff..6ffa7ed 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -17,7 +17,7 @@ jQuery.prototype.getJSON = function(url, data, successCallback, errorCallback) { success: successCallback, url: url }); -} +}; function isOnline() { return $("#sone").hasClass("online"); @@ -456,7 +456,7 @@ function unlikePost(postId) { function updatePostLikes(postId) { $.getJSON("getLikes.ajax", { "type": "post", "post": postId }, function(data, textStatus) { if ((data != null) && data.success) { - $("#sone .post#" + postId + " > .inner-part > .status-line .likes").toggleClass("hidden", data.likes == 0) + $("#sone .post#" + postId + " > .inner-part > .status-line .likes").toggleClass("hidden", data.likes == 0); $("#sone .post#" + postId + " > .inner-part > .status-line .likes span.like-count").text(data.likes); $("#sone .post#" + postId + " > .inner-part > .status-line .likes > span").attr("title", generateSoneList(data.sones)); } @@ -594,7 +594,7 @@ function unbookmarkPost(postId) { function updateReplyLikes(replyId) { $.getJSON("getLikes.ajax", { "type": "reply", "reply": replyId }, function(data, textStatus) { if ((data != null) && data.success) { - $("#sone .reply#" + replyId + " .status-line .likes").toggleClass("hidden", data.likes == 0) + $("#sone .reply#" + replyId + " .status-line .likes").toggleClass("hidden", data.likes == 0); $("#sone .reply#" + replyId + " .status-line .likes span.like-count").text(data.likes); $("#sone .reply#" + replyId + " .status-line .likes > span").attr("title", generateSoneList(data.sones)); } @@ -878,7 +878,7 @@ function ajaxifyNotification(notification) { if (linkElement.is("[href^='viewPost']")) { id = linkElement.attr("class").substr(5); if (hasPost(id)) { - linkElement.attr("href", "#post-" + id); + linkElement.attr("href", "#post-" + id).addClass("in-page-link"); } } }); @@ -923,8 +923,8 @@ function checkForRemovedSones(oldNotification, newNotification) { if (getNotificationId(oldNotification) != "new-sone-notification") { return; } - oldIds = getElementIds(oldNotification, ".sone-id"); - newIds = getElementIds(newNotification, ".sone-id"); + oldIds = getElementIds(oldNotification, ".new-sone-id"); + newIds = getElementIds(newNotification, ".new-sone-id"); $.each(oldIds, function(index, value) { if ($.inArray(value, newIds) == -1) { markSoneAsKnown(getSone(value), true); @@ -978,7 +978,7 @@ function checkForRemovedReplies(oldNotification, newNotification) { } function getStatus() { - $.getJSON("getStatus.ajax", {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { + $.getJSON("getStatus.ajax", isViewSonePage() ? {"soneIds": getShownSoneId() } : {"loadAllSones": isKnownSonesPage()}, function(data, textStatus) { if ((data != null) && data.success) { /* process Sone information. */ $.each(data.sones, function(index, value) { @@ -996,7 +996,7 @@ function getStatus() { }); if (!foundNotification) { if (notificationId == "new-sone-notification") { - $(".sone-id", this).each(function(index, element) { + $(".new-sone-id", this).each(function(index, element) { soneId = $(this).text(); markSoneAsKnown(getSone(soneId), true); }); @@ -1048,7 +1048,7 @@ function getStatus() { }, function(xmlHttpRequest, textStatus, error) { /* something really bad happend, wait a minute. */ setTimeout(getStatus, 60000); - }) + }); } /** @@ -1081,7 +1081,7 @@ function loadNotifications(notificationIds) { notification.slideDown(); setActivity(); } - }) + }); }); } @@ -1494,7 +1494,7 @@ function changeIcon(iconUrl) { function createNotification(id, lastUpdatedTime, text, dismissable) { notification = $("
").addClass("notification").attr("id", id).attr("lastUpdatedTime", lastUpdatedTime); if (dismissable) { - dismissForm = $("#sone #notification-area #notification-dismiss-template").clone().removeClass("hidden").removeAttr("id") + dismissForm = $("#sone #notification-area #notification-dismiss-template").clone().removeClass("hidden").removeAttr("id"); dismissForm.find("input[name=notification]").val(id); notification.append(dismissForm); } @@ -1721,6 +1721,6 @@ $(document).ready(function() { resetActivity(); }).blur(function() { focus = false; - }) + }); });