aboutsummaryrefslogtreecommitdiff
path: root/templates/shortcodes/imghover.html
diff options
context:
space:
mode:
authorJieiku2023-08-09 18:51:29 -0700
committerJieiku2023-08-09 18:51:29 -0700
commitd2aba91ac9f5ab6a6f88b125da80b8f8275138d3 (patch)
tree5b3b167126a324788506b3b9e0c87dfa7a5dcaa9 /templates/shortcodes/imghover.html
parentdfa3de95da02a94ae16cb36028a372f8f553ab51 (diff)
downloadabridge-d2aba91ac9f5ab6a6f88b125da80b8f8275138d3.tar.gz
abridge-d2aba91ac9f5ab6a6f88b125da80b8f8275138d3.tar.bz2
abridge-d2aba91ac9f5ab6a6f88b125da80b8f8275138d3.zip
imghover > imgswap, reduce complexity, fix CSP1.2.2
Diffstat (limited to 'templates/shortcodes/imghover.html')
-rw-r--r--templates/shortcodes/imghover.html95
1 files changed, 0 insertions, 95 deletions
diff --git a/templates/shortcodes/imghover.html b/templates/shortcodes/imghover.html
deleted file mode 100644
index 1ad733c..0000000
--- a/templates/shortcodes/imghover.html
+++ /dev/null
@@ -1,95 +0,0 @@
-{%- set_global bg = "" %}
-
-{%- for source in src %}
-
- {%- set dirtest = source | trim_start_matches(pat="./") %}
- {%- if dirtest is containing("/") %}
- {%- set reldir = true %}
- {%- endif %}
-
- {%- if source is starting_with("./") and reldir %} {# Relative Path #}
- {%- set pathtype = "rel-" %}
- {%- set path = source | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
- {%- set path = path ~ "/" %}
-
- {%- elif source is starting_with("/") %} {# Root Path #}
- {%- set pathtype = "root-" %}
- {%- set rootpath = source | split(pat="/") | slice(end=-1) | join(sep="/") %}
- {%- set path = config.base_url ~ rootpath ~ "/" %}
-
- {%- else %} {# Same Directory Path #}
- {%- set pathtype = "same-" %}
- {%- set path = "" %}
- {%- endif %}
-
- {%- set sourcepath = source | split(pat="/") | last %}
- {%- set sourcename = pathtype ~ sourcepath | split(pat=".") | first %}
-
- {%- if loop.first %}
- {%- set_global bg = source | split(pat="/") | last %}
- {%- else %}
- <div id="{{ sourcename }}"><b>{{ sourcename }} on hover</b></div>
- <div id="{{ sourcename }}image" title="{{ sourcename }}"> </div>
- {%- endif %}
-
-{%- endfor %}
-
-<style>
- {%- for source in src %}
-
- {%- set dirtest = source | trim_start_matches(pat="./") %}
- {%- if dirtest is containing("/") %}
- {%- set reldir = true %}
- {%- endif %}
-
- {%- if source is starting_with("./") and reldir %} {# Relative Path #}
- {%- set pathtype = "rel-" %}
- {%- set path = source | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
- {%- set path = path ~ "/" %}
-
- {%- elif source is starting_with("/") %} {# Root Path #}
- {%- set pathtype = "root-" %}
- {%- set rootpath = source | split(pat="/") | slice(end=-1) | join(sep="/") %}
- {%- set path = config.base_url ~ rootpath ~ "/" %}
-
- {%- else %} {# Same Directory Path #}
- {%- set pathtype = "same-" %}
- {%- set path = "" %}
- {%- endif %}
-
- {%- set sourcepath = source | split(pat="/") | last %}
- {%- set sourcename = pathtype ~ sourcepath | split(pat=".") | first %}
- {%- set sourcetype = pathtype ~ sourcepath | split(pat=".") | last %}
-
- {%- if w and h and p %}
- {%- set padding = h / w * p %}
- {%- elif w and h %}
- {%- set padding = h / w * 50 %}
- {%- elif p %}
- {%- set metafile = page.path ~ path ~ sourcepath %}
- {%- set meta = get_image_metadata(path=metafile) %}
- {%- set padding = meta.height / meta.width * p %}
- {%- else %}
- {%- set metafile = page.path ~ path ~ sourcepath %}
- {%- set meta = get_image_metadata(path=metafile) %}
- {%- set padding = meta.height / meta.width * 50 %}
- {%- endif %}
-
-
-
- {%- if not loop.first %}
- #{{ sourcename | safe }}image {
- background-image: url('{{ path | safe }}{{ bg | safe }}');
- background-size: contain;
- background-repeat: no-repeat;
- width: {{ p | default(value=50) }}%;
- height: 0;
- padding-top: {{ padding }}%;
-
- }
- #{{ sourcename | safe }}image:hover {
- background-image: url('{{ path | safe }}{{ sourcepath | safe }}');
- }
- {%- endif %}
- {%- endfor %}
-</style>