Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ body {
font-family: var(--body-font-family);
line-height: var(--body-line-height);
margin: 0;
tab-size: 4;
word-wrap: anywhere; /* aka overflow-wrap; used when hyphens are disabled or aren't sufficient */
}

Expand Down
8 changes: 4 additions & 4 deletions src/css/vendor/asciidoctor-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
content: none;
}

.doc .tabs:not(.is-loading) .tablist > ul li {
transition: background-color 200ms ease-in-out, color 100ms linear;
}

.doc .tabpanel {
background-color: initial;
border: 0;
padding: 0;
}

html.theme-set .doc .tabs .tablist > ul li {
transition: background-color 200ms ease-in-out, color 100ms linear;
}
35 changes: 35 additions & 0 deletions src/js/07-switch-theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
;(function () {
'use strict'

activateSwitch(document.getElementById('switch-theme-checkbox'))

function activateSwitch (control) {
if (!control) return
control.checked = document.documentElement.classList.contains('dark-theme')
control.addEventListener('change', onThemeChange.bind(control))
}

function onThemeChange () {
document.documentElement.classList.toggle('dark-theme', this.checked)
saveTheme(this.checked ? 'dark' : 'light')
}

function saveTheme (theme) {
window.localStorage && window.localStorage.setItem('theme', theme)
}
})()
61 changes: 0 additions & 61 deletions src/js/vendor/switchtheme.js

This file was deleted.

1 change: 0 additions & 1 deletion src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script id="site-script" src="{{{uiRootPath}}}/js/site.js" data-ui-root-path="{{{uiRootPath}}}"></script>
<script async src="{{{uiRootPath}}}/js/vendor/highlight.js"></script>
<script async src="{{{uiRootPath}}}/js/vendor/{{#if (asciidocExtensionRegistered '@asciidoctor/tabs')}}asciidoctor{{else}}spring{{/if}}-tabs.js"></script>
<script src="{{{uiRootPath}}}/js/vendor/switchtheme.js"></script>
{{#if env.ALGOLIA_API_KEY}}
<script async id="search-script" src="{{{uiRootPath}}}/js/vendor/docsearch.js"{{#if env.ALGOLIA_APP_ID}} data-app-id="{{env.ALGOLIA_APP_ID}}"{{/if}} data-api-key="{{env.ALGOLIA_API_KEY}}" data-index-name="{{env.ALGOLIA_INDEX_NAME}}" data-input-selector="#search-input"></script>
{{/if}}
5 changes: 5 additions & 0 deletions src/partials/head-styles.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<script>
!function (theme) {
if (theme === 'dark') document.documentElement.classList.add('dark-theme')
}(localStorage && localStorage.getItem('theme') || (matchMedia('(prefers-color-scheme: dark)') && 'dark'))
</script>
<link rel="stylesheet" href="{{{uiRootPath}}}/css/site.css">
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/{{#if (asciidocExtensionRegistered '@asciidoctor/tabs')}}asciidoctor{{else}}spring{{/if}}-tabs.css">
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/docsearch.css">