diff --git a/public/javascripts/aspect-contacts.js b/public/javascripts/aspect-contacts.js index 85ceffcc8..ee00bd67f 100644 --- a/public/javascripts/aspect-contacts.js +++ b/public/javascripts/aspect-contacts.js @@ -3,16 +3,15 @@ * the COPYRIGHT file. */ -$("#edit_aspect_trigger").live("click", - function(){ +$("#edit_aspect_trigger").live("click", function() { EditPane.toggle(); - } -); +}); var EditPane = { setTranslations: function(translations) { EditPane.translations = translations; }, + toggle: function() { if( $("#edit_aspect_pane").hasClass("active") ) { EditPane.fadeOut(); @@ -21,22 +20,22 @@ var EditPane = { } }, - fadeIn: function(){ + fadeIn: function() { var trigger = $("#edit_aspect_trigger"); $("#edit_aspect_pane").addClass("active"); - $(".contact_pictures").fadeOut(200, function(){ + $(".contact_pictures").fadeOut(200, function() { $("#edit_aspect_pane").fadeIn(200); trigger.html(EditPane.translations.doneEditing); }); }, - fadeOut: function(){ + fadeOut: function() { var trigger = $("#edit_aspect_trigger"); trigger.html(EditPane.translations.editAspect); $("#edit_aspect_pane").removeClass("active"); - $("#edit_aspect_pane").fadeOut(200, function(){ + $("#edit_aspect_pane").fadeOut(200, function() { $(".contact_pictures").fadeIn(200); }); } diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 3b21d95b1..46087146d 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -49,8 +49,13 @@ var AspectEdit = { $.ajax({ type: "DELETE", url: "/requests/" + person.attr('data-guid'), - data: {"accept" : true, "aspect_id" : dropzone.attr('data-aspect_id') }, - success: function() { AspectEdit.onDeleteRequestSuccess(person, dropzone); } + data: { + "accept": true, + "aspect_id": dropzone.attr('data-aspect_id') + }, + success: function() { + AspectEdit.onDeleteRequestSuccess(person, dropzone); + } }); } @@ -59,11 +64,15 @@ var AspectEdit = { $.ajax({ url: "/aspects/move_contact/", data: { - "person_id" : person.attr('data-guid'), - "from" : person.attr('data-aspect_id'), - "to" : { "to" : dropzone.attr('data-aspect_id') } + "person_id": person.attr('data-guid'), + "from": person.attr('data-aspect_id'), + "to": { + "to": dropzone.attr('data-aspect_id') + } }, - success: function() { AspectEdit.onMovePersonSuccess(person, dropzone); } + success: function() { + AspectEdit.onMovePersonSuccess(person, dropzone); + } }); } @@ -86,8 +95,7 @@ var AspectEdit = { if( $(".person[data-guid='"+ person_id +"']").length == 1) { AspectEdit.alertUser("You cannot remove the person from the last aspect"); - } - else { + } else { if (!person.hasClass('request')) { $.ajax({ @@ -118,7 +126,11 @@ var AspectEdit = { $.ajax({ type: "PUT", url: link, - data: {"aspect" : {"name" : $this.text() }} + data: { + "aspect": { + "name" : $this.text() + } + } }); } //update all other aspect links @@ -159,13 +171,9 @@ var AspectEdit = { var old_request_count = request_html.match(/\d+/); if (old_request_count == 1) { - $new_requests.html( - request_html.replace(/ \(\d+\)/, '') - ); + $new_requests.html( request_html.replace(/ \(\d+\)/, '') ); } else { - $new_requests.html( - request_html.replace(/\d+/, old_request_count - 1) - ); + $new_requests.html( request_html.replace(/\d+/, old_request_count - 1) ); } }, diff --git a/public/javascripts/contact-list.js b/public/javascripts/contact-list.js index 6f544ac05..4c5405380 100644 --- a/public/javascripts/contact-list.js +++ b/public/javascripts/contact-list.js @@ -4,10 +4,10 @@ */ -$(document).ready( function(){ +$(document).ready(function() { var List = { - initialize: function(){ - $(".contact_list_search").keyup(function(e){ + initialize: function() { + $(".contact_list_search").keyup(function(e) { var search = $(this); var list = $(this).siblings("ul").first(); var query = new RegExp(search.val(),'i'); @@ -65,10 +65,10 @@ $(document).ready( function(){ $(this).fadeTo(200,1); }); - $('.added').live('mouseover', function(){ + $('.added').live('mouseover', function() { $(this).addClass("remove"); $(this).children("img").attr("src","/images/icons/monotone_close_exit_delete.png"); - }).live('mouseout', function(){ + }).live('mouseout', function() { $(this).removeClass("remove"); $(this).children("img").attr("src","/images/icons/monotone_check_yes.png"); }); diff --git a/public/javascripts/custom-mobile-scripting.js b/public/javascripts/custom-mobile-scripting.js index 60d555ef9..1bd9eec42 100644 --- a/public/javascripts/custom-mobile-scripting.js +++ b/public/javascripts/custom-mobile-scripting.js @@ -3,8 +3,8 @@ * the COPYRIGHT file. */ -$(document).bind("mobileinit", function(){ - $.extend( $.mobile , { +$(document).bind("mobileinit", function() { + $.extend($.mobile, { ajaxLinksEnabled : false, ajaxFormsEnabled : false }); diff --git a/public/javascripts/mobile.js b/public/javascripts/mobile.js index 65e8de4d4..616b145c6 100644 --- a/public/javascripts/mobile.js +++ b/public/javascripts/mobile.js @@ -4,16 +4,16 @@ */ var Mobile = { - initialize : function(){ + initialize: function() { $('#aspect_picker').change(Mobile.changeAspect); }, - changeAspect : function() { + changeAspect: function() { Mobile.windowLocation('/aspects/' + $('#aspect_picker option:selected').val()); }, - windowLocation : function(url) { + windowLocation: function(url) { window.location = url; - }, + } }; diff --git a/public/javascripts/photo-show.js b/public/javascripts/photo-show.js index 55df7d9d1..66611bb5d 100644 --- a/public/javascripts/photo-show.js +++ b/public/javascripts/photo-show.js @@ -3,7 +3,7 @@ * the COPYRIGHT file. */ -$(document).ready( function(){ +$(document).ready(function() { //edit photo $("#edit_photo_toggle").bind('click', function(evt) { @@ -36,26 +36,19 @@ $(document).ready( function(){ $('.make_profile_photo').bind('ajax:loading', function(data, json, xhr) { var person_id = $(this).closest(".photo_options").attr('data-actor_person'); - $("img[data-person_id='"+ person_id +"']").each( function() { - $(this).fadeTo(200,0.3); - }); + $("img[data-person_id='" + person_id + "']").fadeTo(200, 0.3); }); $('.make_profile_photo').bind('ajax:success', function(data, json, xhr) { json = $.parseJSON(json); - $("img[data-person_id='"+ json['person_id'] +"']").each( function() { - $(this).fadeTo(200,1); - this.src = json['image_url_small']; - }); + $("img[data-person_id='" + json['person_id'] + "']").fadeTo(200, 1).attr('src', json.image_url_small); }); $('.make_profile_photo').bind('ajax:failure', function(data, json, xhr) { var person_id = $(this).closest(".photo_options").attr('data-actor_person'); alert("Failed to update profile photo!"); - $("img[data-person_id='"+ person_id +"']").each( function() { - $(this).fadeTo(200,1); - }); + $("img[data-person_id='" + person_id + "']").fadeTo(200, 1); }); }); diff --git a/public/javascripts/rails.js b/public/javascripts/rails.js index 99e20ea8e..8fbc9ca87 100644 --- a/public/javascripts/rails.js +++ b/public/javascripts/rails.js @@ -1,17 +1,19 @@ /* Clear form plugin - called using $("elem").clearForm(); */ $.fn.clearForm = function() { return this.each(function() { - var type = this.type, tag = this.tagName.toLowerCase(); - if (tag == 'form') - return $(':input',this).clearForm(); - if (type == 'text' || type == 'password' || tag == 'textarea') - this.value = ''; - else if (type == 'checkbox' || type == 'radio') - this.checked = false; - else if (tag == 'select') - this.selectedIndex = -1; - else if (this.name == 'photos[]') - this.value = ''; + var type = this.type, tag = this.tagName.toLowerCase(); + if (tag == 'form') { + return $(':input',this).clearForm(); + } + if (type == 'text' || type == 'password' || tag == 'textarea') { + this.value = ''; + } else if (type == 'checkbox' || type == 'radio') { + this.checked = false; + } else if (tag == 'select') { + this.selectedIndex = -1; + } else if (this.name == 'photos[]') { + this.value = ''; + } $(this).blur(); }); };