mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
openapi: fix theme switch #804
This commit is contained in:
parent
82c1b09c95
commit
131b3a9a01
4 changed files with 6 additions and 5 deletions
|
@ -73,7 +73,7 @@
|
|||
<span> </span>
|
||||
<div class="control-style">
|
||||
<label class="a11y-only" for="R-select-language">{{ T "Language" }}</label>
|
||||
<select id="R-select-language" onchange="location = baseUri + this.value;">
|
||||
<select id="R-select-language" onchange="location = window.relearn.baseUri + this.value;">
|
||||
{{- $page := .Page }}
|
||||
{{- $pageLang := .Page.Language.Lang }}
|
||||
{{- range .Page.AllTranslations }}
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
window.index_js_url={{ "index.search.js" | relLangURL }};
|
||||
{{- end }}
|
||||
var root_url="/";
|
||||
var baseUri=root_url.replace(/\/$/, '');
|
||||
window.relearn = window.relearn || {};
|
||||
window.relearn.baseUri=root_url.replace(/\/$/, '');
|
||||
window.relearn.baseUriFull='{{ trim .Site.BaseURL "/" | safeJS }}/';
|
||||
{{ "// variant stuff" | safeJS }}
|
||||
window.relearn.themeVariantModifier='{{ $themevariantmodifier }}';
|
||||
|
|
|
@ -217,7 +217,7 @@ function searchDetail( value ) {
|
|||
divsuggestion.className = 'autocomplete-suggestion';
|
||||
divsuggestion.setAttribute('data-term', value);
|
||||
divsuggestion.setAttribute('data-title', page.title);
|
||||
divsuggestion.setAttribute('href', baseUri + page.uri);
|
||||
divsuggestion.setAttribute('href', window.relearn.baseUri + page.uri);
|
||||
divsuggestion.setAttribute('data-context', context);
|
||||
var divtitle = document.createElement('div');
|
||||
divtitle.className = 'title';
|
||||
|
@ -289,7 +289,7 @@ function startSearch(){
|
|||
divsuggestion.className = 'autocomplete-suggestion';
|
||||
divsuggestion.setAttribute('data-term', term);
|
||||
divsuggestion.setAttribute('data-title', page.title);
|
||||
divsuggestion.setAttribute('data-uri', baseUri + page.uri);
|
||||
divsuggestion.setAttribute('data-uri', window.relearn.baseUri + page.uri);
|
||||
divsuggestion.setAttribute('data-context', context);
|
||||
var divtitle = document.createElement('div');
|
||||
divtitle.className = 'title';
|
||||
|
|
|
@ -390,6 +390,7 @@ function initOpenapi( update, attrs ){
|
|||
|
||||
}
|
||||
function renderOpenAPI(oc) {
|
||||
var baseUri = window.relearn.baseUri;
|
||||
var mod = window.relearn.themeVariantModifier;
|
||||
var buster = window.themeUseOpenapi.assetsBuster ? '?' + window.themeUseOpenapi.assetsBuster : '';
|
||||
var print = isPrint || attrs.isPrintPreview ? "PRINT-" : "";
|
||||
|
@ -1523,7 +1524,7 @@ if( window.themeUseMermaid ){
|
|||
|
||||
function useOpenapi( config ){
|
||||
if( config.css && config.css.startsWith( '/' ) ){
|
||||
config.css = baseUri + config.css;
|
||||
config.css = window.relearn.baseUri + config.css;
|
||||
}
|
||||
}
|
||||
if( window.themeUseOpenapi ){
|
||||
|
|
Loading…
Reference in a new issue