1- window . cls || ( window . cls = { } ) ;
1+ "use strict" ;
2+
3+ window . cls || ( window . cls = { } ) ;
24
35/**
4- * @constructor
6+ * @varructor
57 * @extends ViewBase
68 */
79cls . 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
255254cls . ResourceDetailView . prototype = ViewBase ;
0 commit comments