Use jquery id selector

This commit is contained in:
Raphael 2010-11-01 16:45:09 -07:00
parent de52e59727
commit 47f040f740
2 changed files with 4 additions and 4 deletions

View file

@ -5,7 +5,7 @@
:javascript :javascript
function createUploader(){ function createUploader(){
var uploader = new qq.FileUploader({ var uploader = new qq.FileUploader({
element: document.getElementById('file-upload'), element: $('#file-upload'),
params: {'photo' : { 'album_id' : "#{album_id}", 'to' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"}, params: {'photo' : { 'album_id' : "#{album_id}", 'to' : "#{aspect_id}"}, 'set_profile_image' : "#{set_profile_image if defined?(set_profile_image)}"},
allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
action: "#{photos_path}" action: "#{photos_path}"

View file

@ -8,12 +8,12 @@ $(document).keydown(function(e){
switch(e.keyCode) { switch(e.keyCode) {
case 37: case 37:
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
window.location = document.getElementById("prev_photo").href; window.location = $("#prev_photo").attr('href');
} }
break; break;
case 39: case 39:
if(!$("textarea").hasClass("hasfocus")){ if(!$("textarea").hasClass("hasfocus")){
window.location = document.getElementById("next_photo").href; window.location = $("#next_photo").attr('href');
} }
break; break;
} }
@ -41,7 +41,7 @@ $(document).ready(function(){
var method = $edit_photo.attr("method"); var method = $edit_photo.attr("method");
var url = $edit_photo.attr("action"); var url = $edit_photo.attr("action");
var data = $edit_photo.serialize(); var data = $edit_photo.serialize();
$(".description").text(document.getElementById("photo_caption").value); $(".description").text($("#photo_caption").val());
$edit_photo.toggle(); $edit_photo.toggle();
$.ajax({ $.ajax({