-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
var elements = document.getElementsByTagName('script'); | ||
|
||
Array.prototype.forEach.call(elements, function (element) { | ||
if (element.type.indexOf('math/tex') !== -1) { | ||
// Extract math markdown | ||
var textToRender = element.innerText || element.textContent; | ||
if (element.type.indexOf('math/tex') !== -1) { | ||
// Extract math markdown | ||
var textToRender = element.innerText || element.textContent; | ||
|
||
// Kramdown and KaTeX workaround | ||
// https://github.com/rohanchandra/type-theme/issues/47 | ||
textToRender = textToRender.replace(/%.*/g, ''); | ||
// Kramdown and KaTeX workaround | ||
// https://github.com/rohanchandra/type-theme/issues/47 | ||
textToRender = textToRender.replace(/%.*/g, ''); | ||
|
||
// Create span for KaTeX | ||
var katexElement = document.createElement('span'); | ||
// Create span for KaTeX | ||
var katexElement = document.createElement('span'); | ||
|
||
// Support inline and display math | ||
if (element.type.indexOf('mode=display') !== -1) { | ||
katexElement.className += "math-display"; | ||
textToRender = '\\displaystyle {' + textToRender + '}'; | ||
} else { | ||
katexElement.className += "math-inline"; | ||
} | ||
|
||
// Set displayMode to true to center equation | ||
// https://github.com/Khan/KaTeX/issues/626 | ||
katex.render(textToRender, katexElement, {displayMode: false}); | ||
element.parentNode.insertBefore(katexElement, element); | ||
// Support inline and display math | ||
if (element.type.indexOf('mode=display') !== -1) { | ||
katexElement.className += "math-display"; | ||
textToRender = '\\displaystyle {' + textToRender + '}'; | ||
} else { | ||
katexElement.className += "math-inline"; | ||
} | ||
|
||
// Set displayMode to true to center equation | ||
// https://github.com/Khan/KaTeX/issues/626 | ||
katex.render(textToRender, katexElement, {displayMode: false}); | ||
element.parentNode.insertBefore(katexElement, element); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// init Masonry | ||
try { | ||
var elem = document.querySelector('.grid'); | ||
var msnry = new Masonry(elem, { | ||
itemSelector: '.grid-item', | ||
columnWidth: '.grid-sizer', | ||
gutter: '.gutter-sizer', | ||
percentPosition: true | ||
}); | ||
var elem = document.querySelector('.grid'); | ||
var msnry = new Masonry(elem, { | ||
itemSelector: '.grid-item', | ||
columnWidth: '.grid-sizer', | ||
gutter: '.gutter-sizer', | ||
percentPosition: true | ||
}); | ||
|
||
// layout Masonry after each image loads | ||
var imgLoad = imagesLoaded(elem); | ||
imgLoad.on('progress', function (instance, image) { | ||
msnry.layout(); | ||
}); | ||
// layout Masonry after each image loads | ||
var imgLoad = imagesLoaded(elem); | ||
imgLoad.on('progress', function (instance, image) { | ||
msnry.layout(); | ||
}); | ||
} catch (err) { | ||
if (err instanceof ReferenceError) { | ||
// Do nothing, Masonry is defined only in the gallery page | ||
} else { | ||
throw err; | ||
} | ||
if (err instanceof ReferenceError) { | ||
// Do nothing, Masonry is defined only in the gallery page | ||
} else { | ||
throw err; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
document.addEventListener("DOMContentLoaded", function (event) { | ||
|
||
/* | ||
* Display the menu items on smaller screens | ||
*/ | ||
var pull = document.getElementById('pull'); | ||
var menu = document.querySelector('nav ul'); | ||
/* | ||
* Display the menu items on smaller screens | ||
*/ | ||
var pull = document.getElementById('pull'); | ||
var menu = document.querySelector('nav ul'); | ||
|
||
pull.addEventListener('click', function (e) { | ||
menu.classList.toggle('hide'); | ||
}); | ||
pull.addEventListener('click', function (e) { | ||
menu.classList.toggle('hide'); | ||
}); | ||
|
||
/* | ||
* Make the header images move on scroll | ||
*/ | ||
window.addEventListener('scroll', function () { | ||
var x = window.pageYOffset || document.body.scrollTop; | ||
var main = document.getElementById("main"); | ||
var mainStyle = main.style; | ||
mainStyle.backgroundPosition = '100% ' + parseInt(-x/3) + 'px' + ', 0%, center top'; | ||
}); | ||
/* | ||
* Make the header images move on scroll | ||
*/ | ||
window.addEventListener('scroll', function () { | ||
var x = window.pageYOffset || document.body.scrollTop; | ||
var main = document.getElementById("main"); | ||
var mainStyle = main.style; | ||
|
||
mainStyle.backgroundPosition = '100% ' + parseInt(-x / 3) + 'px' + ', 0%, center top'; | ||
}); | ||
}); |