ffmprovisr/js/js.js

28 lines
1.2 KiB
JavaScript
Raw Normal View History

$(document).ready(function() {
2017-10-13 04:14:47 +02:00
// open recipe window if a hash is found in URL
if(window.location.hash) {
2017-10-18 23:17:55 +02:00
id = window.location.hash
console.log(id.substring(1))
2017-10-18 23:17:55 +02:00
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='https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"'>https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"</a></small>");
}
2017-10-13 04:14:47 +02:00
// 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='https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"'>https://amiaopensource.github.io/ffmprovisr/index.html"+window.location.hash+"</a></small>");
});
$('#open-all').on("click", function(){
$('input[type=checkbox]').each(function(){
this.checked = !this.checked;
})
});
});