Skip to content

Commit 74464f1

Browse files
hatamiarash7actions-user
authored andcommitted
[CI] Format Code!
Format code using Prettier
1 parent 496db09 commit 74464f1

File tree

4 files changed

+236
-197
lines changed

4 files changed

+236
-197
lines changed

theme/book.js

Lines changed: 85 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function playground_text(playground) {
2020
return Promise.race([
2121
fetch(url, options),
2222
new Promise((_, reject) =>
23-
setTimeout(() => reject(new Error("timeout")), timeout)
23+
setTimeout(() => reject(new Error("timeout")), timeout),
2424
),
2525
]);
2626
}
@@ -38,10 +38,10 @@ function playground_text(playground) {
3838
.then((response) => {
3939
// get list of crates available in the rust playground
4040
let playground_crates = response.crates.map(
41-
(item) => item["id"]
41+
(item) => item["id"],
4242
);
4343
playgrounds.forEach((block) =>
44-
handle_crate_list_update(block, playground_crates)
44+
handle_crate_list_update(block, playground_crates),
4545
);
4646
});
4747
}
@@ -154,7 +154,7 @@ function playground_text(playground) {
154154
.catch(
155155
(error) =>
156156
(result_block.innerText =
157-
"Playground Communication: " + error.message)
157+
"Playground Communication: " + error.message),
158158
);
159159
}
160160

@@ -238,88 +238,92 @@ function playground_text(playground) {
238238
block.classList.add("hide-boring");
239239
}
240240
});
241-
}
241+
},
242242
);
243243

244244
if (window.playground_copyable) {
245-
Array.from(document.querySelectorAll("pre code")).forEach(function (
246-
block
247-
) {
248-
var pre_block = block.parentNode;
249-
if (!pre_block.classList.contains("playground")) {
250-
var buttons = pre_block.querySelector(".buttons");
251-
if (!buttons) {
252-
buttons = document.createElement("div");
253-
buttons.className = "buttons";
254-
pre_block.insertBefore(buttons, pre_block.firstChild);
255-
}
245+
Array.from(document.querySelectorAll("pre code")).forEach(
246+
function (block) {
247+
var pre_block = block.parentNode;
248+
if (!pre_block.classList.contains("playground")) {
249+
var buttons = pre_block.querySelector(".buttons");
250+
if (!buttons) {
251+
buttons = document.createElement("div");
252+
buttons.className = "buttons";
253+
pre_block.insertBefore(buttons, pre_block.firstChild);
254+
}
256255

257-
var clipButton = document.createElement("button");
258-
clipButton.className = "fa fa-copy clip-button";
259-
clipButton.title = "Copy to clipboard";
260-
clipButton.setAttribute("aria-label", clipButton.title);
261-
clipButton.innerHTML = '<i class="tooltiptext"></i>';
256+
var clipButton = document.createElement("button");
257+
clipButton.className = "fa fa-copy clip-button";
258+
clipButton.title = "Copy to clipboard";
259+
clipButton.setAttribute("aria-label", clipButton.title);
260+
clipButton.innerHTML = '<i class="tooltiptext"></i>';
262261

263-
buttons.insertBefore(clipButton, buttons.firstChild);
264-
}
265-
});
262+
buttons.insertBefore(clipButton, buttons.firstChild);
263+
}
264+
},
265+
);
266266
}
267267

