mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
Last selected tab is remembered
This commit is contained in:
parent
9c4123c148
commit
dd3b9610c0
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
|
@ -59,28 +59,16 @@
|
||||
Active Mod: <span style="color: purple"><?php echo $_SESSION['modname'] ?></span>
|
||||
<span style="color: #8888FF">[<?php echo $_SESSION['path'] ?>]</span>
|
||||
</div>
|
||||
<div style="text-align: right;"><button class="btn btn-info" id="reload-gui-button">Reload GUI</button><button class="btn btn-warning" id="reload-button">Reload TXT Files</button></div>
|
||||
<ul class="nav nav-tabs" id="Tabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link active" id="Unique-tab" data-toggle="tab" href="#Unique" role="tab" aria-controls="Unique" aria-selected="true">Unique Items</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Set-tab" data-toggle="tab" href="#Set" role="tab" aria-controls="Set" aria-selected="false">Set Items</a>
|
||||
</li>-->
|
||||
<!-- <li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Gem-tab" data-toggle="tab" href="#Gem" role="tab" aria-controls="Set" aria-selected="false">Gems</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Runewords-tab" data-toggle="tab" href="#Runewords" role="tab" aria-controls="Set" aria-selected="false">Runewords</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Cube-tab" data-toggle="tab" href="#Cube" role="tab" aria-controls="Set" aria-selected="false">Cube</a>
|
||||
</li>
|
||||
-->
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Chars-tab" data-toggle="tab" href="#Chars" role="tab" aria-controls="Chars" aria-selected="false">Char Editor</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="tbl-tab" data-toggle="tab" href="#Tbl" role="tab" aria-controls="Tbl" aria-selected="false">TBL Editor</a>
|
||||
<a class="nav-link" id="Tbl-tab" data-toggle="tab" href="#Tbl" role="tab" aria-controls="Tbl" aria-selected="false">TBL Editor</a>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<a class="nav-link" id="Doc-tab" data-toggle="tab" href="#Doc" role="tab" aria-controls="Doc" aria-selected="false">Docs Generator</a>
|
||||
@ -102,16 +90,6 @@
|
||||
<div class="tab-pane fade" id="Set" role="tabpanel" aria-labelledby="Set-tab">
|
||||
<?php require_once 'tabs/SetItems.php'; ?>
|
||||
</div>
|
||||
<!-- <div class="tab-pane fade" id="Gem" role="tabpanel" aria-labelledby="Gem-tab">
|
||||
<?php //require_once 'tabs/Gems.php'; ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Runewords" role="tabpanel" aria-labelledby="Runewords-tab">
|
||||
<?php //require_once 'tabs/Runewords.php'; ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="Cube" role="tabpanel" aria-labelledby="Cube-tab">
|
||||
<?php //require_once 'tabs/Cube.php'; ?>
|
||||
</div>-->
|
||||
|
||||
<div class="tab-pane fade" id="Doc" role="tabpanel" aria-labelledby="Doc-tab">
|
||||
<?php require_once 'tabs/Doc.php'; ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user