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:
40
js/bit.js
Normal file
40
js/bit.js
Normal 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;
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user