perf: modify checkbox icon with Liquid
Also optimize list padding start
This commit is contained in:
parent
e48d66e525
commit
1fd665bf49
6 changed files with 26 additions and 28 deletions
|
@ -31,11 +31,15 @@
|
|||
%}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add attribute 'hide-bullet' to the checkbox list -->
|
||||
|
||||
{% if _content contains '<li class="task-list-item"><' %}
|
||||
<!-- Change the icon of checkbox -->
|
||||
{% if _content contains '<input type="checkbox"' %}
|
||||
{% assign _content = _content
|
||||
| replace: '"task-list-item"><', '"task-list-item" hide-bullet><'
|
||||
| replace:
|
||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" checked="checked" />',
|
||||
'<i class="fas fa-check-circle fa-fw checked"></i>'
|
||||
| replace:
|
||||
'<input type="checkbox" class="task-list-item-checkbox" disabled="disabled" />',
|
||||
'<i class="far fa-circle fa-fw"></i>'
|
||||
%}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* Create a more beautiful checkbox
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
/* hide browser default checkbox */
|
||||
$("input[type=checkbox]").addClass("unloaded");
|
||||
/* create checked checkbox */
|
||||
$("input[type=checkbox][checked]").before("<i class=\"fas fa-check-circle checked\"></i>");
|
||||
/* create normal checkbox */
|
||||
$("input[type=checkbox]:not([checked])").before("<i class=\"far fa-circle\"></i>");
|
||||
});
|
|
@ -468,31 +468,39 @@ img[data-src] {
|
|||
|
||||
li {
|
||||
margin: 0.25rem 0;
|
||||
padding-left: 0.4rem;
|
||||
padding-left: 0.25rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
-webkit-padding-start: 1.25rem;
|
||||
padding-inline-start: 1.25rem;
|
||||
-webkit-padding-start: 1rem;
|
||||
padding-inline-start: 1rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
/* attribute 'hide-bullet' was added by liquid */
|
||||
.task-list-item[hide-bullet] {
|
||||
ul.task-list {
|
||||
-webkit-padding-start: 1.25rem;
|
||||
padding-inline-start: 1.25rem;
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
|
||||
> i { /* checkbox icon */
|
||||
margin: 0 0.5rem 0.2rem -1.4rem;
|
||||
vertical-align: middle;
|
||||
width: 2rem;
|
||||
margin-left: -1.25rem;
|
||||
color: var(--checkbox-color);
|
||||
|
||||
&.checked {
|
||||
color: var(--checkbox-checked-color);
|
||||
}
|
||||
}
|
||||
|
||||
ul {
|
||||
-webkit-padding-start: 1.75rem;
|
||||
padding-inline-start: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
|
|
2
assets/js/dist/page.min.js
vendored
2
assets/js/dist/page.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/js/dist/post.min.js
vendored
2
assets/js/dist/post.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -46,7 +46,6 @@ const postJs = () => {
|
|||
`${JS_SRC}/commons/*.js`,
|
||||
`${JS_SRC}/utils/img-extra.js`,
|
||||
`${JS_SRC}/utils/locale-datetime.js`,
|
||||
`${JS_SRC}/utils/checkbox.js`,
|
||||
`${JS_SRC}/utils/clipboard.js`,
|
||||
// 'smooth-scroll.js' must be called after ToC is ready
|
||||
`${JS_SRC}/utils/smooth-scroll.js`
|
||||
|
@ -65,7 +64,6 @@ const categoriesJs = () => {
|
|||
const pageJs = () => {
|
||||
return concatJs([
|
||||
`${JS_SRC}/commons/*.js`,
|
||||
`${JS_SRC}/utils/checkbox.js`,
|
||||
`${JS_SRC}/utils/img-extra.js`,
|
||||
`${JS_SRC}/utils/clipboard.js`,
|
||||
`${JS_SRC}/utils/smooth-scroll.js`
|
||||
|
|
Loading…
Reference in a new issue