Commit Graph
42 Commits
Author SHA1 Message Date
ascholerChemeketa ed29a71afa fix: isDarkTheme from int to boolean in academic.js
Fixes data type inconsistency between `isDarkTheme` (int) in `academic.js` and 
 `isSiteThemeDark` (bool) in `site_js.html` that might prevent proper initialization of Mermaid diagrams.

See #1745
Fixes #1742
2020-06-15 20:41:21 +01:00
George Cushen eceb8b6312 feat: clarify day/night modes in appearance chooser
Rather than a 3-way icon-based toggle through light, dark, and automatic modes, present the user with a dropdown list of modes displayed in full textual representation.

Adds language pack options for translating `theme_light`, `theme_dark`, and `theme_auto`.

See #1596
2020-03-15 21:40:00 +00:00
George Cushen 5e62b09331 fix: day/night mode and enable reverting to the default auto day/night mode
Fixes:
- There is no easy way for a user to reset their day/night preference back to automatic (currently, they must use their web browser to clear the local storage data for the site)
- When changing the theme variation is disabled by admin (by setting `day_night` to `false` in `params.toml`), the operating system's day/night preference is still applied
- If the admin removes the option to change the theme variation, the preference for a user who already visited the site is still read from the localstorage and applied. For example, this could result in the user seeing a theme variation with poor contrast that was not intended to be shown as the site's theme was optimized for the other variation.

Fix #1385
Fix #1526
Fix #1534
2020-02-09 00:10:45 +00:00
George Cushen 55228b7ade fix: lazy loading causing inaccurate anchor scrolling + link highlighting
As of a recent update, gallery and figure images are lazy loaded. However, lazy loading without initial sizes defined can lead to inaccurate anchor scrolling and active link highlighting as the anchor offset changes after an uncached image occurring before the anchor is lazily loaded.

See https://github.com/gcushen/hugo-academic/issues/1199#issuecomment-577293818
Fix #1199
2020-01-23 23:44:08 +00:00
George Cushen 4a7f4dc088 fix: improve active link highlighting for edge cases
Attempt improvement by moving the scroll to anchor logic to the end of window load and adding 1 to elementOffset in case of navbar border.

Appears to solve any issues that could arise (such as when clicking Courses and then Publications, but Projects being highlighted instead) in local testing.

See https://github.com/gcushen/hugo-academic/issues/1199#issuecomment-577293818
See #1199
2020-01-23 22:36:42 +00:00
George Cushen d9e553a96b style: upgrade Bootstrap from 4.3.1 to 4.4.1 2020-01-23 22:15:37 +00:00
George Cushen 350beb358b fix: only allow auto day/night when day_night enabled
Fix #1526
2020-01-20 11:19:55 +00:00
George Cushen 42defb4684 fix: highlight active ToC item for Goldmark (Hugo v0.60)
Equivalent to previous workaround for Hugo's Blackfriday ToC in ea2a98a2c3

See ea2a98a2c3
2019-12-09 18:29:06 +00:00
George Cushen ea2a98a2c3 feat: add support for Hugo v0.60 - remove Blackfriday TOC workaround 2019-12-07 20:37:26 +00:00
George Cushen 037d75f6da fix: race condition between HighlightJS and Mermaid
In some cases, the race condition could prevent Mermaid diagrams from being rendered.

Fix #1434
See #1298
2019-11-21 21:41:58 +00:00
George Cushen 766c559e50 feat: improve mobile-first menu
- On mobile, position toggle on left and logo in centre (adopt standard)
- Show Search, Day/Night, and Language icons in mobile menu bar
- Add option to align menu items to left, centre, or right
- Add option to remove logo image/text from menu
- Complete navbar SCSS redesign, making use of Bootstrap vars
- Add automatic menu dropdowns on mouseover (for desktop)

Also,
- Apply live day/night update on system prefs change (no need for refresh)
- Add Mermaid security level on init - a req. for latest Mermaid version

BREAKING CHANGES:
menu_align_right option removed from params.toml
main_menu option added to params.toml

