diff options
author | Robert Speicher <robert@gitlab.com> | 2017-01-05 21:59:34 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2017-01-10 00:12:16 +0300 |
commit | 68f8e3c962f4d321655bf7930b2d883654ae8757 (patch) | |
tree | 887f7531306af0f1ae533839e20e23eb756c8019 /vendor | |
parent | bdc36887e09c07473c8d8df6f8a5a22c64939865 (diff) |
Merge branch 'patch-turbolinks' into 'security'
Updated Turbolinks to patched version of turbolinks-classic
See merge request !2048
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/assets/javascripts/jquery.turbolinks.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vendor/assets/javascripts/jquery.turbolinks.js b/vendor/assets/javascripts/jquery.turbolinks.js new file mode 100644 index 00000000000..fd6e95e75d5 --- /dev/null +++ b/vendor/assets/javascripts/jquery.turbolinks.js @@ -0,0 +1,49 @@ +// Generated by CoffeeScript 1.7.1 + +/* +jQuery.Turbolinks ~ https://github.com/kossnocorp/jquery.turbolinks +jQuery plugin for drop-in fix binded events problem caused by Turbolinks + +The MIT License +Copyright (c) 2012-2013 Sasha Koss & Rico Sta. Cruz + */ + +(function() { + var $, $document; + + $ = window.jQuery || (typeof require === "function" ? require('jquery') : void 0); + + $document = $(document); + + $.turbo = { + version: '2.1.0', + isReady: false, + use: function(load, fetch) { + return $document.off('.turbo').on("" + load + ".turbo", this.onLoad).on("" + fetch + ".turbo", this.onFetch); + }, + addCallback: function(callback) { + if ($.turbo.isReady) { + callback($); + } + return $document.on('turbo:ready', function() { + return callback($); + }); + }, + onLoad: function() { + $.turbo.isReady = true; + return $document.trigger('turbo:ready'); + }, + onFetch: function() { + return $.turbo.isReady = false; + }, + register: function() { + $(this.onLoad); + return $.fn.ready = this.addCallback; + } + }; + + $.turbo.register(); + + $.turbo.use('page:load', 'page:fetch'); + +}).call(this); |