diff --git a/assets/css/distill.scss b/assets/css/distill.scss
index 6e0c0bed..d96d6452 100644
--- a/assets/css/distill.scss
+++ b/assets/css/distill.scss
@@ -6,10 +6,6 @@ a {
color: currentColor;
}
-span .katex {
- color: var(--global-text-color-primary) !important;
-}
-
d-byline {
border-top-color: var(--global-divider-color) !important;
}
diff --git a/assets/js/distillpub/overrides.js b/assets/js/distillpub/overrides.js
index 250899d7..573b66ac 100644
--- a/assets/js/distillpub/overrides.js
+++ b/assets/js/distillpub/overrides.js
@@ -1,56 +1,58 @@
-document.addEventListener('DOMContentLoaded', () => {
- // Override styles of the footnotes.
- document.querySelectorAll('d-footnote').forEach(function (footnote) {
- footnote.shadowRoot
- .querySelector('sup > span')
- .setAttribute('style', 'color: var(--global-theme-color);');
- footnote.shadowRoot
- .querySelector('d-hover-box')
- .shadowRoot.querySelector('style')
- .sheet.insertRule(
- '.panel {background-color: var(--global-bg-color) !important;}'
- );
- footnote.shadowRoot
- .querySelector('d-hover-box')
- .shadowRoot.querySelector('style')
- .sheet.insertRule(
- '.panel {border-color: var(--global-divider-color) !important;}'
- );
- });
- // Override styles of the citations.
- document.querySelectorAll('d-cite').forEach(function (cite) {
- cite.shadowRoot
- .querySelector('div > span')
- .setAttribute('style', 'color: var(--global-theme-color);');
- cite.shadowRoot
- .querySelector('style')
- .sheet.insertRule(
- 'ul li a {color: var(--global-text-color-primary) !important; text-decoration: none;}'
- );
- cite.shadowRoot
- .querySelector('style')
- .sheet.insertRule(
- 'ul li a:hover {color: var(--global-theme-color) !important;}'
- );
- cite.shadowRoot
- .querySelector('d-hover-box')
- .shadowRoot.querySelector('style')
- .sheet.insertRule(
- '.panel {background-color: var(--global-bg-color) !important;}'
- );
- cite.shadowRoot
- .querySelector('d-hover-box')
- .shadowRoot.querySelector('style')
- .sheet.insertRule(
- '.panel {border-color: var(--global-divider-color) !important;}'
- );
- });
- // Override styles of the math.
- document.querySelectorAll('d-math').forEach(function (math) {
- math.shadowRoot
- .querySelector('style')
- .sheet.insertRule(
- 'span .katex {color: var(--global-text-color-primary) !important;}'
- );
- });
+document.addEventListener('readystatechange', () => {
+ if (document.readyState === 'complete') {
+ // Override styles of the footnotes.
+ document.querySelectorAll('d-footnote').forEach(function (footnote) {
+ footnote.shadowRoot
+ .querySelector('sup > span')
+ .setAttribute('style', 'color: var(--global-theme-color);');
+ footnote.shadowRoot
+ .querySelector('d-hover-box')
+ .shadowRoot.querySelector('style')
+ .sheet.insertRule(
+ '.panel {background-color: var(--global-bg-color) !important;}'
+ );
+ footnote.shadowRoot
+ .querySelector('d-hover-box')
+ .shadowRoot.querySelector('style')
+ .sheet.insertRule(
+ '.panel {border-color: var(--global-divider-color) !important;}'
+ );
+ });
+ // Override styles of the citations.
+ document.querySelectorAll('d-cite').forEach(function (cite) {
+ cite.shadowRoot
+ .querySelector('div > span')
+ .setAttribute('style', 'color: var(--global-theme-color);');
+ cite.shadowRoot
+ .querySelector('style')
+ .sheet.insertRule(
+ 'ul li a {color: var(--global-text-color-primary) !important; text-decoration: none;}'
+ );
+ cite.shadowRoot
+ .querySelector('style')
+ .sheet.insertRule(
+ 'ul li a:hover {color: var(--global-theme-color) !important;}'
+ );
+ cite.shadowRoot
+ .querySelector('d-hover-box')
+ .shadowRoot.querySelector('style')
+ .sheet.insertRule(
+ '.panel {background-color: var(--global-bg-color) !important;}'
+ );
+ cite.shadowRoot
+ .querySelector('d-hover-box')
+ .shadowRoot.querySelector('style')
+ .sheet.insertRule(
+ '.panel {border-color: var(--global-divider-color) !important;}'
+ );
+ });
+ // Override styles of the math.
+ document.querySelectorAll('d-math').forEach(function (math) {
+ math.shadowRoot
+ .querySelector('style')
+ .sheet.insertRule(
+ 'span .katex {color: var(--global-text-color-primary) !important;}'
+ );
+ });
+ }
});
diff --git a/assets/js/distillpub/template.v2.js b/assets/js/distillpub/template.v2.js
index a2c79199..0819f149 100644
--- a/assets/js/distillpub/template.v2.js
+++ b/assets/js/distillpub/template.v2.js
@@ -1683,7 +1683,7 @@ d-appendix > distill-appendix {
(function(exports) {
function BibtexParser() {
-
+
this.months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
this.notKey = [',','{','}',' ','='];
this.pos = 0;
@@ -1819,7 +1819,7 @@ d-appendix > distill-appendix {
return k.toLowerCase();
else
throw "Value expected:" + this.input.substring(start) + ' for key: ' + k;
-
+
} };
this.value = function() {
@@ -1842,7 +1842,7 @@ d-appendix > distill-appendix {
return this.input.substring(start, this.pos);
} else {
this.pos++;
-
+
} } };
this.key_equals_value = function() {
@@ -1917,7 +1917,7 @@ d-appendix > distill-appendix {
}
this.match("}");
} };
- }
+ }
exports.toJSON = function(bibtex) {
var b = new BibtexParser();
b.setInput(bibtex);
@@ -1947,7 +1947,7 @@ d-appendix > distill-appendix {
out += '}\n\n';
}
return out;
-
+
};
})( exports);
diff --git a/layouts/partials/scripts/distillpub.html b/layouts/partials/scripts/distillpub.html
index e6d79f84..53b83558 100644
--- a/layouts/partials/scripts/distillpub.html
+++ b/layouts/partials/scripts/distillpub.html
@@ -2,14 +2,14 @@
{{ with resources.Get "js/distillpub/template.v2.js" | minify }}
{{ end }}
- {{ with resources.Get "js/distillpub/overrides.js" | minify }}
-
- {{ end }}
{{ with resources.Get "css/distill.scss" | toCSS | minify }}
{{ end }}
+ {{ with resources.Get "js/distillpub/overrides.js" | minify }}
+
+ {{ end }}
{{ end }}