Supports intralinking for recipes

This commit is contained in:
Ashley Blewer 2019-07-13 17:52:49 -04:00
parent ea2c29a38c
commit c32a7f44ad

View File

@ -3,7 +3,6 @@ $(document).ready(function() {
// open recipe window if a hash is found in URL
if(window.location.hash) {
id = window.location.hash
console.log(id.substring(1))
document.getElementById(id.substring(1)).checked = true;
$('html, body').animate({ scrollTop: $(id).offset().top}, 1000);
$(id).closest('div').find('.link').empty();
@ -18,6 +17,16 @@ $(document).ready(function() {
$('#' + id).closest('div').find('.link').append("<small>Link to this command: <a href='https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"'>https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"</a></small>");
});
// open recipe when clicked
$('a').on("click", function(){
intralink = $(this).attr("href")
if (intralink[0] == "#") {
document.getElementById(intralink.substring(1)).checked = true;
$('html, body').animate({ scrollTop: $(intralink).offset().top }, 1000);
}
})
// open all windows if button is clicked
$('#open-all').on("click", function(){
$('input[type=checkbox]').each(function(){
this.checked = !this.checked;