From a0a5087b86f3de488d2cbecb6bb7c80f1dce7e02 Mon Sep 17 00:00:00 2001 From: shafayetShafee Date: Fri, 10 May 2024 16:09:50 +0600 Subject: [PATCH 1/2] updated readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 52fc438..6a25099 100644 --- a/README.md +++ b/README.md @@ -126,3 +126,8 @@ Also, to change the header text style for slides with simple [`background`](http - The source code for another example that uses only `sc-sb-title`: [example_section-title.qmd](example_section-title.qmd) and the live demo of the rendered revealjs slides, [`example_section_title.html`](https://shafayetshafee.github.io/reveal-header/example_section_title.html) - The source code for example where header text is hidden on the title slide: [example_hide_header_text.qmd](example_hide_header_text.qmd) and the [`rendered output`](https://shafayetshafee.github.io/reveal-header/example_hide_header_text.html) + + +## Similar Extension + +If you find this extension useful, you may also like [`metropolis-beamer`](https://github.com/shafayetShafee/metropolis-beamer/tree/main) extension that provides a custom quarto revealjs format which aims to provide a lookalike [`metropolis beamer theme`] for quarto revealjs. \ No newline at end of file From b8d9fbe4eed988179af052387d7bd85c41e7f1ae Mon Sep 17 00:00:00 2001 From: shafayetShafee Date: Fri, 10 May 2024 16:10:12 +0600 Subject: [PATCH 2/2] fixed #20 --- _extensions/reveal-header/_extension.yml | 2 +- .../resources/css/add_header.css | 3 + .../reveal-header/resources/js/add_header.js | 8 +- .../reveal-header/resources/js/sc_sb_title.js | 2 +- docs/example.html | 127 ++++++++++++------ docs/example_all.html | 101 ++++++++++---- docs/example_hide_header_text.html | 127 ++++++++++++------ docs/example_section_title.html | 84 ++++++++---- open_html_files.sh | 5 - test_examples.sh | 6 - testing.sh | 2 +- 11 files changed, 325 insertions(+), 142 deletions(-) delete mode 100644 open_html_files.sh delete mode 100644 test_examples.sh diff --git a/_extensions/reveal-header/_extension.yml b/_extensions/reveal-header/_extension.yml index c7873b3..b28c980 100644 --- a/_extensions/reveal-header/_extension.yml +++ b/_extensions/reveal-header/_extension.yml @@ -1,6 +1,6 @@ title: Reveal-header author: Shafayet Khan Shafee -version: 1.2.7 +version: 1.2.8 quarto-required: ">=1.2.0" contributes: filters: diff --git a/_extensions/reveal-header/resources/css/add_header.css b/_extensions/reveal-header/resources/css/add_header.css index ce79e67..db2c82c 100644 --- a/_extensions/reveal-header/resources/css/add_header.css +++ b/_extensions/reveal-header/resources/css/add_header.css @@ -35,6 +35,7 @@ .reveal-header.no-logo .sc-title p {margin-left: 6vw} +.reveal .header-logo svg, .reveal .header-logo img { margin: var(--header-margin); padding-left: 1vw; @@ -46,6 +47,8 @@ } + + /* .reveal .slides { margin-top: 3vh !important;} */ .inverse-header { color: #c5d7ce !important;} diff --git a/_extensions/reveal-header/resources/js/add_header.js b/_extensions/reveal-header/resources/js/add_header.js index c195509..daebbc1 100644 --- a/_extensions/reveal-header/resources/js/add_header.js +++ b/_extensions/reveal-header/resources/js/add_header.js @@ -15,10 +15,10 @@ function header() { reveal.insertBefore(header, reveal.firstChild); logo_img = document.querySelector('.header-logo img'); - if (logo_img.getAttribute('src') == null) { + if (logo_img?.getAttribute('src') == null) { if (logo_img?.getAttribute('data-src') != null) { logo_img.src = logo_img?.getAttribute('data-src') || ""; - logo_img.removeAttribute('data-src'); + logo_img?.removeAttribute('data-src'); }; }; }; @@ -86,12 +86,12 @@ function header() { const footer_logo_link = get_clean_attrs(header_logo, 'data-footer-logo-link'); if (header_logo_link != null) { - const header_logo_img = document.querySelector('div.header-logo img'); + const header_logo_img = document.querySelector('div.header-logo').firstElementChild; linkify_logo(header_logo_img, header_logo_link); }; if (footer_logo_link != null) { - const footer_logo_img = document.querySelector('img.slide-logo'); + const footer_logo_img = document.querySelector('.slide-logo'); footer_logo_img.setAttribute('style', "z-index:99;"); linkify_logo(footer_logo_img, footer_logo_link); }; diff --git a/_extensions/reveal-header/resources/js/sc_sb_title.js b/_extensions/reveal-header/resources/js/sc_sb_title.js index 38e18e2..c85fc6c 100644 --- a/_extensions/reveal-header/resources/js/sc_sb_title.js +++ b/_extensions/reveal-header/resources/js/sc_sb_title.js @@ -39,7 +39,7 @@ if (Reveal.isReady()) { - if (document.querySelector('div.reveal-header img').getAttribute('src').length == 0) { + if (document.querySelector('div.reveal-header img')?.getAttribute('src')?.length == 0) { document.querySelector('div.reveal-header').classList.add('no-logo') } diff --git a/docs/example.html b/docs/example.html index 94090bd..107f876 100644 --- a/docs/example.html +++ b/docs/example.html @@ -427,10 +427,10 @@ );