Skip to content

Commit b203915

Browse files
author
p01
committed
Review fixes
1 parent d9c8e06 commit b203915

File tree

10 files changed

+145
-146
lines changed

10 files changed

+145
-146
lines changed

src/client/client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,17 +612,17 @@ ui_framework.layouts.network_rough_layout =
612612

613613
ui_framework.layouts.resource_rough_layout =
614614
{
615-
dir:'h', width:1000,height:700,
615+
dir:'h', width: 1000, height: 700,
616616
children:
617617
[
618618
{
619619
name: 'resource_tree_panel',
620-
min_width:150,
621-
width: 300, tabbar: { id:'resources_tree', tabs: ['resource_tree_view'], is_hidden:true }
620+
min_width: 150,
621+
width: 300, tabbar: { id: 'resources_tree', tabs: ['resource_tree_view'], is_hidden: true }
622622
},
623623
{
624624
name: 'resource_detail_panel',
625-
width:600, tabbar:{id:'resource_detail',tabs:['resource_detail_view'], is_hidden:true }
625+
width: 600, tabbar: { id: 'resource_detail', tabs: ['resource_detail_view'], is_hidden: true }
626626
}
627627
]
628628
};

src/lib/functionprototype.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
* Throttle the function to run at most every delay ms
33
* @argument delay {Number}
44
*/
5-
Function.prototype.throttle || (Function.prototype.throttle = function( delay )
5+
Function.prototype.throttle || (Function.prototype.throttle = function(delay)
66
{
7-
var _callback = this;
8-
var _last = 0;
9-
var _timeout = 0;
10-
var _wrapped = function()
7+
var callback = this;
8+
var last = 0;
9+
var timeout = 0;
10+
var wrapped = function()
1111
{
12-
_timeout = 0;
13-
_last = Date.now();
14-
_callback();
12+
timeout = 0;
13+
last = Date.now();
14+
callback();
1515
};
1616

1717
return function()
1818
{
19-
if (_last < Date.now()-delay)
20-
_wrapped();
21-
else if (!_timeout)
22-
_timeout = setTimeout(_wrapped, delay);
19+
if (last < Date.now()-delay)
20+
wrapped();
21+
else if (!timeout)
22+
timeout = setTimeout(wrapped, delay);
2323
}
2424
});

src/network/network_service.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ cls.RequestContextPrototype = function()
581581
};
582582

