mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-07-20 05:33:17 -04:00
Fixed hightlight file upload on bootstrap5 template
This commit is contained in:
parent
0ce8627561
commit
38955754f3
3 changed files with 30 additions and 2 deletions
|
@ -628,6 +628,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
baseUri = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* check if bootstrap5 object detected
|
||||
*
|
||||
* @name Helper.isBootstrap5
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
me.isBootstrap5 = function ()
|
||||
{
|
||||
return typeof bootstrap !== 'undefined';
|
||||
};
|
||||
|
||||
return me;
|
||||
})();
|
||||
|
||||
|
@ -4632,8 +4643,12 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
// visually indicate file uploaded
|
||||
const $attachDropdownToggle = $attach.children('.dropdown-toggle');
|
||||
if ($attachDropdownToggle.attr('aria-expanded') === 'false') {
|
||||
if (Helper.isBootstrap5()) {
|
||||
new bootstrap.Dropdown($attachDropdownToggle).toggle();
|
||||
} else {
|
||||
$attachDropdownToggle.click();
|
||||
}
|
||||
}
|
||||
$fileWrap.addClass('highlight');
|
||||
setTimeout(function () {
|
||||
$fileWrap.removeClass('highlight');
|
||||
|
|
|
@ -316,5 +316,18 @@ describe('Helper', function () {
|
|||
return $.PrivateBin.Helper.formatBytes(1234567) === '1.18 MiB';
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('isBootstrap5', function () {
|
||||
jsc.property('Bootstrap 5 has been detected', function () {
|
||||
global.bootstrap = {};
|
||||
return $.PrivateBin.Helper.isBootstrap5() === true;
|
||||
});
|
||||
|
||||
jsc.property('Bootstrap 5 has not been detected', function () {
|
||||
delete global.bootstrap;
|
||||
return $.PrivateBin.Helper.isBootstrap5() === false;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class Configuration
|
|||
'js/kjua-0.9.0.js' => 'sha512-CVn7af+vTMBd9RjoS4QM5fpLFEOtBCoB0zPtaqIDC7sF4F8qgUSRFQQpIyEDGsr6yrjbuOLzdf20tkHHmpaqwQ==',
|
||||
'js/legacy.js' => 'sha512-UxW/TOZKon83n6dk/09GsYKIyeO5LeBHokxyIq+r7KFS5KMBeIB/EM7NrkVYIezwZBaovnyNtY2d9tKFicRlXg==',
|
||||
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
|
||||
'js/privatebin.js' => 'sha512-ET6BA8TNB62Rm2aM6EKp8nEGsU8+fggmaZ3aWddwEP1SaThWisIOZFKMcaLs7ztcH8Ye89H6+bzJ+/Uy8hkCMQ==',
|
||||
'js/privatebin.js' => 'sha512-9X1Ns+w/WPlWde118Mbl1UFDPsFmBcXK2zr6ny7oDOuZMVP1hFCPzXjKbC+59xDQW0Q+NmyT4NC6/5B6UzkkDw==',
|
||||
'js/purify-3.2.6.js' => 'sha512-zqwL4OoBLFx89QPewkz4Lz5CSA2ktU+f31fuECkF0iK3Id5qd3Zpq5dMby8KwHjIEpsUgOqwF58cnmcaNem0EA==',
|
||||
'js/rawinflate-0.3.js' => 'sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==',
|
||||
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue