Skip to content

Commit

Permalink
Merge pull request #285 from amiaopensource/link-to-site-locally
Browse files Browse the repository at this point in the history
links to website permalink even when loading locally
  • Loading branch information
ablwr authored Dec 4, 2017
2 parents 6705bdf + c0326ad commit d717935
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ $(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();
$(id).closest('div').find('.link').append("<small>Link to this command: <a href="+window.location.href+">"+window.location.href+"</a></small>");
$(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>");
}

// add hash URL when recipe is opened
$('label[class="recipe"]').on("click", function(){
id = $(this).attr("for");
window.location.hash = ('#' + id)
$('#' + id).closest('div').find('.link').empty();
$('#' + id).closest('div').find('.link').append("<small>Link to this command: <a href="+window.location.href+">"+window.location.href+"</a></small>");
$('#' + 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>");
});

});

0 comments on commit d717935

Please sign in to comment.