active_frontend 17.6.3 → 17.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6884b295858c037f5dd9498f46c690f1f8c26e41b9a810f51b35115a422bb2fd
4
- data.tar.gz: 2c6aab3a692b80db4d6bcf180c6962c0b68dcaa5055343341c96f950da8a02d4
3
+ metadata.gz: ebded1681d93f6687ccd1b1786557a175cd28faaaf2987da63c09947c6c89f7b
4
+ data.tar.gz: 9b8c5aa18366001bfd83ca8fa7fb5f81252f8aeb383da67d8f02d79f3ab4bd1b
5
5
  SHA512:
6
- metadata.gz: d31eeed3f6b6b09b1365a19481b989ad2e19dd26c37bef7107a86bff2422caef436f9acb47d6db63befd2bb43f5ef6a794afb0428aa8fa5356b8be815ef46cc0
7
- data.tar.gz: 4945c8d016ebe8c5271a99dd3da75799eeb3aecde0de2c315482dbb64bafdde273d1927418de6320f4081c71be22940941e88bf944fdfef75b4aa245889c7abe
6
+ metadata.gz: b1505790d454c1a0252c6b7c4ada2a172001d121b8fca4006985c21451fb38ad1af46e177662ae9e444180b6432eab4d7b6763fad1c7b436a18fe243bcbf5593
7
+ data.tar.gz: 3d63a1eabec401c64e48fe5e7fde11845a5932170aa6339c50aace70d28087d2959f7d2a8b9e7c080222917c30259fe7f792426bd33da1d8cd5ee6cd1513ec6a
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveFrontend
4
- VERSION ||= '17.6.3'
4
+ VERSION ||= '17.7.0'
5
5
  end
@@ -1,8 +1,14 @@
1
1
  // Table of Contents
2
2
  // ==================================================
3
+ // Global Imports
3
4
  // Base Imports
4
5
  // Extension Imports
5
6
  //
7
+ // Global Imports
8
+ // ==================================================
9
+ //= require extensions/_initialize
10
+ //= require extensions/_throttle_and_debounce
11
+ //
6
12
  // Base Imports
7
13
  // ==================================================
8
14
  //= require base/_animation
@@ -115,18 +115,27 @@
115
115
  // HOVERDOWN DATA-API
116
116
  // ==================
117
117
 
