Sha256: 4253f498cf0af7c9e741c3c3c0dc2087de09faa7ce073a1a24e0b19443726433

Contents?: true

Size: 1.55 KB

Versions: 14

Compression:

Stored size: 1.55 KB

Contents

$(document).on "turbolinks:load", ->

  $(".open_more").click (e) ->
    e.preventDefault()
    $(this).next('.details').toggle()
    return

  $(".onclick_open_backdrop").click (e) ->
    e.preventDefault()
    $(this).children('.snowflake_popover').popover('show')
    $('.popover_backdrop').show()
    return

  $(document).on "click", ".close, .popover_backdrop", (e) ->
    e.preventDefault()
    $('.snowflake_popover').popover('hide')
    $('.popover_backdrop').hide()
    return

  $('[data-toggle="popover"]').popover
    html: true
    trigger: 'manual'
    content: ->
      $(this).children('.popover_content').html()

  debounceIntervalMs = ->
    return 240

  shiftUrl = (url, regex, shifts) ->
    change = (str, p1, p2, offset, text) ->
      return p1 + (parseInt(p2) + parseInt(shifts))

    text = String(url)
    return text.replace regex, change
    
  $("a.debounce_this").click (e) ->
    e.preventDefault()

    if !window.forwardShiftAmount?
      window.forwardShiftAmount = 0
    if window.debounceTimeout?
      clearTimeout(window.debounceTimeout)
      window.forwardShiftAmount = window.forwardShiftAmount + if (e.currentTarget.dataset.directionForward == 'true') then 1 else -1
      console.log(window.forwardShiftAmount)

    regex = new RegExp("(" + e.currentTarget.dataset.debounceParam + "=)(-?\\d+)", "g")
    delayedPageChange = ->
      location.href = newHref

    newHref = shiftUrl(e.currentTarget.href, regex, window.forwardShiftAmount)
    window.debounceTimeout = setTimeout(delayedPageChange, debounceIntervalMs())
    return

  return

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
candl-0.1.14 app/assets/javascripts/calendar.coffee
candl-0.1.13 app/assets/javascripts/calendar.coffee
candl-0.1.12 app/assets/javascripts/calendar.coffee
candl-0.1.11 app/assets/javascripts/calendar.coffee
candl-0.1.10 app/assets/javascripts/calendar.coffee
candl-0.1.9 app/assets/javascripts/candl/calendar.coffee
candl-0.1.8 app/assets/javascripts/candl/calendar.coffee
candl-0.1.7 app/assets/javascripts/candl/calendar.coffee
candl-0.1.6 app/assets/javascripts/candl/calendar.coffee
candl-0.1.5 app/assets/javascripts/candl/calendar.coffee
candl-0.1.4 app/assets/javascripts/candle/calendar.coffee
candl-0.1.3 app/assets/javascripts/candle/calendar.coffee
candl-0.1.2 app/assets/javascripts/candle/calendar.coffee
candl-0.1.0 app/assets/javascripts/candle/calendar.coffee