use new theme
This commit is contained in:
parent
05bc58562c
commit
ec1341fcd1
261 changed files with 23060 additions and 17 deletions
1
themes/beautifulhugo/static/js/auto-render.min.js
vendored
Normal file
1
themes/beautifulhugo/static/js/auto-render.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.renderMathInElement=e()}})(function(){var e,t,r;return function n(e,t,r){function a(o,l){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!l&&f)return f(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[o]={exports:{}};e[o][0].call(s.exports,function(t){var r=e[o][1][t];return a(r?r:t)},s,s.exports,n,e,t,r)}return t[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)a(r[o]);return a}({1:[function(e,t,r){var n=e("./splitAtDelimiters");var a=function(e,t){var r=[{type:"text",data:e}];for(var a=0;a<t.length;a++){var i=t[a];r=n(r,i.left,i.right,i.display||false)}return r};var i=function(e,t){var r=a(e,t);var n=document.createDocumentFragment();for(var i=0;i<r.length;i++){if(r[i].type==="text"){n.appendChild(document.createTextNode(r[i].data))}else{var o=document.createElement("span");var l=r[i].data;try{katex.render(l,o,{displayMode:r[i].display})}catch(f){if(!(f instanceof katex.ParseError)){throw f}console.error("KaTeX auto-render: Failed to parse `"+r[i].data+"` with ",f);n.appendChild(document.createTextNode(r[i].rawData));continue}n.appendChild(o)}}return n};var o=function(e,t,r){for(var n=0;n<e.childNodes.length;n++){var a=e.childNodes[n];if(a.nodeType===3){var l=i(a.textContent,t);n+=l.childNodes.length-1;e.replaceChild(l,a)}else if(a.nodeType===1){var f=r.indexOf(a.nodeName.toLowerCase())===-1;if(f){o(a,t,r)}}}};var l={delimiters:[{left:"$$",right:"$$",display:true},{left:"\\[",right:"\\]",display:true},{left:"\\(",right:"\\)",display:false}],ignoredTags:["script","noscript","style","textarea","pre","code"]};var f=function(e){var t;var r;for(var n=1,a=arguments.length;n<a;n++){t=arguments[n];for(r in t){if(Object.prototype.hasOwnProperty.call(t,r)){e[r]=t[r]}}}return e};var d=function(e,t){if(!e){throw new Error("No element provided to render")}t=f({},l,t);o(e,t.delimiters,t.ignoredTags)};t.exports=d},{"./splitAtDelimiters":2}],2:[function(e,t,r){var n=function(e,t,r){var n=r;var a=0;var i=e.length;while(n<t.length){var o=t[n];if(a<=0&&t.slice(n,n+i)===e){return n}else if(o==="\\"){n++}else if(o==="{"){a++}else if(o==="}"){a--}n++}return-1};var a=function(e,t,r,a){var i=[];for(var o=0;o<e.length;o++){if(e[o].type==="text"){var l=e[o].data;var f=true;var d=0;var s;s=l.indexOf(t);if(s!==-1){d=s;i.push({type:"text",data:l.slice(0,d)});f=false}while(true){if(f){s=l.indexOf(t,d);if(s===-1){break}i.push({type:"text",data:l.slice(d,s)});d=s}else{s=n(r,l,d+t.length);if(s===-1){break}i.push({type:"math",data:l.slice(d+t.length,s),rawData:l.slice(d,s+r.length),display:a});d=s+r.length}f=!f}i.push({type:"text",data:l.slice(d)})}else{i.push(e[o])}}return i};t.exports=a},{}]},{},[1])(1)});
|
7
themes/beautifulhugo/static/js/bootstrap.min.js
vendored
Normal file
7
themes/beautifulhugo/static/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
themes/beautifulhugo/static/js/highlight.min.js
vendored
Normal file
2
themes/beautifulhugo/static/js/highlight.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
themes/beautifulhugo/static/js/jquery.min.js
vendored
Normal file
5
themes/beautifulhugo/static/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
themes/beautifulhugo/static/js/katex.min.js
vendored
Normal file
4
themes/beautifulhugo/static/js/katex.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
74
themes/beautifulhugo/static/js/load-photoswipe.js
Normal file
74
themes/beautifulhugo/static/js/load-photoswipe.js
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
Put this file in /static/js/load-photoswipe.js
|
||||
Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
|
||||
*/
|
||||
|
||||
/* TODO: Make the share function work */
|
||||
$( document ).ready(function() {
|
||||
/*
|
||||
Initialise Photoswipe
|
||||
*/
|
||||
var items = []; // array of slide objects that will be passed to PhotoSwipe()
|
||||
// for every figure element on the page:
|
||||
$('figure').each( function() {
|
||||
if ($(this).attr('class') == 'no-photoswipe') return true; // ignore any figures where class="no-photoswipe"
|
||||
// get properties from child a/img/figcaption elements,
|
||||
var $figure = $(this),
|
||||
$a = $figure.find('a'),
|
||||
$img = $figure.find('img'),
|
||||
$src = $a.attr('href'),
|
||||
$title = $img.attr('alt'),
|
||||
$msrc = $img.attr('src');
|
||||
// if data-size on <a> tag is set, read it and create an item
|
||||
if ($a.data('size')) {
|
||||
var $size = $a.data('size').split('x');
|
||||
var item = {
|
||||
src : $src,
|
||||
w : $size[0],
|
||||
h : $size[1],
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
//console.log("Using pre-defined dimensions for " + $src);
|
||||
// if not, set temp default size then load the image to check actual size
|
||||
} else {
|
||||
var item = {
|
||||
src : $src,
|
||||
w : 800, // temp default size
|
||||
h : 600, // temp default size
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
//console.log("Using default dimensions for " + $src);
|
||||
// load the image to check its dimensions
|
||||
// update the item as soon as w and h are known (check every 30ms)
|
||||
var img = new Image();
|
||||
img.src = $src;
|
||||
var wait = setInterval(function() {
|
||||
var w = img.naturalWidth,
|
||||
h = img.naturalHeight;
|
||||
if (w && h) {
|
||||
clearInterval(wait);
|
||||
item.w = w;
|
||||
item.h = h;
|
||||
//console.log("Got actual dimensions for " + img.src);
|
||||
}
|
||||
}, 30);
|
||||
}
|
||||
// Save the index of this image then add it to the array
|
||||
var index = items.length;
|
||||
items.push(item);
|
||||
// Event handler for click on a figure
|
||||
$figure.on('click', function(event) {
|
||||
event.preventDefault(); // prevent the normal behaviour i.e. load the <a> hyperlink
|
||||
// Get the PSWP element and initialise it with the desired options
|
||||
var $pswp = $('.pswp')[0];
|
||||
var options = {
|
||||
index: index,
|
||||
bgOpacity: 0.8,
|
||||
showHideOpacity: true
|
||||
}
|
||||
new PhotoSwipe($pswp, PhotoSwipeUI_Default, items, options).init();
|
||||
});
|
||||
});
|
||||
});
|
182
themes/beautifulhugo/static/js/main.js
Normal file
182
themes/beautifulhugo/static/js/main.js
Normal file
|
@ -0,0 +1,182 @@
|
|||
// Dean Attali / Beautiful Jekyll 2016
|
||||
|
||||
var main = {
|
||||
|
||||
bigImgEl : null,
|
||||
numImgs : null,
|
||||
|
||||
init : function() {
|
||||
// Shorten the navbar after scrolling a little bit down
|
||||
$(window).scroll(function() {
|
||||
if ($(".navbar").offset().top > 50) {
|
||||
$(".navbar").addClass("top-nav-short");
|
||||
} else {
|
||||
$(".navbar").removeClass("top-nav-short");
|
||||
}
|
||||
});
|
||||
|
||||
// On mobile, hide the avatar when expanding the navbar menu
|
||||
$('#main-navbar').on('show.bs.collapse', function () {
|
||||
$(".navbar").addClass("top-nav-expanded");
|
||||
});
|
||||
$('#main-navbar').on('hidden.bs.collapse', function () {
|
||||
$(".navbar").removeClass("top-nav-expanded");
|
||||
});
|
||||
|
||||
// On mobile, when clicking on a multi-level navbar menu, show the child links
|
||||
$('#main-navbar').on("click", ".navlinks-parent", function(e) {
|
||||
var target = e.target;
|
||||
$.each($(".navlinks-parent"), function(key, value) {
|
||||
if (value == target) {
|
||||
$(value).parent().toggleClass("show-children");
|
||||
} else {
|
||||
$(value).parent().removeClass("show-children");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Ensure nested navbar menus are not longer than the menu header
|
||||
var menus = $(".navlinks-container");
|
||||
if (menus.length > 0) {
|
||||
var navbar = $("#main-navbar").find("ul");
|
||||
var fakeMenuHtml = "<li class='fake-menu' style='display:none;'><a></a></li>";
|
||||
navbar.append(fakeMenuHtml);
|
||||
var fakeMenu = $(".fake-menu");
|
||||
|
||||
$.each(menus, function(i) {
|
||||
var parent = $(menus[i]).find(".navlinks-parent");
|
||||
var children = $(menus[i]).find(".navlinks-children a");
|
||||
var words = [];
|
||||
$.each(children, function(idx, el) { words = words.concat($(el).text().trim().split(/\s+/)); });
|
||||
var maxwidth = 0;
|
||||
$.each(words, function(id, word) {
|
||||
fakeMenu.html("<a>" + word + "</a>");
|
||||
var width = fakeMenu.width();
|
||||
if (width > maxwidth) {
|
||||
maxwidth = width;
|
||||
}
|
||||
});
|
||||
$(menus[i]).css('min-width', maxwidth + 'px')
|
||||
});
|
||||
|
||||
fakeMenu.remove();
|
||||
}
|
||||
|
||||
// show the big header image
|
||||
main.initImgs();
|
||||
},
|
||||
|
||||
initImgs : function() {
|
||||
// If the page was large images to randomly select from, choose an image
|
||||
if ($("#header-big-imgs").length > 0) {
|
||||
main.bigImgEl = $("#header-big-imgs");
|
||||
main.numImgs = main.bigImgEl.attr("data-num-img");
|
||||
|
||||
// 2fc73a3a967e97599c9763d05e564189
|
||||
// set an initial image
|
||||
var imgInfo = main.getImgInfo();
|
||||
var src = imgInfo.src;
|
||||
var desc = imgInfo.desc;
|
||||
var position = imgInfo.position;
|
||||
main.setImg(src, desc, position);
|
||||
|
||||
// For better UX, prefetch the next image so that it will already be loaded when we want to show it
|
||||
var getNextImg = function() {
|
||||
var imgInfo = main.getImgInfo();
|
||||
var src = imgInfo.src;
|
||||
var desc = imgInfo.desc;
|
||||
var position = imgInfo.position;
|
||||
|
||||
var prefetchImg = new Image();
|
||||
prefetchImg.src = src;
|
||||
// if I want to do something once the image is ready: `prefetchImg.onload = function(){}`
|
||||
|
||||
setTimeout(function(){
|
||||
var img = $("<div></div>").addClass("big-img-transition").css("background-image", 'url(' + src + ')');
|
||||
if (position !== undefined) {
|
||||
img.css("background-position", position);
|
||||
}
|
||||
$(".intro-header.big-img").prepend(img);
|
||||
setTimeout(function(){ img.css("opacity", "1"); }, 50);
|
||||
|
||||
// after the animation of fading in the new image is done, prefetch the next one
|
||||
//img.one("transitioned webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){
|
||||
setTimeout(function() {
|
||||
main.setImg(src, desc, position);
|
||||
img.remove();
|
||||
getNextImg();
|
||||
}, 1000);
|
||||
//});
|
||||
}, 6000);
|
||||
};
|
||||
|
||||
// If there are multiple images, cycle through them
|
||||
if (main.numImgs > 1) {
|
||||
getNextImg();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getImgInfo : function() {
|
||||
var randNum = Math.floor((Math.random() * main.numImgs) + 1);
|
||||
var src = main.bigImgEl.attr("data-img-src-" + randNum);
|
||||
var desc = main.bigImgEl.attr("data-img-desc-" + randNum);
|
||||
var position = main.bigImgEl.attr("data-img-position-" + randNum);
|
||||
|
||||
return {
|
||||
src : src,
|
||||
desc : desc,
|
||||
position : position
|
||||
}
|
||||
},
|
||||
|
||||
setImg : function(src, desc, position) {
|
||||
$(".intro-header.big-img").css("background-image", 'url(' + src + ')');
|
||||
if (position !== undefined) {
|
||||
$(".intro-header.big-img").css("background-position", position);
|
||||
}
|
||||
else {
|
||||
// Remove background-position if added to the prev image.
|
||||
$(".intro-header.big-img").css("background-position", "");
|
||||
}
|
||||
if (typeof desc !== typeof undefined && desc !== false) {
|
||||
// Check for Markdown link
|
||||
var mdLinkRe = /\[(.*?)\]\((.+?)\)/;
|
||||
if (desc.match(mdLinkRe)) {
|
||||
// Split desc into parts, extracting md links
|
||||
var splitDesc = desc.split(mdLinkRe);
|
||||
|
||||
// Build new description
|
||||
var imageDesc = $(".img-desc");
|
||||
splitDesc.forEach(function (element, index){
|
||||
// Check element type. If links every 2nd element is link text, and every 3rd link url
|
||||
if (index % 3 === 0) {
|
||||
// Regular text, just append it
|
||||
imageDesc.append(element);
|
||||
}
|
||||
if (index % 3 === 1) {
|
||||
// Link text - do nothing at the moment
|
||||
}
|
||||
if (index % 3 === 2) {
|
||||
// Link url - Create anchor tag with text
|
||||
var link = $("<a>", {
|
||||
"href": element,
|
||||
"target": "_blank",
|
||||
"rel": "noopener noreferrer"
|
||||
}).text(splitDesc[index - 1]);
|
||||
imageDesc.append(link);
|
||||
}
|
||||
});
|
||||
imageDesc.show();
|
||||
} else {
|
||||
$(".img-desc").text(desc).show();
|
||||
}
|
||||
} else {
|
||||
$(".img-desc").hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 2fc73a3a967e97599c9763d05e564189
|
||||
|
||||
document.addEventListener('DOMContentLoaded', main.init);
|
30
themes/beautifulhugo/static/js/mermaid.js
Normal file
30
themes/beautifulhugo/static/js/mermaid.js
Normal file
File diff suppressed because one or more lines are too long
4
themes/beautifulhugo/static/js/photoswipe-ui-default.min.js
vendored
Normal file
4
themes/beautifulhugo/static/js/photoswipe-ui-default.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
themes/beautifulhugo/static/js/photoswipe.min.js
vendored
Normal file
4
themes/beautifulhugo/static/js/photoswipe.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
themes/beautifulhugo/static/js/recaptcha.js
Normal file
1
themes/beautifulhugo/static/js/recaptcha.js
Normal file
|
@ -0,0 +1 @@
|
|||
/* PLEASE DO NOT COPY AND PASTE THIS CODE. */(function() {if (!window['___grecaptcha_cfg']) { window['___grecaptcha_cfg'] = {}; };if (!window['___grecaptcha_cfg']['render']) { window['___grecaptcha_cfg']['render'] = 'onload'; };window['__google_recaptcha_client'] = true;var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://www.gstatic.com/recaptcha/api2/r20171115120512/recaptcha__en.js'; var elem = document.querySelector('script[nonce]');var nonce = elem && (elem['nonce'] || elem.getAttribute('nonce'));if (nonce) { po.setAttribute('nonce', nonce); }var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();
|
40
themes/beautifulhugo/static/js/staticman.js
Normal file
40
themes/beautifulhugo/static/js/staticman.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Static comments
|
||||
// from: https://github.com/eduardoboucas/popcorn/blob/gh-pages/js/main.js
|
||||
(function ($) {
|
||||
var $comments = $('.js-comments');
|
||||
|
||||
$('.js-form').submit(function () {
|
||||
var form = this;
|
||||
|
||||
$(form).addClass('form--loading');
|
||||
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
success: function (data) {
|
||||
showModal('Perfect !', 'Thanks for your comment! It will show on the site once it has been approved. .');
|
||||
$(form).removeClass('form--loading');
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
showModal('Error', 'Sorry, there was an error with the submission!');
|
||||
$(form).removeClass('form--loading');
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.js-close-modal').click(function () {
|
||||
$('body').removeClass('show-modal');
|
||||
});
|
||||
|
||||
function showModal(title, message) {
|
||||
$('.js-modal-title').text(title);
|
||||
$('.js-modal-text').html(message);
|
||||
|
||||
$('body').addClass('show-modal');
|
||||
}
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue