mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-07-24 10:12:54 +02:00
use SessionStorage to remember flag
This commit is contained in:
@@ -1058,7 +1058,11 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
||||
var AjaxHandler = PhpDebugBar.AjaxHandler = function(debugbar, headerName, autoShow) {
|
||||
this.debugbar = debugbar;
|
||||
this.headerName = headerName || 'phpdebugbar';
|
||||
this.autoShow = typeof(autoShow) == 'undefined' ? true : autoShow;
|
||||
if (sessionStorage.getItem('phpdebugbar-ajaxhandler-autoshow') !== null) {
|
||||
this.autoShow = JSON.parse(sessionStorage.getItem('phpdebugbar-ajaxhandler-autoshow'));
|
||||
} else {
|
||||
this.autoShow = typeof(autoShow) == 'undefined' ? true : autoShow;
|
||||
}
|
||||
};
|
||||
|
||||
$.extend(AjaxHandler.prototype, {
|
||||
@@ -1099,6 +1103,11 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
||||
return Object.prototype.toString.call(response) == '[object XMLHttpRequest]'
|
||||
},
|
||||
|
||||
setAutoShow: function(autoshow) {
|
||||
this.autoShow = autoshow;
|
||||
sessionStorage.setItem('phpdebugbar-ajaxhandler-autoshow', JSON.stringify(autoshow));
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the HEADER-id exists and loads the dataset using the open handler
|
||||
*
|
||||
|
@@ -670,7 +670,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
||||
this.$autoshow = $('<input type=checkbox>')
|
||||
.on('click', function() {
|
||||
if (window.phpdebugbar.ajaxHandler) {
|
||||
window.phpdebugbar.ajaxHandler.autoShow = $(this).is(':checked');
|
||||
window.phpdebugbar.ajaxHandler.setAutoShow($(this).is(':checked'));
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user