Skip to content

Update actions/checkout action to v4 - abandoned #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- name: Checkout project
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
access_token: ${{ github.token }}

- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust
run: |
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get Current Date
id: date
Expand Down
166 changes: 85 additions & 81 deletions theme/book.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function playground_text(playground) {
return Promise.race([
fetch(url, options),
new Promise((_, reject) =>
setTimeout(() => reject(new Error("timeout")), timeout)
setTimeout(() => reject(new Error("timeout")), timeout),
),
]);
}
Expand All @@ -38,10 +38,10 @@ function playground_text(playground) {
.then((response) => {
// get list of crates available in the rust playground
let playground_crates = response.crates.map(
(item) => item["id"]
(item) => item["id"],
);
playgrounds.forEach((block) =>
handle_crate_list_update(block, playground_crates)
handle_crate_list_update(block, playground_crates),
);
});
}
Expand Down Expand Up @@ -154,7 +154,7 @@ function playground_text(playground) {
.catch(
(error) =>
(result_block.innerText =
"Playground Communication: " + error.message)
"Playground Communication: " + error.message),
);
}

Expand Down Expand Up @@ -238,88 +238,92 @@ function playground_text(playground) {
block.classList.add("hide-boring");
}
});
}
},
);

if (window.playground_copyable) {
Array.from(document.querySelectorAll("pre code")).forEach(function (
block
) {
var pre_block = block.parentNode;
if (!pre_block.classList.contains("playground")) {
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement("div");
buttons.className = "buttons";
pre_block.insertBefore(buttons, pre_block.firstChild);
}
Array.from(document.querySelectorAll("pre code")).forEach(
function (block) {
var pre_block = block.parentNode;
if (!pre_block.classList.contains("playground")) {
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement("div");
buttons.className = "buttons";
pre_block.insertBefore(buttons, pre_block.firstChild);
}

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

buttons.insertBefore(clipButton, buttons.firstChild);
}
});
buttons.insertBefore(clipButton, buttons.firstChild);
}
},
);
}

// Process playground code blocks
Array.from(document.querySelectorAll(".playground")).forEach(function (
pre_block
) {
// Add play button
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement("div");
buttons.className = "buttons";
pre_block.insertBefore(buttons, pre_block.firstChild);
}
Array.from(document.querySelectorAll(".playground")).forEach(
function (pre_block) {
// Add play button
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement("div");
buttons.className = "buttons";
pre_block.insertBefore(buttons, pre_block.firstChild);
}

var runCodeButton = document.createElement("button");
runCodeButton.className = "fa fa-play play-button";
runCodeButton.hidden = true;
runCodeButton.title = "Run this code";
runCodeButton.setAttribute("aria-label", runCodeButton.title);
var runCodeButton = document.createElement("button");
runCodeButton.className = "fa fa-play play-button";
runCodeButton.hidden = true;
runCodeButton.title = "Run this code";
runCodeButton.setAttribute("aria-label", runCodeButton.title);

buttons.insertBefore(runCodeButton, buttons.firstChild);
runCodeButton.addEventListener("click", function (e) {
run_rust_code(pre_block);
});
buttons.insertBefore(runCodeButton, buttons.firstChild);
runCodeButton.addEventListener("click", function (e) {
run_rust_code(pre_block);
});

if (window.playground_copyable) {
var copyCodeClipboardButton = document.createElement("button");
copyCodeClipboardButton.className = "fa fa-copy clip-button";
copyCodeClipboardButton.innerHTML = '<i class="tooltiptext"></i>';
copyCodeClipboardButton.title = "Copy to clipboard";
copyCodeClipboardButton.setAttribute(
"aria-label",
copyCodeClipboardButton.title
);
if (window.playground_copyable) {
var copyCodeClipboardButton = document.createElement("button");
copyCodeClipboardButton.className = "fa fa-copy clip-button";
copyCodeClipboardButton.innerHTML =
'<i class="tooltiptext"></i>';
copyCodeClipboardButton.title = "Copy to clipboard";
copyCodeClipboardButton.setAttribute(
"aria-label",
copyCodeClipboardButton.title,
);

buttons.insertBefore(copyCodeClipboardButton, buttons.firstChild);
}
buttons.insertBefore(
copyCodeClipboardButton,
buttons.firstChild,
);
}

let code_block = pre_block.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
var undoChangesButton = document.createElement("button");
undoChangesButton.className = "fa fa-history reset-button";
undoChangesButton.title = "Undo changes";
undoChangesButton.setAttribute(
"aria-label",
undoChangesButton.title
);
let code_block = pre_block.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
var undoChangesButton = document.createElement("button");
undoChangesButton.className = "fa fa-history reset-button";
undoChangesButton.title = "Undo changes";
undoChangesButton.setAttribute(
"aria-label",
undoChangesButton.title,
);

buttons.insertBefore(undoChangesButton, buttons.firstChild);
buttons.insertBefore(undoChangesButton, buttons.firstChild);

undoChangesButton.addEventListener("click", function () {
let editor = window.ace.edit(code_block);
editor.setValue(editor.originalCode);
editor.clearSelection();
});
}
});
undoChangesButton.addEventListener("click", function () {
let editor = window.ace.edit(code_block);
editor.setValue(editor.originalCode);
editor.clearSelection();
});
}
},
);
})();

