-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
79 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,100 @@ | ||
// setTimeout() return value | ||
let disablePopupTimeout; | ||
|
||
function save_options() | ||
{ | ||
localStorage["xdebugIdeKey"] = document.getElementById("idekey").value; | ||
localStorage["xdebugTraceTrigger"] = document.getElementById("tracetrigger").value; | ||
localStorage["xdebugProfileTrigger"] = document.getElementById("profiletrigger").value; | ||
localStorage.xdebugDisablePopup = document.getElementById('disable-popup').checked ? '1' : '0'; | ||
} | ||
|
||
function restore_options() | ||
{ | ||
// Restore IDE Key | ||
idekey = localStorage["xdebugIdeKey"]; | ||
|
||
if (!idekey) | ||
{ | ||
idekey = "XDEBUG_ECLIPSE"; | ||
} | ||
(function () { | ||
|
||
if (idekey == "XDEBUG_ECLIPSE" || idekey == "netbeans-xdebug" || idekey == "macgdbp" || idekey == "PHPSTORM") | ||
{ | ||
$("#ide").val(idekey); | ||
$("#idekey").prop('disabled', true); | ||
} | ||
else | ||
// setTimeout() return value | ||
let disablePopupTimeout; | ||
|
||
function save_options() | ||
{ | ||
$("#ide").val("null"); | ||
$("#idekey").prop('disabled', false); | ||
} | ||
$('#idekey').val(idekey); | ||
|
||
// Restore Trace Triggers | ||
var traceTrigger = localStorage["xdebugTraceTrigger"]; | ||
if (traceTrigger !== null) { | ||
$("#tracetrigger").val(traceTrigger); | ||
} else { | ||
$("#tracetrigger").val(null); | ||
localStorage["xdebugIdeKey"] = document.getElementById("idekey").value; | ||
localStorage["xdebugTraceTrigger"] = document.getElementById("tracetrigger").value; | ||
localStorage["xdebugProfileTrigger"] = document.getElementById("profiletrigger").value; | ||
localStorage.xdebugDisablePopup = document.getElementById('disable-popup').checked ? '1' : '0'; | ||
} | ||
|
||
// Restore Profile Triggers | ||
var profileTrigger = localStorage["xdebugProfileTrigger"]; | ||
if (profileTrigger !== null) { | ||
$("#profiletrigger").val(profileTrigger); | ||
} else { | ||
$("#profiletrigger").val(null); | ||
} | ||
function restore_options() | ||
{ | ||
// Restore IDE Key | ||
idekey = localStorage["xdebugIdeKey"]; | ||
|
||
// Restore Disable Popup | ||
document.getElementById('disable-popup').checked = (localStorage.xdebugDisablePopup === '1') ? true : false; | ||
} | ||
if (!idekey) | ||
{ | ||
idekey = "XDEBUG_ECLIPSE"; | ||
} | ||
|
||
$(function() | ||
{ | ||
$("#ide").change(function () | ||
{ | ||
if ($("#ide").val() != "null") | ||
if (idekey == "XDEBUG_ECLIPSE" || idekey == "netbeans-xdebug" || idekey == "macgdbp" || idekey == "PHPSTORM") | ||
{ | ||
$("#ide").val(idekey); | ||
$("#idekey").prop('disabled', true); | ||
$("#idekey").val($("#ide").val()); | ||
|
||
save_options(); | ||
} | ||
else | ||
{ | ||
$("#ide").val("null"); | ||
$("#idekey").prop('disabled', false); | ||
} | ||
}); | ||
$('#idekey').val(idekey); | ||
|
||
// Restore Trace Triggers | ||
var traceTrigger = localStorage["xdebugTraceTrigger"]; | ||
if (traceTrigger !== null) { | ||
$("#tracetrigger").val(traceTrigger); | ||
} else { | ||
$("#tracetrigger").val(null); | ||
} | ||
|
||
// Restore Profile Triggers | ||
var profileTrigger = localStorage["xdebugProfileTrigger"]; | ||
if (profileTrigger !== null) { | ||
$("#profiletrigger").val(profileTrigger); | ||
} else { | ||
$("#profiletrigger").val(null); | ||
} | ||
|
||
// Restore Disable Popup | ||
document.getElementById('disable-popup').checked = (localStorage.xdebugDisablePopup === '1') ? true : false; | ||
} | ||
|
||
$(function() | ||
{ | ||
$("#ide").change(function () | ||
{ | ||
if ($("#ide").val() != "null") | ||
{ | ||
$("#idekey").prop('disabled', true); | ||
$("#idekey").val($("#ide").val()); | ||
|
||
save_options(); | ||
} | ||
else | ||
{ | ||
$("#idekey").prop('disabled', false); | ||
} | ||
}); | ||
|
||
$("#idekey").change(save_options); | ||
$("#idekey").change(save_options); | ||
|
||
// Persist Disable Popup on onChange event | ||
$('#disable-popup').change(disablePopupChanged); | ||
// Persist Disable Popup on onChange event | ||
$('#disable-popup').change(disablePopupChanged); | ||
|
||
$('.save-button').click(save_options); | ||
$('.save-button').click(save_options); | ||
|
||
restore_options(); | ||
}); | ||
restore_options(); | ||
}); | ||
|
||
/** | ||
* Disable Popup checkbox changed, persist it. | ||
*/ | ||
function disablePopupChanged() { | ||
const $disablePopupSaved = $('.disable-popup-saved'); | ||
|
||
/** | ||
* Disable Popup checkbox changed, persist it. | ||
*/ | ||
function disablePopupChanged() { | ||
const $disablePopupSaved = $('.disable-popup-saved'); | ||
$disablePopupSaved.addClass('show'); | ||
|
||
$disablePopupSaved.addClass('show'); | ||
// First clear interval | ||
clearInterval(disablePopupTimeout); | ||
// Hide after 2 seconds | ||
disablePopupTimeout = setTimeout(() => $disablePopupSaved.removeClass('show'), 2000); | ||
|
||
// First clear interval | ||
clearInterval(disablePopupTimeout); | ||
// Hide after 2 seconds | ||
disablePopupTimeout = setTimeout(() => $disablePopupSaved.removeClass('show'), 2000); | ||
// Persist | ||
save_options(); | ||
} | ||
|
||
// Persist | ||
save_options(); | ||
} | ||
})(); |