Close #1418
2019-11-16 15:42:31 +00:00
George Cushen ede8cef959 feat: update vendor assets & refactor custom CSS path
- Upgrade MathJax from v2 to v3
- Updated Highlight, Leaflet, Fancybox, Mermaid, FontAwesome
- Fixed multilingual icon paths in Web App Manifest
- View Demo script now binds to all network I/F to enable testing on
  other physical devices like smart phones

BREAKING CHANGES:
Removed `plugins_css` from `params.toml`.
Override `custom.scss` to add custom styling.

Close #1400
2019-10-19 20:33:56 +01:00
George Cushen 44f9170f07 fix: in-page anchor scrolling on mobile 2019-10-05 18:39:33 +01:00
George Cushen 6d0c021011 feat: improve search for diacritics + Chinese/Korean/Japanese languages
Close #1361
2019-09-28 15:25:26 +01:00
George Cushen 829995656e fix: console error when clicking back_to_top button
Note: bug did not affect functionality, still scrolled to top.

Fix #1352
2019-09-22 14:34:24 +01:00
George Cushen eacadc7935 feat(search): show talk and publication abstracts in results
Instead of their page bodies which are often empty.

Close #1253
2019-09-11 15:39:04 +01:00
George Cushen c8832e3881 feat: revert Blackfriday math workaround
Also see 255b5e8462
2019-07-20 19:44:30 +01:00
George Cushen 255b5e8462 feat: revert Blackfriday math workaround + improve Mmark support
Guidance for using math going forward:
- add `markup: mmark` to front matter
- no longer need to escape inline or block math in body

Also, fix Mmark task lists by removing bullet points.
2019-07-20 19:43:13 +01:00
George Cushen 0cffd47aca fix: improve handling of math and diagrams
Block math in body can now be wrapped in "<div>$$...$$</div>" tags
Inline math in body can now be wrapping in "`$...$`" backticks
Diagrams can now be created without shortcodes: "```mermaid ... ```"
2019-07-18 00:45:14 +01:00
George Cushen a8c4f887e5 fix: navbar active link highlighting and scrolling
Fixes some edge cases caused due to responsive navbar height and dynamic
Portfolio widget height, as well as case where offset was non-integer,
requiring float to be rounded up.

