aboutsummaryrefslogtreecommitdiff
path: root/docs/dev/articles/web_only/benchmarks_files
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-11-06 00:12:29 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-11-06 00:12:29 +0100
commit092abe8ffc71e634ae95a460380b6a4f57027684 (patch)
tree1adeb9d5d63f4acd3a384adc5ac94112296f2016 /docs/dev/articles/web_only/benchmarks_files
parentb5b446b718b15ccaae5b197e147fc1358f0f564e (diff)
Update benchmarks for dev version
Diffstat (limited to 'docs/dev/articles/web_only/benchmarks_files')
-rw-r--r--docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.css4
-rw-r--r--docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.js33
2 files changed, 37 insertions, 0 deletions
diff --git a/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.css b/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.css
new file mode 100644
index 00000000..07aee5fc
--- /dev/null
+++ b/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.css
@@ -0,0 +1,4 @@
+/* Styles for section anchors */
+a.anchor-section {margin-left: 10px; visibility: hidden; color: inherit;}
+a.anchor-section::before {content: '#';}
+.hasAnchor:hover a.anchor-section {visibility: visible;}
diff --git a/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.js b/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.js
new file mode 100644
index 00000000..570f99a0
--- /dev/null
+++ b/docs/dev/articles/web_only/benchmarks_files/anchor-sections-1.0/anchor-sections.js
@@ -0,0 +1,33 @@
+// Anchor sections v1.0 written by Atsushi Yasumoto on Oct 3rd, 2020.
+document.addEventListener('DOMContentLoaded', function() {
+ // Do nothing if AnchorJS is used
+ if (typeof window.anchors === 'object' && anchors.hasOwnProperty('hasAnchorJSLink')) {
+ return;
+ }
+
+ const h = document.querySelectorAll('h1, h2, h3, h4, h5, h6');
+
+ // Do nothing if sections are already anchored
+ if (Array.from(h).some(x => x.classList.contains('hasAnchor'))) {
+ return null;
+ }
+
+ // Use section id when pandoc runs with --section-divs
+ const section_id = function(x) {
+ return ((x.classList.contains('section') || (x.tagName === 'SECTION'))
+ ? x.id : '');
+ };
+
+ // Add anchors
+ h.forEach(function(x) {
+ const id = x.id || section_id(x.parentElement);
+ if (id === '') {
+ return null;
+ }
+ let anchor = document.createElement('a');
+ anchor.href = '#' + id;
+ anchor.classList = ['anchor-section'];
+ x.classList.add('hasAnchor');
+ x.appendChild(anchor);
+ });
+});

Contact - Imprint