diff --git a/public/javascripts/view.js b/public/javascripts/view.js
index a129330ca..62efa5364 100644
--- a/public/javascripts/view.js
+++ b/public/javascripts/view.js
@@ -49,13 +49,13 @@ $(document).ready(function(){
);
$("#publisher").find("textarea").keydown( function(e) {
- if (e.keyCode == 13) {
+ if (e.keyCode === 13) {
$(this).closest("form").submit();
}
});
$("#stream").delegate("textarea.comment_box", "keydown", function(e){
- if (e.keyCode == 13) {
+ if (e.keyCode === 13) {
$(this).closest("form").submit();
}
});
@@ -101,26 +101,29 @@ $.fn.clearForm = function() {
var video_active_container = null;
function openVideo(type, videoid, link) {
- var container = document.createElement('div');
+ var container = document.createElement('div'),
+ $container = $(container);
if(type == 'youtube.com') {
- container.innerHTML = 'Watch this video on Youtube
';
+ $container.html('Watch this video on Youtube
');
} else {
- container.innerHTML = 'Invalid videotype '+type+' (ID: '+videoid+')';
+ $container.html('Invalid videotype '+type+' (ID: '+videoid+')');
}
if(video_active_container != null) {
video_active_container.parentNode.removeChild(video_active_container);
}
video_active_container = container;
- $(container).hide();
+ $container.hide();
link.parentNode.insertBefore(container, this.nextSibling);
- $(container).slideDown('fast', function() { });
- link.onclick = function() { $(container).slideToggle('fast', function() { } ); }
+ $container.slideDown('fast', function() { });
+ link.onclick = function() { $container.slideToggle('fast', function() { } ); }
}
$(".make_profile_photo").live("click", function(){
- var user_id = $(this).closest(".controls").attr('data-actor');
- person_id = $(this).closest(".controls").attr('data-actor_person');
- photo_url = $(this).closest(".controls").attr('data-image_url');
+ var $this = $(this),
+ $controls = $this.closest(".controls"),
+ user_id = $controls.attr('data-actor');
+ person_id = $controls.attr('data-actor_person');
+ photo_url = $controls(".controls").attr('data-image_url');
$.ajax({
type: "PUT",
@@ -128,7 +131,7 @@ $(".make_profile_photo").live("click", function(){
data: {"person":{"profile":{ "image_url": photo_url }}},
success: function(){
$("img[data-person_id='"+ person_id +"']").each( function() {
- $(this).attr('src', photo_url);
+ this.src = photo_url;
});
}
});