85 lines
1.6 KiB
CoffeeScript
85 lines
1.6 KiB
CoffeeScript
|
|
#= require jquery
|
|
#= require ./shared/jquery-ui
|
|
#= require twitter/bootstrap
|
|
#= require jquery_ujs
|
|
|
|
#= require ./note_files/ajquery.ui.widget
|
|
#= require ./note_files/jquery.fileupload
|
|
|
|
|
|
|
|
#= require redactor
|
|
|
|
|
|
|
|
$(document).on "scroll", () ->
|
|
|
|
if( $(this).scrollTop() <= 40 )
|
|
top = 50 - $(this).scrollTop()
|
|
else
|
|
top = 0
|
|
|
|
$("#toolbar-text, .fix-submit").css
|
|
top : top
|
|
|
|
|
|
@init_user_images = ->
|
|
$(".images .user_image").click ->
|
|
src = undefined
|
|
src = $(this).data("src-large")
|
|
$("#message_form .content").redactor('insert.html', "<img src=\"" + src + "\" />");
|
|
false
|
|
|
|
return
|
|
|
|
editor = new Array()
|
|
$(document).ready ->
|
|
|
|
$(".user_images").on "click", (event) ->
|
|
$(this).toggleClass("open")
|
|
|
|
|
|
$(".redactor_editor").on "click", "img", (event) ->
|
|
event.stopPropagation()
|
|
return
|
|
|
|
|
|
|
|
#upload
|
|
drop = $(".user_images")
|
|
$(".user_images .fileupload").fileupload
|
|
url: $(this).attr("action")
|
|
dropZone: drop
|
|
autoUpload: true
|
|
progressall: (e, data) ->
|
|
progress = parseInt(data.loaded / data.total * 100, 10)
|
|
if progress is 100
|
|
$(this).find(".progress").html "traitement en cours."
|
|
else
|
|
$(this).find(".progress").html progress + "% téléchargé."
|
|
return
|
|
|
|
always: (e, data) ->
|
|
$(this).find(".progress").html ""
|
|
return
|
|
|
|
drop: (e, data) ->
|
|
|
|
drop.css "background", "white"
|
|
return
|
|
|
|
drop.bind "dragover", (e) ->
|
|
$(this).css "background", "#B7DF63"
|
|
return
|
|
|
|
drop.bind "dragleave", (e) ->
|
|
$(this).css "background", "white"
|
|
return
|
|
|
|
$(".user_images .add_files").on "click", ->
|
|
$(this).next("input").click()
|
|
false
|
|
|
|
return
|