nexmo-oas-renderer 2.1.1 → 2.1.2

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: 91aab3edd9be633271fd990e068b50382b9084e487c7cfd305fe02f0ac47158b
4
- data.tar.gz: e5fb1777e48e43054d461fceabdf0ce7786211303fcf468e5e8057e6ebaaa1db
3
+ metadata.gz: 796e5c5fd6f495a5c986a78e8ee6ddcea100a05ee27e62a2c17e9122608d1db3
4
+ data.tar.gz: 9b2a4ed85b48adddde9b114ea4c8c3cd117ee64d9fc7c5b32f54827b1e094e34
5
5
  SHA512:
6
- metadata.gz: 8077595864ec381244b429efdcb6b87013d469d8f1c69ef81c83ba5d3891274259150ee8cec94c8b66a249ab301dff2c7e73d951da85f70f766983867fd7d93d
7
- data.tar.gz: 14bd51335bbb81fbe9a3d7c11ffbb234eafda74e11f3436bf280a51996d8e1deb3536561f40cbb207586cb6c1bd1ed9da3585f57ea07df10b8a899c6203a0420
6
+ metadata.gz: f0d4304e417c6b9346ca62034232c339a8dfc17a9fb3c38a993796fb365c0ebd3b396731153df4e20bb2ee8ce1a5a02f1668ef50628e9456f9f0693348ce66e6
7
+ data.tar.gz: 31e05a319e34add0fab9f39dcada3e17ec43e406980dbcc6d700eff1a5eab6f892e0696479d50f42a3909ecc2df86f3439a50945f65a310021ca329e8300370e
@@ -1,4 +1,9 @@
1
- if(document.querySelector(".oas-wrapper")){
1
+ document.addEventListener("DOMContentLoaded", function() {
2
+ // Only run this JS on OAS pages
3
+ if(!document.querySelector(".oas-wrapper")){
4
+ return;
5
+ }
6
+
2
7
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
3
8
  var queryString = new URLSearchParams(window.location.search);
4
9
  if (!queryString.get('theme')) {
@@ -7,59 +12,56 @@ if(document.querySelector(".oas-wrapper")){
7
12
  }
8
13
  }
9
14
 
10
- document.addEventListener("DOMContentLoaded", function() {
11
- // Handle people clicking on oneOf tabs by changing every one on the page
12
- var oneOfTabs = document.querySelectorAll('[data-tab-link]');
13
- Array.from(oneOfTabs).forEach(function (element) {
14
- element.addEventListener('click', function (event) {
15
- var link = event.target.getAttribute('data-tab-link');
16
- var matchingTabs = document.querySelectorAll('[data-tab-link="' + link + '"]');
17
- Array.from(matchingTabs).forEach(function (element) {
18
- element.dispatchEvent(new Event('toggle'));
19
- });
15
+ // Handle people clicking on oneOf tabs by changing every one on the page
16
+ var oneOfTabs = document.querySelectorAll('[data-tab-link]');
17
+ Array.from(oneOfTabs).forEach(function (element) {
18
+ element.addEventListener('click', function (event) {
19
+ var link = event.target.getAttribute('data-tab-link');
20
+ var matchingTabs = document.querySelectorAll('[data-tab-link="' + link + '"]');
21
+ Array.from(matchingTabs).forEach(function (element) {
22
+ element.dispatchEvent(new Event('toggle'));
20
23
  });
21
24
  });
25
+ });
22
26
 
23
- var toggleTopNav = function(event, closeOnly) {
24
-
25
- if (event) {
26
- if (!Array.from(event.target.classList).includes("oas-trigger")) {
27
- return;
28
- }
29
- }
27
+ var toggleTopNav = function(event, closeOnly) {
30
28
 
31
- var c = document.querySelector('.oas-trigger-content');
32
- if (closeOnly === true) {
33
- c.style.display = "none";
29
+ if (event) {
30
+ if (!Array.from(event.target.classList).includes("oas-trigger")) {
34
31
  return;
35
32
  }
36
- c.style.display = c.style.display == 'block' ? 'none' : "block";
37
- };
33
+ }
38
34
 
39
- if (document.querySelector('.oas-trigger')) {
40
- document.querySelector('.oas-trigger').addEventListener("click", toggleTopNav);
35
+ var c = document.querySelector('.oas-trigger-content');
36
+ if (closeOnly === true) {
37
+ c.style.display = "none";
38
+ return;
41
39
  }
40
+ c.style.display = c.style.display == 'block' ? 'none' : "block";
41
+ };
42
42
 
43
- document.querySelectorAll('a').forEach((element) => {
44
- var href = element.getAttribute("href");
45
- if (!href){ return; }
46
- if (href.slice(0,1) !== "#"){ return; }
47
- element.addEventListener('click', function (event) {
48
- event.preventDefault();
43
+ if (document.querySelector('.oas-trigger')) {
44
+ document.querySelector('.oas-trigger').addEventListener("click", toggleTopNav);
45
+ }
49
46
 
50
- toggleTopNav(null, true);
47
+ document.querySelectorAll('a').forEach((element) => {
48
+ var href = element.getAttribute("href");
49
+ if (!href){ return; }
50
+ if (href.slice(0,1) !== "#"){ return; }
51
+ element.addEventListener('click', function (event) {
52
+ event.preventDefault();
51
53
 
52
- var to = document.querySelector(event.target.hash)
53
- history.pushState({}, '', event.target.href);
54
- window.scrollTo({
55
- top: (window.scrollY + to.getBoundingClientRect().y) - 70,
56
- left: 0,
57
- })
54
+ toggleTopNav(null, true);
58
55
 
56
+ var to = document.querySelector(event.target.hash)
57
+ history.pushState({}, '', event.target.href);
58
+ window.scrollTo({
59
+ top: (window.scrollY + to.getBoundingClientRect().y) - 70,
60
+ left: 0,
61
+ })
59
62
 
60
- });
61
- });
62
63
 
64
+ });
63
65
  });
64
- }
66
+ });
65
67
 
@@ -3,7 +3,7 @@
3
3
  module Nexmo
4
4
  module OAS
5
5
  module Renderer
6
- VERSION = '2.1.1'
6
+ VERSION = '2.1.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexmo-oas-renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabian Rodriguez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -389,8 +389,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
389
  - !ruby/object:Gem::Version
390
390
  version: '0'
391
391
  requirements: []
392
- rubyforge_project:
393
- rubygems_version: 2.7.6.2
392
+ rubygems_version: 3.0.0
394
393
  signing_key:
395
394
  specification_version: 4
396
395
  summary: OpenAPI Specification renderer.