1
0
mirror of https://github.com/bitwarden/help synced 2025-12-10 13:23:16 +00:00

Break out js to specific files

This commit is contained in:
Kyle Spearrin
2020-05-05 09:03:38 -04:00
parent e238c46ff9
commit 981ef7c3c6
4 changed files with 70 additions and 65 deletions

40
js/bit.js Normal file
View File

@@ -0,0 +1,40 @@
$(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;
});
});