268268
// Process playground code blocks
269-
Array.from(document.querySelectorAll(".playground")).forEach(function (
270-
pre_block
271-
) {
272-
// Add play button
273-
var buttons = pre_block.querySelector(".buttons");
274-
if (!buttons) {
275-
buttons = document.createElement("div");
276-
buttons.className = "buttons";
277-
pre_block.insertBefore(buttons, pre_block.firstChild);
278-
}
269+
Array.from(document.querySelectorAll(".playground")).forEach(
270+
function (pre_block) {
271+
// Add play button
272+
var buttons = pre_block.querySelector(".buttons");
273+
if (!buttons) {
274+
buttons = document.createElement("div");
275+
buttons.className = "buttons";
276+
pre_block.insertBefore(buttons, pre_block.firstChild);
277+
}
279278

280-
var runCodeButton = document.createElement("button");
281-
runCodeButton.className = "fa fa-play play-button";
282-
runCodeButton.hidden = true;
283-
runCodeButton.title = "Run this code";
284-
runCodeButton.setAttribute("aria-label", runCodeButton.title);
279+
var runCodeButton = document.createElement("button");
280+
runCodeButton.className = "fa fa-play play-button";
281+
runCodeButton.hidden = true;
282+
runCodeButton.title = "Run this code";
283+
runCodeButton.setAttribute("aria-label", runCodeButton.title);
285284

286-
buttons.insertBefore(runCodeButton, buttons.firstChild);
287-
runCodeButton.addEventListener("click", function (e) {
288-
run_rust_code(pre_block);
289-
});
285+
buttons.insertBefore(runCodeButton, buttons.firstChild);
286+
runCodeButton.addEventListener("click", function (e) {
287+
run_rust_code(pre_block);
288+
});
290289

291-
if (window.playground_copyable) {
292-
var copyCodeClipboardButton = document.createElement("button");
293-
copyCodeClipboardButton.className = "fa fa-copy clip-button";
294-
copyCodeClipboardButton.innerHTML = '<i class="tooltiptext"></i>';
295-
copyCodeClipboardButton.title = "Copy to clipboard";
296-
copyCodeClipboardButton.setAttribute(
297-
"aria-label",
298-
copyCodeClipboardButton.title
299-
);
290+
if (window.playground_copyable) {
291+
var copyCodeClipboardButton = document.createElement("button");
292+
copyCodeClipboardButton.className = "fa fa-copy clip-button";
293+
copyCodeClipboardButton.innerHTML =
294+
'<i class="tooltiptext"></i>';
295+
copyCodeClipboardButton.title = "Copy to clipboard";
296+
copyCodeClipboardButton.setAttribute(
297+
"aria-label",
298+
copyCodeClipboardButton.title,
299+
);
300300

301-
buttons.insertBefore(copyCodeClipboardButton, buttons.firstChild);
302-
}
301+
buttons.insertBefore(
302+
copyCodeClipboardButton,
303+
buttons.firstChild,
304+
);
305+
}
303306

304-
let code_block = pre_block.querySelector("code");
305-
if (window.ace && code_block.classList.contains("editable")) {
306-
var undoChangesButton = document.createElement("button");
307-
undoChangesButton.className = "fa fa-history reset-button";
308-
undoChangesButton.title = "Undo changes";
309-
undoChangesButton.setAttribute(
310-
"aria-label",
311-
undoChangesButton.title
312-
);
307+
let code_block = pre_block.querySelector("code");
308+
if (window.ace && code_block.classList.contains("editable")) {
309+
var undoChangesButton = document.createElement("button");
310+
undoChangesButton.className = "fa fa-history reset-button";
311+
undoChangesButton.title = "Undo changes";
312+
undoChangesButton.setAttribute(
313+
"aria-label",
314+
undoChangesButton.title,
315+
);
313316

314-
buttons.insertBefore(undoChangesButton, buttons.firstChild);
317+
buttons.insertBefore(undoChangesButton, buttons.firstChild);
315318

316-
undoChangesButton.addEventListener("click", function () {
317-
let editor = window.ace.edit(code_block);
318-
editor.setValue(editor.originalCode);
319-
editor.clearSelection();
320-
});
321-
}
322-
});
319+
undoChangesButton.addEventListener("click", function () {
320+
let editor = window.ace.edit(code_block);
321+
editor.setValue(editor.originalCode);
322+
editor.clearSelection();
323+
});
324+
}
325+
},
326+
);
323327
})();
324328

325329
(function themes() {
@@ -380,7 +384,7 @@ function playground_text(playground) {
380384

381385
setTimeout(function () {
382386
themeColorMetaTag.content = getComputedStyle(
383-
document.body
387+
document.body,
384388
).backgroundColor;
385389
}, 1);
386390

@@ -537,14 +541,14 @@ function playground_text(playground) {
537541
if (html.classList.contains("sidebar-hidden")) {
538542
var current_width = parseInt(
539543
document.documentElement.style.getPropertyValue(
540-
"--sidebar-width"
544+
"--sidebar-width",
541545
),
542-
10
546+
10,
543547
);
544548
if (current_width < 150) {
545549
document.documentElement.style.setProperty(
546550
"--sidebar-width",
547-
"150px"
551+
"150px",
548552
);
549553
}
550554
showSidebar();
@@ -577,7 +581,7 @@ function playground_text(playground) {
577581
pos = Math.min(pos, window.innerWidth - 100);
578582
document.documentElement.style.setProperty(
579583
"--sidebar-width",
580-
pos + "px"
584+
pos + "px",
581585
);
582586
}
583587
}
@@ -596,7 +600,7 @@ function playground_text(playground) {
596600
time: Date.now(),
597601
};
598602
},
599-
{ passive: true }
603+
{ passive: true },
600604
);
601605

602606
document.addEventListener(
@@ -620,7 +624,7 @@ function playground_text(playground) {
620624
firstContact = null;
621625
}
622626
},
623-
{ passive: true }
627+
{ passive: true },
624628
);
625629

626630
// Scroll sidebar to current active section
@@ -653,7 +657,7 @@ function playground_text(playground) {
653657
case "ArrowLeft":
654658
e.preventDefault();
655659
var previousButton = document.querySelector(
656-
".nav-chapters.previous"
660+
".nav-chapters.previous",
657661
);
658662
if (previousButton) {
659663
window.location.href = previousButton.href;
@@ -755,7 +759,7 @@ function playground_text(playground) {
755759
}
756760
prevScrollTop = scrollTop;
757761
},
758-
{ passive: true }
762+
{ passive: true },
759763
);
760764
})();
761765
(function controllBorder() {
@@ -769,7 +773,7 @@ function playground_text(playground) {
769773
menu.classList.add("bordered");
770774
}
771775
},
772-
{ passive: true }
776+
{ passive: true },
773777
);
774778
})();
775779
})();

