mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-05-18 15:54:11 +00:00
deploy: 48a56ddefd
This commit is contained in:
parent
44833df3bd
commit
1eeead3aad
168 changed files with 3788 additions and 3757 deletions
19
js/theme.js
19
js/theme.js
|
@ -341,18 +341,23 @@ jQuery(function() {
|
|||
var clip = new ClipboardJS('.copy-to-clipboard-button', {
|
||||
text: function(trigger) {
|
||||
var text = $(trigger).prev('code').text();
|
||||
// remove a trailing line break, this may most likely
|
||||
// come from the browser / Hugo transformation
|
||||
text = text.replace(/\n$/, '');
|
||||
// removes leading $ signs from text in an assumption
|
||||
// that this has to be the unix prompt marker - weird
|
||||
return text.replace(/^\$\s/gm, '');
|
||||
}
|
||||
});
|
||||
|
||||
clip.on('success', function(e) {
|
||||
e.clearSelection();
|
||||
var inPre = $(e.trigger).parent().parent().prop('tagName') == 'PRE';
|
||||
var inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
|
||||
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
|
||||
});
|
||||
|
||||
clip.on('error', function(e) {
|
||||
var inPre = $(e.trigger).parent().parent().prop('tagName') == 'PRE';
|
||||
var inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
|
||||
$(e.trigger).attr('aria-label', fallbackMessage(e.action)).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
|
||||
$(document).one('copy', function(){
|
||||
$(e.trigger).attr('aria-label', window.T_Copied_to_clipboard).addClass('tooltipped tooltipped-' + (inPre ? 'w' : 's'));
|
||||
|
@ -363,9 +368,15 @@ jQuery(function() {
|
|||
}
|
||||
|
||||
var parent = code.parent();
|
||||
var inPre = parent.prop('tagName') == 'PRE';
|
||||
code.addClass('copy-to-clipboard-code');
|
||||
code.replaceWith($('<span/>', {'class': 'copy-to-clipboard'}).append(code.clone() ));
|
||||
code = parent.children('.copy-to-clipboard').last().children('.copy-to-clipboard-code');
|
||||
if( inPre ){
|
||||
parent.addClass( 'copy-to-clipboard' );
|
||||
}
|
||||
else{
|
||||
code.replaceWith($('<span/>', {'class': 'copy-to-clipboard'}).append(code.clone() ));
|
||||
code = parent.children('.copy-to-clipboard').last().children('.copy-to-clipboard-code');
|
||||
}
|
||||
code.after( $('<span>').addClass("copy-to-clipboard-button").attr("title", window.T_Copy_to_clipboard).append("<i class='fas fa-copy'></i>") );
|
||||
code.next('.copy-to-clipboard-button').on('mouseleave', function() {
|
||||
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
|
||||
|
|
|
@ -241,11 +241,11 @@ var variants = {
|
|||
return c;
|
||||
}
|
||||
c = c.trim();
|
||||
c = c.replace( /\s*\(\s*/, "( " );
|
||||
c = c.replace( /\s*\)\s*/, " )" );
|
||||
c = c.replace( /\s*,\s*/, ", " );
|
||||
c = c.replace( /0*\./, "." );
|
||||
c = c.replace( / +/, " " );
|
||||
c = c.replace( /\s*\(\s*/g, "( " );
|
||||
c = c.replace( /\s*\)\s*/g, " )" );
|
||||
c = c.replace( /\s*,\s*/g, ", " );
|
||||
c = c.replace( /0*\./g, "." );
|
||||
c = c.replace( / +/g, " " );
|
||||
return c;
|
||||
},
|
||||
|
||||
|
@ -466,7 +466,7 @@ var variants = {
|
|||
|
||||
{ name: 'CODE-INLINE-color', group: 'inline code', default: '#5e5e5e', tooltip: 'text color of inline code', },
|
||||
{ name: 'CODE-INLINE-BG-color', group: 'inline code', default: '#fffae9', tooltip: 'background color of inline code', },
|
||||
{ name: 'CODE-INLINE-BORDER-color', group: 'inline code', fallback: 'CODE-INLINE-BG-color', tooltip: 'border color of inline code', },
|
||||
{ name: 'CODE-INLINE-BORDER-color', group: 'inline code', default: '#fbf0cb', tooltip: 'border color of inline code', },
|
||||
|
||||
{ name: 'MENU-HEADER-BG-color', group: 'header', default: '#7dc903', tooltip: 'background color of menu header', },
|
||||
{ name: 'MENU-HEADER-BORDER-color', group: 'header', fallback: 'MENU-HEADER-BG-color', tooltip: 'separator color of menu header', },
|
||||
|
@ -513,5 +513,5 @@ var variants = {
|
|||
{ name: 'BOX-WARNING-color', group: 'colored boxes', fallback: 'BOX-RED-color', tooltip: 'background color of warning boxes', },
|
||||
{ name: 'BOX-RED-TEXT-color', group: 'colored boxes', fallback: 'BOX-TEXT-color', tooltip: 'text color of red boxes', },
|
||||
{ name: 'BOX-WARNING-TEXT-color', group: 'colored boxes', fallback: 'BOX-RED-TEXT-color', tooltip: 'text color of warning boxes', },
|
||||
],
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue