Sha256: 156addbebf40c5f893520ab996a0554bad34b71665967dcaa4d7876432d05d36

Contents?: true

Size: 798 Bytes

Versions: 5

Compression:

Stored size: 798 Bytes

Contents

#= require_tree ./lib

#= require _page
#= require _link
#= require _form

class Wiselinks
  constructor: ($target = $('body'), @options = {}) ->
    this._try_jquery()

    @options = $.extend(this._defaults(), @options)
    if this.enabled()
      @page = new _Wiselinks.Page($target, @options)

  enabled: ->
    !History.emulated.pushState || @options.html4 == true

  load: (url, target, render = 'template') ->
    @page.load(url, target, render)

  reload: () ->
    @page.reload()
  
  _defaults: ->
    html4: true
    html4_root_path: '/'
    html4_normalize_path: true
    target_missing: null
    assets_digest: $("meta[name='assets-digest']").attr("content")

  _try_jquery: ->
    throw new Error("[Wiselinks] jQuery is not loaded") unless window.jQuery?

window.Wiselinks = Wiselinks

Version data entries

5 entries across 5 versions & 1 rubygems

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