diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index d1605d8ab..dc9c287ad 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -8,9 +8,9 @@ .span-15.append-1.last #photo_controls .right - =link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch' + =link_to "← #{t('previous')}", @prev_photo, :rel => 'prefetch', :id => 'photo_show_left' \/ - =link_to "#{t('next')} →", @next_photo, :rel => 'prefetch' + =link_to "#{t('next')} →", @next_photo, :rel => 'prefetch', :id => 'photo_show_right' - if @photo.status_message_id =link_to "← #{t('.view_original_post')}", @photo.status_message diff --git a/public/javascripts/photo-show.js b/public/javascripts/photo-show.js index 55df7d9d1..1e348c849 100644 --- a/public/javascripts/photo-show.js +++ b/public/javascripts/photo-show.js @@ -23,7 +23,7 @@ $(document).ready( function(){ $("#show_photo").find("img").fadeTo(200,1); $("#photo_spinner").hide(); }); - + $('.edit_photo').bind('ajax:success', function(data, json, xhr) { json = $.parseJSON(json); $(".edit_photo input[type='text']").val(json['photo']['caption']); @@ -58,4 +58,17 @@ $(document).ready( function(){ }); }); + // right/left hotkeys + $(document).keyup(function(e){ + //left + if(e.keyCode == 37) { + document.location = $("#photo_show_left").attr('href'); + + //right + } else if(e.keyCode == 39) { + document.location = $("#photo_show_right").attr('href'); + + } + }); + }); diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 68cbe95d3..93a2641f8 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -302,8 +302,6 @@ li.message :color #777 .from - :margin - :bottom 5px h4 :display inline a