583583
this.clear = function()
584-
{
584+
{
585585
var helpers = window.helpers;
586586
this._cleared_ids.extend(this.get_entries().map(helpers.prop("id")));
587587
this.after_clear = true;
@@ -1067,7 +1067,7 @@ cls.NetworkLoggerEntryPrototype = function()
10671067
// The first guess is made based on file extension. No response is needed for that.
10681068
// The current response is updated though, at the time it will be the correct one.
10691069
// Multiple responses can get different types in this way.
1070-
if (!cls || !cls.ResourceUtil || !cls.ResourceUtil.guess_type)
1070+
if (!cls || !cls.ResourceUtil)
10711071
return;
10721072

10731073
this.type = cls.ResourceUtil.guess_type(this.mime, this.extension);
@@ -1297,10 +1297,10 @@ cls.ResourceInfo = function(entry)
12971297
this.is_unloaded = entry.is_unloaded;
12981298
this.responsecode = entry.current_responsecode;
12991299

1300-
var lastResponse = entry.requests_responses && entry.requests_responses.last;
1301-
if (lastResponse && lastResponse.responsebody)
1300+
var last_response = entry.requests_responses && entry.requests_responses.last;
1301+
if (last_response && last_response.responsebody)
13021302
{
1303-
this.data = lastResponse.responsebody;
1303+
this.data = last_response.responsebody;
13041304
if (cls.ResourceUtil && cls.ResourceUtil.get_meta_data)
13051305
this.data.meta = cls.ResourceUtil.get_meta_data(this);
13061306
}

src/network/network_templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ templates.url_list_entry = function(selected, entry)
228228
return ["li",
229229
templates.icon(entry),
230230
["span",
231-
(entry.short_distinguisher || entry.human_url || entry.url || "NO URL").slice(0, 200),
231+
(entry.short_distinguisher || entry.human_ur).slice(0, 200),
232232
"class", "network-url",
233233
"data-tooltip", "network-url-list-tooltip"
234234
],

src/resource-manager/resource_detail_view.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
window.cls || (window.cls = {});
1+
"use strict";
2+
3+
window.cls || (window.cls = {});
24

35
/**
4-
* @constructor
6+
* @varructor
57
* @extends ViewBase
68
*/
79
cls.ResourceDetailView = function(id, name, container_class, html, default_handler, network_logger) {
@@ -17,11 +19,11 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
1719
this.createView = function(container)
1820
{
1921
if (this.resource && this.resource.data)
20-
container.clearAndRender( templates.resource_detail.formatting_data(this.resource) );
22+
container.clearAndRender(templates.resource_detail.formatting_data(this.resource));
2123

22-
container.clearAndRender( templates.resource_detail.update(this.resource) );
24+
container.clearAndRender(templates.resource_detail.update(this.resource));
2325
if(this.data)
24-
this.go_to_line(container,this.data);
26+
this.go_to_line(container, this.data);
2527

2628
this.text_search.update_search();
2729
};
@@ -31,10 +33,10 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
3133
container.clearAndRender(window.templates.disabled_view());
3234
};
3335

34-
const HIGHLIGHTED_LINE_CLASSNAME = 'highlighted-line';
35-
const RESOURCE_DETAIL_CONTAINER_CLASSNAME = 'resource-detail-container';
36-
const TEXT = document.TEXT_NODE;
37-
const ELE = document.ELEMENT_NODE;
36+
var HIGHLIGHTED_LINE_CLASSNAME = 'highlighted-line';
37+
var RESOURCE_DETAIL_CONTAINER_CLASSNAME = 'resource-detail-container';
38+
var TEXT = document.TEXT_NODE;
39+
var ELE = document.ELEMENT_NODE;
3840
this._span = document.createElement('span');
3941
this._span.textContent = ' ';
4042
this._line_count = 0;
@@ -45,8 +47,8 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
4547

4648
this._highlight_line = function(ele)
4749
{
48-
const CR = "\r";
49-
const LF = "\n";
50+
var CR = "\r";
51+
var LF = "\n";
5052
var child = ele.firstChild;
5153
while (child && !this._line_found)
5254
{
@@ -60,7 +62,6 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
6062
for (var pos = 0, len = value.length; pos < len; pos++)
6163
{
6264
var c = value.charAt(pos);
63-
// Linefeed recognition will not support Acorn BBC spooled text output
6465
if ((c == CR ) || (c == LF))
6566
{
6667
this._line_count++;
@@ -73,7 +74,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
7374
child.parentNode.normalize();
7475
if (this._tops.length < 2)
7576
{
76-
this._target_line+=1;
77+
this._target_line += 1;
7778
}
7879
else
7980
{
@@ -89,18 +90,16 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
8990

9091
var scroll_position = scroll_top + this._tops[0] - container_top;
9192
if (scroll_position <= this._root_ele.parentNode.clientHeight)
92-
{
93-
scroll_position-=64;
94-
}
93+
scroll_position -= 64;
94+
9595
this._root_ele.scrollTop = scroll_position;
9696
this._line_found = true;
9797
return;
9898
}
9999
}
100+
100101
if ((c == CR) && (value.charAt(pos+1) == LF))
101-
{
102102
pos++;
103-
}
104103
}
105104
}
106105
}
@@ -115,7 +114,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
115114
this._line_found = false;
116115
this._target_line = 0;
117116
this._tops = [];
118-
var _ele = container.querySelectorAll('.'+HIGHLIGHTED_LINE_CLASSNAME)[0];
117+
var _ele = container.querySelectorAll('.' + HIGHLIGHTED_LINE_CLASSNAME)[0];
119118
if (_ele)
120119
_ele.removeClass(HIGHLIGHTED_LINE_CLASSNAME)
121120
}
@@ -129,7 +128,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
129128
if (this._root_ele)
130129
{
131130
this.clear_line_highlight(this._root_ele)
132-
this._target_line = parseInt(data.lines[0]);
131+
this._target_line = Number(data.lines[0]);
133132
this._highlight_line(this._root_ele);
134133
}
135134
};
@@ -152,12 +151,13 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
152151
if (!this._show_resource(resource, data))
153152
this._show_resource_by_key(resource.uid, data);
154153
};
154+
155155
this._show_resource_by_key = function(key, data)
156156
{
157157
var service = this._service;
158158
var resource = service.get_resource(key) || service.get_resource_by_url(key);
159159

160-
var url = resource?resource.url:key;
160+
var url = resource ? resource.url : key;
161161

162162
if (!this._show_resource(resource, data))
163163
service.request_resource_data(url, this.show_resource.bind(this), data, resource);
@@ -170,7 +170,7 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
170170
else
171171
this._show_resource_by_key(key, data);
172172

173-
window.UI.instance.show_view( this.id );
173+
window.UI.instance.show_view(this.id);
174174
};
175175

176176
this._on_debug_context_selected_bound = function()
@@ -182,7 +182,6 @@ cls.ResourceDetailView = function(id, name, container_class, html, default_handl
182182
var messages = window.messages;
183183
messages.addListener('debug-context-selected', this._on_debug_context_selected_bound);
184184

185-
186185
this.init(id, name, container_class, html, default_handler);
187186
};
188187

@@ -210,7 +209,7 @@ cls.ResourceDetailView.create_ui_widgets = function()
210209

211210
var text_search = window.views.resource_detail_view.text_search = new TextSearch();
212211

213-
window.eventHandlers.input["resource-text-search"] = function(event, target)
212+
window.event_handlers.input["resource-text-search"] = function(event, target)
214213
{
215214
text_search.searchDelayed(target.value);
216215
};
@@ -248,8 +247,8 @@ cls.ResourceDetailView.create_ui_widgets = function()
248247
text_search.cleanup();
249248
}
250249

251-
window.messages.addListener("view-created", on_view_created);
252-
window.messages.addListener("view-destroyed", on_view_destroyed);
250+
window.messages.add_listener("view-created", on_view_created);
251+
window.messages.add_listener("view-destroyed", on_view_destroyed);
253252
}
254253

255254
cls.ResourceDetailView.prototype = ViewBase;

src/resource-manager/resource_display_broker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
window.cls = window.cls || {};
1+
"use strict";
2+
3+
window.cls = window.cls || {};
24

35
cls.ResourceDisplayBroker = function()
46
{

0 commit comments

Comments
 (0)