feat(ui): persist active tab and tool selection in localStorage across page refreshes
This commit is contained in:
parent
2a9e4c3769
commit
16f855fcf0
Binary file not shown.
|
|
@ -2103,6 +2103,9 @@ $(document).ready(function() {
|
||||||
$('#grid-container').slideUp();
|
$('#grid-container').slideUp();
|
||||||
gridData = [];
|
gridData = [];
|
||||||
var tool = $(this).val();
|
var tool = $(this).val();
|
||||||
|
if (tool) {
|
||||||
|
localStorage.setItem('nat_selected_tool_img_opti', tool);
|
||||||
|
}
|
||||||
|
|
||||||
if (tool && toolDescriptions[tool]) {
|
if (tool && toolDescriptions[tool]) {
|
||||||
$('#tool-help-text').html('<i class="fa fa-info-circle"></i> ' + toolDescriptions[tool]).slideDown();
|
$('#tool-help-text').html('<i class="fa fa-info-circle"></i> ' + toolDescriptions[tool]).slideDown();
|
||||||
|
|
@ -3199,7 +3202,7 @@ $('#import-settings-file').on('change', function() {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
// ============ PERSIST ACTIVE TAB ============
|
// ============ PERSIST ACTIVE TAB & TOOL ============
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var activeTab = localStorage.getItem('nat_active_tab_img_opti');
|
var activeTab = localStorage.getItem('nat_active_tab_img_opti');
|
||||||
if (activeTab) {
|
if (activeTab) {
|
||||||
|
|
@ -3208,6 +3211,11 @@ $(document).ready(function() {
|
||||||
$('.nav-tabs').first().on('shown.bs.tab', 'a[data-toggle="tab"]', function(e) {
|
$('.nav-tabs').first().on('shown.bs.tab', 'a[data-toggle="tab"]', function(e) {
|
||||||
localStorage.setItem('nat_active_tab_img_opti', $(e.target).attr('href'));
|
localStorage.setItem('nat_active_tab_img_opti', $(e.target).attr('href'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var savedTool = localStorage.getItem('nat_selected_tool_img_opti');
|
||||||
|
if (savedTool && $('#tool-selector option[value="' + savedTool + '"]').length) {
|
||||||
|
$('#tool-selector').val(savedTool).trigger('change');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue