-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New tag video
& warn when use exturl
or extlink
#652
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,83 @@ | ||
{% if theme.codeblock.copy_button.enable %} | ||
<style> | ||
.copy-btn { | ||
display: inline-block; | ||
padding: 6px 12px; | ||
font-size: 13px; | ||
font-weight: 700; | ||
line-height: 20px; | ||
color: #333; | ||
white-space: nowrap; | ||
vertical-align: middle; | ||
cursor: pointer; | ||
{% if theme.codeblock.copy_button.style === 'flat' %} | ||
background-color: #fff; | ||
border: none; | ||
{% else %} | ||
background-color: #eee; | ||
background-image: linear-gradient(#fcfcfc, #eee); | ||
border: 1px solid #d5d5d5; | ||
border-radius: 3px; | ||
{% endif %} | ||
user-select: none; | ||
outline: 0; | ||
} | ||
<style> | ||
.copy-btn { | ||
display: inline-block; | ||
padding: 6px 12px; | ||
font-size: 13px; | ||
font-weight: 700; | ||
line-height: 20px; | ||
color: #333; | ||
white-space: nowrap; | ||
vertical-align: middle; | ||
cursor: pointer; | ||
{% if theme.codeblock.copy_button.style === 'flat' %} | ||
background-color: #fff; | ||
border: none; | ||
{% else %} | ||
background-color: #eee; | ||
background-image: linear-gradient(#fcfcfc, #eee); | ||
border: 1px solid #d5d5d5; | ||
border-radius: 3px; | ||
{% endif %} | ||
user-select: none; | ||
outline: 0; | ||
} | ||
|
||
.highlight-wrap .copy-btn { | ||
transition: opacity .3s ease-in-out; | ||
opacity: 0; | ||
padding: 2px 6px; | ||
position: absolute; | ||
{% if theme.codeblock.copy_button.style === 'flat' %} | ||
right: 0px; | ||
height: 42px; | ||
{% else %} | ||
right: 4px; | ||
top: 8px; | ||
{% endif %} | ||
} | ||
.highlight-wrap .copy-btn { | ||
transition: opacity .3s ease-in-out; | ||
opacity: 0; | ||
padding: 2px 6px; | ||
position: absolute; | ||
{% if theme.codeblock.copy_button.style === 'flat' %} | ||
right: 0px; | ||
height: 42px; | ||
{% else %} | ||
right: 4px; | ||
top: 8px; | ||
{% endif %} | ||
} | ||
|
||
.highlight-wrap:hover .copy-btn, | ||
.highlight-wrap .copy-btn:focus { | ||
opacity: 1; | ||
} | ||
.highlight-wrap:hover .copy-btn, | ||
.highlight-wrap .copy-btn:focus { | ||
opacity: 1; | ||
} | ||
|
||
.highlight-wrap { | ||
position: relative; | ||
} | ||
</style> | ||
<script> | ||
$('.highlight').each(function(i, e) { | ||
var $wrap = $('<div>').addClass('highlight-wrap'); | ||
$(e).after($wrap); | ||
$wrap.append($('<button>').addClass('copy-btn').append('{{__("post.copy_button")}}').on('click', function(e) { | ||
var code = $(this).parent().find('.code').find('.line').map(function(i, e) { | ||
return $(e).text(); | ||
}).toArray().join('\n'); | ||
var ta = document.createElement('textarea'); | ||
var yPosition = window.pageYOffset || document.documentElement.scrollTop; | ||
ta.style.top = yPosition + 'px'; // Prevent page scroll | ||
ta.style.position = 'absolute'; | ||
ta.style.opacity = '0'; | ||
ta.readOnly = true; | ||
ta.value = code; | ||
document.body.appendChild(ta); | ||
ta.select(); | ||
ta.setSelectionRange(0, code.length); | ||
ta.readOnly = false; | ||
var result = document.execCommand('copy'); | ||
{% if theme.codeblock.copy_button.show_result %} | ||
if (result) $(this).text('{{__("post.copy_success")}}'); | ||
else $(this).text('{{__("post.copy_failure")}}'); | ||
{% endif %} | ||
ta.blur(); // For iOS | ||
$(this).blur(); | ||
})).on('mouseleave', function(e) { | ||
var $b = $(this).find('.copy-btn'); | ||
setTimeout(function() { | ||
$b.text('{{__("post.copy_button")}}'); | ||
}, 300); | ||
}).append(e); | ||
}) | ||
</script> | ||
.highlight-wrap { | ||
position: relative; | ||
} | ||
</style> | ||
<script> | ||
$('.highlight').each(function(i, e) { | ||
var $wrap = $('<div>').addClass('highlight-wrap'); | ||
$(e).after($wrap); | ||
$wrap.append($('<button>').addClass('copy-btn').append('{{__("post.copy_button")}}').on('click', function(e) { | ||
var code = $(this).parent().find('.code').find('.line').map(function(i, e) { | ||
return $(e).text(); | ||
}).toArray().join('\n'); | ||
var ta = document.createElement('textarea'); | ||
var yPosition = window.pageYOffset || document.documentElement.scrollTop; | ||
ta.style.top = yPosition + 'px'; // Prevent page scroll | ||
ta.style.position = 'absolute'; | ||
ta.style.opacity = '0'; | ||
ta.readOnly = true; | ||
ta.value = code; | ||
document.body.appendChild(ta); | ||
ta.select(); | ||
ta.setSelectionRange(0, code.length); | ||
ta.readOnly = false; | ||
var result = document.execCommand('copy'); | ||
{% if theme.codeblock.copy_button.show_result %} | ||
if (result) $(this).text('{{__("post.copy_success")}}'); | ||
else $(this).text('{{__("post.copy_failure")}}'); | ||
{% endif %} | ||
ta.blur(); // For iOS | ||
$(this).blur(); | ||
})).on('mouseleave', function(e) { | ||
var $b = $(this).find('.copy-btn'); | ||
setTimeout(function() { | ||
$b.text('{{__("post.copy_button")}}'); | ||
}, 300); | ||
}).append(e); | ||
}) | ||
</script> | ||
{% endif %} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* video.js | https://theme-next.org/docs/tag-plugins/video/ | ||
*/ | ||
|
||
/* global hexo */ | ||
|
||
'use strict'; | ||
|
||
function postVideo(args) { | ||
return `<video src="${args}" preload="metadata" controls playsinline poster="">Sorry, your browser does not support the video tag.</video>`; | ||
} | ||
|
||
hexo.extend.tag.register('video', postVideo, {ends: false}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,5 +179,4 @@ pre { | |
.javascript .function { | ||
color: $highlight-purple; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
@import "full-image"; | ||
@import "blockquote-center"; | ||
@import "group-pictures"; | ||
@import "label"; | ||
@import "note" if hexo-config('note.style') == 'simple' || hexo-config('note.style') == 'flat'; | ||
@import "note-modern" if hexo-config('note.style') == 'modern'; | ||
@import "label" if hexo-config('label'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems need to remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's related to theme-next/theme-next.org#18, and won't cause any side effect. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, looks fine now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ivan-nginx Able to merge now? |
||
@import "tabs" if hexo-config('tabs.enable'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/theme-next/hexo-theme-next/blob/master/layout/_third-party/quicklink/index.swig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's fine