Skip to content

Commit a158457

Browse files
committed
DOC-240 move code
1 parent eff7b54 commit a158457

File tree

4 files changed

+126
-123
lines changed

4 files changed

+126
-123
lines changed

js/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import tracking from './tracking'
2020
import searchBar from './search-bar'
2121
import glightbox from './glightbox'
2222
import autocomplete from './algolia'
23+
import mapTable from './map-table'
2324
feedback()
2425
accordion()
2526
accordionGroup()
@@ -40,4 +41,5 @@ relativeLinks()
4041
sideMenu()
4142
tracking()
4243
searchBar()
43-
glightbox()
44+
glightbox()
45+
mapTable()

js/map-table/index.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export default function () {
2+
3+
clickFilter("all")
4+
5+
var links = document.getElementsByClassName("button-link");
6+
7+
8+
document.querySelectorAll('.button-link').forEach(item => {
9+
let v = item.getAttribute('id');
10+
item.addEventListener('click', (event => {
11+
event.preventDefault();
12+
clickFilter(v);
13+
}))
14+
})
15+
16+
17+
function clickFilter(c) {
18+
var x, i;
19+
x = document.getElementsByClassName("settingRow");
20+
if (c == "all") c = "";
21+
for (i = 0; i < x.length; i++) {
22+
w3RemoveClass(x[i], "show");
23+
if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
24+
}
25+
}
26+
27+
// Show filtered elements
28+
function w3AddClass(element, name) {
29+
var i, arr1, arr2;
30+
arr1 = element.className.split(" ");
31+
arr2 = name.split(" ");
32+
for (i = 0; i < arr2.length; i++) {
33+
if (arr1.indexOf(arr2[i]) == -1) {
34+
element.className += " " + arr2[i];
35+
}
36+
}
37+
}
38+
39+
// Hide elements that are not selected
40+
function w3RemoveClass(element, name) {
41+
var i, arr1, arr2;
42+
arr1 = element.className.split(" ");
43+
arr2 = name.split(" ");
44+
for (i = 0; i < arr2.length; i++) {
45+
while (arr1.indexOf(arr2[i]) > -1) {
46+
arr1.splice(arr1.indexOf(arr2[i]), 1);
47+
}
48+
}
49+
element.className = arr1.join(" ");
50+
}
51+
52+
var btnContainer = document.getElementById("btnContainer");
53+
var btns = document.getElementsByClassName("button-link");
54+
for (var i = 0; i < btns.length; i++) {
55+
btns[i].addEventListener("click", function () {
56+
var current = document.getElementsByClassName("active");
57+
current[0].className = current[0].className.replace(" active", "");
58+
this.className += " active";
59+
});
60+
}
61+
}
Lines changed: 3 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,6 @@
11
{% assign configMap = site.data.actions.amplitude.config %}
22
{% assign conModes = site.data.actions.amplitude.config| map: 'settings' | map: 'connection_mode' | uniq | compact%}
33

4-
<style>
5-
tr.no-map td {
6-
opacity: 0.5;
7-
}
8-
9-
tr.show {
10-
display: table-row;
11-
}
12-
13-
.settingRow {
14-
display: none;
15-
}
16-
17-
.table-search {
18-
width: 100%;
19-
border: 0px;
20-
border-bottom: 1px solid rgb(128, 128, 128);
21-
font-family: "SF Pro Text", BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
22-
color: #474d66;
23-
font-size: 12px;
24-
height: 30px;
25-
margin-bottom: 15px;
26-
}
27-
28-
.table-search:focus-visible {
29-
outline: none
30-
}
31-
32-
.button-container {
33-
display: flex;
34-
justify-content: space-around;
35-
}
36-
37-
.button-link {
38-
padding: 4px 10px;
39-
}
40-
41-
.active {
42-
background-color: #eee;
43-
}
44-
45-
.cmode {
46-
background-color: #edeff5;
47-
font-size: 11px;
48-
padding: 0px 6px;
49-
border-radius: 4px;
50-
height: 16px;
51-
font-weight: 600;
52-
text-transform: uppercase;
53-
color: rgb(71, 77, 102);
54-
opacity: 0.65;
55-
white-space: nowrap;
56-
}
57-
58-
.device-web-mode, .device-mobile-mode {
59-
background-color: #e6f5ef;
60-
color: #317159
61-
}
62-
63-
</style>
644

