Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update scite plugin #415

Merged
merged 5 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/pandoc/defaults/html.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include-after-body:
- build/plugins/analytics.html
- build/plugins/hypothesis.html
- build/plugins/mathjax.html
#- build/plugins/scite.html
# - build/plugins/scite.html
agitter marked this conversation as resolved.
Show resolved Hide resolved
variables:
math: ""
html-math-method:
Expand Down
17 changes: 9 additions & 8 deletions build/plugins/scite.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
See https://scite.ai/.
-->

<link
rel="stylesheet"
type="text/css"
href="https://cdn.scite.ai/badge/scite-badge-latest.min.css"
/>
<script
async
type="application/javascript"
Expand All @@ -19,13 +14,13 @@
<script>
// start script
function start() {
// if printing, exit and don't run badges
if (window.matchMedia("print").matches) return;

// get citation elements
const query = ".references div[id*='ref-']";
const elements = document.querySelectorAll(query);
for (const element of elements) addBadge(element);

// attach scroll listener to window
window.addEventListener("scroll", onScroll);
}

// add badge in citation element
Expand Down Expand Up @@ -58,4 +53,10 @@
text-indent: 0;
margin-top: 10px;
}

@media print {
.scite-badge {
display: none;
}
}
</style>