Sha256: 562c6c7908cb20a7d4824ad8ecfa9e4a5412d8900f112f023c0679d039a483d0
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
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) _cross_origin_link: (link) -> this._different_protocol(link) || this._different_host(link) || this._different_port(link) _different_protocol: (link) -> location.protocol != link.protocol # IE returns host with port and all other browsers return host without port # _different_host: (link) -> (location.host.split(':')[0] != link.host.split(':')[0]) # IE returns for link.port "80" but the location.port is "" # Stupid but "modern" browsers return correct values # _different_port: (link) -> port_equals = (location.port == link.port) || (location.port == "" && link.port == "80") !port_equals _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-1.0.0 | lib/assets/javascripts/_link.js.coffee |