From c32a7f44ad787aa036ffb7693cdbc6cb6f942c99 Mon Sep 17 00:00:00 2001 From: Ashley Blewer Date: Sat, 13 Jul 2019 17:52:49 -0400 Subject: [PATCH] Supports intralinking for recipes --- js/js.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/js/js.js b/js/js.js index 7ec79f6..8719618 100644 --- a/js/js.js +++ b/js/js.js @@ -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("Link to this command: https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+""); }); + // 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;