mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
Last selected tab is remembered
This commit is contained in:
54
res/app.js
54
res/app.js
@@ -1,29 +1,29 @@
|
||||
/*
|
||||
|
||||
|
||||
Copyright (C) 2021 Hash Borgir
|
||||
|
||||
|
||||
This file is part of D2Modder
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with
|
||||
or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
|
||||
* This software must not be used for commercial purposes
|
||||
* without my consent. Any sales or commercial use are prohibited
|
||||
* without my express knowledge and consent.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY!
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
@@ -37,7 +37,7 @@
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
// highlight json dump for item debugger
|
||||
function syntaxHighlight(json) {
|
||||
@@ -71,6 +71,29 @@ function capitalizeFirstLetter(string) {
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
// Check if a tab is stored in local storage
|
||||
var lastTab = localStorage.getItem('lastTab');
|
||||
|
||||
// If a tab is stored, activate it
|
||||
if (lastTab) {
|
||||
$('.nav-link[data-toggle="tab"]').removeClass('active selected');
|
||||
$('.tab-pane').removeClass('show active');
|
||||
|
||||
$(lastTab).addClass('active show');
|
||||
$(lastTab + '-tab').addClass('active show');
|
||||
}
|
||||
|
||||
// Store the selected tab in local storage when a tab is clicked
|
||||
$('.nav-link[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var targetTab = $(e.target).attr('href');
|
||||
localStorage.setItem('lastTab', targetTab);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$('.form-text').hide();
|
||||
$('.help').click(function () {
|
||||
// $('.form-text').slideToggle();
|
||||
@@ -470,4 +493,17 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
// Reload the page when the button is clicked
|
||||
$('#reload-gui-button').on('click', function () {
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// Reload Mod files
|
||||
$('#reload-button').on('click', function () {
|
||||
$.get("/reload.php", function (response) {
|
||||
console.log(response);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});// end document.ready
|
Reference in New Issue
Block a user