mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
Save active tab in cookie in order to restore after page refresh
This commit is contained in:
parent
0f2c093148
commit
f651c68a6a
9 changed files with 99 additions and 65 deletions
|
@ -1,7 +1,21 @@
|
|||
$(document).ready(function(){
|
||||
try{
|
||||
App.Utils.detectBrowser();
|
||||
App.Env.world = 'CRON';
|
||||
|
||||
if ('undefined' != typeof App.Tmp.loadTAB) {
|
||||
App.Env.world = App.Tmp.loadTAB;
|
||||
}
|
||||
|
||||
if ('undefined' == typeof App.Tmp.loadTAB && cookieEnabled()) {
|
||||
var tab = getCookie('tab');
|
||||
if (null != tab && $.inArray(tab, App.Constants.TABS)) {
|
||||
App.Env.world = tab;
|
||||
}
|
||||
else {
|
||||
App.Env.world = App.Constants.TABS[0];
|
||||
}
|
||||
}
|
||||
|
||||
App.Pages.init();
|
||||
App.Ref.init();
|
||||
|
||||
|
|
|
@ -78,7 +78,9 @@ var App = {
|
|||
Core: {},
|
||||
Bash: {},
|
||||
Console: {},
|
||||
Constants: {},
|
||||
Constants: {
|
||||
TABS: ['USER','WEB_DOMAIN','MAIL','DB','DNS','IP','CRON']
|
||||
},
|
||||
Actions: {},
|
||||
Helpers: {},
|
||||
Filters: {},
|
||||
|
@ -175,16 +177,7 @@ App.Ajax.request = function(jedi_method, data, callback)
|
|||
{
|
||||
App.Helpers.beforeAjax(jedi_method);
|
||||
$.ajax({
|
||||
url: function() {
|
||||
var url_parts = location.href.replace('#', '').split('/');
|
||||
if (url_parts[url_parts.length -1] == 'index.html') {
|
||||
url_parts[url_parts.length -1] = 'dispatch.php';
|
||||
}
|
||||
else {
|
||||
url_parts.push('dispatch.php');
|
||||
}
|
||||
return url_parts.join('/');
|
||||
}(),
|
||||
url: App.Helpers.getBackendUrl(),
|
||||
global: false,
|
||||
type: data.request_method || "POST",
|
||||
data: $.extend(data, {'jedi_method': jedi_method}),
|
||||
|
|
|
@ -264,3 +264,26 @@ App.Helpers.closeInnerPopup = function(evt)
|
|||
{
|
||||
$('#inner-popup').remove();
|
||||
}
|
||||
|
||||
App.Helpers.getBackendUrl = function()
|
||||
{
|
||||
var url_parts = location.href.split('#');
|
||||
if (url_parts.length > 1) {
|
||||
var tab = url_parts[url_parts.length - 1];
|
||||
if ($.inArray(tab, App.Constants.TABS) != -1) {
|
||||
App.Tmp.loadTAB = tab;
|
||||
}
|
||||
}
|
||||
|
||||
var url_parts = location.href.split('?', 1);
|
||||
var url = url_parts[0];
|
||||
url_parts = url.split('/');
|
||||
if (url_parts[url_parts.length -1] == 'index.html') {
|
||||
url_parts[url_parts.length -1] = 'dispatch.php';
|
||||
}
|
||||
else {
|
||||
url_parts.push('dispatch.php');
|
||||
}
|
||||
|
||||
return url_parts.join('/');
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ App.Pages.init = function(){
|
|||
|
||||
$('.section.active').removeClass('active');
|
||||
$('#'+App.Env.world).addClass('active');
|
||||
|
||||
if (cookieEnabled()) {
|
||||
setCookie('tab', App.Env.world);
|
||||
}
|
||||
}
|
||||
|
||||
App.Pages.prepareHTML = function()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue