+ <script language="javascript">
+ function recheckMoveButtons() {
+ $("#sone .profile-field").each(function() {
+ $(".move-up-field", this).toggleClass("hidden", $(this).prev(".profile-field").length == 0);
+ $(".move-down-field", this).toggleClass("hidden", $(this).next(".profile-field").length == 0);
+ });
+ }
+
+ $(function() {
+ getTranslation("WebInterface.DefaultText.FirstName", function(firstNameDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=first-name]", firstNameDefaultText, "first-name", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.MiddleName", function(middleNameDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=middle-name]", middleNameDefaultText, "middle-name", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.LastName", function(lastNameDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=last-name]", lastNameDefaultText, "last-name", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.BirthDay", function(birthDayDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=birth-day]", birthDayDefaultText, "birth-day", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.BirthMonth", function(birthMonthDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=birth-month]", birthMonthDefaultText, "birth-month", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.BirthYear", function(birthYearDefaultText) {
+ registerInputTextareaSwap("#sone #edit-profile input[name=birth-year]", birthYearDefaultText, "birth-year", true, true);
+ });
+ getTranslation("WebInterface.DefaultText.FieldName", function(fieldNameDefaultText) {
+ registerInputTextareaSwap("#sone #add-profile-field input[name=field-name]", fieldNameDefaultText, "field-name", false, true);
+ });
+
+ <%foreach fields field>
+ registerInputTextareaSwap("#sone #edit-profile input[name=field-<% loop.count>]", <% field.key|js>, "field-<% loop.count>", true, true);
+ <%/foreach>
+
+ /* hide all the labels. */
+ $("#sone #edit-profile label, #sone #add-profile-field label").hide();
+
+ /* ajaxify the delete buttons. */
+ getTranslation("Page.EditProfile.Fields.Button.ReallyDelete", function(reallyDeleteText) {
+ $("#sone #edit-profile .delete-field-name button").each(function() {
+ confirmButton = $(this).clone().addClass("hidden").addClass("confirm").text(reallyDeleteText).insertAfter(this);
+ (function(deleteButton, confirmButton) {
+ deleteButton.click(function() {
+ deleteButton.fadeOut("slow", function() {
+ confirmButton.fadeIn("slow");
+ $(document).one("click", function() {
+ if (this != confirmButton.get(0)) {
+ confirmButton.fadeOut("slow", function() {
+ deleteButton.fadeIn("slow");
+ });
+ }
+ return false;
+ });
+ });
+ return false;
+ });
+ confirmButton.click(function() {
+ confirmButton.fadeOut("slow");
+ buttonName = confirmButton.attr("name");
+ fieldId = buttonName.substring("delete-field-".length);
+ deleteProfileField(fieldId);
+ recheckMoveButtons();
+ return false;
+ });
+ })($(this), confirmButton);
+ });
+ });