118
- $(document).on('ready.bs.hoverdown.data-api', function () {
119
- $('[data-hover="dropdown"]').each(function () {
120
- var $this = $(this);
121
- if ($this.data('hoverdown')) return;
122
- Plugin.call($this, $this.data());
123
- });
124
- }).on('DOMCharacterDataModified.bs.hoverdown.data-api DOMSubtreeModified.bs.hoverdown.data-api DOMNodeInserted.bs.hoverdown.data-api', function () {
125
- $('[data-hover="dropdown"]').each(function () {
126
- var $this = $(this);
127
- if ($this.data('hoverdown')) return;
128
- Plugin.call($this, $this.data());
129
- });
118
+ function PluginCall(_this) {
119
+ var $this = $(_this);
120
+ if ($this.data('hoverdown')) return;
121
+ Plugin.call($this, $this.data());
122
+ }
123
+
124
+ if ($.fn.initialize) {
125
+ $.initialize('[data-hover="dropdown"]', function() {
126
+ PluginCall(this);
130
127
  });
128
+ } else {
129
+ $(document)
130
+ .on('ready.bs.hoverdown.data-api', function () {
131
+ $('[data-hover="dropdown"]').each(function () {
132
+ PluginCall(this);
133
+ });
134
+ }).on('DOMCharacterDataModified.bs.hoverdown.data-api DOMSubtreeModified.bs.hoverdown.data-api DOMNodeInserted.bs.hoverdown.data-api', function () {
135
+ $('[data-hover="dropdown"]').each(function () {
136
+ PluginCall(this);
137
+ });
138
+ });
139
+ }
131
140
 
132
141
  }(jQuery);
@@ -122,19 +122,27 @@
122
122
  // LIST DATA-API
123
123
  // =============
124
124
 
125
- $(document)
126
- .on('ready.bs.list.data-api', function () {
127
- $('[data-toggle="list"]').each(function () {
128
- var $this = $(this);
129
- if ($this.data('list')) return;
130
- Plugin.call($this, $this.data());
131
- });
132
- }).on('DOMCharacterDataModified.bs.list.data-api DOMSubtreeModified.bs.list.data-api DOMNodeInserted.bs.list.data-api', function () {
133
- $('[data-toggle="list"]').each(function () {
134
- var $this = $(this);
135
- if ($this.data('list')) return;
136
- Plugin.call($this, $this.data());
137
- });
125
+ function PluginCall(_this) {
126
+ var $this = $(_this);
127
+ if ($this.data('list')) return;
128
+ Plugin.call($this, $this.data());
129
+ }
130
+
131
+ if ($.fn.initialize) {
132
+ $.initialize('[data-toggle="list"]', function() {
133
+ PluginCall(this);
138
134
  });
135
+ } else {
136
+ $(document)
137
+ .on('ready.bs.list.data-api', function () {
138
+ $('[data-toggle="list"]').each(function () {
139
+ PluginCall(this);
140
+ });
141
+ }).on('DOMCharacterDataModified.bs.list.data-api DOMSubtreeModified.bs.list.data-api DOMNodeInserted.bs.list.data-api', function () {
142
+ $('[data-toggle="list"]').each(function () {
143
+ PluginCall(this);
144
+ });
145
+ });
146
+ }
139
147
 
140
148
  }(jQuery);
@@ -0,0 +1,117 @@
1
+ ;(function ($) {
2
+ 'use strict';
3
+
4
+ var combinators = [' ', '>', '+', '~'];
5
+ var fraternisers = ['+', '~'];
6
+ var complexTypes = ['ATTR', 'PSEUDO', 'ID', 'CLASS'];
7
+ var msobservers = [];
8
+
9
+ if (!Element.prototype.matches) {
10
+ Element.prototype.matches = Element.prototype.matchesSelector ||
11
+ Element.prototype.webkitMatchesSelector ||
12
+ Element.prototype.mozMatchesSelector ||
13
+ Element.prototype.msMatchesSelector;
14
+ }
15
+
16
+ function grok(msobserver) {
17
+ if (!$.find.tokenize) {
18
+ msobserver.isCombinatorial = true;
19
+ msobserver.isFraternal = true;
20
+ msobserver.isComplex = true;
21
+ return;
22
+ }
23
+
24
+ msobserver.isCombinatorial = false;
25
+ msobserver.isFraternal = false;
26
+ msobserver.isComplex = false;
27
+
28
+ var token = $.find.tokenize(msobserver.selector);
29
+
30
+ for (var i = 0; i < token.length; i++) {
31
+ for (var j = 0; j < token[i].length; j++) {
32
+ if (combinators.indexOf(token[i][j].type) != -1) msobserver.isCombinatorial = true;
33
+ if (fraternisers.indexOf(token[i][j].type) != -1) msobserver.isFraternal = true;
34
+ if (complexTypes.indexOf(token[i][j].type) != -1) msobserver.isComplex = true;
35
+ }
36
+ }
37
+ }
38
+
39
+ var MutationSelectorObserver = function (selector, callback, options) {
40
+ this.selector = selector.trim();
41
+ this.callback = callback;
42
+ this.options = options;
43
+
44
+ grok(this);
45
+ };
46
+
47
+ msobservers.initialize = function (selector, callback, options) {
48
+ var seen = [];
49
+ var callbackOnce = function () {
50
+ if (seen.indexOf(this) === -1) {
51
+ seen.push(this);
52
+ $(this).each(callback);
53
+ }
54
+ };
55
+
56
+ $(options.target).find(selector).each(callbackOnce);
57
+
58
+ var msobserver = new MutationSelectorObserver(selector, callbackOnce, options)
59
+ this.push(msobserver);
60
+
61
+ var observer = new MutationObserver(function (mutations) {
62
+ var matches = [];
63
+
64
+ for (var m = 0; m < mutations.length; m++) {
65
+ if (mutations[m].type === 'attributes') {
66
+ if (mutations[m].target.matches(msobserver.selector)) matches.push(mutations[m].target);
67
+
68
+ if (msobserver.isFraternal) {
69
+ matches.push.apply(matches, mutations[m].target.parentElement.querySelectorAll(msobserver.selector));
70
+ } else {
71
+ matches.push.apply(matches, mutations[m].target.querySelectorAll(msobserver.selector));
72
+ }
73
+ }
74
+
75
+ if (mutations[m].type === 'childList') {
76
+ for (var n = 0; n < mutations[m].addedNodes.length; n++) {
77
+ if (!(mutations[m].addedNodes[n] instanceof Element)) continue;
78
+ if (mutations[m].addedNodes[n].matches(msobserver.selector)) matches.push(mutations[m].addedNodes[n]);
79
+
80
+ if (msobserver.isFraternal) {
81
+ matches.push.apply(matches, mutations[m].addedNodes[n].parentElement.querySelectorAll(msobserver.selector));
82
+ } else {
83
+ matches.push.apply(matches, mutations[m].addedNodes[n].querySelectorAll(msobserver.selector));
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
+ for (var i = 0; i < matches.length; i++) {
90
+ $(matches[i]).each(msobserver.callback);
91
+ }
92
+ });
93
+
94
+ var defaultObeserverOpts = {
95
+ childList: true,
96
+ subtree: true,
97
+ attributes: msobserver.isComplex
98
+ };
99
+
100
+ observer.observe(options.target, options.observer || defaultObeserverOpts );
101
+
102
+ return observer;
103
+ };
104
+
105
+ $.fn.initialize = function (callback, options) {
106
+ return msobservers.initialize(this.selector, callback, $.extend({}, $.initialize.defaults, options));
107
+ };
108
+
109
+ $.initialize = function (selector, callback, options) {
110
+ return msobservers.initialize(selector, callback, $.extend({}, $.initialize.defaults, options));
111
+ };
112
+
113
+ $.initialize.defaults = {
114
+ target: document.documentElement,
115
+ observer: null
116
+ }
117
+ })(jQuery);
@@ -0,0 +1,55 @@
1
+ (function (window, undefined) {
2
+ '$:nomunge';
3
+
4
+ var $ = window.jQuery;
5
+
6
+ $.throttle = function(delay, no_trailing, callback, debounce_mode) {
7
+ var last_exec = 0;
8
+ var timeout_id;
9
+
10
+ if (typeof no_trailing !== 'boolean') {
11
+ debounce_mode = callback;
12
+ callback = no_trailing;
13
+ no_trailing = undefined;
14
+ }
15
+
16
+ function wrapper() {
17
+ var that = this;
18
+ var elapsed = +new Date() - last_exec;
19
+ var args = arguments;
20
+
21
+ function exec() {
22
+ last_exec = +new Date();
23
+ callback.apply( that, args );
24
+ }
25
+
26
+ function clear() {
27
+ timeout_id = undefined;
28
+ }
29
+
30
+ if (debounce_mode && !timeout_id) exec();
31
+
32
+ timeout_id && clearTimeout(timeout_id);
33
+
34
+ if (debounce_mode === undefined && elapsed > delay) {
35
+ exec();
36
+ } else if (no_trailing !== true) {
37
+ timeout_id = setTimeout(debounce_mode ? clear : exec,
38
+ debounce_mode === undefined ? delay - elapsed : delay);
39
+ }
40
+ }
41
+
42
+ if ($.guid) {
43
+ wrapper.guid = callback.guid = callback.guid || $.guid++;
44
+ }
45
+
46
+ return wrapper;
47
+ };
48
+
49
+ $.debounce = function(delay, at_begin, callback) {
50
+ return callback === undefined ?
51
+ $.throttle(delay, at_begin, false) :
52
+ $.throttle(delay, callback, at_begin !== false);
53
+ };
54
+
55
+ })(this);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.6.3
4
+ version: 17.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-13 00:00:00.000000000 Z
11
+ date: 2019-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1330,9 +1330,11 @@ files:
1330
1330
  - vendor/assets/javascripts/extensions/_cohort.js
1331
1331
  - vendor/assets/javascripts/extensions/_copy.js
1332
1332
  - vendor/assets/javascripts/extensions/_funnel.js
1333
+ - vendor/assets/javascripts/extensions/_initialize.js
1333
1334
  - vendor/assets/javascripts/extensions/_map.js
1334
1335
  - vendor/assets/javascripts/extensions/_mobile_events.js
1335
1336
  - vendor/assets/javascripts/extensions/_push.js
1337
+ - vendor/assets/javascripts/extensions/_throttle_and_debounce.js
1336
1338
  - vendor/assets/javascripts/extensions/_wysiwyg.js
1337
1339
  - vendor/assets/javascripts/extensions/_xpull.js
1338
1340
  - vendor/assets/stylesheets/.DS_Store