middleman-hashicorp 0.3.30 → 0.3.31

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: ac1ac1e2b46e71af17939f43428c0093864989d59abb967c9b64b25356244a0a
4
- data.tar.gz: 8ff6840aaaeb2b9b1fd2f0272f961a6938c98dd50364f06aec2e235161e122d8
3
+ metadata.gz: b89d166a23b94b6b828588e86f2ce55a83cf4d02b427f723f43056be31d6d487
4
+ data.tar.gz: 3978068b8d6130bab1c140a9e25fa9a3fc426216560a42849453814ec3b71907
5
5
  SHA512:
6
- metadata.gz: fa1a31486c1efd6b6ae8bbd351ecb7748d6fe3e1238c41a9128e44cb7c541aa0bb36bfb6aeada60b4397e9a60f8c60b91a9239bb89d469ed4c6b6ad0b253321c
7
- data.tar.gz: 0c321ab7458fe3db1a111cded59c9ed1b71d66769bfe9920ab9d1563f9cecbe25d1876113ccc924627ca3fb2c62115c4aa8de21a4b02ed7efe5a8f0f98c0cd64
6
+ metadata.gz: 1d8dd053be52f4e46c1427ec8491955b9d3dbfd94611de4f47e13307829cd245cbf306378e77c11e5d22deb2ccd42be039419c9b19c87dadc40ac4617233e8ee
7
+ data.tar.gz: 2eaa402d56f7a485e0dc1079155ed9e223668220953a926f4db582e453daa97bba95fc17a5b9f74c6324de32133a163139df8119c34da7f29555bfc6aed486b7
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Wrapper for segment's track function that will track multiple elements,
3
+ * normalize parameters, and easily switch between tracking links or events.
4
+ * @param {String} selector - query selector, multi element compatible
5
+ * @param {Function} cb - optional function that should return params, and will receive the element as a parameter
6
+ * @param {Boolean} [link=false] - if true, tracks a link click
7
+ */
8
+ function track(selector, cb, link = false) {
9
+ each(document.querySelectorAll(selector), el => {
10
+ var params = cb
11
+ if (typeof cb === 'function') params = cb(el)
12
+ var event = params.event
13
+ delete params.event
14
+ if (link) {
15
+ analytics.trackLink(el, event, params)
16
+ } else {
17
+ el.addEventListener('click', function() {
18
+ analytics.track(event, params)
19
+ })
20
+ }
21
+ })
22
+ }
23
+
24
+ /**
25
+ * Iterates through a NodeList, not built-in for all browsers.
26
+ * (https://developer.mozilla.org/en-US/docs/Web/API/NodeList)
27
+ * @param {NodeList} list a NodeList instance
28
+ * @param {Function} cb a function to execute for each node
29
+ */
30
+ function each(list, cb) {
31
+ for (let i = 0; i < list.length; i++) cb(list[i], i)
32
+ }
33
+
34
+ // Expose as commonjs for module bundlers if needed
35
+ if (module && module.exports) {
36
+ module.exports = { track }
37
+ }
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module HashiCorp
3
- VERSION = "0.3.30"
3
+ VERSION = "0.3.31"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-hashicorp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.30
4
+ version: 0.3.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-06 00:00:00.000000000 Z
11
+ date: 2018-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman
@@ -191,6 +191,7 @@ files:
191
191
  - assets/images/mega-nav/logo-vagrant.svg
192
192
  - assets/images/mega-nav/logo-vault.svg
193
193
  - assets/javascripts/bootstrap.js
194
+ - assets/javascripts/hashicorp/analytics.js
194
195
  - assets/javascripts/hashicorp/mega-nav.js
195
196
  - assets/javascripts/hashicorp/sidebar.js
196
197
  - assets/javascripts/ie-compat.js