function ajaxGet(url, data, successCallback, errorCallback) {
(function(url, data, successCallback, errorCallback) {
function ajaxGet(url, data, successCallback, errorCallback) {
(function(url, data, successCallback, errorCallback) {
- $.ajax({"type": "GET", "url": url, "data": data, "dataType": "json", "success": function(data, textStatus, xmlHttpRequest) {
+ $.ajax({"cache": false, "type": "GET", "url": url, "data": data, "dataType": "json", "success": function(data, textStatus, xmlHttpRequest) {
ajaxSuccess();
if (typeof successCallback != "undefined") {
successCallback(data, textStatus);
ajaxSuccess();
if (typeof successCallback != "undefined") {
successCallback(data, textStatus);
function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, optional, dontUseTextarea) {
$(inputElement).each(function() {
function registerInputTextareaSwap(inputElement, defaultText, inputFieldName, optional, dontUseTextarea) {
$(inputElement).each(function() {
- commentElement = $("<div><span>" + text + "</span></div>").addClass("show-reply-form").click(function() {
- replyElement = $("#sone .post#post-" + postId + " .create-reply");
+ var commentElement = $("<div><span>" + text + "</span></div>").addClass("show-reply-form").click(function() {
+ var replyElement = sone.find(".post#post-" + postId + " .create-reply");
replyElement.removeClass("hidden");
replyElement.removeClass("light");
(function(replyElement) {
replyElement.removeClass("hidden");
replyElement.removeClass("light");
(function(replyElement) {
* The date and time of the last update (formatted for display)
*/
function updateSoneStatus(soneId, name, status, modified, locked, lastUpdated, lastUpdatedText) {
* The date and time of the last update (formatted for display)
*/
function updateSoneStatus(soneId, name, status, modified, locked, lastUpdated, lastUpdatedText) {
- $("#sone .sone." + filterSoneId(soneId)).
- toggleClass("unknown", status == "unknown").
+ var updateSone = sone.find(".sone." + filterSoneId(soneId));
+ updateSone.toggleClass("unknown", status == "unknown").
toggleClass("idle", status == "idle").
toggleClass("inserting", status == "inserting").
toggleClass("downloading", status == "downloading").
toggleClass("modified", modified);
toggleClass("idle", status == "idle").
toggleClass("inserting", status == "inserting").
toggleClass("downloading", status == "downloading").
toggleClass("modified", modified);
- $("#sone .sone." + filterSoneId(soneId) + " .lock").toggleClass("hidden", locked);
- $("#sone .sone." + filterSoneId(soneId) + " .unlock").toggleClass("hidden", !locked);
+ updateSone.find(".lock").toggleClass("hidden", locked);
+ updateSone.find(".unlock").toggleClass("hidden", !locked);
} else if (data.error == "invalid-post-id") {
/* pretend the post is already gone. */
getPost(postId).slideUp();
} else if (data.error == "invalid-post-id") {
/* pretend the post is already gone. */
getPost(postId).slideUp();
*/
function enhanceDeleteReplyButton(button, replyId, text) {
enhanceDeleteButton(button, text, function() {
*/
function enhanceDeleteReplyButton(button, replyId, text) {
enhanceDeleteButton(button, text, function() {
- ajaxGet("deleteReply.ajax", { "reply": replyId, "formPassword": $("#sone #formPassword").text() }, function(data, textStatus) {
+ ajaxGet("deleteReply.ajax", { "reply": replyId, "formPassword": sone.find("#formPassword").text() }, function(data, textStatus) {
} else if (data.error == "invalid-reply-id") {
/* pretend the reply is already gone. */
getReply(replyId).slideUp();
} else if (data.error == "invalid-reply-id") {
/* pretend the reply is already gone. */
getReply(replyId).slideUp();
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .like").addClass("hidden");
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .unlike").removeClass("hidden");
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .like").addClass("hidden");
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .unlike").removeClass("hidden");
updatePostLikes(postId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
updatePostLikes(postId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .unlike").addClass("hidden");
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .like").removeClass("hidden");
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .unlike").addClass("hidden");
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .like").removeClass("hidden");
updatePostLikes(postId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
updatePostLikes(postId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
function updatePostLikes(postId) {
ajaxGet("getLikes.ajax", { "type": "post", "post": postId }, function(data, textStatus) {
if ((data != null) && data.success) {
function updatePostLikes(postId) {
ajaxGet("getLikes.ajax", { "type": "post", "post": postId }, function(data, textStatus) {
if ((data != null) && data.success) {
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .likes").toggleClass("hidden", data.likes == 0);
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .likes span.like-count").text(data.likes);
- $("#sone .post#post-" + postId + " > .inner-part > .status-line .likes > span").attr("title", generateSoneList(data.sones));
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .likes").toggleClass("hidden", data.likes == 0);
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .likes span.like-count").text(data.likes);
+ sone.find(".post#post-" + postId + " > .inner-part > .status-line .likes > span").attr("title", generateSoneList(data.sones));
}
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
}
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
- $("#sone .reply#reply-" + replyId + " .status-line .like").addClass("hidden");
- $("#sone .reply#reply-" + replyId + " .status-line .unlike").removeClass("hidden");
+ sone.find(".reply#reply-" + replyId + " .status-line .like").addClass("hidden");
+ sone.find(".reply#reply-" + replyId + " .status-line .unlike").removeClass("hidden");
updateReplyLikes(replyId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
updateReplyLikes(replyId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
- $("#sone .reply#reply-" + replyId + " .status-line .unlike").addClass("hidden");
- $("#sone .reply#reply-" + replyId + " .status-line .like").removeClass("hidden");
+ sone.find(".reply#reply-" + replyId + " .status-line .unlike").addClass("hidden");
+ sone.find(".reply#reply-" + replyId + " .status-line .like").removeClass("hidden");
updateReplyLikes(replyId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
updateReplyLikes(replyId);
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
* The trust value for the Sone
*/
function updateTrustControls(soneId, trustValue) {
* The trust value for the Sone
*/
function updateTrustControls(soneId, trustValue) {
if (getPostAuthor(this) == soneId) {
getPostElement(this).find(".post-trust").toggleClass("hidden", trustValue != null);
getPostElement(this).find(".post-distrust").toggleClass("hidden", trustValue != null);
getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null);
}
});
if (getPostAuthor(this) == soneId) {
getPostElement(this).find(".post-trust").toggleClass("hidden", trustValue != null);
getPostElement(this).find(".post-distrust").toggleClass("hidden", trustValue != null);
getPostElement(this).find(".post-untrust").toggleClass("hidden", trustValue == null);
}
});
if (getReplyAuthor(this) == soneId) {
getReplyElement(this).find(".reply-trust").toggleClass("hidden", trustValue != null);
getReplyElement(this).find(".reply-distrust").toggleClass("hidden", trustValue != null);
if (getReplyAuthor(this) == soneId) {
getReplyElement(this).find(".reply-trust").toggleClass("hidden", trustValue != null);
getReplyElement(this).find(".reply-distrust").toggleClass("hidden", trustValue != null);
function updateReplyLikes(replyId) {
ajaxGet("getLikes.ajax", { "type": "reply", "reply": replyId }, function(data, textStatus) {
if ((data != null) && data.success) {
function updateReplyLikes(replyId) {
ajaxGet("getLikes.ajax", { "type": "reply", "reply": replyId }, function(data, textStatus) {
if ((data != null) && data.success) {
- $("#sone .reply#reply-" + replyId + " .status-line .likes").toggleClass("hidden", data.likes == 0);
- $("#sone .reply#reply-" + replyId + " .status-line .likes span.like-count").text(data.likes);
- $("#sone .reply#reply-" + replyId + " .status-line .likes > span").attr("title", generateSoneList(data.sones));
+ sone.find(".reply#reply-" + replyId + " .status-line .likes").toggleClass("hidden", data.likes == 0);
+ sone.find(".reply#reply-" + replyId + " .status-line .likes span.like-count").text(data.likes);
+ sone.find(".reply#reply-" + replyId + " .status-line .likes > span").attr("title", generateSoneList(data.sones));
}
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
}
}, function(xmlHttpRequest, textStatus, error) {
/* ignore error. */
- sender = $(this.form).find(":input[name=sender]").val();
- inputField = $(this.form).find(":input[name=text]:enabled").get(0);
- postId = getPostId(this);
- text = $(inputField).val();
+ var sender = $(this.form).find(":input[name=sender]").val();
+ var inputField = $(this.form).find(":input[name=text]:enabled").get(0);
+ var postId = getPostId(this);
+ var text = $(inputField).val();
(function(sender, postId, text, inputField) {
postReply(sender, postId, text, function(success, error, replyId, soneId) {
if (success) {
$(inputField).val("");
loadNewReply(replyId, soneId, postId);
(function(sender, postId, text, inputField) {
postReply(sender, postId, text, function(success, error, replyId, soneId) {
if (success) {
$(inputField).val("");
loadNewReply(replyId, soneId, postId);
- $("#sone .post#post-" + postId + " .create-reply").addClass("hidden");
- $("#sone .post#post-" + postId + " .create-reply .sender").hide();
- $("#sone .post#post-" + postId + " .create-reply .select-sender").show();
- $("#sone .post#post-" + postId + " .create-reply :input[name=sender]").val(getCurrentSoneId());
+ sone.find(".post#post-" + postId + " .create-reply").addClass("hidden");
+ sone.find(".post#post-" + postId + " .create-reply .sender").hide();
+ sone.find(".post#post-" + postId + " .create-reply .select-sender").show();
+ sone.find(".post#post-" + postId + " .create-reply :input[name=sender]").val(getCurrentSoneId());
/* replace all “delete” buttons with javascript. */
(function(postElement) {
getTranslation("WebInterface.Confirmation.DeletePostButton", function(deletePostText) {
/* replace all “delete” buttons with javascript. */
(function(postElement) {
getTranslation("WebInterface.Confirmation.DeletePostButton", function(deletePostText) {
/* convert “show source” link into javascript function. */
$(postElement).find(".show-source").each(function() {
$("a", this).click(function() {
/* convert “show source” link into javascript function. */
$(postElement).find(".show-source").each(function() {
$("a", this).click(function() {
- post = getPostElement(this);
- rawPostText = $(".post-text.raw-text", post);
+ var post = getPostElement(this);
+ var rawPostText = $(".post-text.raw-text", post);
rawPostText.toggleClass("hidden");
if (rawPostText.hasClass("hidden")) {
$(".post-text.short-text", post).removeClass("hidden");
rawPostText.toggleClass("hidden");
if (rawPostText.hasClass("hidden")) {
$(".post-text.short-text", post).removeClass("hidden");
/* ajaxify author/post links */
$(".post-status-line .permalink a", postElement).click(function() {
if (!$(".create-reply", postElement).hasClass("hidden")) {
/* ajaxify author/post links */
$(".post-status-line .permalink a", postElement).click(function() {
if (!$(".create-reply", postElement).hasClass("hidden")) {
addCommentLink(getPostId(postElement), getPostAuthor(postElement), postElement, $(postElement).find(".post-status-line .permalink-author"));
/* process all replies. */
addCommentLink(getPostId(postElement), getPostAuthor(postElement), postElement, $(postElement).find(".post-status-line .permalink-author"));
/* process all replies. */
/* process reply input fields. */
getTranslation("WebInterface.DefaultText.Reply", function(text) {
/* process reply input fields. */
getTranslation("WebInterface.DefaultText.Reply", function(text) {
registerInputTextareaSwap(this, text, "text", false, false);
});
});
registerInputTextareaSwap(this, text, "text", false, false);
});
});
ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(followElement).addClass("hidden");
$(followElement).parent().find(".unfollow").removeClass("hidden");
ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(followElement).addClass("hidden");
$(followElement).parent().find(".unfollow").removeClass("hidden");
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", true);
$(".unfollow", this).toggleClass("hidden", false);
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", true);
$(".unfollow", this).toggleClass("hidden", false);
ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(unfollowElement).addClass("hidden");
$(unfollowElement).parent().find(".follow").removeClass("hidden");
ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(unfollowElement).addClass("hidden");
$(unfollowElement).parent().find(".follow").removeClass("hidden");
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", false);
$(".unfollow", this).toggleClass("hidden", true);
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", false);
$(".unfollow", this).toggleClass("hidden", true);
/* ajaxify author links */
$(".reply-status-line .permalink a", replyElement).click(function() {
if (!$(".create-reply", getPostElement(replyElement)).hasClass("hidden")) {
/* ajaxify author links */
$(".reply-status-line .permalink a", replyElement).click(function() {
if (!$(".create-reply", getPostElement(replyElement)).hasClass("hidden")) {
/* convert “show source” link into javascript function. */
$(replyElement).find(".show-reply-source").each(function() {
$("a", this).click(function() {
/* convert “show source” link into javascript function. */
$(replyElement).find(".show-reply-source").each(function() {
$("a", this).click(function() {
- reply = getReplyElement(this);
- rawReplyText = $(".reply-text.raw-text", reply);
+ var reply = getReplyElement(this);
+ var rawReplyText = $(".reply-text.raw-text", reply);
rawReplyText.toggleClass("hidden");
if (rawReplyText.hasClass("hidden")) {
$(".reply-text.short-text", reply).removeClass("hidden");
rawReplyText.toggleClass("hidden");
if (rawReplyText.hasClass("hidden")) {
$(".reply-text.short-text", reply).removeClass("hidden");
ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(followElement).addClass("hidden");
$(followElement).parent().find(".unfollow").removeClass("hidden");
ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(followElement).addClass("hidden");
$(followElement).parent().find(".unfollow").removeClass("hidden");
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", true);
$(".unfollow", this).toggleClass("hidden", false);
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", true);
$(".unfollow", this).toggleClass("hidden", false);
ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(unfollowElement).addClass("hidden");
$(unfollowElement).parent().find(".follow").removeClass("hidden");
ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
$(unfollowElement).addClass("hidden");
$(unfollowElement).parent().find(".follow").removeClass("hidden");
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", false);
$(".unfollow", this).toggleClass("hidden", true);
if (getMenuSone(this) == soneId) {
$(".follow", this).toggleClass("hidden", false);
$(".unfollow", this).toggleClass("hidden", true);
notification.find(".text").addClass("hidden");
}
notification.find("form.mark-as-read button").click(function() {
notification.find(".text").addClass("hidden");
}
notification.find("form.mark-as-read button").click(function() {
ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": ids});
}
});
notification.find("a[class^='link-']").each(function() {
ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": ids});
}
});
notification.find("a[class^='link-']").each(function() {
* determine whether the notifications changed and need to be reloaded.
*/
function getNotificationHash() {
* determine whether the notifications changed and need to be reloaded.
*/
function getNotificationHash() {
* @returns All extracted IDs
*/
function getElementIds(notification, selector) {
* @returns All extracted IDs
*/
function getElementIds(notification, selector) {
$(selector, notification).each(function() {
elementIds.push($(this).text());
});
$(selector, notification).each(function() {
elementIds.push($(this).text());
});
- oldIds = getElementIds(oldNotification, ".new-sone-id");
- newIds = getElementIds(newNotification, ".new-sone-id");
+ var oldIds = getElementIds(oldNotification, ".new-sone-id");
+ var newIds = getElementIds(newNotification, ".new-sone-id");
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markSoneAsKnown(getSone(value), true);
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markSoneAsKnown(getSone(value), true);
- oldIds = getElementIds(oldNotification, ".post-id");
- newIds = getElementIds(newNotification, ".post-id");
+ var oldIds = getElementIds(oldNotification, ".post-id");
+ var newIds = getElementIds(newNotification, ".post-id");
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markPostAsKnown(getPost(value), true);
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markPostAsKnown(getPost(value), true);
- oldIds = getElementIds(oldNotification, ".reply-id");
- newIds = getElementIds(newNotification, ".reply-id");
+ var oldIds = getElementIds(oldNotification, ".reply-id");
+ var newIds = getElementIds(newNotification, ".reply-id");
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markReplyAsKnown(getReply(value), true);
$.each(oldIds, function(index, value) {
if ($.inArray(value, newIds) == -1) {
markReplyAsKnown(getReply(value), true);
ajaxGet("getNotifications.ajax", {}, function(data, textStatus) {
if (data && data.success) {
/* search for removed notifications. */
ajaxGet("getNotifications.ajax", {}, function(data, textStatus) {
if (data && data.success) {
/* search for removed notifications. */
- $("#sone #notification-area .notification").each(function() {
- notificationId = $(this).attr("id");
- foundNotification = false;
+ sone.find("#notification-area .notification").each(function() {
+ var notificationId = $(this).attr("id");
+ var foundNotification = false;
$.each(data.notifications, function(index, value) {
if (value.id == notificationId) {
foundNotification = true;
$.each(data.notifications, function(index, value) {
if (value.id == notificationId) {
foundNotification = true;
if (!foundNotification) {
if (notificationId == "new-sone-notification" && (data.options["ShowNotification/NewSones"] == true)) {
$(".new-sone-id", this).each(function(index, element) {
if (!foundNotification) {
if (notificationId == "new-sone-notification" && (data.options["ShowNotification/NewSones"] == true)) {
$(".new-sone-id", this).each(function(index, element) {
markSoneAsKnown(getSone(soneId), true);
});
} else if (notificationId == "new-post-notification" && (data.options["ShowNotification/NewPosts"] == true)) {
$(".post-id", this).each(function(index, element) {
markSoneAsKnown(getSone(soneId), true);
});
} else if (notificationId == "new-post-notification" && (data.options["ShowNotification/NewPosts"] == true)) {
$(".post-id", this).each(function(index, element) {
markPostAsKnown(getPost(postId), true);
});
} else if (notificationId == "new-reply-notification" && (data.options["ShowNotification/NewReplies"] == true)) {
$(".reply-id", this).each(function(index, element) {
markPostAsKnown(getPost(postId), true);
});
} else if (notificationId == "new-reply-notification" && (data.options["ShowNotification/NewReplies"] == true)) {
$(".reply-id", this).each(function(index, element) {
markReplyAsKnown(getReply(replyId), true);
});
}
$(this).slideUp("normal", function() {
$(this).remove();
/* remove activity when no notifications are visible. */
markReplyAsKnown(getReply(replyId), true);
});
}
$(this).slideUp("normal", function() {
$(this).remove();
/* remove activity when no notifications are visible. */
});
/* process notifications. */
$.each(data.notifications, function(index, value) {
});
/* process notifications. */
$.each(data.notifications, function(index, value) {
- oldNotification = getNotification(value.id);
- notification = ajaxifyNotification(createNotification(value.id, value.lastUpdatedTime, value.text, value.dismissable)).hide();
+ var oldNotification = getNotification(value.id);
+ var notification = ajaxifyNotification(createNotification(value.id, value.lastUpdatedTime, value.text, value.dismissable)).hide();
if (oldNotification.length != 0) {
if ((oldNotification.find(".short-text").length > 0) && (notification.find(".short-text").length > 0)) {
if (oldNotification.length != 0) {
if ((oldNotification.find(".short-text").length > 0) && (notification.find(".short-text").length > 0)) {
notification.find(".short-text").toggleClass("hidden", opened);
notification.find(".text").toggleClass("hidden", !opened);
}
notification.find(".short-text").toggleClass("hidden", opened);
notification.find(".text").toggleClass("hidden", !opened);
}
checkForRemovedReplies(oldNotification, notification);
oldNotification.replaceWith(notification.show());
} else {
checkForRemovedReplies(oldNotification, notification);
oldNotification.replaceWith(notification.show());
} else {
if (value.id.substring(0, 5) != "local") {
notification.slideDown();
setActivity();
if (value.id.substring(0, 5) != "local") {
notification.slideDown();
setActivity();
if (pagination.length > 0) {
return $(".current-page", paginationSelector).text();
}
if (pagination.length > 0) {
return $(".current-page", paginationSelector).text();
}
soneIds.push($(this).text());
});
return soneIds.join(",");
soneIds.push($(this).text());
});
return soneIds.join(",");
* exists on the page, <code>false</code> otherwise
*/
function hasReply(replyId) {
* exists on the page, <code>false</code> otherwise
*/
function hasReply(replyId) {
}
function loadNewPost(postId, soneId, recipientId, time) {
}
function loadNewPost(postId, soneId, recipientId, time) {
return;
}
ajaxGet("getPost.ajax", { "post" : postId }, function(data, textStatus) {
return;
}
ajaxGet("getPost.ajax", { "post" : postId }, function(data, textStatus) {
if ($(".post-author-local", newPost).text() == "true") {
newPost.removeClass("new");
}
if ($(".post-author-local", newPost).text() == "true") {
newPost.removeClass("new");
}
var firstNewerReply = null;
$(this).find(".replies .reply").each(function() {
if (getReplyTime(this) > data.reply.time) {
var firstNewerReply = null;
$(this).find(".replies .reply").each(function() {
if (getReplyTime(this) > data.reply.time) {
if ($(".reply-author-local", newReply).text() == "true") {
newReply.removeClass("new");
(function(newReply) {
if ($(".reply-author-local", newReply).text() == "true") {
newReply.removeClass("new");
(function(newReply) {
function markPostAsKnown(postElements, skipRequest) {
$(postElements).each(function() {
function markPostAsKnown(postElements, skipRequest) {
$(postElements).each(function() {
if ($(postElement).hasClass("new") || ((typeof skipRequest != "undefined"))) {
(function(postElement) {
$(postElement).removeClass("new");
if ($(postElement).hasClass("new") || ((typeof skipRequest != "undefined"))) {
(function(postElement) {
$(postElement).removeClass("new");
function markReplyAsKnown(replyElements, skipRequest) {
$(replyElements).each(function() {
function markReplyAsKnown(replyElements, skipRequest) {
$(replyElements).each(function() {
if ($(replyElement).hasClass("new") || ((typeof skipRequest != "undefined"))) {
(function(replyElement) {
$(replyElement).removeClass("new");
if ($(replyElement).hasClass("new") || ((typeof skipRequest != "undefined"))) {
(function(replyElement) {
$(replyElement).removeClass("new");
* user
*/
function createNotification(id, lastUpdatedTime, text, dismissable) {
* user
*/
function createNotification(id, lastUpdatedTime, text, dismissable) {
- notification = $("<div></div>").addClass("notification").attr("id", id).attr("lastUpdatedTime", lastUpdatedTime);
+ var notification = $("<div></div>").addClass("notification").attr("id", id).attr("lastUpdatedTime", lastUpdatedTime);
- $("#sone .notification#" + notificationId + " .text").removeClass("hidden");
- $("#sone .notification#" + notificationId + " .short-text").addClass("hidden");
+ sone.find(".notification#" + notificationId + " .text").removeClass("hidden");
+ sone.find(".notification#" + notificationId + " .short-text").addClass("hidden");
function deleteProfileField(fieldId) {
ajaxGet("deleteProfileField.ajax", {"formPassword": getFormPassword(), "field": fieldId}, function(data, textStatus) {
if (data && data.success) {
function deleteProfileField(fieldId) {
ajaxGet("deleteProfileField.ajax", {"formPassword": getFormPassword(), "field": fieldId}, function(data, textStatus) {
if (data && data.success) {
*/
function showOfflineMarker(visible) {
/* jQuery documentation says toggle() works the other way around?! */
*/
function showOfflineMarker(visible) {
/* jQuery documentation says toggle() works the other way around?! */
newElement.attr("class", oldElement.attr("class")).attr("name", oldElement.attr("name"));
oldElement.before(newElement).remove();
});
newElement.attr("class", oldElement.attr("class")).attr("name", oldElement.attr("name"));
oldElement.before(newElement).remove();
});
/* this initializes the status update input field. */
getTranslation("WebInterface.DefaultText.StatusUpdate", function(defaultText) {
registerInputTextareaSwap("#sone #update-status .status-input", defaultText, "text", false, false);
/* this initializes the status update input field. */
getTranslation("WebInterface.DefaultText.StatusUpdate", function(defaultText) {
registerInputTextareaSwap("#sone #update-status .status-input", defaultText, "text", false, false);
- $("#sone #update-status .select-sender").css("display", "inline");
- $("#sone #update-status .sender").hide();
- $("#sone #update-status .select-sender button").click(function() {
- $("#sone #update-status .sender").show();
- $("#sone #update-status .select-sender").hide();
+ sone.find("#update-status .select-sender").css("display", "inline");
+ sone.find("#update-status .sender").hide();
+ sone.find("#update-status .select-sender button").click(function() {
+ sone.find("#update-status .sender").show();
+ sone.find("#update-status .select-sender").hide();
- $("#sone #update-status").submit(function() {
- button = $("button:submit", this);
+ sone.find("#update-status").submit(function() {
+ var button = $("button:submit", this);
button.attr("disabled", "disabled");
if ($(this).find(":input.default:enabled").length > 0) {
return false;
}
button.attr("disabled", "disabled");
if ($(this).find(":input.default:enabled").length > 0) {
return false;
}
- sender = $(this).find(":input[name=sender]").val();
- text = $(this).find(":input[name=text]:enabled").val();
+ var sender = $(this).find(":input[name=sender]").val();
+ var text = $(this).find(":input[name=text]:enabled").val();
ajaxGet("createPost.ajax", { "formPassword": getFormPassword(), "sender": sender, "text": text }, function(data, textStatus) {
button.removeAttr("disabled");
});
ajaxGet("createPost.ajax", { "formPassword": getFormPassword(), "sender": sender, "text": text }, function(data, textStatus) {
button.removeAttr("disabled");
});
/* ajaxify input field on “view Sone” page. */
getTranslation("WebInterface.DefaultText.Message", function(defaultText) {
registerInputTextareaSwap("#sone #post-message input[name=text]", defaultText, "text", false, false);
/* ajaxify input field on “view Sone” page. */
getTranslation("WebInterface.DefaultText.Message", function(defaultText) {
registerInputTextareaSwap("#sone #post-message input[name=text]", defaultText, "text", false, false);
- $("#sone #post-message .select-sender").css("display", "inline");
- $("#sone #post-message .sender").hide();
- $("#sone #post-message .select-sender button").click(function() {
- $("#sone #post-message .sender").show();
- $("#sone #post-message .select-sender").hide();
+ sone.find("#post-message .select-sender").css("display", "inline");
+ sone.find("#post-message .sender").hide();
+ sone.find("#post-message .select-sender button").click(function() {
+ sone.find("#post-message .sender").show();
+ sone.find("#post-message .select-sender").hide();
- $("#sone #post-message").submit(function() {
- sender = $(this).find(":input[name=sender]").val();
- text = $(this).find(":input[name=text]:enabled").val();
+ sone.find("#post-message").submit(function() {
+ var sender = $(this).find(":input[name=sender]").val();
+ var text = $(this).find(":input[name=text]:enabled").val();
ajaxGet("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "sender": sender, "text": text });
$(this).find(":input[name=sender]").val(getCurrentSoneId());
$(this).find(":input[name=text]:enabled").val("").blur();
ajaxGet("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "sender": sender, "text": text });
$(this).find(":input[name=sender]").val(getCurrentSoneId());
$(this).find(":input[name=text]:enabled").val("").blur();
- getTranslation("WebInterface.Confirmation.DeletePostButton", function(text) {
- getTranslation("WebInterface.Confirmation.DeleteReplyButton", function(text) {
- getTranslation("WebInterface.DefaultText.Reply", function(text) {
- getTranslation("WebInterface.Button.Comment", function(text) {
- $("#sone .post").each(function() {
+ getTranslation("WebInterface.Confirmation.DeletePostButton", function() {
+ getTranslation("WebInterface.Confirmation.DeleteReplyButton", function() {
+ getTranslation("WebInterface.DefaultText.Reply", function() {
+ getTranslation("WebInterface.Button.Comment", function () {
+ sone.find(".post").each(function() {
postIds.push(getPostId(this));
});
updatePostTimes(postIds.join(","));
postIds.push(getPostId(this));
});
updatePostTimes(postIds.join(","));
/* hides all replies but the latest two. */
if (!isViewPostPage()) {
getTranslation("WebInterface.ClickToShow.Replies", function(text) {
/* hides all replies but the latest two. */
if (!isViewPostPage()) {
getTranslation("WebInterface.ClickToShow.Replies", function(text) {
$(allReplies[replyIndex]).addClass("hidden");
newHidden |= $(allReplies[replyIndex]).hasClass("new");
}
$(allReplies[replyIndex]).addClass("hidden");
newHidden |= $(allReplies[replyIndex]).hasClass("new");
}