Skip to content

Commit 49762dc

Browse files
committed
sync classnames with server-based output
1 parent 6bb700b commit 49762dc

4 files changed

Lines changed: 54 additions & 19 deletions

File tree

src/js/DumpObject.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var logDumper = (function($, module){
55
// console.info('dumpObject', abs);
66
var html = '';
77
var title = (abs.phpDoc.summary + "\n\n" + abs.phpDoc.description).trim();
8-
var strClassName = '<b class="t_object-class" '+
9-
(title.length ? 'title="'+title+'" ' : "") +
10-
'>' + abs.className + ' object</b>';
8+
var strClassName = module.markupClassname(abs.className, "span", {
9+
title : title.length ? title : null
10+
})
1111
// var misc = '';
1212
var objToString = '';
1313
var toStringVal = '';
@@ -79,6 +79,28 @@ var logDumper = (function($, module){
7979
return html;
8080
}
8181

82+
module.markupClassname = function(str, tag, attribs) {
83+
var classname = str;
84+
var opMethod = '';
85+
var split = [];
86+
tag = tag || 'span';
87+
attribs = attribs || {};
88+
if (matches = str.match(/^(.+)(::|->)(.+)$/)) {
89+
classname = matches[1];
90+
opMethod = '<span class="t_operator">' + matches[2] + '</span>'
91+
+ '<span class="method-name">' + matches[3] + '</span>';
92+
}
93+
split = classname.split('\\');
94+
if (split.length > 1) {
95+
classname = split.pop();
96+
classname = '<span class="namespace">' + split.join('\\') + '\\</span>'
97+
+ classname;
98+
}
99+
attribs.class = 't_classname';
100+
return $('<'+tag+'/>', attribs).html(classname)[0].outerHTML
101+
+ opMethod;
102+
}
103+
82104
module.base64DecodeObj = function(abs) {
83105
var props = ["className","debug","extends","implements","type"],
84106
prop,

src/js/LogDumper.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ var logDumper = (function($, module) {
9595
} else if (type === "resource") {
9696
val = atob(val.value);
9797
} else if (type === "callable") {
98-
val = '<span class="t_type">callable</span>' +
99-
' ' + atob(val.values[0]) + '::' + atob(val.values[1]);
98+
val = '<span class="t_type">callable</span> ' +
99+
module.markupClassname(atob(val.values[0]) + '::' + atob(val.values[1]));
100100
}
101101
/*
102102
} else if (typeof val == "object") {
@@ -435,11 +435,9 @@ var logDumper = (function($, module) {
435435
collapsedClass = method == 'groupCollapsed'
436436
? 'collapsed'
437437
: 'expanded';
438-
if (!args.length) {
439-
// args[] = 'group';
440-
label = 'group';
441-
} else {
442-
label = atob(args.shift());
438+
label = atob(args.shift());
439+
if (meta.isMethodName) {
440+
label = module.markupClassname(label);
443441
}
444442
for (i = 0; i < args.length; i++) {
445443
args[i] = module.dump(args[i]);
@@ -609,7 +607,8 @@ var logDumper = (function($, module) {
609607
val = '<span class="t_keyword">Array</span>' +
610608
'<span class="t_punct">(</span>' + Object.keys(val).length + '<span class="t_punct">)</span>';
611609
} else if (type == 'object') {
612-
val = '<span class="t_object-class">' + atob(val['className']) + '</span>';
610+
// val = '<span class="t_classname">' + atob(val['className']) + '</span>';
611+
val = module.markupClassname(atob(val['className']));
613612
} else {
614613
val = module.dump(val);
615614
}

src/js/MethodTable.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ var logDumper = (function($, module){
1212
colLength,
1313
row,
1414
$table,
15-
$tr,
16-
$td;
15+
$tr;
1716
if (classname === undefined) {
1817
classname = "table-bordered";
1918
}
@@ -41,11 +40,9 @@ var logDumper = (function($, module){
4140
$tr = $('<tr><th scope="row" class="t_key '+classname+'">'+classAndInner.innerhtml+'</th></tr>');
4241
if (row.debug == module.ABSTRACTION && row.type == "object") {
4342
haveObj = true;
44-
$td = $('<td class="t_object-class"></td>').text(row.className);
45-
if (row.phpDoc.summary) {
46-
$td.prop("title", row.phpDoc.summary);
47-
}
48-
$tr.append($td);
43+
$tr.append(module.markupClassname(row.className, 'td', {
44+
title: row.phpDoc.summary ? row.phpDoc.summary : null
45+
}));
4946
}
5047
values = getValues(row, colKeys);
5148
for (vali = 0, colLength = values.length; vali < colLength; vali++) {

src/js/main.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ var events = (function(){
138138

139139
$(function() {
140140
var classCollapsed = 'glyphicon-chevron-down',
141-
classExpanded = 'glyphicon-chevron-up';
141+
classExpanded = 'glyphicon-chevron-up',
142+
timeoutHandler;
142143
// connection = getConnection(),
143144
// myWorker = new Worker('socketWorker.js');
144145
/*
@@ -192,6 +193,22 @@ $(function() {
192193
$("#body > .panel").not(".working").remove();
193194
});
194195

196+
$("body").on("mouseup", function(e){
197+
if (timeoutHandler) {
198+
e.preventDefault();
199+
clearInterval(timeoutHandler);
200+
timeoutHandler = null;
201+
}
202+
});
203+
204+
$(".clear").on("mousedown", function(e){
205+
timeoutHandler = setTimeout(() => {
206+
// has been long pressed (3 seconds)
207+
// clear all (incl working)
208+
$("#body > .panel").remove();
209+
}, 3000);
210+
});
211+
195212
$("body").on("shown.bs.collapse hidden.bs.collapse", ".panel-body", function(e) {
196213
var $icon = $(this).closest('.panel').find('.panel-heading .'+classCollapsed+', .panel-heading .'+classExpanded);
197214
$icon.toggleClass(classExpanded+' '+classCollapsed);

0 commit comments

Comments
 (0)