Commit Graph

79 Commits

Author SHA1 Message Date
Aditya Telange 6c64ad0695
Show Code Copy scripts only on Kind = page 2021-04-10 11:53:23 +05:30
Kian Kasad 17c4da86b5
Add copy button to copy code block contents (#345)
* add buttons to copy code block contents

Adds a clickable "copy" link in the top-right corner of each code block.

If available, uses the navigator.clipboard API. Falls back to selecting
the text and calling document.execCommand('copy') to copy text.

* hides copy button unless mouse is hovering over code block

* change text of copy button when text is copied

* add translation keys for copy button text  `code_copy` and `code_copied`

* To disable use `Params.disableCodeCopy: true` in site config
2021-04-10 11:33:31 +05:30
Aditya Telange bb7b6f0076
Refactor, move HLJS code from footer to head;
already defered.
2021-04-09 19:38:04 +05:30
Aditya Telange 196b82645e
Fix Spacing in overall repo 2021-03-30 18:26:43 +05:30
Aditya Telange ddf004b709
Allow disabling ScrollToTop button
- refactor corresponding code

usage =>
in site config:
params:
    disableScrollToTop: true

closes: #321
2021-03-25 13:34:01 +05:30
Aditya Telange e1ea90aa60
Revert "Use md5 instead of default sha256 for generating SRI hashes (#195)"
This reverts commit 9e99493e69.
2021-01-26 10:52:48 +05:30
Aditya Telange 9691c41983
retain history of header link clicks
close: #196
2021-01-25 21:48:15 +05:30
John 9e99493e69
Use md5 instead of default sha256 for generating SRI hashes (#195)
reference: https://gohugo.io/hugo-pipes/fingerprint/
2021-01-25 21:38:10 +05:30
Aditya Telange e02df37142
Revert "fix wrong load stylesheet and JS on multihost (multilingual) #126"
Doesn't work with multilingual config with no specific baseurl

This reverts commit ad79fdaf83.
2021-01-20 19:11:21 +05:30
Aditya Telange ad79fdaf83
fix wrong load stylesheet and JS on multihost (multilingual) #126 2021-01-20 19:06:02 +05:30
Aditya Telange ad44cdda0f
fix highlight.js loading on section pages 2021-01-15 23:21:13 +05:30
Aditya Telange b6a308d331
Do not smooth scrollIntoView
if user has it preferred

https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
2021-01-13 23:19:35 +05:30
Aditya Telange dd83560010
go-top-top button cleanup 2021-01-11 21:01:50 +05:30
Roman Ispaev 3b5c7faaec
fix wrong asset links on multihost config (#126)
CORS issue for multidomain setup (#168)
2021-01-06 01:51:43 +05:30
Aditya Telange 0e9ca244dc
fotter: fix Links do not have a discernible name for go-to-top btn 2020-12-29 17:03:22 +05:30
Aditya Telange e252e761f5
footer: allow disabling HLJS #143
usage =>

in site config =>
    params:
        assets:
            disableHLJS: true

per-page in front-matter =>
   disableHLJS: true
2020-12-29 16:39:23 +05:30
Aditya Telange 0f994eee95 footer: change scroll behaviour as it was before 80954de
fixes #151

anchored-headings: retain anchor link '#' in URL
cc #108

footer: remove '#' with go-to-top

Revert "anchored-headings: retain anchor link '#' in URL"
This reverts commit 80954de8bd.

Revert "footer: rm unused code"
This reverts commit c76233b350.
2020-12-24 13:00:58 +05:30
Aditya Telange a150c3449a
Link AccessKeys shortcut in title of elements 2020-12-18 20:02:05 +05:30
Aditya Telange db38e156f5
footer: hljs: add check to not load hljs on archive and search 2020-12-08 00:16:11 +05:30
Aditya Telange f4b900de72
footer: go-to-top: fix Uncrawlable Link
rm redundant a tag
2020-12-06 19:45:46 +05:30
Aditya Telange c76233b350
footer: rm unused code
CC: #108 #64
2020-12-05 20:45:15 +05:30
Aditya Telange 80954de8bd
anchored-headings: retain anchor link '#' in URL
close: #108
2020-12-05 20:17:07 +05:30
Aditya Telange a9ff9533a0
head, footer: add option to disable fingerprinting #89
in site config =>
    params:
      assets:
        disableFingerprinting: true
2020-12-01 18:52:06 +05:30
Aditya Telange b301d60f03
theme-switch: Improve theme switch logic (#86)
- removes unnecessary local-storage item removal
- less inline script on build
- assumes `defaultTheme as auto when value is not `dark` or `light`
- should work according to table at docs
2020-11-26 09:10:24 +05:30
Aditya Telange fd06af55fc
footer: simpify loading hljs,
defer and beautify
2020-11-17 15:44:16 +05:30
Aditya Telange 3c28b8a8b2
footer: fix scroll for non ASCII anchors
closes #78
2020-11-17 15:25:39 +05:30
Itay Cohen 3064e8cfc5
theme-switch: Enable theme toggle unless specifically disabled (#69)
Co-authored-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
2020-11-04 14:04:45 +05:30
Aditya Telange 12b6b132e4 Revert "theme-switch-button: improve logic"
This reverts commit 0eed773e6d.
2020-11-03 20:21:10 +05:30
Aditya Telange 0eed773e6d
theme-switch-button: improve logic
- owner can set dark/light/auto default theme
- theme toggle will be enabled on all theme modes unless disbaled
- if disableThemeToggle is true, user won't be able to switch themes,
here auto (a/c to system theme) also works

for #69
2020-11-03 20:07:59 +05:30
Nick Spreitzer 55107fcfc2
footer: Fix broken anchor link scrolling (#64)
fixes: Footnotes anchor link hrefs such as `#fn:1`
fixes: ToC anchors failing with hrefs having numbers.

based-on: https://stackoverflow.com/a/51396346/300212
2020-10-30 22:39:44 +05:30
Dan van Wijk 0a7a540761
footer: remove hidden chars (#63)
Co-authored-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
2020-10-30 17:31:52 +05:30
Aditya Telange b239f42f6b
Add accesskeys (attribute specifies a shortcut key to activate/focus an element.)
c - ToC Open/Close
g- Go To Top
h - Home (according to current lang)
t - Theme toggle

more: https://www.w3schools.com/tags/att_global_accesskey.asp
2020-10-30 01:15:43 +05:30
Aditya Telange a41f09bb99
extended_footer: init
* add placeholder template for extending footer

closes #37
2020-10-18 21:52:22 +05:30
Aditya Telange a9e00a3640
theme: set proper conditions
for having default-theme with theme-toggle

* can set/unset default theme
* for default-theme: dark/light : theme-toggle will not be visible
* theme-toggle with defaultheme: auto is functional

fixes #25 for #15
2020-10-05 14:34:44 +05:30
Kian Kasad c2c32282c1
footer: implement user-defined copyright (#23) 2020-10-05 10:04:33 +05:30
Aditya Telange 6a9e9e129a
theme-switch-button: init feature (#15)
* thanks to https://feathericons.com for svgs
* can be disabled in site config
   Params:
     disableThemeToggle : true
2020-10-04 20:43:24 +05:30
Aditya Telange 8a8652fbf0
assets: improvements
- rm redundant minify's
    - url as //assets/<js or css>/<path>
2020-10-03 18:31:08 +05:30
Aditya Telange 016dd6e9fa
(lint) remove unnecessary whitespace
created by hugo's {{ }}
2020-09-23 12:52:32 +05:30
Aditya Telange 2cb5c9dad5
footer: mv hljs initialiser with resource
* hinders linter
2020-09-23 12:33:19 +05:30
Aditya Telange 06f09594dd
layouts: add rel="noopener noreferrer"
to outgoing links
2020-09-21 15:53:59 +05:30
Aditya Telange 1e5f020efb
footer : add git.io shortened url 2020-09-20 13:24:38 +05:30
Aditya Telange db1ec959aa
fix: for ebb9eb4043
* Browser errors were logged to the console
2020-09-17 14:57:20 +05:30
Aditya Telange ebb9eb4043
highlightjs : include only on pages with mainSections
* this makes hljs not load on index, taxonomies, archive
pages where code highlighting isn't used
* improving page site load time
2020-09-17 11:56:28 +05:30
Aditya Telange f669a90052
go-to-top: add title
* accessibility
2020-09-15 23:11:06 +05:30
Aditya Telange 70525e39d1
accessibility : add aria-label to go-to-top 2020-09-06 22:07:01 +05:30
Aditya Telange e35915a561
support Multilingual navigation
add reading time as i18n
2020-08-25 14:04:59 +05:30
Aditya Telange e17d61b46c
menu : save menu scroll position in localstorage
(ux improve)
2020-08-21 21:03:05 +05:30
Aditya Telange 1329075c61 add scroll to top button 2020-07-27 12:04:36 +05:30
Joseph Silber 163fa2d3f1 Add Smooth Scrolling
Thanks to Joseph Silber https://stackoverflow.com/a/7717572
2020-07-24 23:55:44 +05:30
Aditya Telange 28aa04ddb6 baseof: separate into header, footer 2020-07-21 15:36:30 +05:30