1
0
mirror of https://github.com/bitwarden/help synced 2025-12-11 13:53:26 +00:00
Files
help/js/bit.js
2020-05-05 09:03:52 -04:00

41 lines
1.2 KiB
JavaScript

$(function () {
var lightboxOpen = false,
lightboxSelector = 'a[rel="lightbox"]';
$(lightboxSelector)
.on('openstart.fluidbox', function () {
lightboxOpen = true;
})
.on('closestart.fluidbox', function () {
lightboxOpen = false;
})
.fluidbox();
$(document).keydown(function (e) {
if (lightboxOpen && e.keyCode === 27) {
$(lightboxSelector).trigger('close.fluidbox');
}
});
$(window).scroll(function () {
if (lightboxOpen) {
$(lightboxSelector).trigger('close.fluidbox');
}
});
$('.article .panel-body > h2, .article .panel-body > h3').filter('[id]').each(function () {
var header = $(this),
headerID = header.attr('id'),
anchorClass = 'header-link',
anchorIcon = '<i class="fa fa-link" aria-hidden="true"></i>';
if (headerID) {
header.append($('<a />')
.addClass(anchorClass)
.attr({ 'href': '#' + headerID, 'aria-hidden': 'true', title: 'Permalink' })
.html(anchorIcon));
}
return this;
});
});