X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=2d6c8ecbda64eb1bc08bb9be594b16454a01862d;hb=76e7a20f5212d9c202dbe92e958834ce3f99bd0e;hp=2decb696a9a4850f300f720ff2ab59489f377a20;hpb=74268996ef69be1af6166dac0ef5f38e58ed6ad5;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2decb69..2d6c8ec 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -500,7 +500,10 @@ function ajaxifyPost(postElement) { }); /* mark everything as known on click. */ - $(postElement).click(function() { + $(postElement).click(function(event) { + if ($(event.target).hasClass("click-to-show")) { + return false; + } markPostAsKnown(this); }); @@ -793,6 +796,7 @@ function markPostAsKnown(postElements) { (function(postElement) { $.getJSON("markPostAsKnown.ajax", {"formPassword": getFormPassword(), "post": getPostId(postElement)}, function(data, textStatus) { $(postElement).removeClass("new"); + $(".click-to-show", postElement).removeClass("new"); }); })(postElement); } @@ -894,6 +898,48 @@ function editProfileField(fieldId, newName, successFunction) { }); } +/** + * Moves the profile field with the given ID one slot in the given direction. + * + * @param fieldId + * The ID of the field to move + * @param direction + * The direction to move in (“up” or “down”) + * @param successFunction + * Function to call on success + */ +function moveProfileField(fieldId, direction, successFunction) { + $.getJSON("moveProfileField.ajax", {"formPassword": getFormPassword(), "field": fieldId, "direction": direction}, function(data, textStatus) { + if (data && data.success) { + successFunction(); + } + }); +} + +/** + * Moves the profile field with the given ID up one slot. + * + * @param fieldId + * The ID of the field to move + * @param successFunction + * Function to call on success + */ +function moveProfileFieldUp(fieldId, successFunction) { + moveProfileField(fieldId, "up", successFunction); +} + +/** + * Moves the profile field with the given ID down one slot. + * + * @param fieldId + * The ID of the field to move + * @param successFunction + * Function to call on success + */ +function moveProfileFieldDown(fieldId, successFunction) { + moveProfileField(fieldId, "down", successFunction); +} + // // EVERYTHING BELOW HERE IS EXECUTED AFTER LOADING THE PAGE //