接受的答案仍然适用,但由于它略微降低了工具对我的可用性,我创建了以下解决方法,延迟所有调用,$(document).ready()
直到加载 Glimpse HUD。如果 Glimpse 关闭,则没有延迟。
// workaround for the problem when Glimpse does not correctly show AJAX requests that happen before the HUD is initialized
(function () {
var origDocumentReady = $.fn.ready;
var checkFinished = false;
$.fn.ready = function (delegate) {
var timerId = -1;
var counter = 0;
var check = function () {
if (counter++ > 50) //~2.5sec - if still not loaded, give up
checkFinished = true;
if (checkFinished || document.getElementById("glimpse-hud-section-input-ajax")) {
checkFinished = true;
window.clearInterval(timerId);
delegate();
}
}
origDocumentReady(function () {
if (!checkFinished && typeof glimpse === typeof undefined)
checkFinished = true;
if (checkFinished)
delegate();
else
timerId = window.setInterval(check, 50);
});
}
})();