Skip to content

Commit f54ad9e

Browse files
committed
update formatting
1 parent f56df6c commit f54ad9e

File tree

3 files changed

+60
-58
lines changed

3 files changed

+60
-58
lines changed

src/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<title>Public APIs</title>
1111
</head>
1212
<header>
13-
<a href="https://your-url" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#4783e5; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
13+
<a href="https://github.com/toddmotto/public-apis" class="github-corner" aria-label="View source on Github"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#4783e5; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
1414
<h1 class="center-text">
1515
Public APIs
1616
</h1>
@@ -51,8 +51,5 @@ <h3 class="center-text">
5151
</div>
5252
<script src="scripts.js"></script>
5353
</body>
54-
<footer>
55-
Site created by Dave Machado, Project maintained by many awesome contributors
56-
</footer>
5754
</html>
5855

src/scripts.js

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
1-
loadJSON(function(response) {
2-
var items = JSON.parse(response);
1+
function loadJSON(callback) {
2+
var xobj = new XMLHttpRequest();
3+
xobj.overrideMimeType("application/json");
4+
xobj.open('GET', 'https://raw.githubusercontent.com/toddmotto/public-apis/master/json/entries.min.json', true); // Replace 'my_data' with the path to your file
5+
xobj.onreadystatechange = function () {
6+
if (xobj.readyState == 4 && xobj.status == "200") {
7+
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
8+
callback(xobj.responseText);
9+
}
10+
};
11+
xobj.send(null);
12+
}
13+
14+
function filterRows() {
15+
16+
var input, filter, table, tr, td, i;
17+
18+
input = document.getElementById("searchbox");
19+
filter = input.value.toUpperCase();
20+
table = document.getElementById("entries");
21+
tr = table.getElementsByTagName("tr");
22+
23+
// Loop through all table rows and hide those who don't match the search
24+
for (i = 0; i < tr.length; i++) {
25+
26+
displayRows = false;
27+
28+
title = tr[i].getElementsByTagName("td")[0];
29+
if (title) {
30+
if (title.innerHTML.toUpperCase().indexOf(filter) > -1) {
31+
displayRows = true;
32+
}
33+
}
34+
section = tr[i].getElementsByTagName("td")[4];
35+
if (section) {
36+
if (section.innerHTML.toUpperCase().indexOf(filter) > -1) {
37+
displayRows = true;
38+
}
39+
}
40+
if (displayRows) {
41+
tr[i].style.display = "";
42+
} else {
43+
tr[i].style.display = "none";
44+
}
45+
}
46+
}
47+
48+
loadJSON(function(response) {
49+
var items = JSON.parse(response);
350
new Vue({
451
data: {
552
filter: ''
@@ -19,7 +66,7 @@
1966
methods: {
2067
filtered(item) {
2168
let show = true;
22-
69+
2370
if(this.filter.length) {
2471

2572
show = false;
@@ -38,50 +85,8 @@
3885

3986
});
4087
}
41-
4288
return show;
4389
}
4490
}
4591
}).$mount('#app');
4692
});
47-
48-
function loadJSON(callback) {
49-
var xobj = new XMLHttpRequest();
50-
xobj.overrideMimeType("application/json");
51-
xobj.open('GET', 'https://raw.githubusercontent.com/toddmotto/public-apis/master/json/entries.min.json', true); // Replace 'my_data' with the path to your file
52-
xobj.onreadystatechange = function () {
53-
if (xobj.readyState == 4 && xobj.status == "200") {
54-
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
55-
callback(xobj.responseText);
56-
}
57-
};
58-
xobj.send(null);
59-
}
60-
61-
function filterRows() {
62-
var input, filter, table, tr, td, i;
63-
input = document.getElementById("searchbox");
64-
filter = input.value.toUpperCase();
65-
table = document.getElementById("entries");
66-
tr = table.getElementsByTagName("tr");
67-
68-
// Loop through all table rows and hide those who don't match the search
69-
for (i = 0; i < tr.length; i++) {
70-
title = tr[i].getElementsByTagName("td")[0];
71-
section = tr[i].getElementsByTagName("td")[4];
72-
if (title) {
73-
if (title.innerHTML.toUpperCase().indexOf(filter) > -1) {
74-
tr[i].style.display = "";
75-
} else {
76-
tr[i].style.display = "none";
77-
}
78-
}
79-
if (section) {
80-
if (section.innerHTML.toUpperCase().indexOf(filter) > -1) {
81-
tr[i].style.display = "";
82-
} else {
83-
tr[i].style.display = "none";
84-
}
85-
}
86-
}
87-
}

src/styles.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ body {
1919
}
2020

2121
#entries {
22-
border-collapse: collapse; /* Collapse borders */
23-
border: 1px solid #ddd; /* Add a grey border */
24-
font-size: 18px; /* Increase font-size */
25-
width: 100%; /* Full-width */
22+
border-collapse: collapse;
23+
border: 1px solid #ddd;
24+
font-size: 18px;
25+
width: 100%;
2626
}
2727

2828
#entries th {
@@ -38,11 +38,11 @@ body {
3838
}
3939

4040
#searchbox {
41-
border: 1px solid #ddd; /* Add a grey border */
41+
border: 1px solid #ddd;
4242
border-radius: 50px;
43-
margin-bottom: 12px; /* Add some space below the input */
44-
font-size: 16px; /* Increase font-size */
45-
padding: 12px 20px 12px 40px; /* Add some padding */
43+
margin-bottom: 12px;
44+
font-size: 16px;
45+
padding: 12px 20px 12px 40px;
4646
text-align: center;
47-
width: 50%; /* Full-width */
47+
width: 50%;
4848
}

0 commit comments

Comments
 (0)