diff --git a/src/Tracy/Bar/assets/bar.js b/src/Tracy/Bar/assets/bar.js
index 3ce40b387..8900b0706 100644
--- a/src/Tracy/Bar/assets/bar.js
+++ b/src/Tracy/Bar/assets/bar.js
@@ -14,14 +14,12 @@ let defaults = {
AutoRefresh: true,
};
-function getOption(key)
-{
+function getOption(key) {
let global = window['Tracy' + key];
return global === undefined ? defaults[key] : global;
}
-class Panel
-{
+class Panel {
constructor(id) {
this.id = id;
this.elem = document.getElementById(this.id);
@@ -32,7 +30,7 @@ class Panel
init() {
let elem = this.elem;
- this.init = function() {};
+ this.init = function () {};
elem.innerHTML = elem.dataset.tracyContent;
Tracy.Dumper.init(Debug.layer);
evalScripts(elem);
@@ -45,7 +43,7 @@ class Panel
}
this.focus();
this.peekPosition = false;
- }
+ },
});
elem.addEventListener('mousedown', () => {
@@ -145,7 +143,7 @@ class Panel
offset.top += typeof window.screenTop === 'number' ? window.screenTop : (window.screenY + 50);
let win = window.open('', this.id.replace(/-/g, '_'), 'left=' + offset.left + ',top=' + offset.top
- + ',width=' + this.elem.offsetWidth + ',height=' + this.elem.offsetHeight + ',resizable=yes,scrollbars=yes');
+ + ',width=' + this.elem.offsetWidth + ',height=' + this.elem.offsetHeight + ',resizable=yes,scrollbars=yes');
if (!win) {
return false;
}
@@ -153,14 +151,14 @@ class Panel
let doc = win.document;
doc.write(''
+ ''
- + '
'
+ + '',
);
let meta = this.elem.parentElement.lastElementChild;
doc.body.innerHTML = ''
- + '' + this.elem.dataset.tracyContent + '
'
- + meta.outerHTML
- + '';
+ + '' + this.elem.dataset.tracyContent + '
'
+ + meta.outerHTML
+ + '';
evalScripts(doc.body);
if (this.elem.querySelector('h1')) {
doc.title = this.elem.querySelector('h1').textContent;
@@ -190,7 +188,7 @@ class Panel
reposition(deltaX, deltaY) {
let pos = getPosition(this.elem);
if (pos.width) { // is visible?
- setPosition(this.elem, {left: pos.left + (deltaX || 0), top: pos.top + (deltaY || 0)});
+ setPosition(this.elem, { left: pos.left + (deltaX || 0), top: pos.top + (deltaY || 0) });
if (this.is(Panel.RESIZED)) {
let size = getWindowSize();
this.elem.style.width = Math.min(size.width, pos.width) + 'px';
@@ -204,9 +202,9 @@ class Panel
let key = this.id.split(':')[0]; // remove :requestId part
let pos = getPosition(this.elem);
if (this.is(Panel.WINDOW)) {
- localStorage.setItem(key, JSON.stringify({window: true}));
+ localStorage.setItem(key, JSON.stringify({ window: true }));
} else if (pos.width) { // is visible?
- localStorage.setItem(key, JSON.stringify({right: pos.right, bottom: pos.bottom, width: pos.width, height: pos.height, zIndex: this.elem.style.zIndex - getOption('PanelZIndex'), resized: this.is(Panel.RESIZED)}));
+ localStorage.setItem(key, JSON.stringify({ right: pos.right, bottom: pos.bottom, width: pos.width, height: pos.height, zIndex: this.elem.style.zIndex - getOption('PanelZIndex'), resized: this.is(Panel.RESIZED) }));
} else {
localStorage.removeItem(key);
}
@@ -244,8 +242,7 @@ Panel.RESIZED = 'tracy-panel-resized';
Panel.zIndexCounter = 1;
-class Bar
-{
+class Bar {
init() {
this.id = 'tracy-debug-bar';
this.elem = document.getElementById(this.id);
@@ -255,7 +252,7 @@ class Bar
draggedClass: 'tracy-dragged',
stop: () => {
this.savePosition();
- }
+ },
});
this.elem.addEventListener('mousedown', (e) => {
@@ -267,7 +264,7 @@ class Bar
(new MutationObserver(() => {
this.restorePosition();
- })).observe(this.elem, {childList: true, characterData: true, subtree: true});
+ })).observe(this.elem, { childList: true, characterData: true, subtree: true });
}
@@ -318,7 +315,7 @@ class Bar
left: getOffset(link).left + getPosition(link).width + 4 - pos.width,
top: this.isAtTop()
? getOffset(this.elem).top + getPosition(this.elem).height + 4
- : getOffset(this.elem).top - pos.height - 4
+ : getOffset(this.elem).top - pos.height - 4,
});
panel.peekPosition = true;
}
@@ -359,7 +356,7 @@ class Bar
reposition(deltaX, deltaY) {
let pos = getPosition(this.elem);
if (pos.width) { // is visible?
- setPosition(this.elem, {left: pos.left + (deltaX || 0), top: pos.top + (deltaY || 0)});
+ setPosition(this.elem, { left: pos.left + (deltaX || 0), top: pos.top + (deltaY || 0) });
this.savePosition();
}
}
@@ -368,14 +365,14 @@ class Bar
savePosition() {
let pos = getPosition(this.elem);
if (pos.width) { // is visible?
- localStorage.setItem(this.id, JSON.stringify(this.isAtTop() ? {right: pos.right, top: pos.top} : {right: pos.right, bottom: pos.bottom}));
+ localStorage.setItem(this.id, JSON.stringify(this.isAtTop() ? { right: pos.right, top: pos.top } : { right: pos.right, bottom: pos.bottom }));
}
}
restorePosition() {
let pos = JSON.parse(localStorage.getItem(this.id));
- setPosition(this.elem, pos || {right: 0, bottom: 0});
+ setPosition(this.elem, pos || { right: 0, bottom: 0 });
this.savePosition();
}
@@ -387,8 +384,7 @@ class Bar
}
-class Debug
-{
+class Debug {
static init(content) {
Debug.bar = new Bar;
Debug.panels = {};
@@ -483,13 +479,13 @@ class Debug
}
let oldOpen = XMLHttpRequest.prototype.open;
- XMLHttpRequest.prototype.open = function() {
+ XMLHttpRequest.prototype.open = function () {
oldOpen.apply(this, arguments);
if (getOption('AutoRefresh') && new URL(arguments[1], location.origin).host === location.host) {
let reqId = Tracy.getAjaxHeader();
this.setRequestHeader('X-Tracy-Ajax', reqId);
- this.addEventListener('load', function() {
+ this.addEventListener('load', function () {
if (this.getAllResponseHeaders().match(/^X-Tracy-Ajax: 1/mi)) {
Debug.loadScript(baseUrl + '_tracy_bar=content-ajax.' + reqId + '&XDEBUG_SESSION_STOP=1&v=' + Math.random());
}
@@ -498,7 +494,7 @@ class Debug
};
let oldFetch = window.fetch;
- window.fetch = function(request, options) {
+ window.fetch = function (request, options) {
request = request instanceof Request ? request : new Request(request, options || {});
let reqId = request.headers.get('X-Tracy-Ajax');
@@ -548,14 +544,14 @@ function draggable(elem, options) {
let dE = document.documentElement, started, deltaX, deltaY, clientX, clientY;
options = options || {};
- let redraw = function () {
+ let redraw = () => {
if (dragging) {
- setPosition(elem, {left: clientX + deltaX, top: clientY + deltaY});
+ setPosition(elem, { left: clientX + deltaX, top: clientY + deltaY });
requestAnimationFrame(redraw);
}
};
- let onMove = function(e) {
+ let onMove = (e) => {
if (e.buttons === 0) {
return onEnd(e);
}
@@ -574,7 +570,7 @@ function draggable(elem, options) {
return false;
};
- let onEnd = function(e) {
+ let onEnd = (e) => {
if (started) {
if (options.draggedClass) {
elem.classList.remove(options.draggedClass);
@@ -591,7 +587,7 @@ function draggable(elem, options) {
return false;
};
- let onStart = function(e) {
+ let onStart = (e) => {
e.preventDefault();
e.stopPropagation();
@@ -631,9 +627,10 @@ function draggable(elem, options) {
// returns total offset for element
function getOffset(elem) {
- let res = {left: elem.offsetLeft, top: elem.offsetTop};
+ let res = { left: elem.offsetLeft, top: elem.offsetTop };
while (elem = elem.offsetParent) { // eslint-disable-line no-cond-assign
- res.left += elem.offsetLeft; res.top += elem.offsetTop;
+ res.left += elem.offsetLeft;
+ res.top += elem.offsetTop;
}
return res;
}
@@ -642,7 +639,7 @@ function getOffset(elem) {
function getWindowSize() {
return {
width: document.documentElement.clientWidth,
- height: document.compatMode === 'BackCompat' ? window.innerHeight : document.documentElement.clientHeight
+ height: document.compatMode === 'BackCompat' ? window.innerHeight : document.documentElement.clientHeight,
};
}
@@ -670,7 +667,7 @@ function getPosition(elem) {
right: win.width - elem.offsetWidth - elem.offsetLeft,
bottom: win.height - elem.offsetHeight - elem.offsetTop,
width: elem.offsetWidth,
- height: elem.offsetHeight
+ height: elem.offsetHeight,
};
}
diff --git a/src/Tracy/BlueScreen/assets/bluescreen.js b/src/Tracy/BlueScreen/assets/bluescreen.js
index 7a1b5b68f..c69cd5cf4 100644
--- a/src/Tracy/BlueScreen/assets/bluescreen.js
+++ b/src/Tracy/BlueScreen/assets/bluescreen.js
@@ -2,8 +2,7 @@
* This file is part of the Tracy (https://tracy.nette.org)
*/
-class BlueScreen
-{
+class BlueScreen {
static init(ajax) {
BlueScreen.globalInit();
@@ -51,7 +50,7 @@ class BlueScreen
window.addEventListener('scroll', stickyFooter);
- BlueScreen.globalInit = function() {};
+ BlueScreen.globalInit = function () {};
}
diff --git a/src/Tracy/Dumper/assets/dumper.js b/src/Tracy/Dumper/assets/dumper.js
index 9ee7246ca..1651935b7 100644
--- a/src/Tracy/Dumper/assets/dumper.js
+++ b/src/Tracy/Dumper/assets/dumper.js
@@ -15,8 +15,7 @@ const
HINT_CTRL = 'Ctrl-Click to open in editor',
HINT_ALT = 'Alt-Click to expand/collapse all child nodes';
-class Dumper
-{
+class Dumper {
static init(context) {
// full lazy
(context || document).querySelectorAll('[data-tracy-snapshot][data-tracy-dump]').forEach((pre) => { //
@@ -146,19 +145,19 @@ function build(data, repository, collapsed, parentIds, keyType) {
return createEl(null, null, [
createEl(
'span',
- {'class': 'tracy-dump-' + type.replace('ean', '')},
- [data + '']
- )
+ { class: 'tracy-dump-' + type.replace('ean', '') },
+ [data + ''],
+ ),
]);
} else if (type === 'string') {
data = {
string: data.replace(/&/g, '&').replace(/\'' + s + '\''}
+ { class: 'tracy-dump-string' },
+ { html: '\'' + s + '\'' },
),
]);
@@ -196,10 +195,10 @@ function build(data, repository, collapsed, parentIds, keyType) {
createEl(
'span',
{
- 'class': classes[typeof keyType === 'string' ? PROP_PRIVATE : keyType],
- 'title': typeof keyType === 'string' ? 'declared in ' + keyType : null,
+ class: classes[typeof keyType === 'string' ? PROP_PRIVATE : keyType],
+ title: typeof keyType === 'string' ? 'declared in ' + keyType : null,
},
- {html: s}
+ { html: s },
),
]);
}
@@ -208,15 +207,15 @@ function build(data, repository, collapsed, parentIds, keyType) {
if (count) {
let collapsed = count >= COLLAPSE_COUNT;
return createEl(null, null, [
- createEl('span', {'class': collapsed ? 'tracy-toggle tracy-collapsed' : 'tracy-toggle'}, ['string']),
+ createEl('span', { class: collapsed ? 'tracy-toggle tracy-collapsed' : 'tracy-toggle' }, ['string']),
'\n',
createEl(
'div',
{
- 'class': 'tracy-dump-string' + (collapsed ? ' tracy-collapsed' : ''),
- 'title': data.length + (data.bin ? ' bytes' : ' characters'),
+ class: 'tracy-dump-string' + (collapsed ? ' tracy-collapsed' : ''),
+ title: data.length + (data.bin ? ' bytes' : ' characters'),
},
- {html: '\'' + s + '\''}
+ { html: '\'' + s + '\'' },
),
]);
}
@@ -225,21 +224,21 @@ function build(data, repository, collapsed, parentIds, keyType) {
createEl(
'span',
{
- 'class': 'tracy-dump-string',
- 'title': data.length + (data.bin ? ' bytes' : ' characters'),
+ class: 'tracy-dump-string',
+ title: data.length + (data.bin ? ' bytes' : ' characters'),
},
- {html: '\'' + s + '\''}
+ { html: '\'' + s + '\'' },
),
]);
} else if (data.number) {
return createEl(null, null, [
- createEl('span', {'class': 'tracy-dump-number'}, [data.number])
+ createEl('span', { class: 'tracy-dump-number' }, [data.number]),
]);
} else if (data.text !== undefined) {
return createEl(null, null, [
- createEl('span', {class: 'tracy-dump-virtual'}, [data.text])
+ createEl('span', { class: 'tracy-dump-virtual' }, [data.text]),
]);
} else { // object || resource || array
@@ -250,17 +249,17 @@ function build(data, repository, collapsed, parentIds, keyType) {
let span = data.array !== undefined
? [
- createEl('span', {'class': 'tracy-dump-array'}, ['array']),
- ' (' + (data.length || data.items.length) + ')'
- ]
+ createEl('span', { class: 'tracy-dump-array' }, ['array']),
+ ' (' + (data.length || data.items.length) + ')',
+ ]
: [
- createEl('span', {
- 'class': data.object ? 'tracy-dump-object' : 'tracy-dump-resource',
- title: data.editor ? 'Declared in file ' + data.editor.file + ' on line ' + data.editor.line + (data.editor.url ? '\n' + HINT_CTRL : '') + '\n' + HINT_ALT : null,
- 'data-tracy-href': data.editor ? data.editor.url : null
- }, nameEl),
- ...(id ? [' ', createEl('span', {'class': 'tracy-dump-hash'}, [data.resource ? '@' + id.substr(1) : '#' + id])] : [])
- ];
+ createEl('span', {
+ 'class': data.object ? 'tracy-dump-object' : 'tracy-dump-resource',
+ 'title': data.editor ? 'Declared in file ' + data.editor.file + ' on line ' + data.editor.line + (data.editor.url ? '\n' + HINT_CTRL : '') + '\n' + HINT_ALT : null,
+ 'data-tracy-href': data.editor ? data.editor.url : null,
+ }, nameEl),
+ ...(id ? [' ', createEl('span', { class: 'tracy-dump-hash' }, [data.resource ? '@' + id.substr(1) : '#' + id])] : []),
+ ];
parentIds = parentIds ? parentIds.slice() : [];
let recursive = id && parentIds.indexOf(id) > -1;
@@ -272,7 +271,7 @@ function build(data, repository, collapsed, parentIds, keyType) {
}
collapsed = collapsed === true || data.collapsed || (data.items && data.items.length >= collapseCount);
- let toggle = createEl('span', {'class': collapsed ? 'tracy-toggle tracy-collapsed' : 'tracy-toggle'}, span);
+ let toggle = createEl('span', { class: collapsed ? 'tracy-toggle tracy-collapsed' : 'tracy-toggle' }, span);
return createEl(null, null, [
toggle,
@@ -285,7 +284,7 @@ function build(data, repository, collapsed, parentIds, keyType) {
function buildStruct(data, repository, toggle, collapsed, parentIds) {
if (Array.isArray(data)) {
- data = {items: data};
+ data = { items: data };
} else if (data.ref) {
parentIds = parentIds.slice();
@@ -295,11 +294,11 @@ function buildStruct(data, repository, toggle, collapsed, parentIds) {
let cut = data.items && data.length > data.items.length;
let type = data.object ? TYPE_OBJECT : data.resource ? TYPE_RESOURCE : TYPE_ARRAY;
- let div = createEl('div', {'class': collapsed ? 'tracy-collapsed' : null});
+ let div = createEl('div', { class: collapsed ? 'tracy-collapsed' : null });
if (collapsed) {
let handler;
- toggle.addEventListener('tracy-toggle', handler = function() {
+ toggle.addEventListener('tracy-toggle', handler = function () {
toggle.removeEventListener('tracy-toggle', handler);
createItems(div, data.items, type, repository, parentIds, null);
if (cut) {
@@ -351,7 +350,7 @@ function createItems(el, items, type, repository, parentIds, collapsed) {
createEl(el, null, [
build(key, null, null, null, type === TYPE_ARRAY ? TYPE_ARRAY : vis),
type === TYPE_ARRAY ? ' => ' : ': ',
- ...(ref ? [createEl('span', {'class': 'tracy-dump-hash'}, ['&' + ref]), ' '] : []),
+ ...(ref ? [createEl('span', { class: 'tracy-dump-hash' }, ['&' + ref]), ' '] : []),
tmp = build(val, repository, collapsed, parentIds),
tmp.lastElementChild.tagName === 'DIV' ? '' : '\n',
]);
@@ -370,7 +369,7 @@ function toggleChildren(cont, usedIds) {
Tracy.Toggle.toggle(el, false);
} else {
usedIds[id] = true;
- Tracy.Toggle.toggle(el, true, {usedIds: usedIds});
+ Tracy.Toggle.toggle(el, true, { usedIds: usedIds });
}
});
}
diff --git a/src/Tracy/assets/table-sort.js b/src/Tracy/assets/table-sort.js
index 02a524729..10e72c111 100644
--- a/src/Tracy/assets/table-sort.js
+++ b/src/Tracy/assets/table-sort.js
@@ -3,8 +3,7 @@
*/
// enables
-class TableSort
-{
+class TableSort {
static init() {
document.documentElement.addEventListener('click', (e) => {
if ((window.getSelection().type !== 'Range')
@@ -14,7 +13,7 @@ class TableSort
}
});
- TableSort.init = function() {};
+ TableSort.init = function () {};
}
static sort(tcell) {
@@ -22,16 +21,16 @@ class TableSort
let preserveFirst = !tcell.closest('thead') && !tcell.parentNode.querySelectorAll('td').length;
let asc = !(tbody.tracyAsc === tcell.cellIndex);
tbody.tracyAsc = asc ? tcell.cellIndex : null;
- let getText = (cell) => { return cell ? (cell.getAttribute('data-order') || cell.innerText) : ''; };
+ let getText = (cell) => cell ? (cell.getAttribute('data-order') || cell.innerText) : '';
Array.from(tbody.children)
.slice(preserveFirst ? 1 : 0)
.sort((a, b) => {
- return function(v1, v2) {
+ return (function (v1, v2) {
return v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2)
? v1 - v2
- : v1.toString().localeCompare(v2, undefined, {numeric: true, sensitivity: 'base'});
- }(getText((asc ? a : b).children[tcell.cellIndex]), getText((asc ? b : a).children[tcell.cellIndex]));
+ : v1.toString().localeCompare(v2, undefined, { numeric: true, sensitivity: 'base' });
+ }(getText((asc ? a : b).children[tcell.cellIndex]), getText((asc ? b : a).children[tcell.cellIndex])));
})
.forEach((tr) => { tbody.appendChild(tr); });
}
diff --git a/src/Tracy/assets/tabs.js b/src/Tracy/assets/tabs.js
index 9e0a55a60..8ec2fe7b2 100644
--- a/src/Tracy/assets/tabs.js
+++ b/src/Tracy/assets/tabs.js
@@ -3,8 +3,7 @@
*/
// enables .tracy-tabs, .tracy-tab-label, .tracy-tab-panel, .tracy-active
-class Tabs
-{
+class Tabs {
static init() {
document.documentElement.addEventListener('click', (e) => {
let label, context;
@@ -19,7 +18,7 @@ class Tabs
}
});
- Tabs.init = function() {};
+ Tabs.init = function () {};
}
static toggle(context, label) {
diff --git a/src/Tracy/assets/toggle.js b/src/Tracy/assets/toggle.js
index 1406f33ef..aabefb5f1 100644
--- a/src/Tracy/assets/toggle.js
+++ b/src/Tracy/assets/toggle.js
@@ -5,8 +5,7 @@
const MOVE_THRESHOLD = 100;
// enables or toggling
-class Toggle
-{
+class Toggle {
static init() {
let start;
document.documentElement.addEventListener('mousedown', (e) => {
@@ -25,7 +24,7 @@ class Toggle
e.stopImmediatePropagation();
}
});
- Toggle.init = function() {};
+ Toggle.init = function () {};
}
@@ -41,7 +40,7 @@ class Toggle
el.dispatchEvent(new CustomEvent('tracy-beforetoggle', {
bubbles: true,
- detail: {collapsed: !expand, originalEvent: e}
+ detail: { collapsed: !expand, originalEvent: e },
}));
if (!ref || ref === '#') {
@@ -60,7 +59,7 @@ class Toggle
el.dispatchEvent(new CustomEvent('tracy-toggle', {
bubbles: true,
- detail: {relatedTarget: dest, collapsed: !expand, originalEvent: e}
+ detail: { relatedTarget: dest, collapsed: !expand, originalEvent: e },
}));
}
@@ -91,7 +90,7 @@ class Toggle
window.addEventListener('pagehide', () => {
toggles = saved.map((el) => {
- let item = {path: [], text: el.textContent, expand: !el.classList.contains('tracy-collapsed')};
+ let item = { path: [], text: el.textContent, expand: !el.classList.contains('tracy-collapsed') };
do {
item.path.unshift(Array.from(el.parentNode.children).indexOf(el));
el = el.parentNode;