This commit is contained in:
s-lnk
2026-04-30 21:58:39 +03:00
commit aabe5fe2b7
2923 changed files with 366740 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
var CopyType = (function() {
// Variables
var $element = '.btn-type-clipboard',
$btn = $($element);
// Methods
function init($this) {
$this.tooltip().on('mouseleave', function() {
// Explicitly hide tooltip, since after clicking it remains
// focused (as it's a button), so tooltip would otherwise
// remain visible until focus is moved away
$this.tooltip('hide');
});
var clipboard = new ClipboardJS($element);
clipboard.on('success', function(e) {
$(e.trigger)
.attr('title', 'Copied!')
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
e.clearSelection()
});
}
// Events
if ($btn.length) {
init($btn);
}
})();
+109
View File
@@ -0,0 +1,109 @@
//
// Forms
//
'use strict';
//
// Form control
//
var FormControl = (function() {
// Variables
var $input = $('.form-control'),
$indeterminateCheckbox = $('[data-toggle="indeterminate"]');
// Methods
function init($this) {
$this.on('focus blur', function(e) {
$(this).parents('.form-group').toggleClass('focused', (e.type === 'focus'));
}).trigger('blur');
}
// Events
if ($input.length) {
init($input);
}
// Add indeterminate state to a checkbox
if($indeterminateCheckbox.length) {
$indeterminateCheckbox.each(function() {
$(this).prop('indeterminate', true)
})
}
})();
//
// Custom input file
//
var CustomInputFile = (function() {
// Variables
var $customInputFile = $('.custom-input-file');
// Methods
function change($input, $this, $e) {
var fileName,
$label = $input.next('label'),
labelVal = $label.html();
if ($this && $this.files.length > 1) {
fileName = ($this.getAttribute('data-multiple-caption') || '').replace('{count}', $this.files.length);
}
else if ($e.target.value) {
fileName = $e.target.value.split('\\').pop();
}
if (fileName) {
$label.find('span').html(fileName);
}
else {
$label.html(labelVal);
}
}
function focus($input) {
$input.addClass('has-focus');
}
function blur($input) {
$input.removeClass('has-focus');
}
// Events
if ($customInputFile.length) {
$customInputFile.each(function() {
var $input = $(this);
$input.on('change', function(e) {
var $this = this,
$e = e;
change($input, $this, $e);
});
// Firefox bug fix
$input.on('focus', function() {
focus($input);
})
.on('blur', function() {
blur($input);
});
});
}
})();
+53
View File
@@ -0,0 +1,53 @@
//
// Sticky Navbar
//
var NavbarSticky = (function() {
// Variables
var $nav = $('.navbar-sticky'),
navOffsetTop = 0,
scrolling = false;
// Methods
function init($this) {
// our current vertical position from the top
var scrollTop = $(window).scrollTop(),
navHeight = $this.outerHeight();
if (scrollTop > (navOffsetTop + 200)) {
$this.addClass('sticky');
$("body").css("padding-top", navHeight + "px");
} else {
$this.removeClass('sticky');
$("body").css("padding-top", "0");
}
}
// Events
if ($nav.length) {
navOffsetTop = $nav.offset().top;
$(window).on({
'scroll': function() {
scrolling = true;
setInterval(function() {
if (scrolling) {
scrolling = false;
// Sticky navbar init
init($nav);
}
}, 250);
}
})
}
})();