Fix #1199
2019-07-11 20:54:52 +01:00
Alessandro Bahgat d9e3e9fcfa fix: 8ddf0ca406 (#1193)
8ddf0ca406 introduced a spurious token
that breaks scrolling back to top
2019-07-09 19:35:07 +01:00
Mingyu Derek MA 8ddf0ca406 feat: automatically turn on night mode if visitor prefers dark themes (#1041) 2019-07-07 21:10:11 +01:00
George Cushen 263926cc45 fix: opening lightbox or search modal causes navbar to move
Edge case caused by page having scrollbar and initial state of lightbox
or search modal not having a scrollbar.

Fix #1177

See https://github.com/fancyapps/fancybox/issues/360
See http://fancyapps.com/fancybox/3/docs/#faq
2019-07-04 21:30:34 +01:00
George Cushen da24df810d fix(js): Chinese TOC links not scrolling to ID on click
Fix #1178
2019-07-02 21:29:33 +01:00
momchil-anachkov e4f0e80dfb fix: browser back button after searching does not behave properly
Switch URL updating strategy from pushState to replaceState in order to avoid pushing all search queries to the browser history

Fix #1166
2019-07-01 11:27:05 +01:00
momchil-anachkov 9a18bf2211 fix(search): after dialog closes, results reappear on refresh (#1161) 2019-06-26 16:46:47 +01:00
George Cushen 63953ab3d4 style: improve consistency if Hugo --minify used 2019-06-02 23:19:57 +01:00
George Cushen 07d94380f2 feat(docs): highlight active page section in right sidebar TOC
Fix #1099
2019-06-02 18:54:18 +01:00
George Cushen 27ff391ab1 feat: generate diagrams and flowcharts from text using Mermaid shortcode
To use, add `diagram: true` to a page's YAML front matter and create a
diagram from text in the body of the Markdown file using Mermaid syntax:
https://mermaidjs.github.io

Close #1111
2019-05-27 18:05:17 +01:00
George Cushen abbd54045c feat(nav): extend navbar active link highlighting to non-home pages
Also,
- Fix ScrollSpy link scrolling/highlighting not working on widget pages
  except the home page
- Add `docs_section_pager = true` to `params.toml`.
- Add more demo tutorial pages and content to showcase the improved
navbar highlighting for child pages and the table of contents feature.
- Bump version in prep. for release

Close #991
2019-05-05 22:23:32 +01:00
George Cushen 92200d6327 refactor: convert CSS to SCSS
Remove Bootstrap from Header and assets.toml
  Remove Bootstrap JS CDN version in footer and assets.toml
  Add latest Bootstrap v4 SASS files locally
  Include Bootstrap JS locally
  Convert Academic's CSS to SASS (mainly SASS variables + Go templating)
  Convert Academic's theming system to integrate with SASS
  Parse SASS in header using Hugo and convert to CSS
  Minify and md5 fingerprint bundled CSS
  Fix Slider widget (reuses .wg-hero but animation and `clear` removed)
  Add Bootstrap files to repo so that Node is not required

See #680
2019-04-24 23:56:41 +01:00
Gert de Pagter 4630f4b784 fix(js): day/night mode when highlight=false or highlight_style is set
Fix JQuery error when `day_night=true` and (`highlight=false` or `highlight_style` is set)

Fix #1040
Fix #952
2019-04-19 13:55:58 +01:00
George Cushen 92c7617ace fix(widget): revert row-based project card view back to masonry 2019-02-18 20:28:49 +00:00
George Cushen 188505b375 feat(pub): add search box to enable filtering by any attribute
Close #922
See #390
2019-02-13 01:21:18 +00:00
George Cushen 09d4e07d4f feat(search): enable searching by author name or category
Also, attempt to increase relevancy of search results in general.

Close #921
2019-02-08 17:48:17 +00:00
George Cushen 34cf1f0957 fix: when toggling day/night mode, also toggle code highlighting theme
Fix case where code highlighting can be difficult to read after night
mode is toggled by user as the highlight theme remained unchanged.
2019-02-05 18:07:55 +00:00
George Cushen 512e2ffde4 fix(search): disable shortcuts when user is typing
Fix #875
2019-01-12 19:38:48 +00:00
George Cushen d2330cb261 feat(theme): enable users to switch between day and night modes
Close #807
2018-12-02 00:17:35 +00:00
George Cushen 07c9f4f387 feat(search): Add search shortcuts (/ and ESC)
* Press / to toggle search dialog
* Press ESC to close search dialog

See #784
2018-11-17 23:39:06 +00:00
George Cushen e95405f79a feat(search): add search icon to navbar to open new search dialog
* Search icon added to navbar if search enabled in config
* New search dialog added which overlays current page when searching
* The docs search box now opens the new search dialog instead of
  displaying results within the docs page itself

Close #784

BREAKING CHANGE:

Search widget is deprecated and `content/home/search.md` should be
removed
2018-11-17 22:42:27 +00:00
George Cushen 3ea332ca67 refactor(js): shorten MathJax filename and minify + fingerprint assets
Remove fingerprinting from MathJax config JS to shorten its generated
filename. Reduces chance of JS filenames becoming too long for user's OS
to handle due to long Sha512 asset fingerprinting.

Minifies and fingerprints Academic's own JS for faster loading and to
prevent old versions getting cached by web browser.

Refactors Algolia search JS into its own file.

Close #768
See #794
2018-11-11 16:06:24 +00:00
Thom Wiggers 8d8cddfdb2 Load MathJax config without eval() (#735)
This allows stricter content security policies for 
`Content-Security-Policy` header.
2018-10-21 20:32:44 +01:00