@@ -66,25 +66,23 @@ def inject(self, request, response):
66
66
css_path = request .app .router [STATIC_ROUTE_NAME ].url (
67
67
filename = 'css/toolbar_button.css' )
68
68
69
+ toolbar_css = toolbar_css_template % {'css_path' : css_path }
69
70
toolbar_html = toolbar_html_template % {
70
71
'button_style' : button_style ,
71
72
'css_path' : css_path ,
72
73
'toolbar_url' : toolbar_url }
73
74
74
75
toolbar_html = toolbar_html .encode (response .charset or 'utf-8' )
76
+ toolbar_css = toolbar_css .encode (response .charset or 'utf-8' )
77
+ response_html = replace_insensitive (
78
+ response_html , b'</head>' , toolbar_css + b'</head>' )
75
79
response .body = replace_insensitive (
76
80
response_html , b'</body>' ,
77
81
toolbar_html + b'</body>' )
82
+ toolbar_css_template = """\
83
+ <link rel="stylesheet" type="text/css" href="%(css_path)s">"""
78
84
79
85
toolbar_html_template = """\
80
- <script type="text/javascript">
81
- var fileref=document.createElement("link")
82
- fileref.setAttribute("rel", "stylesheet")
83
- fileref.setAttribute("type", "text/css")
84
- fileref.setAttribute("href", "%(css_path)s")
85
- document.getElementsByTagName("head")[0].appendChild(fileref)
86
- </script>
87
-
88
86
<div id="pDebug">
89
87
<div style="display: block; %(button_style)s" id="pDebugToolbarHandle">
90
88
<a title="Show Toolbar" id="pShowToolBarButton"
0 commit comments