Replaced jekyll-minifier that uses uglifier by terser (#2571)
Hopefully fixes #2548. --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Signed-off-by: George Araújo <george.gcac@gmail.com>
This commit is contained in:
parent
ec7d7c34e8
commit
05eb46ac3f
@ -2,7 +2,6 @@
|
||||
**/*.min.css
|
||||
**/*.min.js
|
||||
assets/css/main.scss
|
||||
assets/js/search-data.js
|
||||
assets/js/distillpub/template.v2.js
|
||||
assets/js/search/*.js
|
||||
assets/plotly/demo.html
|
||||
@ -10,3 +9,4 @@ lighthouse_results/**
|
||||
_posts/2015-10-20-math.md
|
||||
_sass/font-awesome/*.scss
|
||||
_sass/tabler-icons/*.scss
|
||||
_scripts/search.liquid.js
|
||||
|
||||
1
Gemfile
1
Gemfile
@ -18,6 +18,7 @@ group :jekyll_plugins do
|
||||
gem 'jekyll-toc'
|
||||
gem 'jekyll-twitter-plugin'
|
||||
gem 'jemoji'
|
||||
gem 'terser'
|
||||
gem 'unicode_utils'
|
||||
gem 'webrick'
|
||||
end
|
||||
|
||||
44
Gemfile.lock
44
Gemfile.lock
@ -1,7 +1,7 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (8.0.0.1)
|
||||
activesupport (8.0.1)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
@ -39,7 +39,7 @@ GEM
|
||||
rexml
|
||||
csl-styles (1.0.1.11)
|
||||
csl (~> 1.0)
|
||||
css_parser (1.19.1)
|
||||
css_parser (1.21.0)
|
||||
addressable
|
||||
cssminify2 (2.0.1)
|
||||
csv (3.3.0)
|
||||
@ -166,7 +166,7 @@ GEM
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
logger (1.6.2)
|
||||
logger (1.6.3)
|
||||
loofah (2.23.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
@ -178,17 +178,17 @@ GEM
|
||||
bigdecimal (~> 3.1)
|
||||
namae (1.2.0)
|
||||
racc (~> 1.7)
|
||||
nokogiri (1.17.1-aarch64-linux)
|
||||
nokogiri (1.17.2-aarch64-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.17.1-arm-linux)
|
||||
nokogiri (1.17.2-arm-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.17.1-arm64-darwin)
|
||||
nokogiri (1.17.2-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.17.1-x86-linux)
|
||||
nokogiri (1.17.2-x86-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.17.1-x86_64-darwin)
|
||||
nokogiri (1.17.2-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.17.1-x86_64-linux)
|
||||
nokogiri (1.17.2-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
@ -201,30 +201,32 @@ GEM
|
||||
rexml (3.3.9)
|
||||
rouge (4.5.1)
|
||||
safe_yaml (1.0.5)
|
||||
sass-embedded (1.82.0-aarch64-linux-gnu)
|
||||
sass-embedded (1.83.0-aarch64-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-aarch64-linux-musl)
|
||||
sass-embedded (1.83.0-aarch64-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-arm-linux-gnueabihf)
|
||||
sass-embedded (1.83.0-arm-linux-gnueabihf)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-arm-linux-musleabihf)
|
||||
sass-embedded (1.83.0-arm-linux-musleabihf)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-arm64-darwin)
|
||||
sass-embedded (1.83.0-arm64-darwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-x86-linux-gnu)
|
||||
sass-embedded (1.83.0-x86-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-x86-linux-musl)
|
||||
sass-embedded (1.83.0-x86-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-x86_64-darwin)
|
||||
sass-embedded (1.83.0-x86_64-darwin)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-x86_64-linux-gnu)
|
||||
sass-embedded (1.83.0-x86_64-linux-gnu)
|
||||
google-protobuf (~> 4.28)
|
||||
sass-embedded (1.82.0-x86_64-linux-musl)
|
||||
sass-embedded (1.83.0-x86_64-linux-musl)
|
||||
google-protobuf (~> 4.28)
|
||||
sax-machine (1.3.2)
|
||||
securerandom (0.4.0)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
terser (1.2.4)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uglifier (4.2.1)
|
||||
@ -248,6 +250,7 @@ PLATFORMS
|
||||
x86-linux-gnu
|
||||
x86-linux-musl
|
||||
x86_64-darwin
|
||||
x86_64-linux
|
||||
x86_64-linux-gnu
|
||||
x86_64-linux-musl
|
||||
|
||||
@ -273,8 +276,9 @@ DEPENDENCIES
|
||||
jekyll-toc
|
||||
jekyll-twitter-plugin
|
||||
jemoji
|
||||
terser
|
||||
unicode_utils
|
||||
webrick
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.18
|
||||
2.5.7
|
||||
|
||||
16
_config.yml
16
_config.yml
@ -181,7 +181,7 @@ kramdown:
|
||||
start_line: 1
|
||||
|
||||
# Includes & excludes
|
||||
include: ["_pages"]
|
||||
include: ["_pages", "_scripts"]
|
||||
exclude:
|
||||
- bin/
|
||||
- CONTRIBUTING.md
|
||||
@ -224,6 +224,7 @@ plugins:
|
||||
- jekyll-toc
|
||||
- jekyll-twitter-plugin
|
||||
- jemoji
|
||||
- terser
|
||||
|
||||
# Sitemap settings
|
||||
defaults:
|
||||
@ -240,9 +241,16 @@ sass:
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
jekyll-minifier:
|
||||
exclude: ["robots.txt", "assets/js/search/*.js", "assets/libs/**/*"]
|
||||
uglifier_args:
|
||||
harmony: true
|
||||
compress_javascript: false # set to false since we are using terser as the js minifier
|
||||
# exclude: ["robots.txt", "assets/js/search/*.js"]
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Terser
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
terser:
|
||||
compress:
|
||||
drop_console: true
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Jekyll Archives
|
||||
|
||||
280
_includes/distill_scripts.liquid
Normal file
280
_includes/distill_scripts.liquid
Normal file
@ -0,0 +1,280 @@
|
||||
<!-- jQuery -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.jquery.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.jquery.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
<!-- Bootsrap & MDB scripts -->
|
||||
<script src="{{ '/assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
|
||||
<script
|
||||
src="{{ site.third_party_libraries.mdb.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mdb.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
{% if page.mermaid and page.mermaid.enabled %}
|
||||
<!-- Mermaid and D3 -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.mermaid.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mermaid.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if page.mermaid.zoomable %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.d3.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.d3.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script defer src="{{ '/assets/js/mermaid-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.code_diff %}
|
||||
<!-- Diff2HTML -->
|
||||
<!-- diff2html doesn't go well with Bootstrap Table -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.diff2html.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.diff2html.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/diff2html-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.map %}
|
||||
<!-- Leaflet -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.leaflet.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.leaflet.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/leaflet-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.chartjs %}
|
||||
<!-- Chart.js -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.chartjs.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.chartjs.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/chartjs-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.echarts %}
|
||||
<!-- ECharts -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.library }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.library }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if site.enable_darkmode %}
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.dark_theme }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.dark_theme }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script defer src="{{ '/assets/js/echarts-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.vega_lite %}
|
||||
<!-- Vega -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-lite.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-lite.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-embed.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-embed.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/vega-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tikzjax %}
|
||||
<!-- Tikzjax -->
|
||||
<script
|
||||
defer
|
||||
src="https://tikzjax.com/v1/tikzjax.js"
|
||||
integrity="sha256-+1qyucCXRZJrCg3lm3KxRt/7WXaYhBid4/1XJRHGB1E="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.typograms %}
|
||||
<!-- Typograms -->
|
||||
<script src="{{ '/assets/js/typograms.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_tooltips %}
|
||||
<!-- Tooltips -->
|
||||
<script src="{{ '/assets/js/tooltips-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_medium_zoom %}
|
||||
<!-- Medium Zoom JS -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.toc and page.toc.sidebar %}
|
||||
<!-- Sidebar Table of Contents -->
|
||||
<script defer src="{{ '/assets/js/bootstrap-toc.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.pretty_table %}
|
||||
<!-- Bootstrap Table -->
|
||||
<!-- Bootstrap Table doesn't go well with diff2html -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.bootstrap-table.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.bootstrap-table.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Load Common JS -->
|
||||
<script src="{{ '/assets/js/no_defer.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/common.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/copy_code.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
|
||||
<!-- Jupyter Open External Links New Tab -->
|
||||
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
|
||||
|
||||
<!-- Removed Badges -->
|
||||
|
||||
{% if site.enable_math %}
|
||||
<!-- MathJax -->
|
||||
<script
|
||||
defer
|
||||
type="text/javascript"
|
||||
id="MathJax-script"
|
||||
src="{{ site.third_party_libraries.mathjax.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mathjax.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script src="{{ '/assets/js/mathjax-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.polyfill.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<!-- Removed Pseudocode -->
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_google_analytics %}
|
||||
<!-- Analytics -->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
||||
<script defer src="{{ '/assets/js/google-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_cronitor_analytics %}
|
||||
<!-- Cronitor RUM -->
|
||||
<script async src="https://rum.cronitor.io/script.js"></script>
|
||||
<script defer src="{{ '/assets/js/cronitor-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
{% if site.enable_pirsch_analytics %}
|
||||
<script
|
||||
defer
|
||||
src="https://api.pirsch.io/pa.js"
|
||||
id="pianjs"
|
||||
data-code="{{ site.pirsch_analytics }}"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if site.enable_openpanel_analytics %}
|
||||
<script defer src="{{ '/assets/js/open-panel-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script async defer src="https://openpanel.dev/op1.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_progressbar %}
|
||||
<!-- Scrolling Progress Bar -->
|
||||
<script defer src="{{ '/assets/js/progress-bar.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.images %}
|
||||
<!-- Image Layouts -->
|
||||
{% if page.images.compare %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.img-comparison-slider.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.img-comparison-slider.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.lightbox2 %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.lightbox2.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.lightbox2.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.photoswipe %}
|
||||
<script defer src="{{ '/assets/js/photoswipe-setup.js' | relative_url | bust_file_cache }}" type="module"></script>
|
||||
{% endif %}
|
||||
{% if page.images.slider %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.swiper.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.swiper.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.spotlight %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.spotlight.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.venobox %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.venobox.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.venobox.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/venobox-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.tabs %}
|
||||
<!-- Jekyll Tabs -->
|
||||
<script src="{{ '/assets/js/tabs.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.back_to_top %}
|
||||
<!-- Back to Top -->
|
||||
<script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script>
|
||||
addBackToTop();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.search_enabled %}
|
||||
<!-- Search -->
|
||||
<script type="module" src="{{ '/assets/js/search/ninja-keys.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<ninja-keys hideBreadcrumbs noAutoLoadMdIcons placeholder="Type to start searching"></ninja-keys>
|
||||
<script src="{{ '/assets/js/search-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script src="{{ '/assets/js/search-data.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/shortcut-key.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
@ -10,8 +10,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
|
||||
<!-- Bootstrap Table -->
|
||||
{% if page.pretty_table %}
|
||||
<!-- Bootstrap Table -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -47,8 +47,8 @@
|
||||
|
||||
<!-- Styles -->
|
||||
|
||||
<!-- pseudocode -->
|
||||
{% if page.pseudocode %}
|
||||
<!-- pseudocode -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -84,8 +84,8 @@
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<!-- GeoJSON support via Leaflet -->
|
||||
{% if page.map %}
|
||||
<!-- GeoJSON support via Leaflet -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -95,8 +95,8 @@
|
||||
>
|
||||
{% endif %}
|
||||
|
||||
<!-- diff2html -->
|
||||
{% if page.code_diff %}
|
||||
<!-- diff2html -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -123,8 +123,8 @@
|
||||
{% endif %}
|
||||
|
||||
{% if page.images %}
|
||||
<!-- Image comparison slider -->
|
||||
{% if page.images.compare %}
|
||||
<!-- Image comparison slider -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -133,8 +133,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
{% endif %}
|
||||
<!-- Lightbox2 -->
|
||||
{% if page.images.lightbox2 %}
|
||||
<!-- Lightbox2 -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -143,8 +143,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
{% endif %}
|
||||
<!-- Photoswipe -->
|
||||
{% if page.images.photoswipe %}
|
||||
<!-- Photoswipe -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -152,8 +152,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
{% endif %}
|
||||
<!-- Image slider -->
|
||||
{% if page.images.slider %}
|
||||
<!-- Image slider -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -162,8 +162,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
{% endif %}
|
||||
<!-- Spotlight -->
|
||||
{% if page.images.spotlight %}
|
||||
<!-- Spotlight -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
@ -172,8 +172,8 @@
|
||||
crossorigin="anonymous"
|
||||
>
|
||||
{% endif %}
|
||||
<!-- Venobox -->
|
||||
{% if page.images.venobox %}
|
||||
<!-- Venobox -->
|
||||
<link
|
||||
defer
|
||||
rel="stylesheet"
|
||||
|
||||
312
_includes/scripts.liquid
Normal file
312
_includes/scripts.liquid
Normal file
@ -0,0 +1,312 @@
|
||||
<!-- jQuery -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.jquery.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.jquery.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
<!-- Bootsrap & MDB scripts -->
|
||||
<script src="{{ '/assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
|
||||
<script
|
||||
src="{{ site.third_party_libraries.mdb.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mdb.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
{% if site.enable_masonry %}
|
||||
<!-- Masonry & imagesLoaded -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.masonry.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.masonry.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.imagesloaded.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.imagesloaded.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/masonry.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.mermaid and page.mermaid.enabled %}
|
||||
<!-- Mermaid and D3 -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.mermaid.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mermaid.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if page.mermaid.zoomable %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.d3.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.d3.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script defer src="{{ '/assets/js/mermaid-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.code_diff %}
|
||||
<!-- Diff2HTML -->
|
||||
<!-- diff2html doesn't go well with Bootstrap Table -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.diff2html.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.diff2html.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/diff2html-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.map %}
|
||||
<!-- Leaflet -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.leaflet.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.leaflet.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/leaflet-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.chartjs %}
|
||||
<!-- Chart.js -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.chartjs.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.chartjs.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/chartjs-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.echarts %}
|
||||
<!-- ECharts -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.library }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.library }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if site.enable_darkmode %}
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.dark_theme }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.dark_theme }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script defer src="{{ '/assets/js/echarts-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.chart and page.chart.vega_lite %}
|
||||
<!-- Vega -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-lite.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-lite.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-embed.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-embed.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/vega-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.tikzjax %}
|
||||
<!-- Tikzjax -->
|
||||
<script
|
||||
defer
|
||||
src="https://tikzjax.com/v1/tikzjax.js"
|
||||
integrity="sha256-+1qyucCXRZJrCg3lm3KxRt/7WXaYhBid4/1XJRHGB1E="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.typograms %}
|
||||
<!-- Typograms -->
|
||||
<script src="{{ '/assets/js/typograms.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_tooltips %}
|
||||
<!-- Tooltips -->
|
||||
<script src="{{ '/assets/js/tooltips-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_medium_zoom %}
|
||||
<!-- Medium Zoom JS -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.toc and page.toc.sidebar %}
|
||||
<!-- Sidebar Table of Contents -->
|
||||
<script defer src="{{ '/assets/js/bootstrap-toc.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.pretty_table %}
|
||||
<!-- Bootstrap Table -->
|
||||
<!-- Bootstrap Table doesn't go well with diff2html -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.bootstrap-table.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.bootstrap-table.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Load Common JS -->
|
||||
<script src="{{ '/assets/js/no_defer.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/common.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/copy_code.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
|
||||
<!-- Jupyter Open External Links New Tab -->
|
||||
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
|
||||
|
||||
<!-- Badges -->
|
||||
{% if site.enable_publication_badges.altmetric %}
|
||||
<script async src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>
|
||||
{% endif %}
|
||||
{% if site.enable_publication_badges.dimensions %}
|
||||
<script async src="https://badge.dimensions.ai/badge.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_math %}
|
||||
<!-- MathJax -->
|
||||
<script
|
||||
defer
|
||||
type="text/javascript"
|
||||
id="MathJax-script"
|
||||
src="{{ site.third_party_libraries.mathjax.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mathjax.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% unless page.pseudocode %}
|
||||
<script src="{{ '/assets/js/mathjax-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.polyfill.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% else %}
|
||||
<script src="{{ '/assets/js/pseudocode-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ site.third_party_libraries.pseudocode.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.pseudocode.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_google_analytics %}
|
||||
<!-- Analytics -->
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
||||
<script defer src="{{ '/assets/js/google-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_cronitor_analytics %}
|
||||
<!-- Cronitor RUM -->
|
||||
<script async src="https://rum.cronitor.io/script.js"></script>
|
||||
<script defer src="{{ '/assets/js/cronitor-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
{% if site.enable_pirsch_analytics %}
|
||||
<script
|
||||
defer
|
||||
src="https://api.pirsch.io/pa.js"
|
||||
id="pianjs"
|
||||
data-code="{{ site.pirsch_analytics }}"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if site.enable_openpanel_analytics %}
|
||||
<script defer src="{{ '/assets/js/open-panel-analytics-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script async defer src="https://openpanel.dev/op1.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.enable_progressbar %}
|
||||
<!-- Scrolling Progress Bar -->
|
||||
<script defer src="{{ '/assets/js/progress-bar.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.images %}
|
||||
<!-- Image Layouts -->
|
||||
{% if page.images.compare %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.img-comparison-slider.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.img-comparison-slider.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.lightbox2 %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.lightbox2.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.lightbox2.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.photoswipe %}
|
||||
<script defer src="{{ '/assets/js/photoswipe-setup.js' | relative_url | bust_file_cache }}" type="module"></script>
|
||||
{% endif %}
|
||||
{% if page.images.slider %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.swiper.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.swiper.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.spotlight %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.spotlight.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.venobox %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.venobox.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.venobox.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/venobox-setup.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.tabs %}
|
||||
<!-- Jekyll Tabs -->
|
||||
<script src="{{ '/assets/js/tabs.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.back_to_top %}
|
||||
<!-- Back to Top -->
|
||||
<script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script>
|
||||
addBackToTop();
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.search_enabled %}
|
||||
<!-- Search -->
|
||||
<script type="module" src="{{ '/assets/js/search/ninja-keys.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<ninja-keys hideBreadcrumbs noAutoLoadMdIcons placeholder="Type to start searching"></ninja-keys>
|
||||
<script src="{{ '/assets/js/search-setup.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script src="{{ '/assets/js/search-data.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/shortcut-key.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
@ -1,48 +0,0 @@
|
||||
{% if site.enable_google_analytics %}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
window.dataLayer.push(arguments);
|
||||
}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{ site.google_analytics }}');
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if site.enable_cronitor_analytics %}
|
||||
<!-- Cronitor RUM -->
|
||||
<script async src="https://rum.cronitor.io/script.js"></script>
|
||||
<script>
|
||||
window.cronitor =
|
||||
window.cronitor ||
|
||||
function () {
|
||||
(window.cronitor.q = window.cronitor.q || []).push(arguments);
|
||||
};
|
||||
cronitor('config', { clientKey: '{{ site.cronitor_analytics }}' });
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if site.enable_pirsch_analytics %}
|
||||
<script
|
||||
defer
|
||||
src="https://api.pirsch.io/pa.js"
|
||||
id="pianjs"
|
||||
data-code="{{ site.pirsch_analytics }}"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if site.enable_openpanel_analytics %}
|
||||
<script>
|
||||
window.op =
|
||||
window.op ||
|
||||
function (...args) {
|
||||
(window.op.q = window.op.q || []).push(args);
|
||||
};
|
||||
window.op('init', {
|
||||
clientId: '{{ site.openpanel_analytics }}',
|
||||
trackScreenViews: true,
|
||||
trackOutgoingLinks: true,
|
||||
trackAttributes: true,
|
||||
});
|
||||
</script>
|
||||
<script src="https://openpanel.dev/op1.js" defer async></script>
|
||||
{% endif %}
|
||||
@ -1,6 +0,0 @@
|
||||
{% if site.back_to_top %}
|
||||
<script src="{{ '/assets/js/vanilla-back-to-top.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script>
|
||||
addBackToTop();
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,6 +0,0 @@
|
||||
{% if site.enable_publication_badges.altmetric %}
|
||||
<script async src="https://d1bxh8uas1mnw7.cloudfront.net/assets/embed.js"></script>
|
||||
{% endif %}
|
||||
{% if site.enable_publication_badges.dimensions %}
|
||||
<script async src="https://badge.dimensions.ai/badge.js"></script>
|
||||
{% endif %}
|
||||
@ -1,8 +0,0 @@
|
||||
<!-- Bootsrap & MDB scripts -->
|
||||
<script src="{{ '/assets/js/bootstrap.bundle.min.js' | relative_url }}"></script>
|
||||
<!-- <script src="{{ '/assets/js/mdb.min.js' | relative_url }}"></script> -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.mdb.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mdb.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
@ -1,24 +0,0 @@
|
||||
{% if page.chart and page.chart.chartjs %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.chartjs.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.chartjs.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var $canvas = null,
|
||||
$this = null,
|
||||
_ctx = null,
|
||||
_text = '';
|
||||
$('.language-chartjs').each(function () {
|
||||
$this = $(this);
|
||||
$canvas = $('<canvas></canvas>');
|
||||
_text = $this.text();
|
||||
$this.text('').append($canvas);
|
||||
_ctx = $canvas.get(0).getContext('2d');
|
||||
_ctx && _text && new Chart(_ctx, JSON.parse(_text)) && $this.attr('data-processed', true);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,30 +0,0 @@
|
||||
{% if page.code_diff %}
|
||||
<!-- diff2html doesn't go well with Bootstrap Table -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.diff2html.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.diff2html.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
let diff2HtmlTheme = determineComputedTheme();
|
||||
|
||||
/* Create diff2html as another node and hide the code block, appending the diff2html node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-diff2html').forEach((elem) => {
|
||||
const textData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create diff node */
|
||||
let diffElement = document.createElement('div');
|
||||
diffElement.classList.add('diff2html');
|
||||
backup.after(diffElement);
|
||||
const configuration = { colorScheme: diff2HtmlTheme, drawFileList: true, highlight: true, matching: 'lines' };
|
||||
const diff2htmlUi = new Diff2HtmlUI(diffElement, textData, configuration);
|
||||
diff2htmlUi.draw();
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,45 +0,0 @@
|
||||
{% if page.chart and page.chart.echarts %}
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.library }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.library }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if site.enable_darkmode %}
|
||||
<script
|
||||
src="{{ site.third_party_libraries.echarts.url.js.dark_theme }}"
|
||||
integrity="{{ site.third_party_libraries.echarts.integrity.js.dark_theme }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
let echartsTheme = determineComputedTheme();
|
||||
|
||||
/* Create echarts chart as another node and hide the code block, appending the echarts node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-echarts').forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create echarts node */
|
||||
let chartElement = document.createElement('div');
|
||||
chartElement.classList.add('echarts');
|
||||
backup.after(chartElement);
|
||||
|
||||
/* create echarts */
|
||||
if (echartsTheme === 'dark') {
|
||||
var chart = echarts.init(chartElement, 'dark-fresh-cut');
|
||||
} else {
|
||||
var chart = echarts.init(chartElement);
|
||||
}
|
||||
|
||||
chart.setOption(JSON.parse(jsonData));
|
||||
window.addEventListener('resize', function () {
|
||||
chart.resize();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,60 +0,0 @@
|
||||
{% if page.images %}
|
||||
{% if page.images.compare %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.img-comparison-slider.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.img-comparison-slider.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.lightbox2 %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.lightbox2.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.lightbox2.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.photoswipe %}
|
||||
<script type="module">
|
||||
import PhotoSwipeLightbox from '{{ site.third_party_libraries.photoswipe-lightbox.url.js }}';
|
||||
import PhotoSwipe from '{{ site.third_party_libraries.photoswipe.url.js }}';
|
||||
const photoswipe = new PhotoSwipeLightbox({
|
||||
gallery: '.pswp-gallery',
|
||||
children: 'a',
|
||||
pswpModule: PhotoSwipe,
|
||||
});
|
||||
photoswipe.init();
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if page.images.slider %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.swiper.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.swiper.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.spotlight %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.spotlight.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
{% if page.images.venobox %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.venobox.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.venobox.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
new VenoBox();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@ -1,3 +0,0 @@
|
||||
{% if page.tabs %}
|
||||
<script src="{{ '/assets/js/tabs.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
@ -1,6 +0,0 @@
|
||||
<!-- jQuery -->
|
||||
<script
|
||||
src="{{ site.third_party_libraries.jquery.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.jquery.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
@ -1,31 +0,0 @@
|
||||
{% if page.map %}
|
||||
<script
|
||||
src="{{ site.third_party_libraries.leaflet.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.leaflet.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
/* Create leaflet map as another node and hide the code block, appending the leaflet node after it */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-geojson').forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create leaflet node */
|
||||
let mapElement = document.createElement('div');
|
||||
mapElement.classList.add('map');
|
||||
backup.after(mapElement);
|
||||
|
||||
var map = L.map(mapElement);
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||
}).addTo(map);
|
||||
let geoJSON = L.geoJSON(JSON.parse(jsonData)).addTo(map);
|
||||
map.fitBounds(geoJSON.getBounds());
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,16 +0,0 @@
|
||||
{% if site.enable_masonry %}
|
||||
<!-- Masonry & imagesLoaded -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.masonry.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.masonry.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.imagesloaded.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.imagesloaded.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/masonry.js' | relative_url }}" type="text/javascript"></script>
|
||||
{% endif %}
|
||||
@ -1,25 +0,0 @@
|
||||
{% if site.enable_math %}
|
||||
{% unless page.pseudocode %}
|
||||
<!-- MathJax -->
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
tags: 'ams',
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<script
|
||||
defer
|
||||
type="text/javascript"
|
||||
id="MathJax-script"
|
||||
src="{{ site.third_party_libraries.mathjax.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mathjax.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.polyfill.url.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
@ -1,55 +0,0 @@
|
||||
{% if page.mermaid and page.mermaid.enabled %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.mermaid.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mermaid.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% if page.mermaid.zoomable %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.d3.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.d3.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
<script>
|
||||
let mermaidTheme = determineComputedTheme();
|
||||
|
||||
/* Create mermaid diagram as another node and hide the code block, appending the mermaid node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-mermaid').forEach((elem) => {
|
||||
const svgCode = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create mermaid node */
|
||||
let mermaid = document.createElement('pre');
|
||||
mermaid.classList.add('mermaid');
|
||||
const text = document.createTextNode(svgCode);
|
||||
mermaid.appendChild(text);
|
||||
backup.after(mermaid);
|
||||
});
|
||||
|
||||
mermaid.initialize({ theme: mermaidTheme });
|
||||
|
||||
/* Zoomable mermaid diagrams */
|
||||
if (typeof d3 !== 'undefined') {
|
||||
window.addEventListener('load', function () {
|
||||
var svgs = d3.selectAll('.mermaid svg');
|
||||
svgs.each(function () {
|
||||
var svg = d3.select(this);
|
||||
svg.html('<g>' + svg.html() + '</g>');
|
||||
var inner = svg.select('g');
|
||||
var zoom = d3.zoom().on('zoom', function (event) {
|
||||
inner.attr('transform', event.transform);
|
||||
});
|
||||
svg.call(zoom);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,43 +0,0 @@
|
||||
{% if site.enable_tooltips %}
|
||||
<!-- Enable Tooltips -->
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% if site.enable_medium_zoom %}
|
||||
<!-- Medium Zoom JS -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
{% if page.toc and page.toc.sidebar %}
|
||||
<!-- Sidebar Table of Contents -->
|
||||
<script defer src="{{ '/assets/js/bootstrap-toc.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Bootstrap Table -->
|
||||
{% if page.pretty_table %}
|
||||
<!-- Bootstrap Table doesn't go well with diff2html -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.bootstrap-table.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.bootstrap-table.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Load Common JS -->
|
||||
<script src="{{ '/assets/js/no_defer.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/common.js' | relative_url | bust_file_cache }}"></script>
|
||||
<script defer src="{{ '/assets/js/copy_code.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
|
||||
<!-- Jupyter Open External Links New Tab -->
|
||||
<script defer src="{{ '/assets/js/jupyter_new_tab.js' | relative_url | bust_file_cache }}"></script>
|
||||
|
||||
{% assign site.test-library.url = site.test-library.url | append: 'teste' %}
|
||||
@ -1,176 +0,0 @@
|
||||
<div
|
||||
class="newsletter-form-container"
|
||||
{% if include.center %}
|
||||
style="margin: 20px"
|
||||
{% endif %}
|
||||
>
|
||||
<form
|
||||
class="newsletter-form"
|
||||
action="https://app.loops.so/api/newsletter-form/{{ site.newsletter.endpoint }}"
|
||||
method="POST"
|
||||
style="justify-content: {% if include.left %}flex-start{% elsif include.right %}flex-end{% else %}center{% endif %}"
|
||||
>
|
||||
<input
|
||||
class="newsletter-form-input"
|
||||
name="newsletter-form-input"
|
||||
type="email"
|
||||
placeholder="user@example.com"
|
||||
required=""
|
||||
>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="newsletter-form-button"
|
||||
style="justify-content: {% if include.left %}flex-start{% elsif include.right %}flex-end{% else %}center{% endif %}"
|
||||
>
|
||||
subscribe
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="newsletter-loading-button"
|
||||
style="justify-content: {% if include.left %}flex-start{% elsif include.right %}flex-end{% else %}center{% endif %}"
|
||||
>
|
||||
Please wait...
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div
|
||||
class="newsletter-success"
|
||||
style="justify-content: {% if include.left %}flex-start{% elsif include.right %}flex-end{% else %}center{% endif %}"
|
||||
>
|
||||
<p class="newsletter-success-message">You're subscribed!</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="newsletter-error"
|
||||
style="justify-content: {% if include.left %}flex-start{% elsif include.right %}flex-end{% else %}center{% endif %}"
|
||||
>
|
||||
<p class="newsletter-error-message">Oops! Something went wrong, please try again</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="newsletter-back-button"
|
||||
type="button"
|
||||
onmouseout='this.style.textDecoration="none"'
|
||||
onmouseover='this.style.textDecoration="underline"'
|
||||
>
|
||||
← Back
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submitHandler(event) {
|
||||
event.preventDefault();
|
||||
var container = event.target.parentNode;
|
||||
var form = container.querySelector('.newsletter-form');
|
||||
var formInput = container.querySelector('.newsletter-form-input');
|
||||
var success = container.querySelector('.newsletter-success');
|
||||
var errorContainer = container.querySelector('.newsletter-error');
|
||||
var errorMessage = container.querySelector('.newsletter-error-message');
|
||||
var backButton = container.querySelector('.newsletter-back-button');
|
||||
var submitButton = container.querySelector('.newsletter-form-button');
|
||||
var loadingButton = container.querySelector('.newsletter-loading-button');
|
||||
|
||||
const rateLimit = () => {
|
||||
errorContainer.style.display = 'flex';
|
||||
errorMessage.innerText = 'Too many signups, please try again in a little while';
|
||||
submitButton.style.display = 'none';
|
||||
formInput.style.display = 'none';
|
||||
backButton.style.display = 'block';
|
||||
};
|
||||
|
||||
// Compare current time with time of previous sign up
|
||||
var time = new Date();
|
||||
var timestamp = time.valueOf();
|
||||
var previousTimestamp = localStorage.getItem('loops-form-timestamp');
|
||||
|
||||
// If last sign up was less than a minute ago
|
||||
// display error
|
||||
if (previousTimestamp && Number(previousTimestamp) + 60000 > timestamp) {
|
||||
rateLimit();
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('loops-form-timestamp', timestamp);
|
||||
|
||||
submitButton.style.display = 'none';
|
||||
loadingButton.style.display = 'flex';
|
||||
|
||||
var formBody = 'userGroup=&email=' + encodeURIComponent(formInput.value);
|
||||
fetch(event.target.action, {
|
||||
method: 'POST',
|
||||
body: formBody,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
})
|
||||
.then((res) => [res.ok, res.json(), res])
|
||||
.then(([ok, dataPromise, res]) => {
|
||||
if (ok) {
|
||||
// If response successful
|
||||
// display success
|
||||
success.style.display = 'flex';
|
||||
form.reset();
|
||||
} else {
|
||||
// If response unsuccessful
|
||||
// display error message or response status
|
||||
dataPromise.then((data) => {
|
||||
errorContainer.style.display = 'flex';
|
||||
errorMessage.innerText = data.message ? data.message : res.statusText;
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
// check for cloudflare error
|
||||
if (error.message === 'Failed to fetch') {
|
||||
rateLimit();
|
||||
return;
|
||||
}
|
||||
// If error caught
|
||||
// display error message if available
|
||||
errorContainer.style.display = 'flex';
|
||||
if (error.message) errorMessage.innerText = error.message;
|
||||
localStorage.setItem('loops-form-timestamp', '');
|
||||
})
|
||||
.finally(() => {
|
||||
formInput.style.display = 'none';
|
||||
loadingButton.style.display = 'none';
|
||||
backButton.style.display = 'block';
|
||||
});
|
||||
}
|
||||
function resetFormHandler(event) {
|
||||
var container = event.target.parentNode;
|
||||
var formInput = container.querySelector('.newsletter-form-input');
|
||||
var success = container.querySelector('.newsletter-success');
|
||||
var errorContainer = container.querySelector('.newsletter-error');
|
||||
var errorMessage = container.querySelector('.newsletter-error-message');
|
||||
var backButton = container.querySelector('.newsletter-back-button');
|
||||
var submitButton = container.querySelector('.newsletter-form-button');
|
||||
|
||||
success.style.display = 'none';
|
||||
errorContainer.style.display = 'none';
|
||||
errorMessage.innerText = 'Oops! Something went wrong, please try again';
|
||||
backButton.style.display = 'none';
|
||||
formInput.style.display = 'flex';
|
||||
submitButton.style.display = 'flex';
|
||||
}
|
||||
|
||||
var formContainers = document.getElementsByClassName('newsletter-form-container');
|
||||
|
||||
for (var i = 0; i < formContainers.length; i++) {
|
||||
var formContainer = formContainers[i];
|
||||
var handlersAdded = formContainer.classList.contains('newsletter-handlers-added');
|
||||
if (handlersAdded) continue;
|
||||
formContainer.querySelector('.newsletter-form').addEventListener('submit', submitHandler);
|
||||
formContainer.querySelector('.newsletter-back-button').addEventListener('click', resetFormHandler);
|
||||
formContainer.classList.add('newsletter-handlers-added');
|
||||
}
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<style>
|
||||
.newsletter-form-container {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</noscript>
|
||||
@ -1,78 +0,0 @@
|
||||
{% if site.enable_progressbar %}
|
||||
<!-- Scrolling Progress Bar -->
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* This JavaScript code has been adapted from the article
|
||||
* https://css-tricks.com/reading-position-indicator/ authored by Pankaj Parashar,
|
||||
* published on the website https://css-tricks.com on the 7th of May, 2014.
|
||||
* Couple of changes were made to the original code to make it compatible
|
||||
* with the `al-foio` theme.
|
||||
*/
|
||||
const progressBar = $('#progress');
|
||||
/*
|
||||
* We set up the bar after all elements are done loading.
|
||||
* In some cases, if the images in the page are larger than the intended
|
||||
* size they'll have on the page, they'll be resized via CSS to accomodate
|
||||
* the desired size. This mistake, however, breaks the computations as the
|
||||
* scroll size is computed as soon as the elements finish loading.
|
||||
* To account for this, a minimal delay was introduced before computing the
|
||||
* values.
|
||||
*/
|
||||
window.onload = function () {
|
||||
setTimeout(progressBarSetup, 50);
|
||||
};
|
||||
/*
|
||||
* We set up the bar according to the browser.
|
||||
* If the browser supports the progress element we use that.
|
||||
* Otherwise, we resize the bar thru CSS styling
|
||||
*/
|
||||
function progressBarSetup() {
|
||||
if ('max' in document.createElement('progress')) {
|
||||
initializeProgressElement();
|
||||
$(document).on('scroll', function () {
|
||||
progressBar.attr({ value: getCurrentScrollPosition() });
|
||||
});
|
||||
$(window).on('resize', initializeProgressElement);
|
||||
} else {
|
||||
resizeProgressBar();
|
||||
$(document).on('scroll', resizeProgressBar);
|
||||
$(window).on('resize', resizeProgressBar);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The vertical scroll position is the same as the number of pixels that
|
||||
* are hidden from view above the scrollable area. Thus, a value > 0 is
|
||||
* how much the user has scrolled from the top
|
||||
*/
|
||||
function getCurrentScrollPosition() {
|
||||
return $(window).scrollTop();
|
||||
}
|
||||
|
||||
function initializeProgressElement() {
|
||||
let navbarHeight = $('#navbar').outerHeight(true);
|
||||
$('body').css({ 'padding-top': navbarHeight });
|
||||
$('progress-container').css({ 'padding-top': navbarHeight });
|
||||
progressBar.css({ top: navbarHeight });
|
||||
progressBar.attr({
|
||||
max: getDistanceToScroll(),
|
||||
value: getCurrentScrollPosition(),
|
||||
});
|
||||
}
|
||||
/*
|
||||
* The offset between the html document height and the browser viewport
|
||||
* height will be greater than zero if vertical scroll is possible.
|
||||
* This is the distance the user can scroll
|
||||
*/
|
||||
function getDistanceToScroll() {
|
||||
return $(document).height() - $(window).height();
|
||||
}
|
||||
|
||||
function resizeProgressBar() {
|
||||
progressBar.css({ width: getWidthPercentage() + '%' });
|
||||
}
|
||||
// The scroll ratio equals the percentage to resize the bar
|
||||
function getWidthPercentage() {
|
||||
return (getCurrentScrollPosition() / getDistanceToScroll()) * 100;
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,52 +0,0 @@
|
||||
{% if site.enable_math and page.pseudocode %}
|
||||
<!-- MathJax -->
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
['\\(', '\\)'],
|
||||
],
|
||||
displayMath: [
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]'],
|
||||
],
|
||||
processEscapes: true,
|
||||
processEnvironments: true,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
id="MathJax-script"
|
||||
src="{{ site.third_party_libraries.mathjax.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.mathjax.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="{{ site.third_party_libraries.pseudocode.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.pseudocode.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-pseudocode').forEach((elem) => {
|
||||
const texData = elem.textContent;
|
||||
const parent = elem.parentElement.parentElement;
|
||||
/* create pseudocode node */
|
||||
let pseudoCodeElement = document.createElement('pre');
|
||||
pseudoCodeElement.classList.add('pseudocode');
|
||||
const text = document.createTextNode(texData);
|
||||
pseudoCodeElement.appendChild(text);
|
||||
/* add pseudocode node and remove the original code block */
|
||||
parent.appendChild(pseudoCodeElement);
|
||||
parent.removeChild(elem.parentElement);
|
||||
/* embed the visualization in the container */
|
||||
pseudocode.renderElement(pseudoCodeElement);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,350 +0,0 @@
|
||||
{% if site.search_enabled %}
|
||||
<script type="module" src="{{ '/assets/js/search/ninja-keys.min.js' | relative_url | bust_file_cache }}"></script>
|
||||
<ninja-keys hideBreadcrumbs noAutoLoadMdIcons placeholder="Type to start searching"></ninja-keys>
|
||||
<script>
|
||||
let searchTheme = determineComputedTheme();
|
||||
const ninjaKeys = document.querySelector('ninja-keys');
|
||||
|
||||
if (searchTheme === 'dark') {
|
||||
ninjaKeys.classList.add('dark');
|
||||
} else {
|
||||
ninjaKeys.classList.remove('dark');
|
||||
}
|
||||
|
||||
const openSearchModal = () => {
|
||||
// collapse navbarNav if expanded on mobile
|
||||
const $navbarNav = $('#navbarNav');
|
||||
if ($navbarNav.hasClass('show')) {
|
||||
$navbarNav.collapse('hide');
|
||||
}
|
||||
ninjaKeys.open();
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
// get the ninja-keys element
|
||||
const ninja = document.querySelector('ninja-keys');
|
||||
|
||||
// add the home and posts menu items
|
||||
ninja.data = [
|
||||
{%- for page in site.pages -%}
|
||||
{%- if page.permalink == '/' -%}{%- assign about_title = page.title | strip -%}{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{
|
||||
id: "nav-{{ about_title | slugify }}",
|
||||
title: "{{ about_title | truncatewords: 13 }}",
|
||||
section: "Navigation",
|
||||
handler: () => {
|
||||
window.location.href = "{{ '/' | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- assign sorted_pages = site.pages | sort: "nav_order" -%}
|
||||
{%- for p in sorted_pages -%}
|
||||
{%- if p.nav and p.autogen == null -%}
|
||||
{%- if p.dropdown -%}
|
||||
{%- for child in p.children -%}
|
||||
{%- unless child.title == 'divider' -%}
|
||||
{
|
||||
{%- assign title = child.title | escape | strip -%}
|
||||
{%- if child.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = child.url -%}{%- endif -%}
|
||||
id: "dropdown-{{ title | slugify }}",
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
description: "{{ child.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Dropdown",
|
||||
handler: () => {
|
||||
window.location.href = "{{ url | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- endunless -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- else -%}
|
||||
{
|
||||
{%- assign title = p.title | escape | strip -%}
|
||||
{%- if p.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = p.url -%}{%- endif -%}
|
||||
id: "nav-{{ title | slugify }}",
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
description: "{{ p.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Navigation",
|
||||
handler: () => {
|
||||
window.location.href = "{{ url | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- for post in site.posts -%}
|
||||
{
|
||||
{%- assign title = post.title | escape | strip -%}
|
||||
id: "post-{{ title | slugify }}",
|
||||
{% if post.redirect == blank %}
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
{% elsif post.redirect contains '://' %}
|
||||
title: '{{ title | truncatewords: 13 }} <svg width="1.2rem" height="1.2rem" top=".5rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
||||
{% else %}
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
{% endif %}
|
||||
description: "{{ post.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Posts",
|
||||
handler: () => {
|
||||
{% if post.redirect == blank %}
|
||||
window.location.href = "{{ post.url | relative_url }}";
|
||||
{% elsif post.redirect contains '://' %}
|
||||
window.open("{{ post.redirect }}", "_blank");
|
||||
{% else %}
|
||||
window.location.href = "{{ post.redirect | relative_url }}";
|
||||
{% endif %}
|
||||
},
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- for collection in site.collections -%}
|
||||
{%- if collection.label != 'posts' -%}
|
||||
{%- for item in collection.docs -%}
|
||||
{
|
||||
{%- if item.inline -%}
|
||||
{%- assign title = item.content | newline_to_br | replace: "<br />", " " | replace: "<br/>", " " | strip_html | strip_newlines | escape | strip -%}
|
||||
{%- else -%}
|
||||
{%- assign title = item.title | newline_to_br | replace: "<br />", " " | replace: "<br/>", " " | strip_html | strip_newlines | escape | strip -%}
|
||||
{%- endif -%}
|
||||
id: "{{ collection.label }}-{{ title | slugify }}",
|
||||
title: '{{ title | escape | emojify | truncatewords: 13 }}',
|
||||
description: "{{ item.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "{{ collection.label | capitalize }}",
|
||||
{%- unless item.inline -%}
|
||||
handler: () => {
|
||||
window.location.href = "{{ item.url | relative_url }}";
|
||||
},
|
||||
{%- endunless -%}
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if site.socials_in_search -%}
|
||||
{%- for social in site.data.socials -%}
|
||||
{%- case social[0] -%}
|
||||
{%- when "acm_id" -%}
|
||||
{%- assign social_id = "social-acm" -%}
|
||||
{%- assign social_title = "ACM DL" -%}
|
||||
{%- capture social_url %}"https://dl.acm.org/profile/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "blogger_url" -%}
|
||||
{%- assign social_id = "social-blogger" -%}
|
||||
{%- assign social_title = "Blogger" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "bluesky_url" -%}
|
||||
{%- assign social_id = "social-bluesky" -%}
|
||||
{%- assign social_title = "Bluesky" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "dblp_url" -%}
|
||||
{%- assign social_id = "social-dblp" -%}
|
||||
{%- assign social_title = "DBLP" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "discord_id" -%}
|
||||
{%- assign social_id = "social-discord" -%}
|
||||
{%- assign social_title = "Discord" -%}
|
||||
{%- capture social_url %}"https://discord.com/users/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "email" -%}
|
||||
{%- assign social_id = "social-email" -%}
|
||||
{%- assign social_title = "email" -%}
|
||||
{%- capture social_url %}"mailto:{{ social[1] | encode_email }}"{% endcapture -%}
|
||||
{%- when "facebook_id" -%}
|
||||
{%- assign social_id = "social-facebook" -%}
|
||||
{%- assign social_title = "Facebook" -%}
|
||||
{%- capture social_url %}"https://facebook.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "flickr_id" -%}
|
||||
{%- assign social_id = "social-flickr" -%}
|
||||
{%- assign social_title = "Flickr" -%}
|
||||
{%- capture social_url %}"https://www.flickr.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "github_username" -%}
|
||||
{%- assign social_id = "social-github" -%}
|
||||
{%- assign social_title = "GitHub" -%}
|
||||
{%- capture social_url %}"https://github.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "gitlab_username" -%}
|
||||
{%- assign social_id = "social-gitlab" -%}
|
||||
{%- assign social_title = "GitLab" -%}
|
||||
{%- capture social_url %}"https://gitlab.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "ieee_id" -%}
|
||||
{%- assign social_id = "social-ieee" -%}
|
||||
{%- assign social_title = "IEEE Xplore" -%}
|
||||
{%- capture social_url %}"https://ieeexplore.ieee.org/author/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "inspirehep_id" -%}
|
||||
{%- assign social_id = "social-inspire" -%}
|
||||
{%- assign social_title = "Inspire HEP" -%}
|
||||
{%- capture social_url %}"https://inspirehep.net/authors/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "instagram_id" -%}
|
||||
{%- assign social_id = "social-instagram" -%}
|
||||
{%- assign social_title = "Instagram" -%}
|
||||
{%- capture social_url %}"https://instagram.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "kaggle_id" -%}
|
||||
{%- assign social_id = "social-kaggle" -%}
|
||||
{%- assign social_title = "Kaggle" -%}
|
||||
{%- capture social_url %}"https://www.kaggle.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "keybase_username" -%}
|
||||
{%- assign social_id = "social-keybase" -%}
|
||||
{%- assign social_title = "Keybase" -%}
|
||||
{%- capture social_url %}"https://keybase.io/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "lastfm_id" -%}
|
||||
{%- assign social_id = "social-lastfm" -%}
|
||||
{%- assign social_title = "Last FM" -%}
|
||||
{%- capture social_url %}"https://www.last.fm/user/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "lattes_id" -%}
|
||||
{%- assign social_id = "social-lattes" -%}
|
||||
{%- assign social_title = "Lattes" -%}
|
||||
{%- capture social_url %}"http://lattes.cnpq.br/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "leetcode_id" -%}
|
||||
{%- assign social_id = "social-leetcode" -%}
|
||||
{%- assign social_title = "LeetCode" -%}
|
||||
{%- capture social_url %}"https://leetcode.com/u/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "linkedin_username" -%}
|
||||
{%- assign social_id = "social-linkedin" -%}
|
||||
{%- assign social_title = "LinkedIn" -%}
|
||||
{%- capture social_url %}"https://www.linkedin.com/in/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "mastodon_username" -%}
|
||||
{%- assign social_id = "social-mastodon" -%}
|
||||
{%- assign social_title = "Mastodon" -%}
|
||||
{%- capture social_url %}"https://{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "medium_username" -%}
|
||||
{%- assign social_id = "social-medium" -%}
|
||||
{%- assign social_title = "Medium" -%}
|
||||
{%- capture social_url %}"https://medium.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "orcid_id" -%}
|
||||
{%- assign social_id = "social-orcid" -%}
|
||||
{%- assign social_title = "ORCID" -%}
|
||||
{%- capture social_url %}"https://orcid.org/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "osf_id" -%}
|
||||
{%- assign social_id = "social-osf" -%}
|
||||
{%- assign social_title = "Open Science Framework" -%}
|
||||
{%- capture social_url %}"https://osf.io/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "pinterest_id" -%}
|
||||
{%- assign social_id = "social-pinterest" -%}
|
||||
{%- assign social_title = "Pinterest" -%}
|
||||
{%- capture social_url %}"https://www.pinterest.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "publons_id" -%}
|
||||
{%- assign social_id = "social-publons" -%}
|
||||
{%- assign social_title = "Publons" -%}
|
||||
{%- capture social_url %}"https://publons.com/a/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "quora_username" -%}
|
||||
{%- assign social_id = "social-quora" -%}
|
||||
{%- assign social_title = "Quora" -%}
|
||||
{%- capture social_url %}"https://www.quora.com/profile/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "research_gate_profile" -%}
|
||||
{%- assign social_id = "social-researchgate" -%}
|
||||
{%- assign social_title = "ResearchGate" -%}
|
||||
{%- capture social_url %}"https://www.researchgate.net/profile/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "rss_icon" -%}
|
||||
{%- assign social_id = "social-rss" -%}
|
||||
{%- assign social_title = "RSS Feed" -%}
|
||||
{%- capture social_url %}"{{ site.baseurl }}/feed.xml"{% endcapture -%}
|
||||
{%- when "scholar_userid" -%}
|
||||
{%- assign social_id = "social-scholar" -%}
|
||||
{%- assign social_title = "Google Scholar" -%}
|
||||
{%- capture social_url %}"https://scholar.google.com/citations?user={{ social[1] }}"{% endcapture -%}
|
||||
{%- when "scopus_id" -%}
|
||||
{%- assign social_id = "social-scopus" -%}
|
||||
{%- assign social_title = "Scopus" -%}
|
||||
{%- capture social_url %}"https://www.scopus.com/authid/detail.uri?authorId={{ social[1] }}"{% endcapture -%}
|
||||
{%- when "semanticscholar_id" -%}
|
||||
{%- assign social_id = "social-semanticscholar" -%}
|
||||
{%- assign social_title = "Semantic Scholar" -%}
|
||||
{%- capture social_url %}"https://www.semanticscholar.org/author/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "spotify_id" -%}
|
||||
{%- assign social_id = "social-spotify" -%}
|
||||
{%- assign social_title = "Spotify" -%}
|
||||
{%- capture social_url %}"https://open.spotify.com/user/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "stackoverflow_id" -%}
|
||||
{%- assign social_id = "social-stackoverflow" -%}
|
||||
{%- assign social_title = "Stackoverflow" -%}
|
||||
{%- capture social_url %}"https://stackoverflow.com/users/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "strava_userid" -%}
|
||||
{%- assign social_id = "social-strava" -%}
|
||||
{%- assign social_title = "Strava" -%}
|
||||
{%- capture social_url %}"https://www.strava.com/athletes/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "telegram_username" -%}
|
||||
{%- assign social_id = "social-telegram" -%}
|
||||
{%- assign social_title = "telegram" -%}
|
||||
{%- capture social_url %}"https://telegram.me/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "unsplash_id" -%}
|
||||
{%- assign social_id = "social-unsplash" -%}
|
||||
{%- assign social_title = "Unsplash" -%}
|
||||
{%- capture social_url %}"https://unsplash.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- comment -%}
|
||||
// check how to add wechat qr code
|
||||
{%- when "wechat_qr" -%}
|
||||
{%- assign social_id = "social-wechat" -%}
|
||||
{%- assign social_title = "WeChat" -%}
|
||||
{%- capture social_url %}"https://wechat.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- endcomment -%}
|
||||
{%- when "whatsapp_number" -%}
|
||||
{%- assign social_id = "social-whatsapp" -%}
|
||||
{%- assign social_title = "whatsapp" -%}
|
||||
{%- capture social_url %}"https://wa.me/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "wikidata_id" -%}
|
||||
{%- assign social_id = "social-wikidata" -%}
|
||||
{%- assign social_title = "Wikidata" -%}
|
||||
{%- capture social_url %}"https://www.wikidata.org/wiki/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "wikipedia_id" -%}
|
||||
{%- assign social_id = "social-wikipedia" -%}
|
||||
{%- assign social_title = "Wikipedia" -%}
|
||||
{%- capture social_url %}"https://wikipedia.org/wiki/User:{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "work_url" -%}
|
||||
{%- assign social_id = "social-work" -%}
|
||||
{%- assign social_title = "Work" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "x_username" -%}
|
||||
{%- assign social_id = "social-x" -%}
|
||||
{%- assign social_title = "X" -%}
|
||||
{%- capture social_url %}"https://twitter.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "youtube_id" -%}
|
||||
{%- assign social_id = "social-youtube" -%}
|
||||
{%- assign social_title = "YouTube" -%}
|
||||
{%- capture social_url %}"https://youtube.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "zotero_username" -%}
|
||||
{%- assign social_id = "social-zotero" -%}
|
||||
{%- assign social_title = "Zotero" -%}
|
||||
{%- capture social_url %}"https://www.zotero.org/{{ social[1] }}"{% endcapture -%}
|
||||
{%- else -%}
|
||||
{%- assign social_id = "social-" | append: social[0] -%}
|
||||
{%- assign social_title = social[0] | capitalize -%}
|
||||
{%- capture social_url %}"{{ social[1].url }}"{% endcapture -%}
|
||||
{%- endcase -%}
|
||||
{
|
||||
id: '{{ social_id }}',
|
||||
title: '{{ social_title }}',
|
||||
section: 'Socials',
|
||||
handler: () => {
|
||||
window.open({{ social_url }}, "_blank");
|
||||
},
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- if site.enable_darkmode -%}
|
||||
{
|
||||
id: 'light-theme',
|
||||
title: 'Change theme to light',
|
||||
description: 'Change the theme of the site to Light',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("light");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'dark-theme',
|
||||
title: 'Change theme to dark',
|
||||
description: 'Change the theme of the site to Dark',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("dark");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'system-theme',
|
||||
title: 'Use system default theme',
|
||||
description: 'Change the theme of the site to System Default',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("system");
|
||||
},
|
||||
},
|
||||
{%- endif -%}
|
||||
];
|
||||
</script>
|
||||
<script src="{{ '/assets/js/shortcut-key.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
@ -1,8 +0,0 @@
|
||||
{% if page.tikzjax %}
|
||||
<script
|
||||
defer
|
||||
src="https://tikzjax.com/v1/tikzjax.js"
|
||||
integrity="sha256-+1qyucCXRZJrCg3lm3KxRt/7WXaYhBid4/1XJRHGB1E="
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
{% endif %}
|
||||
@ -1,23 +0,0 @@
|
||||
{% if page.typograms %}
|
||||
<script src="{{ '/assets/js/typograms.js' | relative_url | bust_file_cache }}"></script>
|
||||
|
||||
<script>
|
||||
/* Create typogram as another node and hide the code block, appending the typogram node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-typograms').forEach((elem) => {
|
||||
const texData = elem.textContent;
|
||||
const parent = elem.parentElement.parentElement;
|
||||
/* create typograms node */
|
||||
let typogram = document.createElement('pre');
|
||||
typogram.classList.add('typogram');
|
||||
const svg = create('\n' + texData, 0.3, false);
|
||||
typogram.appendChild(svg);
|
||||
parent.appendChild(typogram);
|
||||
parent.removeChild(elem.parentElement);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,47 +0,0 @@
|
||||
{% if page.chart and page.chart.vega_lite %}
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-lite.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-lite.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.vega-embed.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.vega-embed.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
<script>
|
||||
let vegaTheme = determineComputedTheme();
|
||||
|
||||
/* Create vega lite chart as another node and hide the code block, appending the vega lite node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener('readystatechange', () => {
|
||||
if (document.readyState === 'complete') {
|
||||
document.querySelectorAll('pre>code.language-vega_lite').forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add('unloaded');
|
||||
/* create vega lite node */
|
||||
let chartElement = document.createElement('div');
|
||||
chartElement.classList.add('vega-lite');
|
||||
backup.after(chartElement);
|
||||
|
||||
/* Embed the visualization in the container */
|
||||
if (vegaTheme === 'dark') {
|
||||
vegaEmbed(chartElement, JSON.parse(jsonData), { theme: 'dark' });
|
||||
} else {
|
||||
vegaEmbed(chartElement, JSON.parse(jsonData));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
@ -1,18 +0,0 @@
|
||||
<!-- WeChat Modal -->
|
||||
|
||||
<script>
|
||||
var wechatModal = document.getElementById('WeChatMod');
|
||||
var wechatBtn = document.querySelectorAll('[id="WeChatBtn"]');
|
||||
|
||||
for (var i = 0; i < wechatBtn.length; i++) {
|
||||
wechatBtn[i].onclick = function () {
|
||||
wechatModal.style.display = 'block';
|
||||
};
|
||||
}
|
||||
|
||||
window.onclick = function (event) {
|
||||
if (event.target == wechatModal) {
|
||||
wechatModal.style.display = 'none';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -77,7 +77,7 @@
|
||||
<div id="WeChatMod" class="wechat-modal">
|
||||
<img src="{{ social[1] | prepend: 'assets/img/' | relative_url }}" alt="WeChat QR" id="WeChatQR">
|
||||
</div>
|
||||
{% include scripts/wechatModal.liquid %}
|
||||
<script defer src="{{ '/assets/js/wechat.js' | relative_url | bust_file_cache }}" type="text/javascript"></script>
|
||||
{% when 'whatsapp_number' %}
|
||||
<a href="https://wa.me/{{ social[1] }}" title="whatsapp"><i class="fa-brands fa-whatsapp"></i></a>
|
||||
{% when 'wikidata_id' %}
|
||||
|
||||
@ -51,27 +51,6 @@
|
||||
{% include footer.liquid %}
|
||||
|
||||
<!-- JavaScripts -->
|
||||
{% include scripts/jquery.liquid %}
|
||||
{% include scripts/bootstrap.liquid %}
|
||||
{% include scripts/masonry.liquid %}
|
||||
{% include scripts/mermaid.liquid %}
|
||||
{% include scripts/diff2html.liquid %}
|
||||
{% include scripts/leaflet.liquid %}
|
||||
{% include scripts/chartjs.liquid %}
|
||||
{% include scripts/echarts.liquid %}
|
||||
{% include scripts/vega.liquid %}
|
||||
{% include scripts/tikzjax.liquid %}
|
||||
{% include scripts/typograms.liquid %}
|
||||
{% include scripts/misc.liquid %}
|
||||
{% include scripts/badges.liquid %}
|
||||
{% include scripts/mathjax.liquid %}
|
||||
{% include scripts/pseudocode.liquid %}
|
||||
{% include scripts/analytics.liquid %}
|
||||
{% include scripts/progressBar.liquid %}
|
||||
{% include scripts/wechatModal.liquid %}
|
||||
{% include scripts/imageLayouts.liquid %}
|
||||
{% include scripts/jekyll_tabs.liquid %}
|
||||
{% include scripts/back_to_top.liquid %}
|
||||
{% include scripts/search.liquid %}
|
||||
{% include scripts.liquid %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -2,30 +2,6 @@
|
||||
<html>
|
||||
<head>
|
||||
{% include head.liquid %}
|
||||
{% if site.enable_medium_zoom %}
|
||||
<!-- Medium Zoom JS -->
|
||||
<script
|
||||
defer
|
||||
src="{{ site.third_party_libraries.medium_zoom.url.js }}"
|
||||
integrity="{{ site.third_party_libraries.medium_zoom.integrity.js }}"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script defer src="{{ '/assets/js/zoom.js' | relative_url | bust_file_cache }}"></script>
|
||||
{% endif %}
|
||||
{% include scripts/jquery.liquid %}
|
||||
{% include scripts/mathjax.liquid %}
|
||||
{% include scripts/mermaid.liquid %}
|
||||
{% include scripts/diff2html.liquid %}
|
||||
{% include scripts/leaflet.liquid %}
|
||||
{% include scripts/chartjs.liquid %}
|
||||
{% include scripts/echarts.liquid %}
|
||||
{% include scripts/vega.liquid %}
|
||||
{% include scripts/tikzjax.liquid %}
|
||||
{% include scripts/typograms.liquid %}
|
||||
{% include scripts/misc.liquid %}
|
||||
{% comment %}
|
||||
misc.liquid loads interactive features like the code copy button to prevent dynamic elements from displaying incorrectly at the end of the article.
|
||||
{% endcomment %}
|
||||
|
||||
<!-- Distill js -->
|
||||
<script src="{{ '/assets/js/distillpub/template.v2.js' | relative_url }}"></script>
|
||||
@ -131,10 +107,8 @@
|
||||
|
||||
<!-- Footer -->
|
||||
{% include footer.liquid %}
|
||||
{% include scripts/bootstrap.liquid %}
|
||||
{% include scripts/analytics.liquid %}
|
||||
{% include scripts/progressBar.liquid %}
|
||||
{% include scripts/back_to_top.liquid %}
|
||||
{% include scripts/search.liquid %}
|
||||
|
||||
<!-- JavaScripts -->
|
||||
{% include distill_scripts.liquid %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
102
_plugins/terser.rb
Normal file
102
_plugins/terser.rb
Normal file
@ -0,0 +1,102 @@
|
||||
# based on https://github.com/RobertoJBeltran/jekyll-terser
|
||||
# it should be changed to use `jekyll-terser` gem after https://github.com/RobertoJBeltran/jekyll-terser/pull/1 is merged
|
||||
require 'terser'
|
||||
|
||||
module Jekyll
|
||||
module Terser
|
||||
class JSFile < Jekyll::StaticFile
|
||||
@@mtimes = {}
|
||||
|
||||
# Initialize a new JSFile.
|
||||
# +site+ is the Site
|
||||
# +base+ is the String path to the <source>
|
||||
# +dir+ is the String path between <source> and the file
|
||||
# +name+ is the String filename of the file
|
||||
# +terser+ is the Terser instance
|
||||
def initialize(site, base, dir, name, terser = nil)
|
||||
super(site, base, dir, name)
|
||||
@site = site
|
||||
@base = base
|
||||
@dir = dir
|
||||
@name = name
|
||||
if terser.nil?
|
||||
if site.config["terser"].nil?
|
||||
options = {}
|
||||
else
|
||||
options = site.config["terser"]
|
||||
end
|
||||
@terser = ::Terser.new(options.transform_keys(&:to_sym))
|
||||
|
||||
else
|
||||
@terser = terser
|
||||
end
|
||||
end
|
||||
|
||||
# Obtain destination path.
|
||||
# +dest+ is the String path to the destination dir
|
||||
#
|
||||
# Returns destination file path.
|
||||
def destination(dest)
|
||||
File.join(dest, @dir, @name)
|
||||
end
|
||||
|
||||
# Process the .js file
|
||||
# +dest+ is the String path to the destination dir
|
||||
#
|
||||
# Returns false if the file was not modified since last time (no-op).
|
||||
def write(dest)
|
||||
dest_path = destination(dest)
|
||||
|
||||
return false if File.exist? dest_path and !modified?
|
||||
@@mtimes[path] = mtime
|
||||
|
||||
FileUtils.mkdir_p(File.dirname(dest_path))
|
||||
begin
|
||||
content = File.read(path)
|
||||
content = @terser.compile(content)
|
||||
File.open(dest_path, 'w') do |f|
|
||||
f.write(content)
|
||||
end
|
||||
rescue => e
|
||||
STDERR.puts "Terser Exception: #{e.message}"
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class TerserGenerator < Jekyll::Generator
|
||||
safe true
|
||||
|
||||
# Initialize options from site config.
|
||||
def initialize(config = {})
|
||||
# check if options is not empty
|
||||
if config["terser"].nil?
|
||||
@options = {}
|
||||
else
|
||||
@options = config["terser"]
|
||||
end
|
||||
|
||||
@terser = ::Terser.new(@options.transform_keys(&:to_sym))
|
||||
end
|
||||
|
||||
# Jekyll will have already added the *.js files as Jekyll::StaticFile
|
||||
# objects to the static_files array. Here we replace those with a
|
||||
# JSFile object.
|
||||
def generate(site)
|
||||
site.static_files.clone.each do |sf|
|
||||
# do not process already minified files
|
||||
if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\.js$/ && !sf.path.end_with?(".min.js")
|
||||
puts "Terser: Minifying #{sf.path}"
|
||||
site.static_files.delete(sf)
|
||||
name = File.basename(sf.path)
|
||||
destination = File.dirname(sf.path).sub(site.source, '')
|
||||
|
||||
js_file = JSFile.new(site, site.source, destination, name, @terser)
|
||||
site.static_files << js_file
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
327
_scripts/search.liquid.js
Normal file
327
_scripts/search.liquid.js
Normal file
@ -0,0 +1,327 @@
|
||||
---
|
||||
permalink: /assets/js/search-data.js
|
||||
---
|
||||
// get the ninja-keys element
|
||||
const ninja = document.querySelector('ninja-keys');
|
||||
|
||||
// add the home and posts menu items
|
||||
ninja.data = [
|
||||
{%- for page in site.pages -%}
|
||||
{%- if page.permalink == '/' -%}{%- assign about_title = page.title | strip -%}{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{
|
||||
id: "nav-{{ about_title | slugify }}",
|
||||
title: "{{ about_title | truncatewords: 13 }}",
|
||||
section: "Navigation",
|
||||
handler: () => {
|
||||
window.location.href = "{{ '/' | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- assign sorted_pages = site.pages | sort: "nav_order" -%}
|
||||
{%- for p in sorted_pages -%}
|
||||
{%- if p.nav and p.autogen == null -%}
|
||||
{%- if p.dropdown -%}
|
||||
{%- for child in p.children -%}
|
||||
{%- unless child.title == 'divider' -%}
|
||||
{
|
||||
{%- assign title = child.title | escape | strip -%}
|
||||
{%- if child.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = child.url -%}{%- endif -%}
|
||||
id: "dropdown-{{ title | slugify }}",
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
description: "{{ child.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Dropdown",
|
||||
handler: () => {
|
||||
window.location.href = "{{ url | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- endunless -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- else -%}
|
||||
{
|
||||
{%- assign title = p.title | escape | strip -%}
|
||||
{%- if p.permalink contains "/blog/" -%}{%- assign url = "/blog/" -%} {%- else -%}{%- assign url = p.url -%}{%- endif -%}
|
||||
id: "nav-{{ title | slugify }}",
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
description: "{{ p.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Navigation",
|
||||
handler: () => {
|
||||
window.location.href = "{{ url | relative_url }}";
|
||||
},
|
||||
},
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- for post in site.posts -%}
|
||||
{
|
||||
{%- assign title = post.title | escape | strip -%}
|
||||
id: "post-{{ title | slugify }}",
|
||||
{% if post.redirect == blank %}
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
{% elsif post.redirect contains '://' %}
|
||||
title: '{{ title | truncatewords: 13 }} <svg width="1.2rem" height="1.2rem" top=".5rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg>',
|
||||
{% else %}
|
||||
title: "{{ title | truncatewords: 13 }}",
|
||||
{% endif %}
|
||||
description: "{{ post.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "Posts",
|
||||
handler: () => {
|
||||
{% if post.redirect == blank %}
|
||||
window.location.href = "{{ post.url | relative_url }}";
|
||||
{% elsif post.redirect contains '://' %}
|
||||
window.open("{{ post.redirect }}", "_blank");
|
||||
{% else %}
|
||||
window.location.href = "{{ post.redirect | relative_url }}";
|
||||
{% endif %}
|
||||
},
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- for collection in site.collections -%}
|
||||
{%- if collection.label != 'posts' -%}
|
||||
{%- for item in collection.docs -%}
|
||||
{
|
||||
{%- if item.inline -%}
|
||||
{%- assign title = item.content | newline_to_br | replace: "<br />", " " | replace: "<br/>", " " | strip_html | strip_newlines | escape | strip -%}
|
||||
{%- else -%}
|
||||
{%- assign title = item.title | newline_to_br | replace: "<br />", " " | replace: "<br/>", " " | strip_html | strip_newlines | escape | strip -%}
|
||||
{%- endif -%}
|
||||
id: "{{ collection.label }}-{{ title | slugify }}",
|
||||
title: '{{ title | escape | emojify | truncatewords: 13 }}',
|
||||
description: "{{ item.description | strip_html | strip_newlines | escape | strip }}",
|
||||
section: "{{ collection.label | capitalize }}",
|
||||
{%- unless item.inline -%}
|
||||
handler: () => {
|
||||
window.location.href = "{{ item.url | relative_url }}";
|
||||
},
|
||||
{%- endunless -%}
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if site.socials_in_search -%}
|
||||
{%- for social in site.data.socials -%}
|
||||
{%- case social[0] -%}
|
||||
{%- when "acm_id" -%}
|
||||
{%- assign social_id = "social-acm" -%}
|
||||
{%- assign social_title = "ACM DL" -%}
|
||||
{%- capture social_url %}"https://dl.acm.org/profile/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "blogger_url" -%}
|
||||
{%- assign social_id = "social-blogger" -%}
|
||||
{%- assign social_title = "Blogger" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "bluesky_url" -%}
|
||||
{%- assign social_id = "social-bluesky" -%}
|
||||
{%- assign social_title = "Bluesky" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "dblp_url" -%}
|
||||
{%- assign social_id = "social-dblp" -%}
|
||||
{%- assign social_title = "DBLP" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "discord_id" -%}
|
||||
{%- assign social_id = "social-discord" -%}
|
||||
{%- assign social_title = "Discord" -%}
|
||||
{%- capture social_url %}"https://discord.com/users/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "email" -%}
|
||||
{%- assign social_id = "social-email" -%}
|
||||
{%- assign social_title = "email" -%}
|
||||
{%- capture social_url %}"mailto:{{ social[1] | encode_email }}"{% endcapture -%}
|
||||
{%- when "facebook_id" -%}
|
||||
{%- assign social_id = "social-facebook" -%}
|
||||
{%- assign social_title = "Facebook" -%}
|
||||
{%- capture social_url %}"https://facebook.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "flickr_id" -%}
|
||||
{%- assign social_id = "social-flickr" -%}
|
||||
{%- assign social_title = "Flickr" -%}
|
||||
{%- capture social_url %}"https://www.flickr.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "github_username" -%}
|
||||
{%- assign social_id = "social-github" -%}
|
||||
{%- assign social_title = "GitHub" -%}
|
||||
{%- capture social_url %}"https://github.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "gitlab_username" -%}
|
||||
{%- assign social_id = "social-gitlab" -%}
|
||||
{%- assign social_title = "GitLab" -%}
|
||||
{%- capture social_url %}"https://gitlab.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "ieee_id" -%}
|
||||
{%- assign social_id = "social-ieee" -%}
|
||||
{%- assign social_title = "IEEE Xplore" -%}
|
||||
{%- capture social_url %}"https://ieeexplore.ieee.org/author/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "inspirehep_id" -%}
|
||||
{%- assign social_id = "social-inspire" -%}
|
||||
{%- assign social_title = "Inspire HEP" -%}
|
||||
{%- capture social_url %}"https://inspirehep.net/authors/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "instagram_id" -%}
|
||||
{%- assign social_id = "social-instagram" -%}
|
||||
{%- assign social_title = "Instagram" -%}
|
||||
{%- capture social_url %}"https://instagram.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "kaggle_id" -%}
|
||||
{%- assign social_id = "social-kaggle" -%}
|
||||
{%- assign social_title = "Kaggle" -%}
|
||||
{%- capture social_url %}"https://www.kaggle.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "keybase_username" -%}
|
||||
{%- assign social_id = "social-keybase" -%}
|
||||
{%- assign social_title = "Keybase" -%}
|
||||
{%- capture social_url %}"https://keybase.io/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "lastfm_id" -%}
|
||||
{%- assign social_id = "social-lastfm" -%}
|
||||
{%- assign social_title = "Last FM" -%}
|
||||
{%- capture social_url %}"https://www.last.fm/user/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "lattes_id" -%}
|
||||
{%- assign social_id = "social-lattes" -%}
|
||||
{%- assign social_title = "Lattes" -%}
|
||||
{%- capture social_url %}"http://lattes.cnpq.br/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "leetcode_id" -%}
|
||||
{%- assign social_id = "social-leetcode" -%}
|
||||
{%- assign social_title = "LeetCode" -%}
|
||||
{%- capture social_url %}"https://leetcode.com/u/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "linkedin_username" -%}
|
||||
{%- assign social_id = "social-linkedin" -%}
|
||||
{%- assign social_title = "LinkedIn" -%}
|
||||
{%- capture social_url %}"https://www.linkedin.com/in/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "mastodon_username" -%}
|
||||
{%- assign social_id = "social-mastodon" -%}
|
||||
{%- assign social_title = "Mastodon" -%}
|
||||
{%- capture social_url %}"https://{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "medium_username" -%}
|
||||
{%- assign social_id = "social-medium" -%}
|
||||
{%- assign social_title = "Medium" -%}
|
||||
{%- capture social_url %}"https://medium.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "orcid_id" -%}
|
||||
{%- assign social_id = "social-orcid" -%}
|
||||
{%- assign social_title = "ORCID" -%}
|
||||
{%- capture social_url %}"https://orcid.org/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "osf_id" -%}
|
||||
{%- assign social_id = "social-osf" -%}
|
||||
{%- assign social_title = "Open Science Framework" -%}
|
||||
{%- capture social_url %}"https://osf.io/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "pinterest_id" -%}
|
||||
{%- assign social_id = "social-pinterest" -%}
|
||||
{%- assign social_title = "Pinterest" -%}
|
||||
{%- capture social_url %}"https://www.pinterest.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "publons_id" -%}
|
||||
{%- assign social_id = "social-publons" -%}
|
||||
{%- assign social_title = "Publons" -%}
|
||||
{%- capture social_url %}"https://publons.com/a/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "quora_username" -%}
|
||||
{%- assign social_id = "social-quora" -%}
|
||||
{%- assign social_title = "Quora" -%}
|
||||
{%- capture social_url %}"https://www.quora.com/profile/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "research_gate_profile" -%}
|
||||
{%- assign social_id = "social-researchgate" -%}
|
||||
{%- assign social_title = "ResearchGate" -%}
|
||||
{%- capture social_url %}"https://www.researchgate.net/profile/{{ social[1] }}/"{% endcapture -%}
|
||||
{%- when "rss_icon" -%}
|
||||
{%- assign social_id = "social-rss" -%}
|
||||
{%- assign social_title = "RSS Feed" -%}
|
||||
{%- capture social_url %}"{{ site.baseurl }}/feed.xml"{% endcapture -%}
|
||||
{%- when "scholar_userid" -%}
|
||||
{%- assign social_id = "social-scholar" -%}
|
||||
{%- assign social_title = "Google Scholar" -%}
|
||||
{%- capture social_url %}"https://scholar.google.com/citations?user={{ social[1] }}"{% endcapture -%}
|
||||
{%- when "scopus_id" -%}
|
||||
{%- assign social_id = "social-scopus" -%}
|
||||
{%- assign social_title = "Scopus" -%}
|
||||
{%- capture social_url %}"https://www.scopus.com/authid/detail.uri?authorId={{ social[1] }}"{% endcapture -%}
|
||||
{%- when "semanticscholar_id" -%}
|
||||
{%- assign social_id = "social-semanticscholar" -%}
|
||||
{%- assign social_title = "Semantic Scholar" -%}
|
||||
{%- capture social_url %}"https://www.semanticscholar.org/author/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "spotify_id" -%}
|
||||
{%- assign social_id = "social-spotify" -%}
|
||||
{%- assign social_title = "Spotify" -%}
|
||||
{%- capture social_url %}"https://open.spotify.com/user/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "stackoverflow_id" -%}
|
||||
{%- assign social_id = "social-stackoverflow" -%}
|
||||
{%- assign social_title = "Stackoverflow" -%}
|
||||
{%- capture social_url %}"https://stackoverflow.com/users/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "strava_userid" -%}
|
||||
{%- assign social_id = "social-strava" -%}
|
||||
{%- assign social_title = "Strava" -%}
|
||||
{%- capture social_url %}"https://www.strava.com/athletes/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "telegram_username" -%}
|
||||
{%- assign social_id = "social-telegram" -%}
|
||||
{%- assign social_title = "telegram" -%}
|
||||
{%- capture social_url %}"https://telegram.me/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "unsplash_id" -%}
|
||||
{%- assign social_id = "social-unsplash" -%}
|
||||
{%- assign social_title = "Unsplash" -%}
|
||||
{%- capture social_url %}"https://unsplash.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- comment -%}
|
||||
// check how to add wechat qr code
|
||||
{%- when "wechat_qr" -%}
|
||||
{%- assign social_id = "social-wechat" -%}
|
||||
{%- assign social_title = "WeChat" -%}
|
||||
{%- capture social_url %}"https://wechat.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- endcomment -%}
|
||||
{%- when "whatsapp_number" -%}
|
||||
{%- assign social_id = "social-whatsapp" -%}
|
||||
{%- assign social_title = "whatsapp" -%}
|
||||
{%- capture social_url %}"https://wa.me/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "wikidata_id" -%}
|
||||
{%- assign social_id = "social-wikidata" -%}
|
||||
{%- assign social_title = "Wikidata" -%}
|
||||
{%- capture social_url %}"https://www.wikidata.org/wiki/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "wikipedia_id" -%}
|
||||
{%- assign social_id = "social-wikipedia" -%}
|
||||
{%- assign social_title = "Wikipedia" -%}
|
||||
{%- capture social_url %}"https://wikipedia.org/wiki/User:{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "work_url" -%}
|
||||
{%- assign social_id = "social-work" -%}
|
||||
{%- assign social_title = "Work" -%}
|
||||
{%- capture social_url %}"{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "x_username" -%}
|
||||
{%- assign social_id = "social-x" -%}
|
||||
{%- assign social_title = "X" -%}
|
||||
{%- capture social_url %}"https://twitter.com/{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "youtube_id" -%}
|
||||
{%- assign social_id = "social-youtube" -%}
|
||||
{%- assign social_title = "YouTube" -%}
|
||||
{%- capture social_url %}"https://youtube.com/@{{ social[1] }}"{% endcapture -%}
|
||||
{%- when "zotero_username" -%}
|
||||
{%- assign social_id = "social-zotero" -%}
|
||||
{%- assign social_title = "Zotero" -%}
|
||||
{%- capture social_url %}"https://www.zotero.org/{{ social[1] }}"{% endcapture -%}
|
||||
{%- else -%}
|
||||
{%- assign social_id = "social-" | append: social[0] -%}
|
||||
{%- assign social_title = social[0] | capitalize -%}
|
||||
{%- capture social_url %}"{{ social[1].url }}"{% endcapture -%}
|
||||
{%- endcase -%}
|
||||
{
|
||||
id: '{{ social_id }}',
|
||||
title: '{{ social_title }}',
|
||||
section: 'Socials',
|
||||
handler: () => {
|
||||
window.open({{ social_url }}, "_blank");
|
||||
},
|
||||
},
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- if site.enable_darkmode -%}
|
||||
{
|
||||
id: 'light-theme',
|
||||
title: 'Change theme to light',
|
||||
description: 'Change the theme of the site to Light',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("light");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'dark-theme',
|
||||
title: 'Change theme to dark',
|
||||
description: 'Change the theme of the site to Dark',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("dark");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'system-theme',
|
||||
title: 'Use system default theme',
|
||||
description: 'Change the theme of the site to System Default',
|
||||
section: 'Theme',
|
||||
handler: () => {
|
||||
setThemeSetting("system");
|
||||
},
|
||||
},
|
||||
{%- endif -%}
|
||||
];
|
||||
14
assets/js/chartjs-setup.js
Normal file
14
assets/js/chartjs-setup.js
Normal file
@ -0,0 +1,14 @@
|
||||
$(document).ready(function () {
|
||||
var $canvas = null,
|
||||
$this = null,
|
||||
_ctx = null,
|
||||
_text = "";
|
||||
$(".language-chartjs").each(function () {
|
||||
$this = $(this);
|
||||
$canvas = $("<canvas></canvas>");
|
||||
_text = $this.text();
|
||||
$this.text("").append($canvas);
|
||||
_ctx = $canvas.get(0).getContext("2d");
|
||||
_ctx && _text && new Chart(_ctx, JSON.parse(_text)) && $this.attr("data-processed", true);
|
||||
});
|
||||
});
|
||||
6
assets/js/cronitor-analytics-setup.js
Normal file
6
assets/js/cronitor-analytics-setup.js
Normal file
@ -0,0 +1,6 @@
|
||||
window.cronitor =
|
||||
window.cronitor ||
|
||||
function () {
|
||||
(window.cronitor.q = window.cronitor.q || []).push(arguments);
|
||||
};
|
||||
cronitor("config", { clientKey: "{{ site.cronitor_analytics }}" });
|
||||
20
assets/js/diff2html-setup.js
Normal file
20
assets/js/diff2html-setup.js
Normal file
@ -0,0 +1,20 @@
|
||||
let diff2HtmlTheme = determineComputedTheme();
|
||||
|
||||
/* Create diff2html as another node and hide the code block, appending the diff2html node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-diff2html").forEach((elem) => {
|
||||
const textData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add("unloaded");
|
||||
/* create diff node */
|
||||
let diffElement = document.createElement("div");
|
||||
diffElement.classList.add("diff2html");
|
||||
backup.after(diffElement);
|
||||
const configuration = { colorScheme: diff2HtmlTheme, drawFileList: true, highlight: true, matching: "lines" };
|
||||
const diff2htmlUi = new Diff2HtmlUI(diffElement, textData, configuration);
|
||||
diff2htmlUi.draw();
|
||||
});
|
||||
}
|
||||
});
|
||||
29
assets/js/echarts-setup.js
Normal file
29
assets/js/echarts-setup.js
Normal file
@ -0,0 +1,29 @@
|
||||
let echartsTheme = determineComputedTheme();
|
||||
|
||||
/* Create echarts chart as another node and hide the code block, appending the echarts node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-echarts").forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add("unloaded");
|
||||
/* create echarts node */
|
||||
let chartElement = document.createElement("div");
|
||||
chartElement.classList.add("echarts");
|
||||
backup.after(chartElement);
|
||||
|
||||
/* create echarts */
|
||||
if (echartsTheme === "dark") {
|
||||
var chart = echarts.init(chartElement, "dark-fresh-cut");
|
||||
} else {
|
||||
var chart = echarts.init(chartElement);
|
||||
}
|
||||
|
||||
chart.setOption(JSON.parse(jsonData));
|
||||
window.addEventListener("resize", function () {
|
||||
chart.resize();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
6
assets/js/google-analytics-setup.js
Normal file
6
assets/js/google-analytics-setup.js
Normal file
@ -0,0 +1,6 @@
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
window.dataLayer.push(arguments);
|
||||
}
|
||||
gtag("js", new Date());
|
||||
gtag("config", "{{ site.google_analytics }}");
|
||||
22
assets/js/leaflet-setup.js
Normal file
22
assets/js/leaflet-setup.js
Normal file
@ -0,0 +1,22 @@
|
||||
/* Create leaflet map as another node and hide the code block, appending the leaflet node after it */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-geojson").forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add("unloaded");
|
||||
/* create leaflet node */
|
||||
let mapElement = document.createElement("div");
|
||||
mapElement.classList.add("map");
|
||||
backup.after(mapElement);
|
||||
|
||||
var map = L.map(mapElement);
|
||||
L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
||||
}).addTo(map);
|
||||
let geoJSON = L.geoJSON(JSON.parse(jsonData)).addTo(map);
|
||||
map.fitBounds(geoJSON.getBounds());
|
||||
});
|
||||
}
|
||||
});
|
||||
5
assets/js/mathjax-setup.js
Normal file
5
assets/js/mathjax-setup.js
Normal file
@ -0,0 +1,5 @@
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
tags: "ams",
|
||||
},
|
||||
};
|
||||
37
assets/js/mermaid-setup.js
Normal file
37
assets/js/mermaid-setup.js
Normal file
@ -0,0 +1,37 @@
|
||||
let mermaidTheme = determineComputedTheme();
|
||||
|
||||
/* Create mermaid diagram as another node and hide the code block, appending the mermaid node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-mermaid").forEach((elem) => {
|
||||
const svgCode = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add("unloaded");
|
||||
/* create mermaid node */
|
||||
let mermaid = document.createElement("pre");
|
||||
mermaid.classList.add("mermaid");
|
||||
const text = document.createTextNode(svgCode);
|
||||
mermaid.appendChild(text);
|
||||
backup.after(mermaid);
|
||||
});
|
||||
|
||||
mermaid.initialize({ theme: mermaidTheme });
|
||||
|
||||
/* Zoomable mermaid diagrams */
|
||||
if (typeof d3 !== "undefined") {
|
||||
window.addEventListener("load", function () {
|
||||
var svgs = d3.selectAll(".mermaid svg");
|
||||
svgs.each(function () {
|
||||
var svg = d3.select(this);
|
||||
svg.html("<g>" + svg.html() + "</g>");
|
||||
var inner = svg.select("g");
|
||||
var zoom = d3.zoom().on("zoom", function (event) {
|
||||
inner.attr("transform", event.transform);
|
||||
});
|
||||
svg.call(zoom);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
11
assets/js/open-panel-analytics-setup.js
Normal file
11
assets/js/open-panel-analytics-setup.js
Normal file
@ -0,0 +1,11 @@
|
||||
window.op =
|
||||
window.op ||
|
||||
function (...args) {
|
||||
(window.op.q = window.op.q || []).push(args);
|
||||
};
|
||||
window.op("init", {
|
||||
clientId: "{{ site.openpanel_analytics }}",
|
||||
trackScreenViews: true,
|
||||
trackOutgoingLinks: true,
|
||||
trackAttributes: true,
|
||||
});
|
||||
8
assets/js/photoswipe-setup.js
Normal file
8
assets/js/photoswipe-setup.js
Normal file
@ -0,0 +1,8 @@
|
||||
import PhotoSwipeLightbox from "{{ site.third_party_libraries.photoswipe-lightbox.url.js }}";
|
||||
import PhotoSwipe from "{{ site.third_party_libraries.photoswipe.url.js }}";
|
||||
const photoswipe = new PhotoSwipeLightbox({
|
||||
gallery: ".pswp-gallery",
|
||||
children: "a",
|
||||
pswpModule: PhotoSwipe,
|
||||
});
|
||||
photoswipe.init();
|
||||
73
assets/js/progress-bar.js
Normal file
73
assets/js/progress-bar.js
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This JavaScript code has been adapted from the article
|
||||
* https://css-tricks.com/reading-position-indicator/ authored by Pankaj Parashar,
|
||||
* published on the website https://css-tricks.com on the 7th of May, 2014.
|
||||
* Couple of changes were made to the original code to make it compatible
|
||||
* with the `al-foio` theme.
|
||||
*/
|
||||
const progressBar = $("#progress");
|
||||
/*
|
||||
* We set up the bar after all elements are done loading.
|
||||
* In some cases, if the images in the page are larger than the intended
|
||||
* size they'll have on the page, they'll be resized via CSS to accomodate
|
||||
* the desired size. This mistake, however, breaks the computations as the
|
||||
* scroll size is computed as soon as the elements finish loading.
|
||||
* To account for this, a minimal delay was introduced before computing the
|
||||
* values.
|
||||
*/
|
||||
window.onload = function () {
|
||||
setTimeout(progressBarSetup, 50);
|
||||
};
|
||||
/*
|
||||
* We set up the bar according to the browser.
|
||||
* If the browser supports the progress element we use that.
|
||||
* Otherwise, we resize the bar thru CSS styling
|
||||
*/
|
||||
function progressBarSetup() {
|
||||
if ("max" in document.createElement("progress")) {
|
||||
initializeProgressElement();
|
||||
$(document).on("scroll", function () {
|
||||
progressBar.attr({ value: getCurrentScrollPosition() });
|
||||
});
|
||||
$(window).on("resize", initializeProgressElement);
|
||||
} else {
|
||||
resizeProgressBar();
|
||||
$(document).on("scroll", resizeProgressBar);
|
||||
$(window).on("resize", resizeProgressBar);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The vertical scroll position is the same as the number of pixels that
|
||||
* are hidden from view above the scrollable area. Thus, a value > 0 is
|
||||
* how much the user has scrolled from the top
|
||||
*/
|
||||
function getCurrentScrollPosition() {
|
||||
return $(window).scrollTop();
|
||||
}
|
||||
|
||||
function initializeProgressElement() {
|
||||
let navbarHeight = $("#navbar").outerHeight(true);
|
||||
$("body").css({ "padding-top": navbarHeight });
|
||||
$("progress-container").css({ "padding-top": navbarHeight });
|
||||
progressBar.css({ top: navbarHeight });
|
||||
progressBar.attr({
|
||||
max: getDistanceToScroll(),
|
||||
value: getCurrentScrollPosition(),
|
||||
});
|
||||
}
|
||||
/*
|
||||
* The offset between the html document height and the browser viewport
|
||||
* height will be greater than zero if vertical scroll is possible.
|
||||
* This is the distance the user can scroll
|
||||
*/
|
||||
function getDistanceToScroll() {
|
||||
return $(document).height() - $(window).height();
|
||||
}
|
||||
|
||||
function resizeProgressBar() {
|
||||
progressBar.css({ width: getWidthPercentage() + "%" });
|
||||
}
|
||||
// The scroll ratio equals the percentage to resize the bar
|
||||
function getWidthPercentage() {
|
||||
return (getCurrentScrollPosition() / getDistanceToScroll()) * 100;
|
||||
}
|
||||
33
assets/js/pseudocode-setup.js
Normal file
33
assets/js/pseudocode-setup.js
Normal file
@ -0,0 +1,33 @@
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [
|
||||
["$", "$"],
|
||||
["\\(", "\\)"],
|
||||
],
|
||||
displayMath: [
|
||||
["$$", "$$"],
|
||||
["\\[", "\\]"],
|
||||
],
|
||||
processEscapes: true,
|
||||
processEnvironments: true,
|
||||
},
|
||||
};
|
||||
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-pseudocode").forEach((elem) => {
|
||||
const texData = elem.textContent;
|
||||
const parent = elem.parentElement.parentElement;
|
||||
/* create pseudocode node */
|
||||
let pseudoCodeElement = document.createElement("pre");
|
||||
pseudoCodeElement.classList.add("pseudocode");
|
||||
const text = document.createTextNode(texData);
|
||||
pseudoCodeElement.appendChild(text);
|
||||
/* add pseudocode node and remove the original code block */
|
||||
parent.appendChild(pseudoCodeElement);
|
||||
parent.removeChild(elem.parentElement);
|
||||
/* embed the visualization in the container */
|
||||
pseudocode.renderElement(pseudoCodeElement);
|
||||
});
|
||||
}
|
||||
});
|
||||
17
assets/js/search-setup.js
Normal file
17
assets/js/search-setup.js
Normal file
@ -0,0 +1,17 @@
|
||||
let searchTheme = determineComputedTheme();
|
||||
const ninjaKeys = document.querySelector("ninja-keys");
|
||||
|
||||
if (searchTheme === "dark") {
|
||||
ninjaKeys.classList.add("dark");
|
||||
} else {
|
||||
ninjaKeys.classList.remove("dark");
|
||||
}
|
||||
|
||||
const openSearchModal = () => {
|
||||
// collapse navbarNav if expanded on mobile
|
||||
const $navbarNav = $("#navbarNav");
|
||||
if ($navbarNav.hasClass("show")) {
|
||||
$navbarNav.collapse("hide");
|
||||
}
|
||||
ninjaKeys.open();
|
||||
};
|
||||
3
assets/js/tooltips-setup.js
Normal file
3
assets/js/tooltips-setup.js
Normal file
@ -0,0 +1,3 @@
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
@ -1,5 +1,6 @@
|
||||
// based on the original typograms code from https://github.com/google/typograms/blob/main/src/typograms.js
|
||||
// only moved the css to its own file (_sass/_typograms.scss) and commented the last line of the file
|
||||
// only moved the css to its own file (_sass/_typograms.scss), commented the last line of the file (module.exports = create;)
|
||||
// and added the last function to the end of the file
|
||||
const ratio = 2;
|
||||
|
||||
function grid(width, height) {
|
||||
@ -1320,3 +1321,21 @@ function around(diagram, [x, y]) {
|
||||
}
|
||||
|
||||
// module.exports = create;
|
||||
|
||||
/* Create typogram as another node and hide the code block, appending the typogram node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-typograms").forEach((elem) => {
|
||||
const texData = elem.textContent;
|
||||
const parent = elem.parentElement.parentElement;
|
||||
/* create typograms node */
|
||||
let typogram = document.createElement("pre");
|
||||
typogram.classList.add("typogram");
|
||||
const svg = create("\n" + texData, 0.3, false);
|
||||
typogram.appendChild(svg);
|
||||
parent.appendChild(typogram);
|
||||
parent.removeChild(elem.parentElement);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
24
assets/js/vega-setup.js
Normal file
24
assets/js/vega-setup.js
Normal file
@ -0,0 +1,24 @@
|
||||
let vegaTheme = determineComputedTheme();
|
||||
|
||||
/* Create vega lite chart as another node and hide the code block, appending the vega lite node after it
|
||||
this is done to enable retrieving the code again when changing theme between light/dark */
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
document.querySelectorAll("pre>code.language-vega_lite").forEach((elem) => {
|
||||
const jsonData = elem.textContent;
|
||||
const backup = elem.parentElement;
|
||||
backup.classList.add("unloaded");
|
||||
/* create vega lite node */
|
||||
let chartElement = document.createElement("div");
|
||||
chartElement.classList.add("vega-lite");
|
||||
backup.after(chartElement);
|
||||
|
||||
/* Embed the visualization in the container */
|
||||
if (vegaTheme === "dark") {
|
||||
vegaEmbed(chartElement, JSON.parse(jsonData), { theme: "dark" });
|
||||
} else {
|
||||
vegaEmbed(chartElement, JSON.parse(jsonData));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
5
assets/js/venobox-setup.js
Normal file
5
assets/js/venobox-setup.js
Normal file
@ -0,0 +1,5 @@
|
||||
document.addEventListener("readystatechange", () => {
|
||||
if (document.readyState === "complete") {
|
||||
new VenoBox();
|
||||
}
|
||||
});
|
||||
14
assets/js/wechat.js
Normal file
14
assets/js/wechat.js
Normal file
@ -0,0 +1,14 @@
|
||||
var wechatModal = document.getElementById("WeChatMod");
|
||||
var wechatBtn = document.querySelectorAll('[id="WeChatBtn"]');
|
||||
|
||||
for (var i = 0; i < wechatBtn.length; i++) {
|
||||
wechatBtn[i].onclick = function () {
|
||||
wechatModal.style.display = "block";
|
||||
};
|
||||
}
|
||||
|
||||
window.onclick = function (event) {
|
||||
if (event.target == wechatModal) {
|
||||
wechatModal.style.display = "none";
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user