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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796e5c5fd6f495a5c986a78e8ee6ddcea100a05ee27e62a2c17e9122608d1db3
|
4
|
+
data.tar.gz: 9b2a4ed85b48adddde9b114ea4c8c3cd117ee64d9fc7c5b32f54827b1e094e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d4304e417c6b9346ca62034232c339a8dfc17a9fb3c38a993796fb365c0ebd3b396731153df4e20bb2ee8ce1a5a02f1668ef50628e9456f9f0693348ce66e6
|
7
|
+
data.tar.gz: 31e05a319e34add0fab9f39dcada3e17ec43e406980dbcc6d700eff1a5eab6f892e0696479d50f42a3909ecc2df86f3439a50945f65a310021ca329e8300370e
|
@@ -1,4 +1,9 @@
|
|
1
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
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
|
-
|
32
|
-
if (
|
33
|
-
c.style.display = "none";
|
29
|
+
if (event) {
|
30
|
+
if (!Array.from(event.target.classList).includes("oas-trigger")) {
|
34
31
|
return;
|
35
32
|
}
|
36
|
-
|
37
|
-
};
|
33
|
+
}
|
38
34
|
|
39
|
-
|
40
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
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
|
-
|
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
|
|
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.
|
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
|
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
|
-
|
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.
|