|
282 | 282 | setPosition(panel.elem, {
|
283 | 283 | right: pos.right - getOffset(link).left + pos.width - getPosition(link).width - 4 + getOffset(panel.elem).left,
|
284 | 284 | bottom: _this.isAtTop()
|
285 |
| - ? getPosition(elem).bottom - pos.height - 4 |
| 285 | + ? getPosition(_this.elem).bottom - pos.height - 4 |
286 | 286 | : pos.bottom - getOffset(elem).top + pos.height + 4 + getOffset(panel.elem).top
|
287 | 287 | });
|
288 | 288 | }
|
|
313 | 313 | };
|
314 | 314 |
|
315 | 315 | Bar.prototype.savePosition = function() {
|
316 |
| - var pos = getPosition(document.getElementById(this.id)); |
317 |
| - localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom})); |
| 316 | + var pos = getPosition(this.elem), |
| 317 | + atTop = this.isAtTop(); |
| 318 | + localStorage.setItem(this.id, JSON.stringify({right: pos.right, bottom: pos.bottom + (atTop ? pos.height : 0), atTop: atTop})); |
318 | 319 | };
|
319 | 320 |
|
320 | 321 | Bar.prototype.restorePosition = function() {
|
321 | 322 | var pos = JSON.parse(localStorage.getItem(this.id));
|
322 | 323 | if (pos) {
|
323 |
| - setPosition(document.getElementById(this.id), pos); |
| 324 | + setPosition(this.elem, {right: pos.right, bottom: pos.bottom - (pos.atTop ? getPosition(this.elem).height : 0)}); |
324 | 325 | }
|
325 | 326 | };
|
326 | 327 |
|
|
375 | 376 | Debug.layer.insertAdjacentHTML('beforeend', content);
|
376 | 377 | evalScripts(Debug.layer);
|
377 | 378 | ajaxBar = document.getElementById('tracy-ajax-bar');
|
378 |
| - document.getElementById(Bar.prototype.id).appendChild(ajaxBar); |
| 379 | + var oldPos = getPosition(Debug.bar.elem); |
| 380 | + Debug.bar.elem.appendChild(ajaxBar); |
| 381 | + if (Debug.bar.isAtTop()) { |
| 382 | + setPosition(Debug.bar.elem, {right: oldPos.right, bottom: oldPos.bottom + oldPos.height - getPosition(Debug.bar.elem).height}); |
| 383 | + } |
379 | 384 |
|
380 | 385 | forEach(document.querySelectorAll('.tracy-panel'), function(panel) {
|
381 | 386 | if (!Debug.panels[panel.id]) {
|
|
0 commit comments