From a93f2cf6045c8ac2f6cf31892648f402699ceaba Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 20:32:27 -0400 Subject: [PATCH 1/9] fix some hypothesis issues --- build/plugins/hypothesis.html | 94 +++++++++++++++++++++++++--- build/plugins/table-of-contents.html | 3 +- build/themes/default.html | 51 ++++++++++++++- 3 files changed, 136 insertions(+), 12 deletions(-) diff --git a/build/plugins/hypothesis.html b/build/plugins/hypothesis.html index b38888e7..6a1a32e4 100644 --- a/build/plugins/hypothesis.html +++ b/build/plugins/hypothesis.html @@ -1,6 +1,16 @@ - + - + // hypothesis client script + const embed = 'https://hypothes.is/embed.js'; + // hypothesis annotation count query url + const query = 'https://api.hypothes.is/api/search?limit=0&url=' - + + + + diff --git a/build/plugins/table-of-contents.html b/build/plugins/table-of-contents.html index fc57f78f..ac5b7321 100644 --- a/build/plugins/table-of-contents.html +++ b/build/plugins/table-of-contents.html @@ -172,11 +172,12 @@ button.innerHTML = document.querySelector( '.icon_th_list' ).innerHTML; + button.title = 'Table of Contents'; button.classList.add('icon_button'); // create header text const text = document.createElement('h3'); - text.innerHTML = 'Table of Contents'; + text.innerHTML = 'View Table of Contents'; // create container for toc list const list = document.createElement('div'); diff --git a/build/themes/default.html b/build/themes/default.html index 26675bdf..73ec1021 100644 --- a/build/themes/default.html +++ b/build/themes/default.html @@ -80,6 +80,26 @@ border-bottom: solid 1px #bdbdbd; } + /* heading font sizes */ + h1 { + font-size: 2em; + } + h2 { + font-size: 1.5em; + } + h3{ + font-size: 1.35em; + } + h4 { + font-size: 1.25em; + } + h5 { + font-size: 1.15em; + } + h6 { + font-size: 1em; + } + /* -------------------------------------------------- */ /* manuscript header */ /* -------------------------------------------------- */ @@ -1182,10 +1202,39 @@ /* hypothesis (annotations) plugin */ /* -------------------------------------------------- */ + /* hypothesis activation button */ + #hypothesis_button { + box-sizing: border-box; + position: fixed; + top: 0; + right: 0; + width: 60px; + height: 60px; + background: #ffffff; + border-radius: 0; + border-left: solid 1px #bdbdbd; + border-bottom: solid 1px #bdbdbd; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.05); + z-index: 2; + } + + /* hypothesis button svg */ + #hypothesis_button > svg { + position: relative; + top: -4px; + } + + /* hypothesis annotation count */ + #hypothesis_count { + position: absolute; + left: 0; + right: 0; + bottom: 5px; + } + /* side panel */ .annotator-frame { width: 280px !important; - z-index: 0 !important; } /* match highlight color to rest of theme */ From ef35c6bfbf5ca6484493e616c2a17637ef02499d Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 20:43:07 -0400 Subject: [PATCH 2/9] use canonical url for ann count lookup if available --- build/plugins/hypothesis.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/plugins/hypothesis.html b/build/plugins/hypothesis.html index 6a1a32e4..63d84953 100644 --- a/build/plugins/hypothesis.html +++ b/build/plugins/hypothesis.html @@ -63,7 +63,10 @@ // get annotation count from Hypothesis based on url let count = '-'; try { - const response = await fetch(query + window.location.href); + const canonical = + (document.querySelector('link[rel="canonical"]') || {}).href; + const url = window.location.href; + const response = await fetch(query + (canonical || url)); const json = await response.json(); count = json.total || '-'; } catch(error) { From 22dc412523f4c14a1ba48f14d8c9514882f7cdac Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 20:45:09 -0400 Subject: [PATCH 3/9] update --- build/plugins/hypothesis.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build/plugins/hypothesis.html b/build/plugins/hypothesis.html index 63d84953..63b8995f 100644 --- a/build/plugins/hypothesis.html +++ b/build/plugins/hypothesis.html @@ -63,10 +63,9 @@ // get annotation count from Hypothesis based on url let count = '-'; try { - const canonical = - (document.querySelector('link[rel="canonical"]') || {}).href; - const url = window.location.href; - const response = await fetch(query + (canonical || url)); + const canonical = document.querySelector('link[rel="canonical"]'); + const location = window.location; + const response = await fetch(query + (canonical || location).href); const json = await response.json(); count = json.total || '-'; } catch(error) { From 420b35c484925c71144285e6a5739d8bcb0c15ce Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 20:46:51 -0400 Subject: [PATCH 4/9] update --- build/plugins/hypothesis.html | 4 +--- build/plugins/table-of-contents.html | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/build/plugins/hypothesis.html b/build/plugins/hypothesis.html index 63b8995f..089715d7 100644 --- a/build/plugins/hypothesis.html +++ b/build/plugins/hypothesis.html @@ -42,9 +42,7 @@ // create button const button = document.createElement('button'); button.id = 'hypothesis_button'; - button.innerHTML = document.querySelector( - '.icon_hypothesis' - ).innerHTML; + button.innerHTML = document.querySelector('.icon_hypothesis').innerHTML; button.title = 'Hypothesis annotations'; button.classList.add('icon_button'); diff --git a/build/plugins/table-of-contents.html b/build/plugins/table-of-contents.html index ac5b7321..49d6e01c 100644 --- a/build/plugins/table-of-contents.html +++ b/build/plugins/table-of-contents.html @@ -169,9 +169,7 @@ // create toc button const button = document.createElement('button'); button.id = 'toc_button'; - button.innerHTML = document.querySelector( - '.icon_th_list' - ).innerHTML; + button.innerHTML = document.querySelector('.icon_th_list').innerHTML; button.title = 'Table of Contents'; button.classList.add('icon_button'); From 670f24d073ec660c59edbd107286d42ed46908d0 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 20:53:49 -0400 Subject: [PATCH 5/9] hide hypothesis button on print --- build/themes/default.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/themes/default.html b/build/themes/default.html index 73ec1021..7fca81ea 100644 --- a/build/themes/default.html +++ b/build/themes/default.html @@ -1252,8 +1252,12 @@ background: #f5f5f5 !important; } - /* always hide toolbar and tooltip on print */ + /* always hide button, toolbar, and tooltip on print */ @media only print { + #hypothesis_button { + display: none; + } + .annotator-frame { display: none !important; } From 4a355f62684860a5f57bf1f00b145e82831381b8 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 21:01:38 -0400 Subject: [PATCH 6/9] add headings 5 and 6 to delete me --- content/02.delete-me.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/02.delete-me.md b/content/02.delete-me.md index 8f2ed071..78d9c7ed 100644 --- a/content/02.delete-me.md +++ b/content/02.delete-me.md @@ -63,6 +63,10 @@ Document section headings: #### Heading 4 +##### Heading 5 + +###### Heading 6 + ### A heading centered on its own printed page{.center .page_center} From 5acd12bf8dbbd251ea67b2695d4cf2f0829c7852 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Thu, 4 Jun 2020 21:11:05 -0400 Subject: [PATCH 7/9] remove print shrinking of h1 thru h3 --- build/themes/default.html | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/build/themes/default.html b/build/themes/default.html index 7fca81ea..cfff8980 100644 --- a/build/themes/default.html +++ b/build/themes/default.html @@ -533,22 +533,6 @@ margin: 15px 0; } - /* heading 1 */ - h1 { - font-size: 1.75em; - } - - /* heading 2 */ - h2 { - font-size: 1.25em; - margin-top: 0; - } - - /* heading 3 */ - h3 { - font-size: 1.10em; - } - /* figures and tables */ figure, table { font-size: 0.85em; From 58eb7e9476d452d15884151d568db703000aead7 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Fri, 5 Jun 2020 15:31:16 -0400 Subject: [PATCH 8/9] incorp review comments --- build/plugins/hypothesis.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/plugins/hypothesis.html b/build/plugins/hypothesis.html index 089715d7..08944ed9 100644 --- a/build/plugins/hypothesis.html +++ b/build/plugins/hypothesis.html @@ -63,7 +63,8 @@ try { const canonical = document.querySelector('link[rel="canonical"]'); const location = window.location; - const response = await fetch(query + (canonical || location).href); + const url = encodeURIComponent((canonical || location).href); + const response = await fetch(query + url); const json = await response.json(); count = json.total || '-'; } catch(error) { @@ -93,10 +94,10 @@