diff options
| Commit | a3827aca5f9d0e021bc94a00e4f022982e4a3db6 (patch) | |
|---|---|---|
| Author | 2023-07-11 12:50:36 +0300 | |
| Committer | 2023-07-11 12:50:36 +0300 | |
| Files | 715f58810d377bc2ac55f9cb955001dbb81d0930 /src/scripts | |
| syndamia.com-a3827aca5f9d0e021bc94a00e4f022982e4a3db6.tar syndamia.com-a3827aca5f9d0e021bc94a00e4f022982e4a3db6.tar.gz syndamia.com-a3827aca5f9d0e021bc94a00e4f022982e4a3db6.zip | ||
| Parent | c6cd443da038de421909278726b18972dd4cc19a (diff) | |
(presentation) Implemented changing label on article mode button and query inside URL when in article mode
So you could share a presentation as an article
1 files changed, 15 insertions, 0 deletions
| -rw-r--r-- | src/scripts/presentation.js | 15 |
diff --git a/src/scripts/presentation.js b/src/scripts/presentation.js index 8dd4960..484961e 100644 --- a/src/scripts/presentation.js +++ b/src/scripts/presentation.js @@ -115,7 +115,22 @@ function toggleArticleMode() { presentBtn.classList.toggle('nodisplay'); // Toggle presentation.css document.styleSheets.item(3).disabled = !document.styleSheets.item(3).disabled; + + // Add a=y to url when in article mode + var url = window.location.href.substring(0, window.location.href.indexOf('?')); + if (document.styleSheets.item(3).disabled) url += '?a=y'; + url += window.location.href.substr(window.location.href.indexOf('#')); + + window.history.replaceState(history.state, document.title, url); + + // Fix message + if (articleBtn.innerHTML[0] === 'A') + articleBtn.innerHTML = 'Slide' + articleBtn.innerHTML.substr(7); + else + articleBtn.innerHTML = 'Article' + articleBtn.innerHTML.substr(5); } articleBtn.addEventListener('click', toggleArticleMode); window.addEventListener('load', function() { + if (window.location.href.substr(window.location.href.indexOf('?'), 4) === '?a=y') + toggleArticleMode(); }); |