mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-27 09:32:16 +02:00
Merge pull request #161 from google/defunct-speaker-notes
Simplify state transitions for speaker notes
This commit is contained in:
commit
81ba5b6a06
@ -19,12 +19,13 @@
|
|||||||
width: 40px;
|
width: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content details summary a {
|
.content details summary .pop-out {
|
||||||
margin-left: 0.5em;
|
color: var(--icons);
|
||||||
|
padding: 0 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1080px) {
|
.content details summary .pop-out i:hover {
|
||||||
.content details summary a {
|
color: var(--icons-hover);
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,9 @@
|
|||||||
popIn.setAttribute("title", "Close speaker notes");
|
popIn.setAttribute("title", "Close speaker notes");
|
||||||
popIn.setAttribute("aria-label", "Close speaker notes");
|
popIn.setAttribute("aria-label", "Close speaker notes");
|
||||||
popIn.classList.add("icon-button");
|
popIn.classList.add("icon-button");
|
||||||
let i = document.createElement("i");
|
let popInIcon = document.createElement("i");
|
||||||
i.classList.add("fa", "fa-window-close-o");
|
popInIcon.classList.add("fa", "fa-window-close-o");
|
||||||
popIn.append(i);
|
popIn.append(popInIcon);
|
||||||
popIn.addEventListener("click", (event) => {
|
popIn.addEventListener("click", (event) => {
|
||||||
setState("inline-open");
|
setState("inline-open");
|
||||||
applyState();
|
applyState();
|
||||||
@ -108,10 +108,20 @@
|
|||||||
// Create pop-out button.
|
// Create pop-out button.
|
||||||
let popOutLocation = new URL(window.location.href);
|
let popOutLocation = new URL(window.location.href);
|
||||||
popOutLocation.hash = "#speaker-notes-open";
|
popOutLocation.hash = "#speaker-notes-open";
|
||||||
let popOut = document.createElement("a");
|
let popOut = document.createElement("button");
|
||||||
popOut.setAttribute("href", popOutLocation.href);
|
popOut.classList.add("icon-button", "pop-out");
|
||||||
popOut.setAttribute("target", "speakerNotes");
|
popOut.addEventListener("click", (event) => {
|
||||||
popOut.classList.add("fa", "fa-external-link");
|
let popup = window.open(popOutLocation.href, "speakerNotes", "popup");
|
||||||
|
if (popup) {
|
||||||
|
setState("popup");
|
||||||
|
applyState();
|
||||||
|
} else {
|
||||||
|
window.alert("Could not open popup, please check your popup blocker settings.");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let popOutIcon = document.createElement("i");
|
||||||
|
popOutIcon.classList.add("fa", "fa-external-link");
|
||||||
|
popOut.append(popOutIcon);
|
||||||
summary.append(popOut);
|
summary.append(popOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,11 +139,6 @@
|
|||||||
|
|
||||||
// Create controls for a speaker note window.
|
// Create controls for a speaker note window.
|
||||||
function setupSpeakerNotes() {
|
function setupSpeakerNotes() {
|
||||||
// Show the notes inline again when the window is closed.
|
|
||||||
window.addEventListener("pagehide", (event) => {
|
|
||||||
setState("inline-open");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Hide sidebar and buttons.
|
// Hide sidebar and buttons.
|
||||||
document.querySelector("html").classList.remove("sidebar-visible");
|
document.querySelector("html").classList.remove("sidebar-visible");
|
||||||
document.querySelector("html").classList.add("sidebar-hidden");
|
document.querySelector("html").classList.add("sidebar-hidden");
|
||||||
@ -215,9 +220,7 @@
|
|||||||
// We encode the kind of page in the location hash:
|
// We encode the kind of page in the location hash:
|
||||||
switch (window.location.hash) {
|
switch (window.location.hash) {
|
||||||
case "#speaker-notes-open":
|
case "#speaker-notes-open":
|
||||||
// We are on a page in the speaker notes. We need to re-establish the
|
// We are on a page in the speaker notes.
|
||||||
// popup state so that the main window will hide the notes.
|
|
||||||
setState("popup");
|
|
||||||
setupSpeakerNotes();
|
setupSpeakerNotes();
|
||||||
break;
|
break;
|
||||||
case "#speaker-notes-defunct":
|
case "#speaker-notes-defunct":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user