push
This commit is contained in:
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n<t.length;){var i=t[n];if(o<=0&&t.slice(n,n+a)===e)return n;"\\"===i?n++:"{"===i?o++:"}"===i&&o--,n++}return-1},i=function(e,t,r,n){for(var o=[],i=0;i<e.length;i++)if("text"===e[i].type){var l=e[i].data,d=!0,s=0,f=void 0;for(-1!==(f=l.indexOf(t))&&(s=f,o.push({type:"text",data:l.slice(0,s)}),d=!1);;){if(d){if(-1===(f=l.indexOf(t,s)))break;o.push({type:"text",data:l.slice(s,f)}),s=f}else{if(-1===(f=a(r,l,s+t.length)))break;o.push({type:"math",data:l.slice(s+t.length,f),rawData:l.slice(s,f+r.length),display:n}),s=f+r.length}d=!d}o.push({type:"text",data:l.slice(s)})}else o.push(e[i]);return o},l=function(e,t){var r=function(e,t){for(var r=[{type:"text",data:e}],n=0;n<t.length;n++){var o=t[n];r=i(r,o.left,o.right,o.display||!1)}return r}(e,t.delimiters);if(1===r.length&&"text"===r[0].type)return null;for(var n=document.createDocumentFragment(),a=0;a<r.length;a++)if("text"===r[a].type)n.appendChild(document.createTextNode(r[a].data));else{var l=document.createElement("span"),d=r[a].data;t.displayMode=r[a].display;try{t.preProcess&&(d=t.preProcess(d)),o.a.render(d,l,t)}catch(e){if(!(e instanceof o.a.ParseError))throw e;t.errorCallback("KaTeX auto-render: Failed to parse `"+r[a].data+"` with ",e),n.appendChild(document.createTextNode(r[a].rawData));continue}n.appendChild(l)}return n};t.default=function(e,t){if(!e)throw new Error("No element provided to render");var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);r.delimiters=r.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},function e(t,r){for(var n=0;n<t.childNodes.length;n++){var o=t.childNodes[n];if(3===o.nodeType){var a=l(o.textContent,r);a&&(n+=a.childNodes.length-1,t.replaceChild(a,o))}else 1===o.nodeType&&function(){var t=" "+o.className+" ";-1===r.ignoredTags.indexOf(o.nodeName.toLowerCase())&&r.ignoredClasses.every(function(e){return-1===t.indexOf(" "+e+" ")})&&e(o,r)}()}}(e,r)}}]).default});
|
||||
-2306
File diff suppressed because it is too large
Load Diff
+5
-5
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
@@ -29,7 +29,7 @@ $( document ).ready(function() {
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
console.log("Using pre-defined dimensions for " + $src);
|
||||
//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 = {
|
||||
@@ -39,7 +39,7 @@ $( document ).ready(function() {
|
||||
title : $title,
|
||||
msrc : $msrc
|
||||
};
|
||||
console.log("Using default dimensions for " + $src);
|
||||
//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();
|
||||
@@ -51,7 +51,7 @@ $( document ).ready(function() {
|
||||
clearInterval(wait);
|
||||
item.w = w;
|
||||
item.h = h;
|
||||
console.log("Got actual dimensions for " + img.src);
|
||||
//console.log("Got actual dimensions for " + img.src);
|
||||
}
|
||||
}, 30);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ var main = {
|
||||
$(".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");
|
||||
@@ -22,7 +22,7 @@ var main = {
|
||||
$('#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;
|
||||
@@ -34,11 +34,11 @@ var main = {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Ensure nested navbar menus are not longer than the menu header
|
||||
var menus = $(".navlinks-container");
|
||||
if (menus.length > 0) {
|
||||
var navbar = $("#main-navbar ul");
|
||||
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");
|
||||
@@ -60,12 +60,12 @@ var main = {
|
||||
});
|
||||
|
||||
fakeMenu.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// show the big header image
|
||||
// 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) {
|
||||
@@ -77,58 +77,102 @@ var main = {
|
||||
var imgInfo = main.getImgInfo();
|
||||
var src = imgInfo.src;
|
||||
var desc = imgInfo.desc;
|
||||
main.setImg(src, 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 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);
|
||||
main.setImg(src, desc, position);
|
||||
img.remove();
|
||||
getNextImg();
|
||||
}, 1000);
|
||||
//});
|
||||
}, 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
|
||||
desc : desc,
|
||||
position : position
|
||||
}
|
||||
},
|
||||
|
||||
setImg : function(src, desc) {
|
||||
|
||||
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) {
|
||||
$(".img-desc").text(desc).show();
|
||||
// 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();
|
||||
$(".img-desc").hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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);})();
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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;
|
||||
let url = $(this).attr('action');
|
||||
let data = $(this).serialize();
|
||||
|
||||
$(form).addClass('form--loading');
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.onreadystatechange = function () {
|
||||
if(xhr.readyState === XMLHttpRequest.DONE) {
|
||||
var status = xhr.status;
|
||||
if (status >= 200 && status < 400) {
|
||||
showModal('Perfect !', 'Thanks for your comment! It will show on the site once it has been approved. .');
|
||||
$(form).removeClass('form--loading');
|
||||
} else {
|
||||
console.error(xhr.statusText);
|
||||
showModal('Error', 'Sorry, there was an error with the submission!');
|
||||
$(form).removeClass('form--loading');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(data);
|
||||
|
||||
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);
|
||||
Reference in New Issue
Block a user