Sha256: ebd98af2c2a09c77e992922ec1479d096d03523e3e7084f23f2dee5d2bfe2214

Contents?: true

Size: 1.74 KB

Versions: 53

Compression:

Stored size: 1.74 KB

Contents

try
  window.addEventListener "load", (->

    # get mouse coords at window.
    window.onmousemove = (e) ->
      mouseX = undefined
      mouseY = undefined
      if e
        mouseX = e.pageX
        mouseY = e.pageY
      else
        mouseX = event.pageX + document.body.scrollLeft
        mouseY = event.pageY + document.body.scrollTop
      document.getElementById("mouseX").value = mouseX
      document.getElementById("mouseY").value = mouseY


    # get scroll amount.
    window.onscroll = ->
      scrollX = document.documentElement.scrollLeft
      scrollY = document.documentElement.scrollTop
      document.getElementById("scrollX").value = scrollX
      document.getElementById("scrollY").value = scrollY


    # get mouse coords at targetDiv.
    document.getElementById("js-target-field").onmousemove = (e) ->
      mouseX = undefined
      mouseY = undefined
      offsetX = 0
      offsetY = 0
      element = this
      while element
        offsetX += element.offsetLeft
        offsetY += element.offsetTop
        element = element.offsetParent
      if e
        mouseX = e.pageX - offsetX
        mouseY = e.pageY - offsetY
      else
        mouseX = event.pageX + document.body.scrollLeft - offsetX
        mouseY = event.pageY + document.body.scrollTop - offsetY
      document.getElementById("divMouseX").value = mouseX
      document.getElementById("divMouseY").value = mouseY


    # get Window Size.
    window.onresize = (e) ->
      w = window.innerWidth
      h = window.innerHeight
      document.getElementById("windowW").value = w
      document.getElementById("windowH").value = h

    document.getElementById("windowW").value = window.innerWidth
    document.getElementById("windowH").value = window.innerHeight
    prettyPrint()
  ), false

Version data entries

53 entries across 53 versions & 2 rubygems

Version Path
middleman-oulu-0.6.7 assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.6 assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.5 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.6.5 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.6.4 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.4 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.6.3 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.3 assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.2 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.6.2 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.6.1 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.6.0 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.5.37 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.5.37 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.5.36 assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.5.35 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.5.34 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.5.33 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee
middleman-oulu-0.5.32 assets/javascripts/oulu/dev/positions-pp.js.coffee
oulu-rails-0.5.32 vendor/assets/javascripts/oulu/dev/positions-pp.js.coffee