ffmprovisr/js/js.js
Reto Kromer c02e8044c2 Making links alive
This is a test. Sorry, I cannot check now if it works.
2016-06-30 10:47:24 +02:00

29 lines
964 B
JavaScript

$(document).ready(function() {
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
// open modal window if a hash is found in URL
if(window.location.hash) {
$(window.location.hash).modal('show');
// add direct link to modal window
$(".link").empty();
$(".link").append("<small>Link to this command: <a href=&quot;"+window.location.href+"&quot;>"+window.location.href+"</a></small>");
}
// add hash to URL when modal is opened
$('span[data-toggle="modal"]').on("click", function(){
window.location.hash = $(this).attr("data-target");
// add direct link to modal window
$(".link").empty();
$(".link").append("<small>Link to this command: <a href=&quot;"+window.location.href+"&quot;>"+window.location.href+"</a></small>");
});
// remove hash from URL when modal is closed
$(document).on('hide.bs.modal', function (e) {
history.pushState("", document.title, window.location.pathname);
});
});