@@ -82,7 +82,7 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
8282 extras . tpl . button ,
8383 [ "span" ,
8484 window_info . title ,
85- "class" , "resource-tree-window-label"
85+ "class" , "resource-tree-window-label"
8686 ]
8787 ] . concat ( extras . tpl . h2 ) ,
8888 ] . concat ( extras . tpl . li )
@@ -107,36 +107,39 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
107107 return document_resources . contains ( r . uid ) ;
108108 } ) ;
109109
110- var depth = d . depth ;
111- var extras = this . _expander_extras ( context , d . pivot_id , depth ) ;
112-
113- this . flat_list . push (
114- [ "li" ,
115- [ "h2" ,
116- extras . tpl . button ,
117- [ "span" ,
118- this . _get_short_distinguisher ( d . url ) ,
119- "class" , "resource-tree-document-label" ,
120- "data-tooltip" , " js-script-select" ,
121- "data-tooltip-text" , d . original_url
122- ] ,
123- " " ,
124- d . sameOrigin ? [ ] : [ "span" , d . url . host , "class" , "resource-domain" ] ,
125- " " ,
126- [ "span" ,
127- String ( resources . length ) ,
128- "class" , "resource-tree-count"
129- ]
130- ] . concat ( extras . tpl . h2 ) ,
131- ] . concat ( extras . tpl . li )
132- ) ;
133-
134- if ( ! extras . collapsed )
110+ if ( resources . length > 0 )
135111 {
136- if ( resources . length )
137- this . resource_groups ( context , resources , d ) ;
138-
139- this . documents ( context , d . windowID , d . documentID ) ;
112+ var depth = d . depth ;
113+ var extras = this . _expander_extras ( context , d . pivot_id , depth ) ;
114+
115+ this . flat_list . push (
116+ [ "li" ,
117+ [ "h2" ,
118+ extras . tpl . button ,
119+ [ "span" ,
120+ this . _get_short_distinguisher ( d . url ) ,
121+ "class" , "resource-tree-document-label" ,
122+ "data-tooltip" , " js-script-select" ,
123+ "data-tooltip-text" , d . original_url
124+ ] ,
125+ " " ,
126+ d . same_origin ? [ ] : [ "span" , d . url . host , "class" , "resource-domain" ] ,
127+ " " ,
128+ [ "span" ,
129+ String ( resources . length ) ,
130+ "class" , "resource-tree-count"
131+ ]
132+ ] . concat ( extras . tpl . h2 ) ,
133+ ] . concat ( extras . tpl . li )
134+ ) ;
135+
136+ if ( ! extras . collapsed )
137+ {
138+ if ( resources . length )
139+ this . resource_groups ( context , resources , d ) ;
140+
141+ this . documents ( context , d . windowID , d . documentID ) ;
142+ }
140143 }
141144 } ;
142145
@@ -179,7 +182,7 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
179182 this . resources ( context , resources , depth + 1 ) ;
180183 } ;
181184
182- this . resources = function ( context , resources , depth )
185+ this . resources = function ( context , resources , depth )
183186 {
184187 resources . forEach ( this . resource . bind ( this , context , depth ) ) ;
185188 } ;
@@ -209,7 +212,7 @@ window.templates.resource_tree || (window.templates.resource_tree = new function
209212 "data-tooltip-text" , r . url
210213 ] ,
211214 " " ,
212- r . sameOrigin ? [ ] : [ "span" , r . host , "class" , "resource-domain" ] ,
215+ r . same_origin ? [ ] : [ "span" , r . host , "class" , "resource-domain" ] ,
213216 "class" , "resource-tree-resource"
214217 ] ,
215218 "class" , ( context . selected_resource_uid == r . uid ? "resource-highlight" : "" ) ,
@@ -282,12 +285,12 @@ window.templates.resource_detail || (window.templates.resource_detail = new func
282285 {
283286 var info =
284287 {
285- "responseCode " : resource . responsecode + " " + cls . ResourceUtil . http_status_codes [ resource . responsecode ] ,
288+ "response_code " : resource . responsecode + " " + cls . ResourceUtil . http_status_codes [ resource . responsecode ] ,
286289 "size" : resource . size || resource . data . contentLength || resource . data . content . length ,
287- "characterEncoding " : resource . encoding || resource . data . characterEncoding
290+ "character_encoding " : resource . encoding || resource . data . characterEncoding
288291 } ;
289292
290- var isError = resource . responsecode && ! [ 200 , 304 ] . contains ( resource . responsecode ) ;
293+ var is_error = resource . responsecode && ! [ 200 , 304 ] . contains ( resource . responsecode ) ;
291294
292295 return (
293296 [ "div" ,
@@ -302,12 +305,12 @@ window.templates.resource_detail || (window.templates.resource_detail = new func
302305 "class" , "resource-detail-overview-url"
303306 ] ,
304307 [ "span" ,
305- ( isError ? info . responseCode + " - " : "" ) +
308+ ( is_error ? info . response_code + " - " : "" ) +
306309 ui_strings . S_RESOURCE_SENT_AND_GUESSED_TYPE
307310 . replace ( "%(SENT)s" , resource . data . mimeType )
308311 . replace ( "%(GUESSED)s" , resource . type ) +
309- ( info . characterEncoding && " " + ui_strings . S_RESOURCE_ENCODING . replace ( "%s" , info . characterEncoding ) ) ,
310- "class" , "resource-detail-overview-type" + ( isError ? " resource-detail-error" : "" )
312+ ( info . character_encoding && " " + ui_strings . S_RESOURCE_ENCODING . replace ( "%s" , info . character_encoding ) ) ,
313+ "class" , "resource-detail-overview-type" + ( is_error ? " resource-detail-error" : "" )
311314 ] ,
312315 [ "span" ,
313316 cls . ResourceUtil . bytes_to_human_readable ( info . size ) +
@@ -373,18 +376,24 @@ window.templates.resource_detail || (window.templates.resource_detail = new func
373376
374377 this . font = function ( resource )
375378 {
376- var font_face = "@font-face{font-family:\"resource-" + resource . uid + "\";src:url(\"" + resource . data . content . stringData + "\");}" ;
377- var inline_style = "font-size:64px;font-family:resource-" + resource . uid + ";" ;
379+ var font_family_name = "font" + resource . uid ;
380+ var style_sheet = "@font-face { font-family: \"" + font_family_name + "\";" +
381+ "src: url(\"" + resource . data . content . stringData + "\"); }" ;
382+ var inline_style = "font-size: 64px; font-family: " + font_family_name + ";" +
383+ "white-space: pre; word-break: break-all; " +
384+ "word-wrap: break-word; overflow-wrap: break-word;" ;
378385 var sample_string = "The quick brown fox jumps over the lazy dog 0123456789" ;
379386
380387 return (
381388 [ "object" ,
382389 [ "div" ,
383390 sample_string ,
384- [ "style" , font_face ] ,
391+ [ "style" , style_sheet ] ,
385392 "style" , inline_style ,
386393 ] ,
387- "data" , "data:text/html;base64," + btoa ( "<!doctype html><style>" + font_face + "</style><div contenteditable=\"true\" style=\"" + inline_style + "\">" + sample_string ) ,
394+ "data" , "data:text/html;base64," +
395+ btoa ( "<!doctype html><style>" + style_sheet + "</style>" +
396+ "<div contenteditable=\"true\" style=\"" + inline_style + "\">" + sample_string ) ,
388397 "class" , "resource-detail-font"
389398 ] ) ;
390399 } ;
0 commit comments