[BS5] change bootstrap in js

This commit is contained in:
FreddleSpl0it
2022-04-01 08:25:47 +02:00
parent 5088636d5f
commit e62069d3db
7 changed files with 107 additions and 128 deletions

View File

@@ -55,14 +55,14 @@ $(document).ready(function() {
// tooltips
$(function () {
$('[data-toggle="tooltip"]').tooltip()
$('[data-bs-toggle="tooltip"]').tooltip()
});
// remember last navigation pill
(function () {
'use strict';
if ($('a[data-toggle="tab"]').length) {
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
if ($('a[data-bs-toggle="tab"]').length) {
$('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
if ($(this).data('dont-remember') == 1) {
return true;
}
@@ -119,7 +119,7 @@ $(document).ready(function() {
shake(password_field);
}
else {
$(hibp_result).attr('class', 'hibp-out label label-info');
$(hibp_result).attr('class', 'hibp-out badge fs-5 bg-info');
$(hibp_result).text(lang_footer.loading);
var password_digest = $.sha1($(password_field).val())
var digest_five = password_digest.substring(0, 5).toUpperCase();
@@ -130,16 +130,16 @@ $(document).ready(function() {
type: 'GET',
success: function(res) {
if (res.search(compl_digest) > -1){
$(hibp_result).removeClass('label label-info').addClass('label label-danger');
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-danger');
$(hibp_result).text(lang_footer.hibp_nok)
} else {
$(hibp_result).removeClass('label label-info').addClass('label label-success');
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-success');
$(hibp_result).text(lang_footer.hibp_ok)
}
$(hibp_field).removeClass('task-running');
},
error: function(xhr, status, error) {
$(hibp_result).removeClass('label label-info').addClass('label label-warning');
$(hibp_result).removeClass('badge fs-5 bg-info').addClass('badge fs-5 bg-warning');
$(hibp_result).text('API error: ' + xhr.responseText)
$(hibp_field).removeClass('task-running');
}
@@ -150,8 +150,8 @@ $(document).ready(function() {
// Disable disallowed inputs
$('[data-acl="0"]').each(function(event){
if ($(this).is("a")) {
$(this).removeAttr("data-toggle");
$(this).removeAttr("data-target");
$(this).removeAttr("data-bs-toggle");
$(this).removeAttr("data-bs-target");
$(this).removeAttr("data-action");
$(this).click(function(event) {
event.preventDefault();
@@ -166,8 +166,8 @@ $(document).ready(function() {
if ($(this).hasClass('btn-group')) {
$(this).find('a').each(function(){
$(this).removeClass('dropdown-toggle')
.removeAttr('data-toggle')
.removeAttr('data-target')
.removeAttr('data-bs-toggle')
.removeAttr('data-bs-target')
.removeAttr('data-action')
.removeAttr('id')
.attr("disabled", true);
@@ -182,7 +182,7 @@ $(document).ready(function() {
} else if ($(this).hasClass('input-group')) {
$(this).find('input').each(function() {
$(this).removeClass('dropdown-toggle')
.removeAttr('data-toggle')
.removeAttr('data-bs-toggle')
.attr("disabled", true);
$(this).click(function(event) {
event.preventDefault();
@@ -252,25 +252,4 @@ $(document).ready(function() {
})
});
})
// responsive tabs
$('.responsive-tabs').tabCollapse({
tabsClass: 'hidden-xs',
accordionClass: 'js-tabcollapse-panel-group visible-xs'
});
$(document).on("shown.bs.collapse shown.bs.tab", function (e) {
var target = $(e.target);
if($(window).width() <= 767) {
var offset = target.offset().top - 112;
$("html, body").stop().animate({
scrollTop: offset
}, 100);
}
if(target.hasClass('panel-collapse')){
var id = e.target.id.replace(/-collapse$/g, '');
if(id){
localStorage.setItem('lastTag', '#'+id);
}
}
});
});