Sha256: 5e535e5031a4517bb986de6a3fae6bccce1e2ebd34a77ec4d27194b76e883901

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

class Link
  constructor: (@page, @$link) ->

  allows_process: (event) ->
    !(this._cross_origin_link(event.currentTarget) ||
      this._non_standard_click(event))

  process: ->
    type = if (@$link.data('push') == 'partial')
      'partial'
    else
      'template'

    @page.load(@$link.attr("href"), @$link.data('target'), type)

  # We split host because IE returns host with port and other browsers not
  #
  _cross_origin_link: (link) ->
    (location.protocol != link.protocol) ||
    (location.port != link.port) ||
    (location.host.split(':')[0] != link.host.split(':')[0])

  _non_standard_click: (event) ->
    event.metaKey || event.ctrlKey || event.shiftKey || event.altKey

window._Wiselinks = {} if window._Wiselinks == undefined
window._Wiselinks.Link = Link

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wiselinks-0.7.3 lib/assets/javascripts/_link.js.coffee
wiselinks-0.7.2 lib/assets/javascripts/_link.js.coffee
wiselinks-0.7.1 lib/assets/javascripts/_link.js.coffee