From f7ecb7b6cba4fc14c8361fd8dbf1a7663ead5f85 Mon Sep 17 00:00:00 2001 From: lifehackerhansol Date: Sat, 30 Sep 2023 09:45:32 -0700 Subject: [PATCH] treewide: code readability improvements All downstream changes from the theme (i.e. here) will be denoted with: /* hacks-guide change start */ and /* hacks-guide change end */ One-line changes are marked with /* hacks-guide change */ next to it. Since our theme does not have linear history with upstream, this allows quicker identification of what exactly has differentiated downstream, as we do have a few out-of-tree patches for extra functionality. --- _includes/footer.html | 7 +++- _includes/head/custom.html | 6 +++- _includes/masthead.html | 12 ++++--- _includes/nav_list | 4 ++- _includes/scripts.html | 3 +- _includes/sidebar.html | 7 ++-- _layouts/default.html | 3 +- _layouts/single.html | 2 ++ _layouts/splash.html | 4 +++ _sass/minimal-mistakes/_base.scss | 2 ++ _sass/minimal-mistakes/_navigation.scss | 32 ++++++++++++------- _sass/minimal-mistakes/_notices.scss | 5 +-- _sass/minimal-mistakes/_page.scss | 2 +- _sass/minimal-mistakes/_tables.scss | 12 ++++--- _sass/minimal-mistakes/_utilities.scss | 5 +++ assets/js/_main.js | 4 +-- assets/js/plugins/jquery.greedy-navigation.js | 2 ++ 17 files changed, 80 insertions(+), 32 deletions(-) diff --git a/_includes/footer.html b/_includes/footer.html index e9518abc2..6e94049c4 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -11,16 +11,21 @@ {% endif %} {% endfor %} {% endif %} + + + + - + {% assign split_path = page.path | split: "/" %} {% assign locale = split_path[1] %} {% assign titles = site.data.navigation[locale].footer %} + diff --git a/_includes/head/custom.html b/_includes/head/custom.html index 5619851f1..71f0de9b8 100644 --- a/_includes/head/custom.html +++ b/_includes/head/custom.html @@ -1,6 +1,9 @@ + + + @@ -46,5 +49,6 @@ window.cookieconsent.initialise({ } })}); + - \ No newline at end of file + diff --git a/_includes/masthead.html b/_includes/masthead.html index 90bb8d790..acb518c82 100755 --- a/_includes/masthead.html +++ b/_includes/masthead.html @@ -7,13 +7,16 @@ {% unless logo_path == empty %} {% endunless %} - + + {% if site.search == true %} {% endif %} - + - \ No newline at end of file + + diff --git a/_includes/scripts.html b/_includes/scripts.html index 45f93bd50..a6639b1cd 100644 --- a/_includes/scripts.html +++ b/_includes/scripts.html @@ -6,7 +6,7 @@ {% endif %} - + {% if site.search == true or page.layout == "search" %} {%- assign search_provider = site.search_provider | default: "lunr" -%} {%- case search_provider -%} @@ -18,6 +18,7 @@ {% include search/algolia-search-scripts.html %} {%- endcase -%} {% endif %} + {% include analytics.html %} {% include /comments-providers/scripts.html %} diff --git a/_includes/sidebar.html b/_includes/sidebar.html index 62029be8d..7808af033 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -1,4 +1,6 @@ - + diff --git a/_layouts/default.html b/_layouts/default.html index 558198557..bd841b6bd 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -9,13 +9,13 @@ https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE --> - {% include head.html %} {% include head/custom.html %} + {% include skip-links.html %} {% include browser-upgrade.html %} @@ -37,6 +37,7 @@ {% include footer.html %} + {% include scripts.html %} diff --git a/_layouts/single.html b/_layouts/single.html index 0688c4dc8..94ac87aca 100644 --- a/_layouts/single.html +++ b/_layouts/single.html @@ -41,6 +41,7 @@ layout: default {% endif %} +
{% assign split_path = page.path | split: "/" %} @@ -56,6 +57,7 @@ layout: default {% endfor %}
+ {{ content }} {% if page.link %}
{{ site.data.ui-text[site.locale].ext_link_label | default: "Direct Link" }}
{% endif %} diff --git a/_layouts/splash.html b/_layouts/splash.html index 717f099d3..12fed2dc2 100644 --- a/_layouts/splash.html +++ b/_layouts/splash.html @@ -16,6 +16,8 @@ layout: default {% if page.last_modified_at %}{% endif %}
+ +
{% assign split_path = page.path | split: "/" %} @@ -31,6 +33,8 @@ layout: default {% endfor %}
+ + {{ content }}
diff --git a/_sass/minimal-mistakes/_base.scss b/_sass/minimal-mistakes/_base.scss index 83be663c3..9477299af 100644 --- a/_sass/minimal-mistakes/_base.scss +++ b/_sass/minimal-mistakes/_base.scss @@ -6,10 +6,12 @@ html { /* sticky footer fix */ position: relative; min-height: 100%; +/* hacks-guide change start: add Nord skin */ ::selection { color: $text-color; background: $text-highlight-color; } +/* hacks-guide change end */ } body { diff --git a/_sass/minimal-mistakes/_navigation.scss b/_sass/minimal-mistakes/_navigation.scss index 30f379bfb..5a752b488 100644 --- a/_sass/minimal-mistakes/_navigation.scss +++ b/_sass/minimal-mistakes/_navigation.scss @@ -191,14 +191,18 @@ color: $masthead-link-color-hover; } - // &.site-logo { - // margin-left: 0; - // margin-right: 0.5rem; - // } +/* hacks-guide change start: disable site logo, site title */ + /* + &.site-logo { + margin-left: 0; + margin-right: 0.5rem; + } - // &.site-title { - // margin-left: 0; - // } + &.site-title { + margin-left: 0; + } + */ +/* hacks-guide change end */ } img{ @@ -216,6 +220,7 @@ cursor: pointer; } +/* hacks-guide change start: add language selector */ &__toggle_lang { -ms-flex-item-align: center; align-self: center; @@ -225,14 +230,17 @@ background-color: transparent; cursor: pointer; } +/* hacks-guide change end */ .visible-links { display: -webkit-box; display: -ms-flexbox; display: flex; +/* hacks-guide change start: s/end/start */ -webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; +/* hacks-guide change end */ -webkit-box-flex: 1; -ms-flex: 1; flex: 1; @@ -333,9 +341,11 @@ } } +/* hacks-guide change start: adjust links-menu position */ .links-menu{ right: 2rem; } +/* hacks-guide change end */ } @@ -458,10 +468,9 @@ a { color: inherit; - // line-height: 1.6; } - // progress list, guide-specific +/* hacks-guide change start: Add progress table */ ol { padding-left: 0.9rem; } @@ -474,15 +483,16 @@ color: $gray; text-decoration: line-through; } - // end guide-specific +/* hacks-guide change end */ +/* hacks-guide change start: disable padding on active */ .active { // margin-left: -0.5em; // padding-left: 0.5em; // padding-right: 0.5em; font-weight: bold; } - +/* hacks-guide change end */ @include breakpoint(max-width $large - 1px) { position: relative; diff --git a/_sass/minimal-mistakes/_notices.scss b/_sass/minimal-mistakes/_notices.scss index 88d2c178a..1489fb6d9 100644 --- a/_sass/minimal-mistakes/_notices.scss +++ b/_sass/minimal-mistakes/_notices.scss @@ -17,7 +17,7 @@ font-family: $global-font-family; font-size: $type-size-6 !important; text-indent: initial; /* override*/ - font-weight: bold; // guide specific + font-weight: bold; /* hacks-guide change: override font-weight on notices for readability */ background-color: mix($background-color, $notice-color, $notice-background-mix); border-radius: $border-radius; box-shadow: 0 1px 1px rgba($notice-color, 0.25); @@ -47,12 +47,13 @@ } a { - // guide specific linking +/* hacks-guide change start: adjust colours for links in notices for readability */ color: mix(#fff, $notice-color, 30%); &:hover { color: mix(#fff, $notice-color, 70%); } +/* hacks-guide change end */ } code { diff --git a/_sass/minimal-mistakes/_page.scss b/_sass/minimal-mistakes/_page.scss index 6f0c7a8a3..209b85052 100644 --- a/_sass/minimal-mistakes/_page.scss +++ b/_sass/minimal-mistakes/_page.scss @@ -98,7 +98,7 @@ body { -moz-transition: opacity 0.2s ease-in-out 0.1s; -o-transition: opacity 0.2s ease-in-out 0.1s; transition: opacity 0.2s ease-in-out 0.1s; - user-select: none; + user-select: none; /* hacks-guide change: do not change link colour as it hurts readability */ } &:hover .header-link { diff --git a/_sass/minimal-mistakes/_tables.scss b/_sass/minimal-mistakes/_tables.scss index 68f29e812..d5132a71c 100644 --- a/_sass/minimal-mistakes/_tables.scss +++ b/_sass/minimal-mistakes/_tables.scss @@ -3,13 +3,13 @@ ========================================================================== */ table { - display: table; + display: table; /* hacks-guide change */ margin-bottom: 1em; width: 100%; font-family: $global-font-family; font-size: $type-size-6; border-collapse: collapse; - border: 1px solid $light-gray; // guide-specific + border: 1px solid $light-gray; /* hacks-guide change */ overflow-x: auto; & + table { @@ -19,24 +19,26 @@ table { thead { background-color: $border-color; +/* hacks-guide change start */ // border-bottom: 2px solid mix(#000, $border-color, 25%); - // guide-specific border-bottom: 1px solid $light-gray; +/* hacks-guide change end */ } th { padding: 0.5em; font-weight: bold; text-align: left; - border-right: 1px solid $light-gray; // guide-specific + border-right: 1px solid $light-gray; /* hacks-guide change */ } td { padding: 0.5em; +/* hacks-guide change start */ // border-bottom: 1px solid mix(#000, $border-color, 25%); - // guide-specific border-bottom: 1px solid $light-gray; border-right: 1px solid $light-gray; +/* hacks-guide change end */ } tr, diff --git a/_sass/minimal-mistakes/_utilities.scss b/_sass/minimal-mistakes/_utilities.scss index b1c4ef9ff..a0a882114 100644 --- a/_sass/minimal-mistakes/_utilities.scss +++ b/_sass/minimal-mistakes/_utilities.scss @@ -384,6 +384,8 @@ body:hover .visually-hidden button { transform: rotate3d(0, 0, 1, -45deg); } } + +/* hacks-guide change start: disable toggle effects on navigation as it breaks the site in some cases */ /* .greedy-nav__toggle { &:before { @@ -426,6 +428,7 @@ body:hover .visually-hidden button { } } */ +/* hacks-guide change end */ /* Sticky, fixed to top content @@ -593,6 +596,7 @@ a.reversefootnote { } } +/* hacks-guide change start: Add language selector */ /* Langicons ========================================================================== */ @@ -655,3 +659,4 @@ a.reversefootnote { transform: rotate3d(0,0,1,-45deg); } } +/* hacks-guide change end */ diff --git a/assets/js/_main.js b/assets/js/_main.js index 1ae206101..5702d29d7 100644 --- a/assets/js/_main.js +++ b/assets/js/_main.js @@ -144,8 +144,7 @@ $(document).ready(function() { } }); - // Adding navigation bar and language selector - +/* hacks-guide change start: add configs for navigation bar and language selector */ if((window.location.href.indexOf("/he_IL/") > -1) || (window.location.href.indexOf("/ar_SA/") > -1)) { $("body").css("direction", "rtl"); @@ -177,4 +176,5 @@ $(document).ready(function() { $('nav.greedy-nav').prepend(''); $('nav.greedy-nav').prepend(''); } +/* hacks-guide change end */ }); diff --git a/assets/js/plugins/jquery.greedy-navigation.js b/assets/js/plugins/jquery.greedy-navigation.js index 22afa4dd0..382343fa3 100644 --- a/assets/js/plugins/jquery.greedy-navigation.js +++ b/assets/js/plugins/jquery.greedy-navigation.js @@ -4,6 +4,8 @@ Licensed under the MIT license - http://opensource.org/licenses/MIT Copyright (c) 2015 Luke Jackson */ +/* hacks-guide change: add language selector, remove logo */ + $(function() { var $btn = $("nav.greedy-nav .greedy-nav__toggle");