i18n 1.1.2
xaoxuu 5 years ago
parent 20c8bff9b2
commit 74f1bdbd84
  1. 2
      _config.yml
  2. 254
      layout/_partial/scripts.ejs
  3. 73
      source/js/clipboard-use.js
  4. 4
      source/js/clipboard.min.js
  5. 74
      source/less/_article.less
  6. 3
      source/less/_layout.less
  7. 38
      source/less/_main.less
  8. 1
      source/less/_search.less

@ -8,7 +8,7 @@ info:
name: Material X
docs: https://xaoxuu.com/wiki/material-x/
# 主题的CDN地址。如需启用CDN,请在主目录的config中设置,详见文档。
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.3.22/
cdn: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.3.24/
############################### 主题样式 ###############################

@ -15,142 +15,144 @@
if(!ROOT.endsWith('/'))ROOT += '/';
</script>
<% } %>
<% if (theme.services) { %>
<% if (theme.services.scrollreveal == true) { %>
<script async src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js"></script>
<script type="text/javascript">
$(function() {
const $reveal = $('.reveal');
if ($reveal.length === 0) return;
const sr = ScrollReveal({ distance: 0 });
sr.reveal('.reveal');
});
</script>
<% } %>
<% if (theme.services.nodewaves == true) { %>
<script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>
<script type="text/javascript">
$(function() {
Waves.attach('.flat-btn', ['waves-button']);
Waves.attach('.float-btn', ['waves-button', 'waves-float']);
Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
Waves.attach('.flat-box', ['waves-block']);
Waves.attach('.float-box', ['waves-block', 'waves-float']);
Waves.attach('.waves-image');
Waves.init();
});
</script>
<% } %>
<% if (theme.services.busuanzi == true) { %>
<script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>
<% } %>
<% if (theme.services.fastclick == true) { %>
<!-- fastclick -->
<script src="https://cdn.jsdelivr.net/npm/fastclick@1.0.6/lib/fastclick.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body)
}, false)
</script>
<% } %>
<% if (theme.services.share == true && config.mob && config.mob.app_key) { %>
<% if (page.layout == 'post' && page.share != false) { %>
<script id="-mob-share" src="//f1.webshare.mob.com/code/mob-share.js?appkey=<%- config.mob.app_key %>"></script>
<% } %>
<% if (theme.services.scrollreveal == true) { %>
<script async src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.5/dist/scrollreveal.min.js"></script>
<script type="text/javascript">
$(function() {
const $reveal = $('.reveal');
if ($reveal.length === 0) return;
const sr = ScrollReveal({ distance: 0 });
sr.reveal('.reveal');
});
</script>
<% } %>
<% if (theme.services.nodewaves == true) { %>
<script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>
<script type="text/javascript">
$(function() {
Waves.attach('.flat-btn', ['waves-button']);
Waves.attach('.float-btn', ['waves-button', 'waves-float']);
Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
Waves.attach('.flat-box', ['waves-block']);
Waves.attach('.float-box', ['waves-block', 'waves-float']);
Waves.attach('.waves-image');
Waves.init();
});
</script>
<% } %>
<% if (theme.services.busuanzi == true) { %>
<script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>
<% } %>
<% if (theme.services.fastclick == true) { %>
<!-- fastclick -->
<script src="https://cdn.jsdelivr.net/npm/fastclick@1.0.6/lib/fastclick.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body)
}, false)
</script>
<% } %>
<% if (theme.services.share == true && config.mob && config.mob.app_key) { %>
<% if (page.layout == 'post' && page.share != false) { %>
<script id="-mob-share" src="//f1.webshare.mob.com/code/mob-share.js?appkey=<%- config.mob.app_key %>"></script>
<% } %>
<% } %>
<%
var enableDisqus = false;
var enableLivere = false;
var enableValine = false;
if (page && theme.services && theme.services.comments == true && page.comments != false) {
if (config.disqus_shortname) {
enableDisqus = true;
}
if (config.livere_uid) {
enableLivere = true;
}
if (config.valine && config.valine.app_id && config.valine.app_key) {
enableValine = true;
}
<%
var enableDisqus = false;
var enableLivere = false;
var enableValine = false;
if (page && theme.services && theme.services.comments == true && page.comments != false) {
if (config.disqus_shortname) {
enableDisqus = true;
}
%>
<% if (enableDisqus){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (enableLivere){ %>
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<% } %>
<% if (enableValine){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<% if (theme.services.volantis == true) { %>
<% if (theme.services && theme.services.cdn == true) { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1/js/volantis.min.js"></script>
<% } else { %>
<%- js('js/volantis.js') %>
<% } %>
if (config.livere_uid) {
enableLivere = true;
}
if (config.valine && config.valine.app_id && config.valine.app_key) {
enableValine = true;
}
}
%>
<% if (enableDisqus){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (enableLivere){ %>
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<% } %>
<% if (enableValine){ %>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<% if (theme.services.volantis == true) { %>
<% if (theme.services && theme.services.cdn == true) { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/volantis@1/js/volantis.min.js"></script>
<% } else { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-valine@1.3.4/js/valine.min.js"></script>
<%- js('js/volantis.js') %>
<% } %>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
<% if(page.valine && page.valine.path) { %>
path: "<%= page.valine.path %>",
<% } %>
appId: "<%= config.valine.app_id %>",
appKey: "<%= config.valine.app_key %>",
placeholder: "<%= (page.valine && page.valine.placeholder) ? page.valine.placeholder : config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>',
highlight:'<%= config.valine.highlight %>'
})
</script>
<% } else { %>
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-valine@1.3.4/js/valine.min.js"></script>
<% } %>
<% if (theme.services.cdn == true && config.theme_cdn) { %>
<% if (config.theme_cdn == true) { %>
<%- js([theme.info.cdn + 'js/app.js', theme.info.cdn + 'js/search.js']) %>
<% } else if (config.theme_cdn.length > 0) { %>
<%- js([config.theme_cdn + 'js/app.js', config.theme_cdn + 'js/search.js']) %>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
<% if(page.valine && page.valine.path) { %>
path: "<%= page.valine.path %>",
<% } %>
<% } else { %>
<%- js(['js/app.js', 'js/search.js']) %>
appId: "<%= config.valine.app_id %>",
appKey: "<%= config.valine.app_key %>",
placeholder: "<%= (page.valine && page.valine.placeholder) ? page.valine.placeholder : config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>',
highlight:'<%= config.valine.highlight %>'
})
</script>
<% } %>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<% if (theme.services.cdn == true && config.theme_cdn) { %>
<% if (config.theme_cdn == true) { %>
<%- js([theme.info.cdn + 'js/app.js', theme.info.cdn + 'js/search.js', theme.info.cdn + 'js/clipboard-use.js']) %>
<% } else if (config.theme_cdn.length > 0) { %>
<%- js([config.theme_cdn + 'js/app.js', config.theme_cdn + 'js/search.js', config.theme_cdn + 'js/clipboard-use.js']) %>
<% } %>
<% } else { %>
<%- js(['js/app.js', 'js/search.js', 'js/clipboard-use.js']) %>
<% } %>
<% if (page.layout == 'links') { %>
<%- js('https://cdn.jsdelivr.net/gh/toddmotto/echo@1.7.3/src/echo.js') %>
<script>

@ -1,17 +1,76 @@
/*页面载入完成后,创建复制按钮*/
!function (e, t, a) {
!function (e, t, a) {
/* code */
var initCopyCode = function(){
var copyHtml = '';
copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
copyHtml += ' <i class="fa fa-globe"></i><span>copy</span>';
copyHtml += ' <i class="fa fa-copy"></i><span>Copy</span>';
copyHtml += '</button>';
$(".highlight .code pre").before(copyHtml);
new ClipboardJS('.btn-copy', {
target: function(trigger) {
return trigger.nextElementSibling;
}
var clipboard = new ClipboardJS('.btn-copy', {
target: function(trigger) {
return trigger.nextElementSibling;
}
});
clipboard.on('success', function(e) {
//您可以加入成功提示
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
success_prompt("复制成功");
e.clearSelection();
});
clipboard.on('error', function(e) {
//您可以加入失败提示
console.error('Action:', e.action);
console.error('Trigger:', e.trigger);
fail_prompt("复制失败");
});
}
initCopyCode();
}(window, document);
}(window, document);
/**
* 弹出式提示框默认1.2秒自动消失
* @param message 提示信息
* @param style 提示样式有alert-successalert-dangeralert-warningalert-info
* @param time 消失时间
*/
var prompt = function (message, style, time)
{
style = (style === undefined) ? 'alert-success' : style;
time = (time === undefined) ? 1200 : time*1000;
$('<div>')
.appendTo('body')
.addClass('alert ' + style)
.html(message)
.show()
.delay(time)
.fadeOut();
};
// 成功提示
var success_prompt = function(message, time)
{
prompt(message, 'alert-success', time);
};
// 失败提示
var fail_prompt = function(message, time)
{
prompt(message, 'alert-danger', time);
};
// 提醒
var warning_prompt = function(message, time)
{
prompt(message, 'alert-warning', time);
};
// 信息提示
var info_prompt = function(message, time)
{
prompt(message, 'alert-info', time);
};

File diff suppressed because one or more lines are too long

@ -452,43 +452,6 @@
}
//代码块复制按钮
.highlight{
//方便copy代码按钮(btn-copy)的定位
position: relative;
}
.btn-copy {
display: inline-block;
cursor: pointer;
background-color: #eee;
background-image: linear-gradient(#fcfcfc,#eee);
border: 1px solid #d5d5d5;
border-radius: 3px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-appearance: none;
font-size: 13px;
font-weight: 700;
line-height: 20px;
color: #333;
-webkit-transition: opacity .3s ease-in-out;
-o-transition: opacity .3s ease-in-out;
transition: opacity .3s ease-in-out;
padding: 2px 6px;
position: absolute;
right: 5px;
top: 5px;
opacity: 0;
}
.btn-copy span {
margin-left: 5px;
}
.highlight:hover .btn-copy{
opacity: 1;
}
/* Handle */
&::-webkit-scrollbar-thumb {
@ -589,3 +552,40 @@ pre{
color: @hl_red;
}
}
//代码块复制按钮
.highlight{
//方便copy代码按钮(btn-copy)的定位
position: relative;
}
.btn-copy {
display: inline-block;
cursor: pointer;
background-color: #eee;
background-image: linear-gradient(#fcfcfc,#eee);
border: 1px solid #d5d5d5;
border-radius: 3px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-appearance: none;
font-size: 13px;
font-weight: 700;
line-height: 20px;
color: #333;
-webkit-transition: opacity .3s ease-in-out;
-o-transition: opacity .3s ease-in-out;
transition: opacity .3s ease-in-out;
padding: 2px 6px;
position: absolute;
right: 5px;
top: 5px;
opacity: 0;
}
.btn-copy span {
margin-left: 5px;
}
.highlight:hover .btn-copy{
opacity: 1;
}

@ -34,8 +34,7 @@
// start: 圆角 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// 0px: 极端,2px:硬朗,4px:常规,8px:圆润,16px:温柔
@border_radius: 8px; // 圆角半径,可以根据心情随时调整风格
@border_radius: 12px; // 圆角半径,可以根据心情随时调整风格
@border_radius_line: 4px; // 线的宽度和滚动条的宽度
@border_radius_code_block: 4px; // 引用、代码块的圆角

@ -479,3 +479,41 @@
}
}
.alert {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 99999;
text-align: center;
padding: 24px 36px;
border-radius: @border_radius;
box-shadow: @boxshadow_card_normal;
&.alert-success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
&.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
&.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
&.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
}

@ -231,6 +231,7 @@
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
background-color: @theme_cardbg;
border-radius: @border_radius;
@media (max-width: @on_modal_threshold) {
padding: 60px 20px 80px 20px;
}

Loading…
Cancel
Save