|
1 | 1 | function createTableFromJSON(arr) {
|
2 | 2 | // exit if there are no variables
|
3 |
| - if (!arr.length) { return; }; |
| 3 | + if (!arr.length) { return; } |
4 | 4 |
|
5 | 5 | var divForTheTable = document.createElement("div");
|
6 |
| - divForTheTable.id = "gitlab-ext-variables" |
7 |
| - divForTheTable.className = "gl-mb-3" |
| 6 | + divForTheTable.id = "gitlab-ext-variables"; |
| 7 | + divForTheTable.className = "gl-mb-3"; |
8 | 8 |
|
9 | 9 | var table = document.createElement("table");
|
10 | 10 | table.style = "font-family:monospace; margin-top: 1rem;"
|
11 | 11 |
|
12 | 12 | for (var i = 0; i < arr.length; i++) {
|
13 |
| - tr = table.insertRow(-1); |
| 13 | + var tr = table.insertRow(-1); |
14 | 14 |
|
15 | 15 | var tabK = tr.insertCell(0);
|
16 | 16 | Object.assign(tabK, {
|
17 | 17 | textContent: arr[i].key,
|
18 | 18 | style: "padding-right: 2rem;",
|
19 | 19 | id: "gl-ext-key-" + i,
|
20 |
| - data-clipboard-target: "#gl-ext-key-" + i |
| 20 | + "data-clipboard-target": "#gl-ext-key-" + i, |
21 | 21 | title: "Copy name",
|
22 |
| - aria-live: "polite", |
23 |
| - data-placement: "bottom", |
24 |
| - data-toggle: "tooltip" |
| 22 | + "aria-live": "polite", |
| 23 | + "data-placement": "bottom", |
| 24 | + "data-toggle": "tooltip" |
25 | 25 | });
|
26 | 26 |
|
27 | 27 | var tabV = tr.insertCell(1);
|
28 | 28 | Object.assign(tabV, {
|
29 | 29 | textContent: arr[i].value,
|
30 | 30 | id: "gl-ext-val-" + i,
|
31 |
| - data-clipboard-target: "#gl-ext-val-" + i |
| 31 | + "data-clipboard-target": "#gl-ext-val-" + i, |
32 | 32 | title: "Copy value",
|
33 |
| - aria-live: "polite", |
34 |
| - data-placement: "bottom", |
35 |
| - data-toggle: "tooltip" |
| 33 | + "aria-live": "polite", |
| 34 | + "data-placement": "bottom", |
| 35 | + "data-toggle": "tooltip" |
36 | 36 | });
|
37 | 37 | }
|
38 | 38 |
|
39 | 39 | divForTheTable.appendChild(table);
|
40 | 40 | var divContainer = document.querySelector('[data-testid="pipeline-details-header"]').children[0].children[0];
|
41 | 41 | divContainer.appendChild(divForTheTable);
|
42 |
| -}; |
| 42 | +} |
43 | 43 |
|
44 | 44 | function checkTab() {
|
45 |
| - var tab_url = document.querySelector('meta[property="og:url"]').content |
| 45 | + var tab_url = document.querySelector('meta[property="og:url"]').content; |
46 | 46 | if (tab_url) {
|
47 | 47 | var match = tab_url.match("^https://gitlab([.a-z-]+)/(.*?)(?:/-)?/pipelines/([0-9]+)$");
|
48 | 48 | if (match) {
|
49 | 49 | // exit if the table has been injected previously
|
50 |
| - if (document.getElementById("gitlab-ext-variables")) { return; }; |
| 50 | + if (document.getElementById("gitlab-ext-variables")) { return; } |
51 | 51 |
|
52 | 52 | var host = match[1];
|
53 | 53 | var repo = match[2];
|
|
0 commit comments