theme/css/chrome.css

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,31 @@ a > .hljs {
165165
-ms-flex-direction: column;
166166
flex-direction: column;
167167

168-
-webkit-transition: color 0.5s, background-color 0.5s;
168+
-webkit-transition:
169+
color 0.5s,
170+
background-color 0.5s;
169171

170-
-o-transition: color 0.5s, background-color 0.5s;
172+
-o-transition:
173+
color 0.5s,
174+
background-color 0.5s;
171175

172-
transition: color 0.5s, background-color 0.5s;
176+
transition:
177+
color 0.5s,
178+
background-color 0.5s;
173179
}
174180

175181
.nav-chapters:hover {
176182
text-decoration: none;
177183
background-color: var(--theme-hover);
178-
-webkit-transition: background-color 0.15s, color 0.15s;
179-
-o-transition: background-color 0.15s, color 0.15s;
180-
transition: background-color 0.15s, color 0.15s;
184+
-webkit-transition:
185+
background-color 0.15s,
186+
color 0.15s;
187+
-o-transition:
188+
background-color 0.15s,
189+
color 0.15s;
190+
transition:
191+
background-color 0.15s,
192+
color 0.15s;
181193
}
182194

183195
.nav-wrapper {
@@ -307,9 +319,11 @@ mark.fade-out {
307319
transition: -webkit-box-shadow 300ms ease-in-out;
308320
-o-transition: box-shadow 300ms ease-in-out;
309321
transition: box-shadow 300ms ease-in-out;
310-
transition: box-shadow 300ms ease-in-out,
322+
transition:
323+
box-shadow 300ms ease-in-out,
311324
-webkit-box-shadow 300ms ease-in-out;
312-
transition: box-shadow 300ms ease-in-out,
325+
transition:
326+
box-shadow 300ms ease-in-out,
313327
-webkit-box-shadow 300ms ease-in-out;
314328
border: 1px solid var(--searchbar-border-color);
315329
border-radius: 3px;
@@ -387,7 +401,9 @@ ul#searchresults span.teaser em {
387401
transition: -webkit-transform 0.3s;
388402
-o-transition: transform 0.3s;
389403
transition: transform 0.3s;
390-
transition: transform 0.3s, -webkit-transform 0.3s; /* Animation: slide away */
404+
transition:
405+
transform 0.3s,
406+
-webkit-transform 0.3s; /* Animation: slide away */
391407
}
392408
.sidebar code {
393409
line-height: 2em;
@@ -491,7 +507,9 @@ ul#searchresults span.teaser em {
491507
transition: -webkit-transform 0.5s;
492508
-o-transition: transform 0.5s;
493509
transition: transform 0.5s;
494-
transition: transform 0.5s, -webkit-transform 0.5s;
510+
transition:
511+
transform 0.5s,
512+
-webkit-transform 0.5s;
495513
}
496514

497515
/* collapse the section */

theme/css/general.css

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
}
99

1010
html {
11-
font-family: Vazirmatn RD UI FD, sans-serif;
11+
font-family:
12+
Vazirmatn RD UI FD,
13+
sans-serif;
1214
color: var(--fg);
1315
background-color: var(--bg);
1416
-moz-text-size-adjust: none;
@@ -125,13 +127,25 @@ h2 a.header {
125127
}
126128

127129
.js:not(.sidebar-resizing) .page-wrapper {
128-
-webkit-transition: margin-right 0.3s ease, -webkit-transform 0.3s ease;
129-
transition: margin-right 0.3s ease, -webkit-transform 0.3s ease;
130-
-o-transition: margin-right 0.3s ease, transform 0.3s ease;
131-
transition: margin-right 0.3s ease, transform 0.3s ease;
132-
transition: margin-right 0.3s ease, transform 0.3s ease,
130+
-webkit-transition:
131+
margin-right 0.3s ease,
133132
-webkit-transform 0.3s ease;
134-
transition: margin-right 0.3s ease, transform 0.3s ease,
133+
transition:
134+
margin-right 0.3s ease,
135+
-webkit-transform 0.3s ease;
136+
-o-transition:
137+
margin-right 0.3s ease,
138+
transform 0.3s ease;
139+
transition:
140+
margin-right 0.3s ease,
141+
transform 0.3s ease;
142+
transition:
143+
margin-right 0.3s ease,
144+
transform 0.3s ease,
145+
-webkit-transform 0.3s ease;
146+
transition:
147+
margin-right 0.3s ease,
148+
transform 0.3s ease,
135149
-webkit-transform 0.3s ease; /* Animation: slide away */
136150
}
137151

0 commit comments

Comments
 (0)