|
78 | 78 | popIn.setAttribute("title", "Close speaker notes");
|
79 | 79 | popIn.setAttribute("aria-label", "Close speaker notes");
|
80 | 80 | popIn.classList.add("icon-button");
|
81 |
| - let i = document.createElement("i"); |
82 |
| - i.classList.add("fa", "fa-window-close-o"); |
83 |
| - popIn.append(i); |
| 81 | + let popInIcon = document.createElement("i"); |
| 82 | + popInIcon.classList.add("fa", "fa-window-close-o"); |
| 83 | + popIn.append(popInIcon); |
84 | 84 | popIn.addEventListener("click", (event) => {
|
85 | 85 | setState("inline-open");
|
86 | 86 | applyState();
|
|
108 | 108 | // Create pop-out button.
|
109 | 109 | let popOutLocation = new URL(window.location.href);
|
110 | 110 | popOutLocation.hash = "#speaker-notes-open";
|
111 |
| - let popOut = document.createElement("a"); |
112 |
| - popOut.setAttribute("href", popOutLocation.href); |
113 |
| - popOut.setAttribute("target", "speakerNotes"); |
114 |
| - popOut.classList.add("fa", "fa-external-link"); |
| 111 | + let popOut = document.createElement("button"); |
| 112 | + popOut.classList.add("icon-button", "pop-out"); |
| 113 | + popOut.addEventListener("click", (event) => { |
| 114 | + let popup = window.open(popOutLocation.href, "speakerNotes", "popup"); |
| 115 | + if (popup) { |
| 116 | + setState("popup"); |
| 117 | + applyState(); |
| 118 | + } else { |
| 119 | + window.alert("Could not open popup, please check your popup blocker settings."); |
| 120 | + } |
| 121 | + }) |
| 122 | + let popOutIcon = document.createElement("i"); |
| 123 | + popOutIcon.classList.add("fa", "fa-external-link"); |
| 124 | + popOut.append(popOutIcon); |
115 | 125 | summary.append(popOut);
|
116 | 126 | }
|
117 | 127 |
|
|
129 | 139 |
|
130 | 140 | // Create controls for a speaker note window.
|
131 | 141 | function setupSpeakerNotes() {
|
132 |
| - // Show the notes inline again when the window is closed. |
133 |
| - window.addEventListener("pagehide", (event) => { |
134 |
| - setState("inline-open"); |
135 |
| - }); |
136 |
| - |
137 | 142 | // Hide sidebar and buttons.
|
138 | 143 | document.querySelector("html").classList.remove("sidebar-visible");
|
139 | 144 | document.querySelector("html").classList.add("sidebar-hidden");
|
|
215 | 220 | // We encode the kind of page in the location hash:
|
216 | 221 | switch (window.location.hash) {
|
217 | 222 | case "#speaker-notes-open":
|
218 |
| - // We are on a page in the speaker notes. We need to re-establish the |
219 |
| - // popup state so that the main window will hide the notes. |
220 |
| - setState("popup"); |
| 223 | + // We are on a page in the speaker notes. |
221 | 224 | setupSpeakerNotes();
|
222 | 225 | break;
|
223 | 226 | case "#speaker-notes-defunct":
|
|
0 commit comments