Sha256: 52cc558bb971a5d02a9586e14be011b93231d9f69580be87dd0dc280e7e0962f

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

$(document).ready ->
  background = $("body").data("background-image")
  background_tile = $("body").data("background-tile")
  background_blur = $("body").data("background-blur")
  logo = $("body").data("logo-image")

  $("a.logo div").css("background-image", "url(" + (if logo? then logo else "<%= asset_path('almanac/logo.jpg') %>") + ")")

  if background_tile
    $("body.almanac").css("background-image", "url(" + (if background? then background else "<%= asset_path('almanac/background.jpg') %>") + ")")
  else
    image = new Image()
    options = { amount: background_blur }

    image.onload = ->
      Pixastic.process (Pixastic.process image, "blurfast", options), "blur", options
      $.backstretch options.resultCanvas.toDataURL('image/png')

    image.src = if background? then background else "<%= asset_path('almanac/background.jpg') %>"

  $(".custom-upload input[type=file]").change ->
    $("#new_image input[type=submit]").show()
    $(this).next().find("input").val $(this).val()

  $("a.popup").click (e) ->
    e.preventDefault()
    window.open(this.href, "mywindow","width=600,height=300")

  $("a.add-photo").click (e) ->
    e.preventDefault()
    $("#post_body").val($("#post_body").val() + "\n\n![](" + $(this).data("image") + ")\n\n")

  $(".delete-post").bind ("ajax:success"), ->
    post = $(this).parent().parent()
    if post.prev().attr('class') is "head" and post.next().attr('class') is "head"
      post.prev().fadeOut()
    post.fadeOut()

  $(".delete-comment").bind ("ajax:success"), ->
    comment = $(this).parent().parent()
    if comment.prev().prop("tagName") is "H4" and comment.next().prop("tagName") is "HR"
      comment.prev().fadeOut()
      comment.next().fadeOut()
    comment.fadeOut()

  $('.datepicker').datepicker({ format: 'yyyy-mm-dd' })

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
almanac-0.4.5 app/assets/javascripts/almanac/5-main.coffee.erb
almanac-0.4.4 app/assets/javascripts/almanac/5-main.coffee.erb