Skip to content

Commit 450484a

Browse files
committed
[chores] Run prettier on all HTML files in the repo
1 parent e065cce commit 450484a

File tree

5 files changed

+66
-54
lines changed

5 files changed

+66
-54
lines changed

examples/load_data_geo_extent/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<title>Load data using geo extent</title>
Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,58 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3-
<head>
3+
<head>
44
<title>Live update example</title>
5-
<meta charset="utf-8">
5+
<meta charset="utf-8" />
66
<!-- theme can be easily customized via css -->
7-
<link href="/netjsongraph.css" rel="stylesheet">
8-
<link href="/netjsongraph-theme.css" rel="stylesheet">
9-
</head>
10-
<body>
11-
<script src="https://cdn.socket.io/4.5.0/socket.io.min.js" integrity="sha384-7EyYLQZgWBi67fBtVxw60/OWl1kjsfrPFcaU0pp0nAh+i8FD068QogUvg85Ewy1k" crossorigin="anonymous"></script>
7+
<link href="/netjsongraph.css" rel="stylesheet" />
8+
<link href="/netjsongraph-theme.css" rel="stylesheet" />
9+
</head>
10+
<body>
11+
<script
12+
src="https://cdn.socket.io/4.5.0/socket.io.min.js"
13+
integrity="sha384-7EyYLQZgWBi67fBtVxw60/OWl1kjsfrPFcaU0pp0nAh+i8FD068QogUvg85Ewy1k"
14+
crossorigin="anonymous"
15+
></script>
1216
<script type="text/javascript" src="/netjsongraph.min.js"></script>
1317
<script type="text/javascript">
14-
/*
18+
/*
1519
The demo is used to show how to use the `JSONDataUpdate` function to update data.
1620
In this example we use socket.io to listen for server messages.
1721
Adopted the default parameters of function --
1822
overrride old data and deal with the new data with the processing function set in config.
1923
See other examples:
2024
*/
21-
// `graph` render by default.
22-
const graph = new NetJSONGraph("/netjsonmap.json",{
23-
echartsOption: {
24-
legend: {
25-
show: false,
26-
},
27-
title:{
28-
text:'Live update example',
29-
textStyle:{
30-
color:'#fff',
31-
fontSize:24,
32-
},
33-
left:'center',
34-
top:20,
35-
}
25+
// `graph` render by default.
26+
const graph = new NetJSONGraph("/netjsonmap.json", {
27+
echartsOption: {
28+
legend: {
29+
show: false,
30+
},
31+
title: {
32+
text: "Live update example",
33+
textStyle: {
34+
color: "#fff",
35+
fontSize: 24,
3636
},
37-
});
37+
left: "center",
38+
top: 20,
39+
},
40+
},
41+
});
3842

39-
graph.render();
43+
graph.render();
4044

41-
const socket = io("http://localhost:3000/",{ transports : ['websocket'] });
45+
const socket = io("http://localhost:3000/", {transports: ["websocket"]});
4246

43-
socket.on("connect", function() {
44-
console.log("client connected");
45-
});
46-
socket.on("disconnect", function() {
47-
console.log("client disconnected");
48-
});
47+
socket.on("connect", function () {
48+
console.log("client connected");
49+
});
50+
socket.on("disconnect", function () {
51+
console.log("client disconnected");
52+
});
4953

50-
// Update view when the data changes. override old data by default.
51-
socket.on("netjsonChange", graph.utils.JSONDataUpdate.bind(graph));
54+
// Update view when the data changes. override old data by default.
55+
socket.on("netjsonChange", graph.utils.JSONDataUpdate.bind(graph));
5256
</script>
53-
</html>
57+
</body>
58+
</html>

index.html

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<title>Netjsongraph.js: Examples</title>
@@ -33,12 +33,13 @@
3333
margin: 0;
3434
padding: 0;
3535
box-sizing: border-box;
36-
transition: background-color var(--transition-speed) ease,
37-
color var(--transition-speed) ease;
36+
transition:
37+
background-color var(--transition-speed) ease,
38+
color var(--transition-speed) ease;
3839
}
3940

4041
body {
41-
font-family: 'Inter', sans-serif;
42+
font-family: "Inter", sans-serif;
4243
background-color: var(--bg-primary);
4344
color: var(--text-primary);
4445
line-height: 1.6;
@@ -141,7 +142,9 @@ <h1>NetJSONGraph.js Example Demos</h1>
141142

142143
<main>
143144
<div class="cards">
144-
<a href="./examples/netjsongraph.html" target="_blank">Standard graph</a>
145+
<a href="./examples/netjsongraph.html" target="_blank"
146+
>Standard graph</a
147+
>
145148
</div>
146149
<div class="cards">
147150
<a href="./examples/netjsongraph-elementsLegend.html" target="_blank"
@@ -249,23 +252,27 @@ <h1>NetJSONGraph.js Example Demos</h1>
249252
</main>
250253

251254
<script>
252-
const themeToggle = document.querySelector('.theme-toggle');
255+
const themeToggle = document.querySelector(".theme-toggle");
253256
const htmlElement = document.documentElement;
254257

255258
// Check for saved theme preference or system preference
256-
const savedTheme = localStorage.getItem('theme');
257-
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
259+
const savedTheme = localStorage.getItem("theme");
260+
const systemPrefersDark = window.matchMedia(
261+
"(prefers-color-scheme: dark)",
262+
).matches;
258263

259-
if (savedTheme === 'dark' || (!savedTheme && systemPrefersDark)) {
260-
htmlElement.classList.add('dark-mode');
264+
if (savedTheme === "dark" || (!savedTheme && systemPrefersDark)) {
265+
htmlElement.classList.add("dark-mode");
261266
}
262267

263-
themeToggle.addEventListener('click', () => {
264-
htmlElement.classList.toggle('dark-mode');
268+
themeToggle.addEventListener("click", () => {
269+
htmlElement.classList.toggle("dark-mode");
265270

266271
// Save theme preference
267-
const currentTheme = htmlElement.classList.contains('dark-mode') ? 'dark' : 'light';
268-
localStorage.setItem('theme', currentTheme);
272+
const currentTheme = htmlElement.classList.contains("dark-mode")
273+
? "dark"
274+
: "light";
275+
localStorage.setItem("theme", currentTheme);
269276
});
270277
</script>
271278
</body>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"prettier --write",
2020
"git add"
2121
],
22-
"public/example_templates/**/*.html": [
22+
"**/*.html": [
2323
"prettier --write",
2424
"git add"
2525
]

run-qa-checks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -e
44

55
yarn lint || (echo "Try running yarn lint:fix"; exit 1)
66

7-
prettier --check public/example_templates/**/*.html || \
8-
(echo -e "Try running:\n prettier -w public/example_templates/**/*.html"; exit 1)
7+
prettier --check "**/*.html" || \
8+
(echo -e "Try running:\n\nprettier -w \"**/*.html\""; exit 1)
99

1010
openwisp-qa-check --skip-checkmigrations \
1111
--skip-checkmakemigrations \

0 commit comments

Comments
 (0)