Skip to content

Commit 7340861

Browse files
authored
backport copy-to-clipboard ui root fallback and fix ui root config (#30)
1 parent 8bb275f commit 7340861

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/js/06-copy-to-clipboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
var TRAILING_SPACE_RX = / +$/gm
77

88
var config = (document.getElementById('site-script') || { dataset: {} }).dataset
9-
var uiRootPath = config.uiRootPath == null ? '.' : config.uiRootPath
10-
var svgAs = config.svgAs
119
var supportsCopy = window.navigator.clipboard
10+
var svgAs = config.svgAs
11+
var uiRootPath = (config.uiRootPath == null ? window.uiRootPath : config.uiRootPath) || '.'
1212

1313
;[].slice.call(document.querySelectorAll('.doc pre.highlight, .doc .literalblock pre')).forEach(function (pre) {
1414
var code, language, lang, copy, toast, toolbox

src/js/header/01-root.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
'use strict'
2-
3-
// eslint-disable-next-line no-unused-vars
4-
var uiRootPath = '_'
5-
62
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
73
document.documentElement.setAttribute('data-theme', 'dark')
84
}

src/partials/head-scripts.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<script async src="https://www.googletagmanager.com/gtag/js?id={{this}}"></script>
33
<script>function gtag(){dataLayer.push(arguments)};window.dataLayer=window.dataLayer||[];gtag('js',new Date());gtag('config','{{this}}')</script>
44
{{/with}}
5-
<script id="header-script" src="{{{uiRootPath}}}/js/header.js" data-ui-root-path="_"></script>
5+
<script id="header-script" src="{{{uiRootPath}}}/js/header.js" data-ui-root-path="{{{uiRootPath}}}"></script>

0 commit comments

Comments
 (0)