(function themes() {
Expand Down Expand Up @@ -380,7 +384,7 @@ function playground_text(playground) {

setTimeout(function () {
themeColorMetaTag.content = getComputedStyle(
document.body
document.body,
).backgroundColor;
}, 1);

Expand Down Expand Up @@ -537,14 +541,14 @@ function playground_text(playground) {
if (html.classList.contains("sidebar-hidden")) {
var current_width = parseInt(
document.documentElement.style.getPropertyValue(
"--sidebar-width"
"--sidebar-width",
),
10
10,
);
if (current_width < 150) {
document.documentElement.style.setProperty(
"--sidebar-width",
"150px"
"150px",
);
}
showSidebar();
Expand Down Expand Up @@ -577,7 +581,7 @@ function playground_text(playground) {
pos = Math.min(pos, window.innerWidth - 100);
document.documentElement.style.setProperty(
"--sidebar-width",
pos + "px"
pos + "px",
);
}
}
Expand All @@ -596,7 +600,7 @@ function playground_text(playground) {
time: Date.now(),
};
},
{ passive: true }
{ passive: true },
);

document.addEventListener(
Expand All @@ -620,7 +624,7 @@ function playground_text(playground) {
firstContact = null;
}
},
{ passive: true }
{ passive: true },
);

// Scroll sidebar to current active section
Expand Down Expand Up @@ -653,7 +657,7 @@ function playground_text(playground) {
case "ArrowLeft":
e.preventDefault();
var previousButton = document.querySelector(
".nav-chapters.previous"
".nav-chapters.previous",
);
if (previousButton) {
window.location.href = previousButton.href;
Expand Down Expand Up @@ -755,7 +759,7 @@ function playground_text(playground) {
}
prevScrollTop = scrollTop;
},
{ passive: true }
{ passive: true },
);
})();
(function controllBorder() {
Expand All @@ -769,7 +773,7 @@ function playground_text(playground) {
menu.classList.add("bordered");
}
},
{ passive: true }
{ passive: true },
);
})();
})();
38 changes: 28 additions & 10 deletions theme/css/chrome.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,31 @@ a > .hljs {
-ms-flex-direction: column;
flex-direction: column;

-webkit-transition: color 0.5s, background-color 0.5s;
-webkit-transition:
color 0.5s,
background-color 0.5s;

-o-transition: color 0.5s, background-color 0.5s;
-o-transition:
color 0.5s,
background-color 0.5s;

transition: color 0.5s, background-color 0.5s;
transition:
color 0.5s,
background-color 0.5s;
}

.nav-chapters:hover {
text-decoration: none;
background-color: var(--theme-hover);
-webkit-transition: background-color 0.15s, color 0.15s;
-o-transition: background-color 0.15s, color 0.15s;
transition: background-color 0.15s, color 0.15s;
-webkit-transition:
background-color 0.15s,
color 0.15s;
-o-transition:
background-color 0.15s,
color 0.15s;
transition:
background-color 0.15s,
color 0.15s;
}

.nav-wrapper {
Expand Down Expand Up @@ -307,9 +319,11 @@ mark.fade-out {
transition: -webkit-box-shadow 300ms ease-in-out;
-o-transition: box-shadow 300ms ease-in-out;
transition: box-shadow 300ms ease-in-out;
transition: box-shadow 300ms ease-in-out,
transition:
box-shadow 300ms ease-in-out,
-webkit-box-shadow 300ms ease-in-out;
transition: box-shadow 300ms ease-in-out,
transition:
box-shadow 300ms ease-in-out,
-webkit-box-shadow 300ms ease-in-out;
border: 1px solid var(--searchbar-border-color);
border-radius: 3px;
Expand Down Expand Up @@ -387,7 +401,9 @@ ul#searchresults span.teaser em {
transition: -webkit-transform 0.3s;
-o-transition: transform 0.3s;
transition: transform 0.3s;
transition: transform 0.3s, -webkit-transform 0.3s; /* Animation: slide away */
transition:
transform 0.3s,
-webkit-transform 0.3s; /* Animation: slide away */
}
.sidebar code {
line-height: 2em;
Expand Down Expand Up @@ -491,7 +507,9 @@ ul#searchresults span.teaser em {
transition: -webkit-transform 0.5s;
-o-transition: transform 0.5s;
transition: transform 0.5s;
transition: transform 0.5s, -webkit-transform 0.5s;
transition:
transform 0.5s,
-webkit-transform 0.5s;
}

/* collapse the section */
Expand Down
Loading