Sha256: 4226c89f046ac4daaabd7420308b0cef52c6cfce13ee009a6359d7a8d52f963b
Contents?: true
Size: 1 KB
Versions: 38
Compression:
Stored size: 1 KB
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(); } }, listeners: function () { var listeners = []; if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) { // Turbolinks 5 if (Turbolinks.BrowserAdapter) { listeners.push('turbolinks:load'); } else { // Turbolinks < 5 listeners.push('page:load', 'DOMContentLoaded'); } } else { listeners.push('DOMContentLoaded'); } return listeners; } }; }(); // turbolinks triggers page:load events on page transition // If app isn't using turbolinks, this event will never be triggered, no prob. Blacklight.listeners().forEach(function(listener) { document.addEventListener(listener, function() { Blacklight.activate() }) }) $('.no-js').removeClass('no-js').addClass('js');
Version data entries
38 entries across 38 versions & 1 rubygems