655
### Amplitude settings mapping
666

@@ -100,7 +40,8 @@
10040
</table>
10141

10242
<script>
103-
function searchFilter() {
43+
44+
function searchFilter() {
10445
var input, filter, table, tr, td, i, txtValue;
10546

10647
input = document.getElementById("filterInput");
@@ -119,63 +60,4 @@
11960
}
12061
}
12162
}
122-
clickFilter("all")
123-
124-
var links = document.getElementsByClassName("button-link");
125-
126-
127-
document.querySelectorAll('.button-link').forEach(item => {
128-
let v = item.getAttribute('id');
129-
item.addEventListener('click', (event => {
130-
event.preventDefault();
131-
clickFilter(v);
132-
}))
133-
})
134-
135-
136-
function clickFilter(c) {
137-
var x, i;
138-
x = document.getElementsByClassName("settingRow");
139-
if (c == "all") c = "";
140-
for (i = 0; i < x.length; i++) {
141-
w3RemoveClass(x[i], "show");
142-
if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
143-
}
144-
}
145-
146-
// Show filtered elements
147-
function w3AddClass(element, name) {
148-
var i, arr1, arr2;
149-
arr1 = element.className.split(" ");
150-
arr2 = name.split(" ");
151-
for (i = 0; i < arr2.length; i++) {
152-
if (arr1.indexOf(arr2[i]) == -1) {
153-
element.className += " " + arr2[i];
154-
}
155-
}
156-
}
157-
158-
// Hide elements that are not selected
159-
function w3RemoveClass(element, name) {
160-
var i, arr1, arr2;
161-
arr1 = element.className.split(" ");
162-
arr2 = name.split(" ");
163-
for (i = 0; i < arr2.length; i++) {
164-
while (arr1.indexOf(arr2[i]) > -1) {
165-
arr1.splice(arr1.indexOf(arr2[i]), 1);
166-
}
167-
}
168-
element.className = arr1.join(" ");
169-
}
170-
171-
var btnContainer = document.getElementById("btnContainer");
172-
var btns = document.getElementsByClassName("button-link");
173-
for (var i = 0; i < btns.length; i++) {
174-
btns[i].addEventListener("click", function () {
175-
var current = document.getElementsByClassName("active");
176-
current[0].className = current[0].className.replace(" active", "");
177-
this.className += " active";
178-
});
179-
}
180-
181-
</script>
63+
</script>

src/_sass/components/_markdown.scss

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,62 @@ a[target="_blank"]:not(.reference-button):after{
300300

301301
a.no-icon[target="_blank"]:after {
302302
content: none
303-
}
303+
}
304+
305+
tr.no-map td {
306+
opacity: 0.5;
307+
}
308+
309+
tr.show {
310+
display: table-row;
311+
}
312+
313+
.settingRow {
314+
display: none;
315+
}
316+
317+
.table-search {
318+
width: 100%;
319+
border: 0px;
320+
border-bottom: 1px solid rgb(128, 128, 128);
321+
font-family: "SF Pro Text", BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
322+
color: #474d66;
323+
font-size: 12px;
324+
height: 30px;
325+
margin-bottom: 15px;
326+
}
327+
328+
.table-search:focus-visible {
329+
outline: none
330+
}
331+
332+
.button-container {
333+
display: flex;
334+
justify-content: space-around;
335+
}
336+
337+
.button-link {
338+
padding: 4px 10px;
339+
}
340+
341+
.active {
342+
background-color: #eee;
343+
}
344+
345+
.cmode {
346+
background-color: #edeff5;
347+
font-size: 11px;
348+
padding: 0px 6px;
349+
border-radius: 4px;
350+
height: 16px;
351+
font-weight: 600;
352+
text-transform: uppercase;
353+
color: rgb(71, 77, 102);
354+
opacity: 0.65;
355+
white-space: nowrap;
356+
}
357+
358+
.device-web-mode, .device-mobile-mode {
359+
background-color: #e6f5ef;
360+
color: #317159
361+
}

0 commit comments

Comments
 (0)