X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=8029ccc58f8c18bd4845babf839c9cbf4fd3def0;hb=b8aa22ff7725d69f126c4dfe838c7ce4b5ea3e2d;hp=2decb696a9a4850f300f720ff2ab59489f377a20;hpb=0a135cf48d060e43377c6cc56a73addf092ef536;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 2decb69..8029ccc 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -894,6 +894,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 //