Skip to content

Commit

Permalink
fix: Legacy bugs (styles, site plugin error, and dev server error) (#…
Browse files Browse the repository at this point in the history
…1743)

* Add try/catch w/ error message to plugin calls

* Update lifecycle.js

* Update lifecycle.js

* Fix docsify-plugin-carbon error

* Fix ESLint errors

* Simplify conditional JS loading

* Fix styles in legacy browser w/o CSS var support

* Fix gitignore paths

* Fix BrowserSync IE error

* Fix search field presentation in IE11

- Removed fixed height and allow element to size naturally via font-size and padding
- Remove default "x" rendered on IE input fields

* Revert "Update lifecycle.js"

This reverts commit 2a58be6.

* Revert "Update lifecycle.js"

This reverts commit 67c5410.

* Revert "Add try/catch w/ error message to plugin calls"

This reverts commit 631e924.

* Fix docsify-plugin-carbon error & ESLint errors

Co-authored-by: 沈唁 <[email protected]>
  • Loading branch information
jhildenbiddle and sy-records authored Feb 5, 2022
1 parent 8aee074 commit fa6df6d
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 35 deletions.
42 changes: 19 additions & 23 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

<body>
<div id="app">Loading ...</div>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1"></script>
<script>
// Set html "lang" attribute based on URL
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
Expand Down Expand Up @@ -118,21 +118,21 @@
'/zh-cn/': '搜索',
'/': 'Search',
},
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn']
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'],
},
vueComponents: {
'button-counter': {
template:
'<button @click="count += 1">You clicked me {{ count }} times</button>',
data: function() {
data: function () {
return {
count: 0,
};
},
},
},
vueGlobalOptions: {
data: function() {
data: function () {
return {
count: 0,
message: 'Hello, World!',
Expand All @@ -145,7 +145,7 @@
};
},
computed: {
timeOfDay: function() {
timeOfDay: function () {
const date = new Date();
const hours = date.getHours();

Expand All @@ -159,14 +159,14 @@
},
},
methods: {
hello: function() {
hello: function () {
alert(this.message);
},
},
},
vueMounts: {
'#counter': {
data: function() {
data: function () {
return {
count: 0,
};
Expand All @@ -175,8 +175,8 @@
},
plugins: [
DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'),
function(hook, vm) {
hook.beforeEach(function(html) {
function (hook, vm) {
hook.beforeEach(function (html) {
if (/githubusercontent\.com/.test(vm.route.file)) {
url = vm.route.file
.replace('raw.githubusercontent.com', 'github.com')
Expand All @@ -198,7 +198,7 @@
'<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
);
}),
hook.afterEach(function(html) {
hook.afterEach(function (html) {
if (vm.route.path === '/') {
return html;
}
Expand All @@ -218,19 +218,15 @@
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-nginx.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
<script>
(function() {
function loadJS(src, attrs) {
document.write(
'<script src="' + src + '" ' + (attrs || '') + '><\/script>'
);
}

// Public site only
if (/docsify/.test(location.host)) {
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js');
loadJS('//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js');
}
})();
// Public site only
if (/docsify/.test(location.host)) {
document.write(
'<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/ga.min.js"><\/script>'
);
document.write(
'<script src="//cdn.jsdelivr.net/npm/docsify@4/lib/plugins/matomo.min.js"><\/script>'
);
}
</script>
<script src="//cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
<!-- <script src="//cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script> -->
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<body>
<div id="app"></div>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1/index.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1"></script>
<script>
// Set html "lang" attribute based on URL
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
Expand Down Expand Up @@ -82,12 +82,12 @@
'/zh-cn/': '搜索',
'/': 'Search',
},
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn']
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn'],
},
plugins: [
DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'),
function(hook, vm) {
hook.beforeEach(function(html) {
function (hook, vm) {
hook.beforeEach(function (html) {
if (/githubusercontent\.com/.test(vm.route.file)) {
url = vm.route.file
.replace('raw.githubusercontent.com', 'github.com')
Expand Down
12 changes: 9 additions & 3 deletions src/plugins/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ function style() {
outline: none;
border: none;
width: 100%;
padding: 0 7px;
line-height: 36px;
font-size: 14px;
padding: 0.6em 7px;
font-size: inherit;
border: 1px solid transparent;
}
Expand All @@ -51,6 +50,13 @@ function style() {
-moz-appearance: none;
appearance: none;
}
.search input::-ms-clear {
display: none;
height: 0;
width: 0;
}
.search .clear-button {
cursor: pointer;
width: 36px;
Expand Down
5 changes: 5 additions & 0 deletions src/themes/basic/_coverpage.styl
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ section.cover
padding 0

.cover-main > p:last-child a
border-color $color-primary
border-color var(--theme-color, $color-primary)
border-radius 2rem
border-style solid
border-width 1px
box-sizing border-box
color $color-primary
color var(--theme-color, $color-primary)
display inline-block
font-size 1.05rem
Expand All @@ -79,6 +81,7 @@ section.cover
transition all 0.15s ease

&:last-child
background-color $color-primary
background-color var(--theme-color, $color-primary)
color #fff

Expand All @@ -90,8 +93,10 @@ section.cover
color inherit

blockquote > p > a
border-bottom 2px solid $color-primary
border-bottom 2px solid var(--theme-color, $color-primary)
transition color 0.3s

&:hover
color $color-primary
color var(--theme-color, $color-primary)
8 changes: 8 additions & 0 deletions src/themes/basic/_layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ div#app
vertical-align middle

.progress
background-color $color-primary
background-color var(--theme-color, $color-primary)
height 2px
left 0px
Expand All @@ -37,9 +38,11 @@ div#app
z-index 999999

.search a:hover
color $color-primary
color var(--theme-color, $color-primary)

.search .search-keyword
color $color-primary
color var(--theme-color, $color-primary)
font-style normal
font-weight bold
Expand Down Expand Up @@ -108,10 +111,13 @@ li input[type='checkbox']
transition color 0.3s

&:hover
color $color-primary
color var(--theme-color, $color-primary)

&.active
border-bottom 2px solid $color-primary
border-bottom 2px solid var(--theme-color, $color-primary)
color $color-primary
color var(--theme-color, $color-primary)

/* navbar dropdown */
Expand Down Expand Up @@ -172,6 +178,7 @@ li input[type='checkbox']

svg
color $color-bg
fill $color-primary
fill var(--theme-color, $color-primary)
height 80px
width 80px
Expand Down Expand Up @@ -284,6 +291,7 @@ main.hidden
opacity 0.4

span
background-color $color-primary
background-color var(--theme-color, $color-primary)
display block
margin-bottom 4px
Expand Down
2 changes: 2 additions & 0 deletions src/themes/buble.styl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $sidebar-width = 16rem
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)

.markdown-section p, .markdown-section ul, .markdown-section ol
Expand Down Expand Up @@ -83,6 +84,7 @@ $sidebar-width = 16rem
margin 0

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down
5 changes: 5 additions & 0 deletions src/themes/dark.styl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ body
padding 0

ul li.active > a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -43,6 +44,7 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand Down Expand Up @@ -79,6 +81,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -138,6 +141,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -150,6 +154,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword
Expand Down
7 changes: 6 additions & 1 deletion src/themes/dolphin.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ body

ul li.active > a
border-right 2px solid
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -52,9 +53,10 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

&:hover
text-decoration underline

Expand Down Expand Up @@ -91,6 +93,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -150,6 +153,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -162,6 +166,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword, .token.function
Expand Down
5 changes: 5 additions & 0 deletions src/themes/vue.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ body

ul li.active > a
border-right 2px solid
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand All @@ -52,6 +53,7 @@ body
font-weight 600

.markdown-section a
color $color-primary
color var(--theme-color, $color-primary)
font-weight 600

Expand Down Expand Up @@ -88,6 +90,7 @@ body
padding-left 1.5rem

.markdown-section blockquote
border-left 4px solid $color-primary
border-left 4px solid var(--theme-color, $color-primary)
color #858585
margin 2em 0
Expand Down Expand Up @@ -204,6 +207,7 @@ body
color #2973b7

.token.string
color $color-primary
color var(--theme-color, $color-primary)

.token.selector
Expand All @@ -216,6 +220,7 @@ body
color #22a2c9

.token.attr-value, .token.control, .token.directive, .token.unit
color $color-primary
color var(--theme-color, $color-primary)

.token.keyword, .token.function
Expand Down
Loading

1 comment on commit fa6df6d

@vercel
Copy link

@vercel vercel bot commented on fa6df6d Feb 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.