Sha256: 932af0cf61db52381f11de830cdae4b920e36c303015e6538faea1348238bdd8

Contents?: true

Size: 881 Bytes

Versions: 13

Compression:

Stored size: 881 Bytes

Contents

Blacklight = function() {
  var buffer = new Array;
  return {
    onLoad: function(func) {
      buffer.push(func);
    },

    activate: function() {
      for(var i = 0; i < buffer.length; i++) {
        buffer[i].call();
      }
    }
  };
}();

// turbolinks triggers page:load events on page transition
// If app isn't using turbolinks, this event will never be triggered, no prob.
// $(document).on('ready') is deprecated in JQuery 1.8
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
  // Turbolinks 5
  if (Turbolinks.BrowserAdapter) {
    $(document).on('turbolinks:load', function() { Blacklight.activate(); });
  } else {
    // Turbolinks < 5
    $(document).on('page:load', function() { Blacklight.activate(); });
    $(document).ready(function() { Blacklight.activate(); });
  }
} else {
  $(document).ready(function() { Blacklight.activate(); });
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-6.25.0 app/assets/javascripts/blacklight/core.js
blacklight-6.24.0 app/assets/javascripts/blacklight/core.js
blacklight-6.23.0 app/assets/javascripts/blacklight/core.js
blacklight-6.22.0 app/assets/javascripts/blacklight/core.js
blacklight-6.21.0 app/assets/javascripts/blacklight/core.js
blacklight-6.20.0 app/assets/javascripts/blacklight/core.js
blacklight-6.19.2 app/assets/javascripts/blacklight/core.js
blacklight-6.19.1 app/assets/javascripts/blacklight/core.js
blacklight-6.19.0 app/assets/javascripts/blacklight/core.js
blacklight-6.18.0 app/assets/javascripts/blacklight/core.js
blacklight-6.17.0 app/assets/javascripts/blacklight/core.js
blacklight-6.16.0 app/assets/javascripts/blacklight/core.js
blacklight-6.15.0 app/assets/javascripts/blacklight/core.js