Skip to content

Instantly share code, notes, and snippets.

@jondkinney
Created July 25, 2013 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondkinney/6081225 to your computer and use it in GitHub Desktop.
Save jondkinney/6081225 to your computer and use it in GitHub Desktop.
$ ->
$('#entry_description').simplyCountable()
$(document).on "mouseover", "*[data-zc-copy-value]", ->
that = $(this)
width = that.outerWidth()
height = that.outerHeight()
if that.data("zc-activated") isnt "true"
# init new ZeroClipboard client
clip = new ZeroClipboard.Client()
clip.setHandCursor true
clip.setText that.data("zc-copy-value")
flash_movie = "<div>" + clip.getHTML(width, height) + "</div>"
# make your own div with your own css property and not use clip.glue()
flash_movie = $(flash_movie).css(
position: "relative"
marginTop: -height
width: width
height: height
zIndex: that.css("zIndex") + 1
)
# delegate mouse states (use the .hover/.active class instead of :hover/:active)
flash_movie.hover(->
that.addClass "hover"
, ->
that.removeClass "hover"
).mousedown(->
that.addClass "active"
index_val = that.data("index-value")
console.log index_val
$(".copy_text#{index_val}").text("Emails Copied")
).mouseup ->
that.removeClass "active"
# add flash overlay
# if you want to put before and not after, then you have to change the marginTop to marginBottom
that.after(flash_movie).data "zc-activated", "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment