Sha256: d1c26582dcb3cd927d1c5404cae75ca1febb4978d55df3404e6b14ca727cddf7

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 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.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

1 entries across 1 versions & 1 rubygems

Version Path
wiselinks-0.7.0 lib/assets/javascripts/_link.js.coffee