Merge pull request #248 from amiaopensource/modals-go-inline

modals go inline instead of popup
This commit is contained in:
Ashley 2017-10-13 09:48:56 -04:00 committed by GitHub
commit 082f9a1175
2 changed files with 1553 additions and 2053 deletions

3578
index.html

File diff suppressed because it is too large Load Diff

View File

@ -4,25 +4,21 @@ $(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip()
});
// open modal window if a hash is found in URL
// open recipe 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="+window.location.href+">"+window.location.href+"</a></small>");
id = window.location.hash
$(id).collapse('show');
$('html, body').animate({ scrollTop: $(id).offset().top}, 1000);
$(id + " .link").empty();
$(id + " .link").append("<small>Link to this command: <a href="+window.location.href+">"+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="+window.location.href+">"+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);
// add hash URL when recipe is opened
$('span[data-toggle="collapse"]').on("click", function(){
id = $(this).attr("data-target");
window.location.hash = id
$(id + " .link").empty();
$(id + " .link").append("<small>Link to this command: <a href="+window.location.href+">"+window.location.href+"</a></small>");
});
});