-# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - content_for :head do :javascript function createUploader(){ var uploader = new qq.FileUploaderBasic({ element: document.getElementById('file-upload'), params: {'photo' : {'pending' : true, 'aspect_ids' : "all", 'set_profile_photo': true}}, allowedExtensions: ['jpg', 'jpeg', 'png'], action: "#{photos_path}", button: document.getElementById('file-upload'), sizeLimit: 4194304, onProgress: function(id, fileName, loaded, total){ var progress = Math.round(loaded / total * 100 ); $('#fileInfo').text(fileName + ' ' + progress + '%'); }, messages: { typeError: "#{t('photos.new_photo.invalid_ext')}", sizeError: "#{t('photos.new_photo.size_error')}", emptyError: "#{t('photos.new_photo.empty')}" }, onSubmit: function(id, fileName){ $('#file-upload').addClass("loading"); $("#profile_photo_upload").find(".avatar").addClass('loading'); $("#file-upload-spinner").removeClass("hidden"); }, onComplete: function(id, fileName, result){ $("#file-upload-spinner").addClass("hidden"); $('#fileInfo').text(fileName + ' completed').fadeOut(2000); $('#file-upload').removeClass("loading"); location.reload(); } }); } window.onload = createUploader; #profile_photo_upload = owner_image_tag(:thumb_medium) #file-upload.button =t('.upload') = image_tag('mobile-spinner.gif', :class => 'hidden', :style => "z-index:-1", :id => 'file-upload-spinner') %p #fileInfo #publisher_photo_upload