rack-mini-profiler 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fa3a381694869814cd3d19c37f76c8c0a4bdddda170ed5199266a14e82e6c55
4
- data.tar.gz: c75b035729657117744511f53ced6c7fe76383d5b7ee253a3aa5af1a60b1364c
3
+ metadata.gz: b2764a7d1387cba061653cb89ddd4088ce5c4f83c8b094e0798378d45b3c7f8c
4
+ data.tar.gz: 5bd9f160a6b95d203f5a23226023a5f5f415e9eace61a3244858b9954e08f818
5
5
  SHA512:
6
- metadata.gz: 1198efbc5b26cc99d9a0e296fa82f45ea27eb590489324a9cca1bfd764e3994e88cfd4b7d9e16db251b08d570cc6571653f25b23d89bad730323ac3b5369d730
7
- data.tar.gz: 8ebb0d569583e67667b725443fd9349a4c9cd588320ec8d57ec49ab18a82a7e9a5e92cd36c346f7b94448844a6b37bc2874e354629e5c3fc8bb9d4c8714734d9
6
+ metadata.gz: 100fb4ccda742c715ea51c7c8b52c427bdc2a368feffadada41a00af108258e348f018336afb51f591a7df1866a4a15fce587d9edaf1f0fd71928f53511c96b6
7
+ data.tar.gz: 274f3325b95217b956e7b997a7098698e7697e9f5907305167244935ac82fcbe4cbe54e4adf7330967b01452f39be0e867576d61ae76a6096daa8dca97049b5d
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.1.0 2019-10-01
4
+
5
+ - [FEATURE] remove jQuery dependency, switch template library to dot.js
6
+ - [FEATURE] disable all sensitive debugging methods by default (env, memory profiling) can be enabled with enable_advanced_debugging_tools.
7
+ - [FIX] when conditionally requiring rack mini profiler, asset precompile could fail
8
+ - [FEATURE] `/rack-mini-profiler/requests` can be used to monitor all requests for apps that do not have a UI (like API apps)
9
+
3
10
  ## 1.0.2 2019-02-05
4
11
 
5
12
  - [FIX] correct script injection to work with Rails 6 and above
data/README.md CHANGED
@@ -23,8 +23,7 @@ We have decided to restructure our repository so there is a central UI repo and
23
23
 
24
24
  **WE NEED HELP.**
25
25
 
26
- - Setting up a build that reuses https://github.com/MiniProfiler/ui
27
- - Migrating the internal data structures [per the spec](https://github.com/MiniProfiler/ui)
26
+ - Help [triage issues](https://www.codetriage.com/miniprofiler/rack-mini-profiler) [![Open Source Helpers](https://www.codetriage.com/miniprofiler/rack-mini-profiler/badges/users.svg)](https://www.codetriage.com/miniprofiler/rack-mini-profiler)
28
27
 
29
28
  If you feel like taking on any of this start an issue and update us on your progress.
30
29
 
@@ -187,6 +186,13 @@ In those cases use:
187
186
  Rack::MiniProfiler.config.authorization_mode = :whitelist
188
187
  ```
189
188
 
189
+ When deciding to fully profile a page mini profiler consults with the `authorization_mode`
190
+
191
+ By default in production we attempt to set the authorization mode to `:whitelist` meaning that end user will only be able to see requests where somewhere `Rack::MiniProfiler.authorize_request` is invoked.
192
+
193
+ In development we run in the `:allow_all` authorization mode meaning every request is profiled and displayed to the end user.
194
+
195
+
190
196
  ## Configuration
191
197
 
192
198
  Various aspects of rack-mini-profiler's behavior can be configured when your app boots.
@@ -291,6 +297,9 @@ You need to inject the following in your SPA to load MiniProfiler's speed badge
291
297
 
292
298
  _Note:_ The GUID (`data-version` and the `?v=` parameter on the `src`) will change with each release of `rack_mini_profiler`. The MiniProfiler's speed badge will continue to work, although you will have to change the GUID to expire the script to fetch the most recent version.
293
299
 
300
+ #### Using MiniProfiler's built in route for apps without HTML responses
301
+ MiniProfiler also ships with a `/rack-mini-profiler/requests` route that displays the speed badge on a blank HTML page. This can be useful when profiling an application that does not render HTML.
302
+
294
303
  ### Configuration Options
295
304
 
296
305
  You can set configuration options using the configuration accessor on `Rack::MiniProfiler`.
@@ -310,18 +319,18 @@ skip_paths|`[]`|Paths that skip profiling.
310
319
  skip_schema_queries|Rails dev: `'true'`<br>Othwerwise: `'false'`|`'true'` to log schema queries.
311
320
  auto_inject|`true`|`true` to inject the miniprofiler script in the page.
312
321
  backtrace_ignores|`[]`|Regexes of lines to be removed from backtraces.
313
- backtrace_includes|Rails: `[/^\/?(app|config|lib|test)/]`<br>Rack: `[]`|Regexes of lines to keep in backtraces.
322
+ backtrace_includes|Rails: `[/^\/?(app\|config\|lib\|test)/]`<br>Rack: `[]`|Regexes of lines to keep in backtraces.
314
323
  backtrace_remove|rails: `Rails.root`<br>Rack: `nil`|A string or regex to remove part of each line in the backtrace.
315
324
  toggle_shortcut|Alt+P|Keyboard shortcut to toggle the mini_profiler's visibility. See [jquery.hotkeys](https://github.com/jeresig/jquery.hotkeys).
316
325
  start_hidden|`false`|`false` to make mini_profiler visible on page load.
317
326
  backtrace_threshold_ms|`0`|Minimum SQL query elapsed time before a backtrace is recorded.
318
327
  flamegraph_sample_rate|`0.5`|How often to capture stack traces for flamegraphs in milliseconds.
319
- disable_env_dump|`false`|`true` disables `?pp=env`, which prevents sending ENV vars over HTTP.
320
328
  base_url_path|`'/mini-profiler-resources/'`|Path for assets; added as a prefix when naming assets and sought when responding to requests.
321
329
  collapse_results|`true`|If multiple timing results exist in a single page, collapse them till clicked.
322
330
  max_traces_to_show|20|Maximum number of mini profiler timing blocks to show on one page
323
331
  html_container|`body`|The HTML container (as a jQuery selector) to inject the mini_profiler UI into
324
332
  show_total_sql_count|`false`|Displays the total number of SQL executions.
333
+ enable_advanced_debugging_tools|`false`|Enables sensitive debugging tools that can be used via the UI. In production we recommend keeping this disabled as memory and environment debugging tools can expose contents of memory that may contain passwords.
325
334
 
326
335
  ### Custom middleware ordering (required if using `Rack::Deflate` with Rails)
327
336
 
@@ -0,0 +1,2 @@
1
+ /* Laura Doktorova https://github.com/olado/doT */
2
+ !function(){"use strict";function e(n,t,r){return("string"==typeof t?t:t.toString()).replace(n.define||a,function(e,t,o,a){return 0===t.indexOf("def.")&&(t=t.substring(4)),t in r||(":"===o?(n.defineParams&&a.replace(n.defineParams,function(e,n,o){r[t]={arg:n,text:o}}),t in r||(r[t]=a)):new Function("def","def['"+t+"']="+a)(r)),""}).replace(n.use||a,function(t,o){n.useParams&&(o=o.replace(n.useParams,function(e,n,t,o){if(r[t]&&r[t].arg&&o){var a=(t+":"+o).replace(/'|\\/g,"_");return r.__exp=r.__exp||{},r.__exp[a]=r[t].text.replace(new RegExp("(^|[^\\w$])"+r[t].arg+"([^\\w$])","g"),"$1"+o+"$2"),n+"def.__exp['"+a+"']"}}));var a=new Function("def","return "+o)(r);return a?e(n,a,r):a})}function n(e){return e.replace(/\\('|\\)/g,"$1").replace(/[\r\t\n]/g," ")}var t,r={engine:"doT",version:"1.1.1",templateSettings:{evaluate:/\{\{([\s\S]+?(\}?)+)\}\}/g,interpolate:/\{\{=([\s\S]+?)\}\}/g,encode:/\{\{!([\s\S]+?)\}\}/g,use:/\{\{#([\s\S]+?)\}\}/g,useParams:/(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,define:/\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,defineParams:/^\s*([\w$]+):([\s\S]+)/,conditional:/\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,iterate:/\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,varname:"it",strip:!0,append:!0,selfcontained:!1,doNotSkipEncoded:!1},template:void 0,compile:void 0,log:!0};r.encodeHTMLSource=function(e){var n={"&":"&#38;","<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","/":"&#47;"},t=e?/[&<>"'\/]/g:/&(?!#?\w+;)|<|>|"|'|\//g;return function(e){return e?e.toString().replace(t,function(e){return n[e]||e}):""}},t=function(){return this||(0,eval)("this")}(),"undefined"!=typeof module&&module.exports?module.exports=r:"function"==typeof define&&define.amd?define(function(){return r}):t.doT=r;var o={append:{start:"'+(",end:")+'",startencode:"'+encodeHTML("},split:{start:"';out+=(",end:");out+='",startencode:"';out+=encodeHTML("}},a=/$^/;r.template=function(c,i,u){i=i||r.templateSettings;var d,s,p=i.append?o.append:o.split,l=0,f=i.use||i.define?e(i,c,u||{}):c;f=("var out='"+(i.strip?f.replace(/(^|\r|\n)\t* +| +\t*(\r|\n|$)/g," ").replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g,""):f).replace(/'|\\/g,"\\$&").replace(i.interpolate||a,function(e,t){return p.start+n(t)+p.end}).replace(i.encode||a,function(e,t){return d=!0,p.startencode+n(t)+p.end}).replace(i.conditional||a,function(e,t,r){return t?r?"';}else if("+n(r)+"){out+='":"';}else{out+='":r?"';if("+n(r)+"){out+='":"';}out+='"}).replace(i.iterate||a,function(e,t,r,o){return t?(l+=1,s=o||"i"+l,t=n(t),"';var arr"+l+"="+t+";if(arr"+l+"){var "+r+","+s+"=-1,l"+l+"=arr"+l+".length-1;while("+s+"<l"+l+"){"+r+"=arr"+l+"["+s+"+=1];out+='"):"';} } out+='"}).replace(i.evaluate||a,function(e,t){return"';"+n(t)+"out+='"})+"';return out;").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/(\s|;|\}|^|\{)out\+='';/g,"$1").replace(/\+''/g,""),d&&(i.selfcontained||!t||t._encodeHTML||(t._encodeHTML=r.encodeHTMLSource(i.doNotSkipEncoded)),f="var encodeHTML = typeof _encodeHTML !== 'undefined' ? _encodeHTML : ("+r.encodeHTMLSource.toString()+"("+(i.doNotSkipEncoded||"")+"));"+f);try{return new Function(i.varname,f)}catch(e){throw"undefined"!=typeof console&&console.log("Could not create a template function: "+f),e}},r.compile=function(e,n){return r.template(e,null,n)}}();
@@ -1,9 +1,29 @@
1
1
  @charset "UTF-8";
2
- .profiler-result, .profiler-queries {
2
+ .profiler-result,
3
+ .profiler-queries {
3
4
  color: #555;
4
5
  line-height: 1;
5
6
  font-size: 12px; }
6
- .profiler-result pre, .profiler-result code, .profiler-result label, .profiler-result table, .profiler-result tbody, .profiler-result thead, .profiler-result tfoot, .profiler-result tr, .profiler-result th, .profiler-result td, .profiler-queries pre, .profiler-queries code, .profiler-queries label, .profiler-queries table, .profiler-queries tbody, .profiler-queries thead, .profiler-queries tfoot, .profiler-queries tr, .profiler-queries th, .profiler-queries td {
7
+ .profiler-result pre,
8
+ .profiler-result code,
9
+ .profiler-result label,
10
+ .profiler-result table,
11
+ .profiler-result tbody,
12
+ .profiler-result thead,
13
+ .profiler-result tfoot,
14
+ .profiler-result tr,
15
+ .profiler-result th,
16
+ .profiler-result td,
17
+ .profiler-queries pre,
18
+ .profiler-queries code,
19
+ .profiler-queries label,
20
+ .profiler-queries table,
21
+ .profiler-queries tbody,
22
+ .profiler-queries thead,
23
+ .profiler-queries tfoot,
24
+ .profiler-queries tr,
25
+ .profiler-queries th,
26
+ .profiler-queries td {
7
27
  margin: 0;
8
28
  padding: 0;
9
29
  border: 0;
@@ -13,15 +33,21 @@
13
33
  background-color: transparent;
14
34
  overflow: visible;
15
35
  max-height: none; }
16
- .profiler-result table, .profiler-queries table {
36
+ .profiler-result table,
37
+ .profiler-queries table {
17
38
  border-collapse: collapse;
18
39
  border-spacing: 0; }
19
- .profiler-result a, .profiler-result a:hover, .profiler-queries a, .profiler-queries a:hover {
40
+ .profiler-result a,
41
+ .profiler-result a:hover,
42
+ .profiler-queries a,
43
+ .profiler-queries a:hover {
20
44
  cursor: pointer;
21
- color: #0077CC; }
22
- .profiler-result a, .profiler-queries a {
45
+ color: #0077cc; }
46
+ .profiler-result a,
47
+ .profiler-queries a {
23
48
  text-decoration: none; }
24
- .profiler-result a:hover, .profiler-queries a:hover {
49
+ .profiler-result a:hover,
50
+ .profiler-queries a:hover {
25
51
  text-decoration: underline; }
26
52
 
27
53
  .profiler-result {
@@ -38,9 +64,13 @@
38
64
  color: #767676; }
39
65
  .profiler-result .profiler-trivial {
40
66
  display: none; }
41
- .profiler-result .profiler-trivial td, .profiler-result .profiler-trivial td * {
67
+ .profiler-result .profiler-trivial td,
68
+ .profiler-result .profiler-trivial td * {
42
69
  color: #767676 !important; }
43
- .profiler-result pre, .profiler-result code, .profiler-result .profiler-number, .profiler-result .profiler-unit {
70
+ .profiler-result pre,
71
+ .profiler-result code,
72
+ .profiler-result .profiler-number,
73
+ .profiler-result .profiler-unit {
44
74
  font-family: Consolas, monospace, serif; }
45
75
  .profiler-result .profiler-number {
46
76
  color: #111; }
@@ -54,7 +84,8 @@
54
84
  background-color: #fff;
55
85
  color: #767676;
56
86
  text-align: right; }
57
- .profiler-result .profiler-timings th, .profiler-result .profiler-timings td {
87
+ .profiler-result .profiler-timings th,
88
+ .profiler-result .profiler-timings td {
58
89
  white-space: nowrap; }
59
90
  .profiler-result .profiler-timings .profiler-duration-with-children {
60
91
  display: none; }
@@ -63,8 +94,9 @@
63
94
  text-align: right; }
64
95
  .profiler-result .profiler-timings .profiler-indent {
65
96
  letter-spacing: 4px; }
66
- .profiler-result .profiler-timings .profiler-queries-show .profiler-number, .profiler-result .profiler-timings .profiler-queries-show .profiler-unit {
67
- color: #0077CC; }
97
+ .profiler-result .profiler-timings .profiler-queries-show .profiler-number,
98
+ .profiler-result .profiler-timings .profiler-queries-show .profiler-unit {
99
+ color: #0077cc; }
68
100
  .profiler-result .profiler-timings .profiler-queries-duration {
69
101
  padding-left: 6px; }
70
102
  .profiler-result .profiler-timings .profiler-percent-in-sql {
@@ -89,13 +121,15 @@
89
121
  .profiler-result .profiler-queries tbody tr {
90
122
  border-bottom: 1px solid #f1f1f1; }
91
123
  .profiler-result .profiler-queries tr {
92
- background-color: #FFF; }
124
+ background-color: #fff; }
125
+ .profiler-result .profiler-queries tr.higlight-animate {
126
+ animation: highlight-in 3s; }
93
127
  .profiler-result .profiler-queries tr.slow {
94
- background-color: #FEE; }
128
+ background-color: #fee; }
95
129
  .profiler-result .profiler-queries tr.very-slow {
96
- background-color: #FDD; }
130
+ background-color: #fdd; }
97
131
  .profiler-result .profiler-queries tr.very-very-slow {
98
- background-color: #FCC; }
132
+ background-color: #fcc; }
99
133
  .profiler-result .profiler-queries pre {
100
134
  font-family: Consolas, monospace, serif;
101
135
  white-space: pre-wrap; }
@@ -110,12 +144,14 @@
110
144
  text-align: left; }
111
145
  .profiler-result .profiler-queries td:last-child {
112
146
  padding-right: 25px; }
113
- .profiler-result .profiler-queries .profiler-since-start, .profiler-result .profiler-queries .profiler-duration {
147
+ .profiler-result .profiler-queries .profiler-since-start,
148
+ .profiler-result .profiler-queries .profiler-duration {
114
149
  text-align: right; }
115
150
  .profiler-result .profiler-queries .profiler-info div {
116
151
  text-align: right;
117
152
  margin-bottom: 5px; }
118
- .profiler-result .profiler-queries .profiler-gap-info, .profiler-result .profiler-queries .profiler-gap-info td {
153
+ .profiler-result .profiler-queries .profiler-gap-info,
154
+ .profiler-result .profiler-queries .profiler-gap-info td {
119
155
  background-color: #ccc; }
120
156
  .profiler-result .profiler-queries .profiler-gap-info .profiler-unit {
121
157
  color: #777; }
@@ -147,9 +183,15 @@
147
183
  color: blue; }
148
184
  .profiler-result .profiler-queries .dec {
149
185
  color: purple; }
150
- .profiler-result .profiler-warning, .profiler-result .profiler-warning *, .profiler-result .profiler-warning .profiler-queries-show, .profiler-result .profiler-warning .profiler-queries-show .profiler-unit {
186
+ .profiler-result .profiler-warning,
187
+ .profiler-result .profiler-warning *,
188
+ .profiler-result .profiler-warning .profiler-queries-show,
189
+ .profiler-result .profiler-warning .profiler-queries-show .profiler-unit {
151
190
  color: #f00; }
152
- .profiler-result .profiler-warning:hover, .profiler-result .profiler-warning *:hover, .profiler-result .profiler-warning .profiler-queries-show:hover, .profiler-result .profiler-warning .profiler-queries-show .profiler-unit:hover {
191
+ .profiler-result .profiler-warning:hover,
192
+ .profiler-result .profiler-warning *:hover,
193
+ .profiler-result .profiler-warning .profiler-queries-show:hover,
194
+ .profiler-result .profiler-warning .profiler-queries-show .profiler-unit:hover {
153
195
  color: #f00; }
154
196
  .profiler-result .profiler-nuclear {
155
197
  color: #f00;
@@ -165,39 +207,52 @@
165
207
  top: 0px; }
166
208
  .profiler-results.profiler-top.profiler-left {
167
209
  left: 0px; }
168
- .profiler-results.profiler-top.profiler-left.profiler-no-controls .profiler-totals, .profiler-results.profiler-top.profiler-left.profiler-no-controls .profiler-result:last-child .profiler-button, .profiler-results.profiler-top.profiler-left .profiler-controls {
210
+ .profiler-results.profiler-top.profiler-left.profiler-no-controls .profiler-totals,
211
+ .profiler-results.profiler-top.profiler-left.profiler-no-controls .profiler-result:last-child .profiler-button,
212
+ .profiler-results.profiler-top.profiler-left .profiler-controls {
169
213
  -webkit-border-bottom-right-radius: 10px;
170
214
  -moz-border-radius-bottomright: 10px;
171
215
  border-bottom-right-radius: 10px; }
172
- .profiler-results.profiler-top.profiler-left .profiler-button, .profiler-results.profiler-top.profiler-left .profiler-controls {
216
+ .profiler-results.profiler-top.profiler-left .profiler-button,
217
+ .profiler-results.profiler-top.profiler-left .profiler-controls {
173
218
  border-right: 1px solid #888; }
174
219
  .profiler-results.profiler-top.profiler-right {
175
220
  right: 0px; }
176
- .profiler-results.profiler-top.profiler-right.profiler-no-controls .profiler-totals, .profiler-results.profiler-top.profiler-right.profiler-no-controls .profiler-result:last-child .profiler-button, .profiler-results.profiler-top.profiler-right .profiler-controls {
221
+ .profiler-results.profiler-top.profiler-right.profiler-no-controls .profiler-totals,
222
+ .profiler-results.profiler-top.profiler-right.profiler-no-controls .profiler-result:last-child .profiler-button,
223
+ .profiler-results.profiler-top.profiler-right .profiler-controls {
177
224
  -webkit-border-bottom-left-radius: 10px;
178
225
  -moz-border-radius-bottomleft: 10px;
179
226
  border-bottom-left-radius: 10px; }
180
- .profiler-results.profiler-top.profiler-right .profiler-button, .profiler-results.profiler-top.profiler-right .profiler-controls {
227
+ .profiler-results.profiler-top.profiler-right .profiler-button,
228
+ .profiler-results.profiler-top.profiler-right .profiler-controls {
181
229
  border-left: 1px solid #888; }
182
230
  .profiler-results.profiler-bottom {
183
231
  bottom: 0px; }
184
232
  .profiler-results.profiler-bottom.profiler-left {
185
233
  left: 0px; }
186
- .profiler-results.profiler-bottom.profiler-left.profiler-no-controls .profiler-totals, .profiler-results.profiler-bottom.profiler-left.profiler-no-controls .profiler-result:first-child .profiler-button, .profiler-results.profiler-bottom.profiler-left .profiler-controls {
234
+ .profiler-results.profiler-bottom.profiler-left.profiler-no-controls .profiler-totals,
235
+ .profiler-results.profiler-bottom.profiler-left.profiler-no-controls .profiler-result:first-child .profiler-button,
236
+ .profiler-results.profiler-bottom.profiler-left .profiler-controls {
187
237
  -webkit-border-top-right-radius: 10px;
188
238
  -moz-border-radius-topright: 10px;
189
239
  border-top-right-radius: 10px; }
190
- .profiler-results.profiler-bottom.profiler-left .profiler-button, .profiler-results.profiler-bottom.profiler-left .profiler-controls {
240
+ .profiler-results.profiler-bottom.profiler-left .profiler-button,
241
+ .profiler-results.profiler-bottom.profiler-left .profiler-controls {
191
242
  border-right: 1px solid #888; }
192
243
  .profiler-results.profiler-bottom.profiler-right {
193
244
  right: 0px; }
194
- .profiler-results.profiler-bottom.profiler-right.profiler-no-controls .profiler-totals, .profiler-results.profiler-bottom.profiler-right.profiler-no-controls .profiler-result:first-child .profiler-button, .profiler-results.profiler-bottom.profiler-right .profiler-controls {
245
+ .profiler-results.profiler-bottom.profiler-right.profiler-no-controls .profiler-totals,
246
+ .profiler-results.profiler-bottom.profiler-right.profiler-no-controls .profiler-result:first-child .profiler-button,
247
+ .profiler-results.profiler-bottom.profiler-right .profiler-controls {
195
248
  -webkit-border-bottom-top-radius: 10px;
196
249
  -moz-border-radius-topleft: 10px;
197
250
  border-top-left-radius: 10px; }
198
- .profiler-results.profiler-bottom.profiler-right .profiler-button, .profiler-results.profiler-bottom.profiler-right .profiler-controls {
251
+ .profiler-results.profiler-bottom.profiler-right .profiler-button,
252
+ .profiler-results.profiler-bottom.profiler-right .profiler-controls {
199
253
  border-left: 1px solid #888; }
200
- .profiler-results .profiler-button, .profiler-results .profiler-controls {
254
+ .profiler-results .profiler-button,
255
+ .profiler-results .profiler-controls {
201
256
  display: none;
202
257
  z-index: 2147483640;
203
258
  border-bottom: 1px solid #888;
@@ -205,12 +260,17 @@
205
260
  padding: 4px 7px;
206
261
  text-align: right;
207
262
  cursor: pointer; }
208
- .profiler-results .profiler-button.profiler-button-active, .profiler-results .profiler-controls.profiler-button-active {
263
+ .profiler-results .profiler-button.profiler-button-active,
264
+ .profiler-results .profiler-controls.profiler-button-active {
209
265
  background-color: maroon; }
210
- .profiler-results .profiler-button.profiler-button-active .profiler-number, .profiler-results .profiler-button.profiler-button-active .profiler-nuclear, .profiler-results .profiler-controls.profiler-button-active .profiler-number, .profiler-results .profiler-controls.profiler-button-active .profiler-nuclear {
266
+ .profiler-results .profiler-button.profiler-button-active .profiler-number,
267
+ .profiler-results .profiler-button.profiler-button-active .profiler-nuclear,
268
+ .profiler-results .profiler-controls.profiler-button-active .profiler-number,
269
+ .profiler-results .profiler-controls.profiler-button-active .profiler-nuclear {
211
270
  color: #fff;
212
271
  font-weight: bold; }
213
- .profiler-results .profiler-button.profiler-button-active .profiler-unit, .profiler-results .profiler-controls.profiler-button-active .profiler-unit {
272
+ .profiler-results .profiler-button.profiler-button-active .profiler-unit,
273
+ .profiler-results .profiler-controls.profiler-button-active .profiler-unit {
214
274
  color: #fff;
215
275
  font-weight: normal; }
216
276
  .profiler-results .profiler-totals .profiler-reqs {
@@ -258,7 +318,8 @@
258
318
  display: none; }
259
319
  .profiler-results .profiler-popup .profiler-info .profiler-server-time {
260
320
  font-size: 95%; }
261
- .profiler-results .profiler-popup .profiler-timings th, .profiler-results .profiler-popup .profiler-timings td {
321
+ .profiler-results .profiler-popup .profiler-timings th,
322
+ .profiler-results .profiler-popup .profiler-timings td {
262
323
  padding-left: 6px;
263
324
  padding-right: 6px; }
264
325
  .profiler-results .profiler-popup .profiler-timings th {
@@ -313,7 +374,8 @@
313
374
  padding-right: 20px;
314
375
  font-size: 80%;
315
376
  color: #888; }
316
- .profiler-result-full .profiler-result .profiler-popup .profiler-timings td, .profiler-result-full .profiler-result .profiler-popup .profiler-timings th {
377
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings td,
378
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings th {
317
379
  padding-left: 8px;
318
380
  padding-right: 8px; }
319
381
  .profiler-result-full .profiler-result .profiler-popup .profiler-timings th {
@@ -339,3 +401,9 @@
339
401
  .profiler-result-full .profiler-result .profiler-queries .profiler-info div {
340
402
  text-align: right;
341
403
  margin-bottom: 5px; }
404
+
405
+ @keyframes highlight-in {
406
+ 0% {
407
+ background: #ffffbb; }
408
+ 100% {
409
+ background: #fff; } }
@@ -1,1103 +1,2286 @@
1
1
  "use strict";
2
- var MiniProfiler = (function () {
3
- var $;
4
-
5
- var options,
6
- container,
7
- controls,
8
- fetchedIds = [],
9
- fetchingIds = [], // so we never pull down a profiler twice
10
- ajaxStartTime,
11
- totalsControl,
12
- reqs = 0,
13
- expandedResults = false,
14
- totalTime = 0,
15
- totalSqlCount = 0
16
- ;
17
-
18
- var hasLocalStorage = function (keyPrefix) {
19
- try {
20
- // attempt to save to localStorage as Safari private windows will throw an error
21
- localStorage[keyPrefix+'-test'] = '1';
22
- localStorage.removeItem(keyPrefix+'-test');
23
- return 'localStorage' in window && window['localStorage'] !== null ;
24
- } catch (e) {
25
- return false;
2
+ var MiniProfiler = (function() {
3
+ var options,
4
+ container,
5
+ controls,
6
+ fetchedIds = [],
7
+ fetchingIds = [], // so we never pull down a profiler twice
8
+ ajaxStartTime,
9
+ totalsControl,
10
+ reqs = 0,
11
+ expandedResults = false,
12
+ totalTime = 0,
13
+ totalSqlCount = 0;
14
+ var hasLocalStorage = function(keyPrefix) {
15
+ try {
16
+ // attempt to save to localStorage as Safari private windows will throw an error
17
+ localStorage[keyPrefix + "-test"] = "1";
18
+ localStorage.removeItem(keyPrefix + "-test");
19
+ return "localStorage" in window && window["localStorage"] !== null;
20
+ } catch (e) {
21
+ return false;
22
+ }
23
+ };
24
+
25
+ var getVersionedKey = function(keyPrefix) {
26
+ return keyPrefix + "-" + options.version;
27
+ };
28
+
29
+ var save = function(keyPrefix, value) {
30
+ if (!hasLocalStorage(keyPrefix)) {
31
+ return;
32
+ }
33
+
34
+ // clear old keys with this prefix, if any
35
+ for (var i = 0; i < localStorage.length; i++) {
36
+ if ((localStorage.key(i) || "").indexOf(keyPrefix) > -1) {
37
+ localStorage.removeItem(localStorage.key(i));
38
+ }
39
+ }
40
+
41
+ // save under this version
42
+ localStorage[getVersionedKey(keyPrefix)] = value;
43
+ };
44
+
45
+ var load = function(keyPrefix) {
46
+ if (!hasLocalStorage(keyPrefix)) {
47
+ return null;
48
+ }
49
+
50
+ return localStorage[getVersionedKey(keyPrefix)];
51
+ };
52
+
53
+ var compileTemplates = function(data) {
54
+ var element = document.createElement("DIV");
55
+ element.innerHTML = data;
56
+ var templates = {};
57
+ var children = element.children;
58
+ for (var i = 0; i < children.length; i++) {
59
+ var child = children[i];
60
+ templates[child.id] = doT.compile(child.innerHTML);
61
+ }
62
+ MiniProfiler.templates = templates;
63
+ };
64
+
65
+ var fetchTemplates = function(success) {
66
+ var key = "templates",
67
+ cached = load(key);
68
+
69
+ if (cached) {
70
+ compileTemplates(cached);
71
+ success();
72
+ } else {
73
+ var request = new XMLHttpRequest();
74
+ var url = options.path + "includes.tmpl?v=" + options.version;
75
+ request.open("GET", url, true);
76
+ request.onload = function() {
77
+ if (request.status >= 200 && request.status < 400) {
78
+ let data = request.response;
79
+ if (data) {
80
+ save(key, data);
81
+ compileTemplates(data);
82
+ success();
83
+ }
26
84
  }
27
- };
85
+ };
86
+ request.setRequestHeader("Content-Type", "text/plain");
87
+ request.send();
88
+ }
89
+ };
28
90
 
29
- var getVersionedKey = function (keyPrefix) {
30
- return keyPrefix + '-' + options.version;
31
- };
91
+ var getClientPerformance = function() {
92
+ return window.performance === null ? null : window.performance;
93
+ };
94
+
95
+ var fetchResults = function(ids) {
96
+ var clientPerformance, clientProbes, i, j, p, id, idx;
97
+
98
+ for (i = 0; i < ids.length; i++) {
99
+ id = ids[i];
32
100
 
33
- var save = function (keyPrefix, value) {
34
- if (!hasLocalStorage(keyPrefix)) { return; }
101
+ clientPerformance = null;
102
+ clientProbes = null;
35
103
 
36
- // clear old keys with this prefix, if any
37
- for (var i = 0; i < localStorage.length; i++) {
38
- if ((localStorage.key(i) || '').indexOf(keyPrefix) > -1) {
39
- localStorage.removeItem(localStorage.key(i));
104
+ if (window.mPt) {
105
+ clientProbes = mPt.results();
106
+ for (j = 0; j < clientProbes.length; j++) {
107
+ clientProbes[j].d = clientProbes[j].d.getTime();
108
+ }
109
+ mPt.flush();
110
+ }
111
+
112
+ if (id == options.currentId) {
113
+ clientPerformance = getClientPerformance();
114
+
115
+ if (clientPerformance !== null) {
116
+ // ie is buggy strip out functions
117
+ var copy = { navigation: {}, timing: {} };
118
+ var timing = extend({}, clientPerformance.timing);
119
+ for (p in timing) {
120
+ if (
121
+ timing.hasOwnProperty(p) &&
122
+ !(typeof timing[p] === "function")
123
+ ) {
124
+ copy.timing[p] = timing[p];
40
125
  }
126
+ }
127
+ if (clientPerformance.navigation) {
128
+ copy.navigation.redirectCount =
129
+ clientPerformance.navigation.redirectCount;
130
+ }
131
+ clientPerformance = copy;
41
132
  }
133
+ } else if (
134
+ ajaxStartTime !== null &&
135
+ clientProbes &&
136
+ clientProbes.length > 0
137
+ ) {
138
+ clientPerformance = {
139
+ timing: { navigationStart: ajaxStartTime.getTime() }
140
+ };
141
+ ajaxStartTime = null;
142
+ }
143
+
144
+ if (fetchedIds.indexOf(id) < 0 && fetchingIds.indexOf(id) < 0) {
145
+ idx = fetchingIds.push(id) - 1;
146
+
147
+ (function() {
148
+ var request = new XMLHttpRequest();
149
+ var url = options.path + "results";
150
+ var params = `id=${id}&clientPerformance=${clientPerformance}&clientProbes=${clientProbes}&popup=1`;
151
+
152
+ request.open("POST", url, true);
153
+ request.onload = function() {
154
+ if (request.status >= 200 && request.status < 400) {
155
+ var json = JSON.parse(request.responseText);
156
+ fetchedIds.push(id);
157
+ if (json != "hidden") {
158
+ buttonShow(json);
159
+ }
160
+ }
161
+ fetchingIds.splice(idx, 1);
162
+ };
163
+ request.setRequestHeader("Accept", "application/json");
164
+ request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
165
+ request.setRequestHeader(
166
+ "Content-Type",
167
+ "application/x-www-form-urlencoded"
168
+ );
169
+ request.send(params);
170
+ })();
171
+ }
172
+ }
173
+ };
174
+
175
+ var extend = out => {
176
+ out = out || {};
177
+ for (var i = 1; i < arguments.length; i++) {
178
+ if (!arguments[i]) continue;
179
+ for (var key in arguments[i]) {
180
+ if (arguments[i].hasOwnProperty(key)) out[key] = arguments[i][key];
181
+ }
182
+ }
183
+ return out;
184
+ };
185
+
186
+ var renderTemplate = function(json) {
187
+ var textDom = MiniProfiler.templates.profilerTemplate(json);
188
+ var tempElement = document.createElement("DIV");
189
+ tempElement.innerHTML = textDom;
190
+ return tempElement.children[0];
191
+ };
192
+
193
+ var buttonShow = function(json) {
194
+ var result = renderTemplate(json);
195
+ totalTime += parseFloat(json.duration_milliseconds, 10);
196
+ totalSqlCount += parseInt(json.sql_count);
197
+ reqs++;
198
+
199
+ if (!controls && reqs > 1 && options.collapseResults && !expandedResults) {
200
+ if (!totalsControl) {
201
+ container
202
+ .querySelectorAll(".profiler-result")
203
+ .forEach(el => (el.style.display = "none"));
204
+
205
+ totalsControl = document.createElement("div");
206
+ totalsControl.setAttribute("class", "profiler-result");
207
+ totalsControl.innerHTML =
208
+ "<div class='profiler-button profiler-totals'></div>";
209
+
210
+ container.appendChild(totalsControl);
211
+ totalsControl.addEventListener("click", function() {
212
+ totalsControl.parentNode
213
+ .querySelectorAll(".profiler-result")
214
+ .forEach(el => (el.style.display = "block"));
215
+ totalsControl.style.display = "none";
216
+ expandedResults = true;
217
+ });
42
218
 
43
- // save under this version
44
- localStorage[getVersionedKey(keyPrefix)] = value;
219
+ totalsControl
220
+ .querySelectorAll(".profiler-button")
221
+ .forEach(el => (el.style.display = "block"));
222
+ }
223
+
224
+ var reqsHtml =
225
+ reqs > 1 ? "<span class='profiler-reqs'>" + reqs + "</span>" : "";
226
+ var sqlHtml =
227
+ options.showTotalSqlCount && totalSqlCount > 0
228
+ ? " / <span class='profiler-number'>" +
229
+ totalSqlCount +
230
+ "</span> <span class='profiler-unit'>sql</span>"
231
+ : "";
232
+ totalsControl.querySelector(".profiler-button").innerHTML =
233
+ "<span class='profiler-number'>" +
234
+ totalTime.toFixed(1) +
235
+ "</span> <span class='profiler-unit'>ms</span>" +
236
+ sqlHtml +
237
+ reqsHtml;
238
+
239
+ result.style.display = "none";
240
+ }
241
+
242
+ if (controls) result.insertBefore(controls);
243
+ else container.appendChild(result);
244
+
245
+ var button = result.querySelector(".profiler-button"),
246
+ popup = result.querySelector(".profiler-popup");
247
+
248
+ // button will appear in corner with the total profiling duration - click to show details
249
+ button.addEventListener("click", function() {
250
+ buttonClick(button, popup);
251
+ });
252
+
253
+ // small duration steps and the column with aggregate durations are hidden by default; allow toggling
254
+ toggleHidden(popup);
255
+
256
+ // lightbox in the queries
257
+ popup.querySelectorAll(".profiler-queries-show").forEach(el => {
258
+ el.addEventListener("click", function() {
259
+ queriesShow(this, result);
260
+ });
261
+ });
262
+
263
+ // limit count
264
+ if (
265
+ container.querySelector(".profiler-result").length >
266
+ options.maxTracesToShow
267
+ ) {
268
+ container
269
+ .find(".profiler-result")
270
+ .first()
271
+ .remove();
272
+ }
273
+ button.style.display = "block";
274
+ };
275
+
276
+ var toggleHidden = popup => {
277
+ var trivial = popup.querySelector(".profiler-toggle-trivial");
278
+ var childrenTime = popup.querySelector(
279
+ ".profiler-toggle-duration-with-children"
280
+ );
281
+ var trivialGaps = popup.parentNode.querySelector(
282
+ ".profiler-toggle-trivial-gaps"
283
+ );
284
+
285
+ var toggleIt = node => {
286
+ var link = node,
287
+ klass =
288
+ "profiler-" +
289
+ link.getAttribute("class").substr("profiler-toggle-".length),
290
+ isHidden = link.textContent.indexOf("show") > -1;
291
+ let elements = popup.parentNode.querySelectorAll("." + klass);
292
+
293
+ if (isHidden) {
294
+ elements.forEach(el => (el.style.display = "table-row"));
295
+ } else {
296
+ elements.forEach(el => (el.style.display = "none"));
297
+ }
298
+
299
+ let text = link.textContent;
300
+ link.textContent = text.replace(
301
+ isHidden ? "show" : "hide",
302
+ isHidden ? "hide" : "show"
303
+ );
304
+
305
+ popupPreventHorizontalScroll(popup);
45
306
  };
46
307
 
47
- var load = function (keyPrefix) {
48
- if (!hasLocalStorage(keyPrefix)) { return null; }
49
-
50
- return localStorage[getVersionedKey(keyPrefix)];
308
+ [childrenTime, trivial, trivialGaps].forEach(el => {
309
+ if (el) {
310
+ el.addEventListener("click", function() {
311
+ toggleIt(this);
312
+ });
313
+ }
314
+ });
315
+
316
+ // if option is set or all our timings are trivial, go ahead and show them
317
+ if (
318
+ trivial &&
319
+ (options.showTrivial || trivial.getAttribute("show-on-load"))
320
+ ) {
321
+ toggleIt(trivial);
322
+ }
323
+ // if option is set, go ahead and show time with children
324
+ if (childrenTime && options.showChildrenTime) {
325
+ toggleIt(childrenTime);
326
+ }
327
+ };
328
+
329
+ var buttonClick = (button, popup) => {
330
+ // we're toggling this button/popup
331
+
332
+ if (popup.offsetWidth > 0 || popup.offsetHeight > 0) {
333
+ // if visible
334
+ popupHide(button, popup);
335
+ } else {
336
+ var visiblePopups = [
337
+ ...container.querySelectorAll(".profiler-popup")
338
+ ].filter(el => el.offsetWidth > 0 || el.offsetHeight > 0);
339
+ // theirButtons = visiblePopups.siblings(".profiler-button");
340
+ let theirButtons = [];
341
+
342
+ visiblePopups.forEach(el => {
343
+ theirButtons.push(el.parentNode.querySelector(".profiler-button"));
344
+ });
345
+
346
+ // hide any other popups
347
+ popupHide(theirButtons, visiblePopups);
348
+ // before showing the one we clicked
349
+ popupShow(button, popup);
350
+ }
351
+ };
352
+
353
+ var popupShow = (button, popup) => {
354
+ button.classList.add("profiler-button-active");
355
+ popupSetDimensions(button, popup);
356
+ popup.style.display = "block";
357
+ popupPreventHorizontalScroll(popup);
358
+ };
359
+
360
+ var popupSetDimensions = (button, popup) => {
361
+ var px = button.offsetTop - 1, // position next to the button we clicked
362
+ windowHeight = window.innerHeight,
363
+ maxHeight = windowHeight - 40; // make sure the popup doesn't extend below the fold
364
+
365
+ popup.style[options.renderVerticalPosition] = `${px}px`;
366
+ popup.style.maxHeight = `${maxHeight}px`;
367
+ popup.style[options.renderHorizontalPosition] = `${button.offsetWidth -
368
+ 3}px`; // move left or right, based on config
369
+ };
370
+
371
+ var popupPreventHorizontalScroll = popup => {
372
+ var childrenHeight = 0;
373
+
374
+ [...popup.children].forEach(el => {
375
+ childrenHeight += el.offsetHeight;
376
+ });
377
+
378
+ popup.style.paddingRight = `${
379
+ childrenHeight > popup.offsetHeight ? 40 : 10
380
+ }px`;
381
+ };
382
+
383
+ var popupHide = (button, popup) => {
384
+ if (button) {
385
+ if (Array.isArray(button)) {
386
+ button.forEach(el => el.classList.remove("profiler-button-active"));
387
+ } else {
388
+ button.classList.remove("profiler-button-active");
389
+ }
390
+ }
391
+
392
+ if (popup) {
393
+ if (Array.isArray(popup)) {
394
+ popup.forEach(el => (el.style.display = "none"));
395
+ } else {
396
+ popup.style.display = "none";
397
+ }
398
+ }
399
+ };
400
+
401
+ var queriesShow = function(link, result) {
402
+ result = result;
403
+ var px = 30,
404
+ win = window,
405
+ width = win.innerWidth - 2 * px,
406
+ height = win.innerHeight - 2 * px,
407
+ queries = result.querySelector(".profiler-queries");
408
+
409
+ // opaque background
410
+ let background = document.createElement("div");
411
+ background.classList.add("profiler-queries-bg");
412
+ document.body.appendChild(background);
413
+ background.style.height = `${window.innerHeight}px`;
414
+ background.style.display = "block";
415
+
416
+ // center the queries and ensure long content is scrolled
417
+ queries.style[options.renderVerticalPosition] = `${px}px`;
418
+ queries.style.maxHeight = `${height}px`;
419
+ queries.style.width = `${width}px`;
420
+ queries.style[options.renderHorizontalPosition] = `${px}px`;
421
+ queries.querySelector("table").style.width = `${width}px`;
422
+
423
+ // have to show everything before we can get a position for the first query
424
+ queries.style.display = "block";
425
+
426
+ queriesScrollIntoView(link, queries, queries);
427
+
428
+ // syntax highlighting
429
+ prettyPrint();
430
+ };
431
+
432
+ var queriesScrollIntoView = (link, queries, whatToScroll) => {
433
+ var id = link.closest("tr").getAttribute("data-timing-id"),
434
+ cells = queries.querySelectorAll('tr[data-timing-id="' + id + '"]');
435
+ // ensure they're in view
436
+ whatToScroll.scrollTop =
437
+ (whatToScroll.scrollTop || 0) + cells[0].offsetTop - 100;
438
+
439
+ // highlight and then fade back to original bg color; do it ourselves to prevent any conflicts w/ jquery.UI or other implementations of Resig's color plugin
440
+ cells.forEach(el => {
441
+ el.classList.add("higlight-animate");
442
+ });
443
+ setTimeout(() => {
444
+ cells.forEach(el => el.classList.remove("higlight-animate"));
445
+ }, 3000);
446
+ };
447
+
448
+ let onClickEvents = e => {
449
+ // this happens on every keystroke, and :visible is crazy expensive in IE <9
450
+ // and in this case, the display:none check is sufficient.
451
+ var popup = [...document.querySelectorAll(".profiler-popup")].filter(el => {
452
+ return el.style.display === "block";
453
+ });
454
+
455
+ if (!popup.length) {
456
+ return;
457
+ }
458
+ popup = popup[0];
459
+
460
+ var button = popup.parentNode.querySelector(".profiler-button"),
461
+ queries = popup
462
+ .closest(".profiler-result")
463
+ .querySelector(".profiler-queries"),
464
+ bg = document.querySelector(".profiler-queries-bg"),
465
+ isEscPress = e.type == "keyup" && e.which == 27,
466
+ hidePopup = false,
467
+ hideQueries = false;
468
+
469
+ if (bg && bg.style.display === "block") {
470
+ hideQueries =
471
+ isEscPress ||
472
+ (e.type == "click" &&
473
+ !(queries !== e.target && queries.contains(e.target)) &&
474
+ !(popup !== e.target && popup.contains(e.target)));
475
+ } else if (popup.style.display === "block") {
476
+ hidePopup =
477
+ isEscPress ||
478
+ (e.type == "click" &&
479
+ !(popup !== e.target && popup.contains(e.target)) &&
480
+ !(button !== e.target && button.contains(e.target)) &&
481
+ button != e.target);
482
+ }
483
+
484
+ if (hideQueries) {
485
+ bg.remove();
486
+ queries.style.display = "none";
487
+ }
488
+
489
+ if (hidePopup) {
490
+ popupHide(button, popup);
491
+ }
492
+ };
493
+
494
+ let keydownEvent = () => {
495
+ let results = document.querySelector(".profiler-results");
496
+ if (results.style.display === "none") {
497
+ results.style.display = "block";
498
+ } else {
499
+ results.style.display = "none";
500
+ }
501
+
502
+ sessionStorage["rack-mini-profiler-start-hidden"] =
503
+ results.style.display === "none";
504
+ };
505
+
506
+ var toggleShortcutEvent = function(e) {
507
+ // simplified version of https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
508
+ var shortcut = options.toggleShortcut.toLowerCase();
509
+ var modifier = "";
510
+ ["alt", "ctrl", "shift"].forEach(k => {
511
+ if (e[k + "Key"]) {
512
+ modifier += `${k}+`;
513
+ }
514
+ });
515
+ var specialKeys = {
516
+ 8: "backspace",
517
+ 9: "tab",
518
+ 10: "return",
519
+ 13: "return",
520
+ 16: "shift",
521
+ 17: "ctrl",
522
+ 18: "alt",
523
+ 27: "esc",
524
+ 32: "space",
525
+ 59: ";",
526
+ 61: "=",
527
+ 96: "0",
528
+ 97: "1",
529
+ 98: "2",
530
+ 99: "3",
531
+ 100: "4",
532
+ 101: "5",
533
+ 102: "6",
534
+ 103: "7",
535
+ 104: "8",
536
+ 105: "9",
537
+ 106: "*",
538
+ 107: "+",
539
+ 109: "-",
540
+ 110: ".",
541
+ 173: "-",
542
+ 186: ";",
543
+ 187: "="
544
+ };
545
+ var shiftNums = {
546
+ "`": "~",
547
+ "1": "!",
548
+ "2": "@",
549
+ "3": "#",
550
+ "4": "$",
551
+ "5": "%",
552
+ "6": "^",
553
+ "7": "&",
554
+ "8": "*",
555
+ "9": "(",
556
+ "0": ")",
557
+ "-": "_",
558
+ "=": "+",
559
+ ";": ": ",
560
+ "'": '"',
561
+ ",": "<",
562
+ ".": ">",
563
+ "/": "?",
564
+ "\\": "|"
51
565
  };
52
566
 
53
- var fetchTemplates = function (success) {
54
- var key = 'templates',
55
- cached = load(key);
567
+ var character = String.fromCharCode(e.which).toLowerCase();
568
+ var special = specialKeys[e.which];
569
+ var keys = [];
570
+
571
+ if (special) {
572
+ keys.push(special);
573
+ } else {
574
+ keys.push(character);
575
+ keys.push(shiftNums[character]);
576
+ }
577
+ for (var i = 0; i < keys.length; i++) {
578
+ if (modifier + keys[i] === shortcut) {
579
+ keydownEvent();
580
+ break;
581
+ }
582
+ }
583
+ };
584
+
585
+ var bindDocumentEvents = function() {
586
+ document.addEventListener("click", onClickEvents);
587
+ document.addEventListener("keyup", onClickEvents);
588
+ document.addEventListener("keyup", toggleShortcutEvent);
589
+
590
+ if (typeof Turbolinks !== "undefined" && Turbolinks.supported) {
591
+ document.addEventListener("page:change", unbindDocumentEvents);
592
+ document.addEventListener("turbolinks:load", unbindDocumentEvents);
593
+ }
594
+ };
595
+
596
+ var unbindDocumentEvents = function() {
597
+ document.removeEventListener("click", onClickEvents);
598
+ document.removeEventListener("keyup", onClickEvents);
599
+ document.removeEventListener("keyup", toggleShortcutEvent);
600
+ document.removeEventListener("page:change", unbindDocumentEvents);
601
+ document.removeEventListener("turbolinks:load", unbindDocumentEvents);
602
+ };
603
+
604
+ var initFullView = function() {
605
+ // first, get jquery tmpl, then render and bind handlers
606
+ fetchTemplates(function() {
607
+ // profiler will be defined in the full page's head
608
+ container[0].appendChild(renderTemplate(profiler));
609
+
610
+ var popup = document.querySelector(".profiler-popup");
611
+
612
+ toggleHidden(popup);
613
+
614
+ prettyPrint();
615
+
616
+ // since queries are already shown, just highlight and scroll when clicking a "1 sql" link
617
+ popup.querySelectorAll(".profiler-queries-show").forEach(el => {
618
+ el.addEventListener("click", function() {
619
+ queriesScrollIntoView(
620
+ this,
621
+ document.querySelector(".profiler-queries"),
622
+ document.body
623
+ );
624
+ });
625
+ });
626
+ });
627
+ };
628
+
629
+ var initControls = function(container) {
630
+ if (options.showControls) {
631
+ let controls = document.createElement("div");
632
+ controls.classList.add("profiler-controls");
633
+ controls.innerHTML =
634
+ '<span class="profiler-min-max">m</span><span class="profiler-clear">c</span>';
635
+
636
+ container.appendChild(controls);
637
+
638
+ document
639
+ .querySelector(".profiler-controls .profiler-min-max")
640
+ .addEventListener("click", () =>
641
+ toggleClass(container, "profiler-min")
642
+ );
643
+
644
+ container.addEventListener("mouseenter", function() {
645
+ if (this.classList.contains("profiler-min")) {
646
+ this.querySelector(".profiler-min-max").style.display = "block";
647
+ }
648
+ });
56
649
 
57
- if (cached) {
58
- $('body').append(cached);
59
- success();
650
+ container.addEventListener("mouseleave", function() {
651
+ if (this.classList.contains("profiler-min")) {
652
+ this.querySelector(".profiler-min-max").style.display = "none";
60
653
  }
61
- else {
62
- $.get(options.path + 'includes.tmpl?v=' + options.version, function (data) {
63
- if (data) {
64
- save(key, data);
65
- $('body').append(data);
66
- success();
67
- }
68
- }, "text");
654
+ });
655
+
656
+ document
657
+ .querySelector(".profiler-controls .profiler-clear")
658
+ .addEventListener("click", () => {
659
+ container
660
+ .querySelectorAll(".profiler-result")
661
+ .forEach(el => el.remove());
662
+ });
663
+ } else {
664
+ container.classList.add("profiler-no-controls");
665
+ }
666
+ };
667
+
668
+ var toggleClass = (el, className) => {
669
+ if (el.classList) {
670
+ el.classList.toggle(className);
671
+ } else {
672
+ var classes = el.className.split(" ");
673
+ var existingIndex = classes.indexOf(className);
674
+
675
+ if (existingIndex >= 0) classes.splice(existingIndex, 1);
676
+ else classes.push(className);
677
+
678
+ el.className = classes.join(" ");
679
+ }
680
+ };
681
+
682
+ var initPopupView = () => {
683
+ if (options.authorized) {
684
+ // all fetched profilings will go in here
685
+ container = document.createElement("div");
686
+ container.className = "profiler-results";
687
+ document.querySelector(options.htmlContainer).appendChild(container);
688
+
689
+ // MiniProfiler.RenderIncludes() sets which corner to render in - default is upper left
690
+ container.classList.add("profiler-" + options.renderHorizontalPosition);
691
+ container.classList.add("profiler-" + options.renderVerticalPosition);
692
+
693
+ //initialize the controls
694
+ initControls(container);
695
+
696
+ // we'll render results json via a jquery.tmpl - after we get the templates, we'll fetch the initial json to populate it
697
+ fetchTemplates(function() {
698
+ // get master page profiler results
699
+ fetchResults(options.ids);
700
+ });
701
+
702
+ if (options.startHidden) container.style.display = "none";
703
+ } else {
704
+ fetchResults(options.ids);
705
+ }
706
+
707
+ var send = XMLHttpRequest.prototype.send;
708
+ XMLHttpRequest.prototype.send = function(data) {
709
+ ajaxStartTime = new Date();
710
+
711
+ this.addEventListener("load", function() {
712
+ // should be an array of strings, e.g. ["008c4813-9bd7-443d-9376-9441ec4d6a8c","16ff377b-8b9c-4c20-a7b5-97cd9fa7eea7"]
713
+ var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");
714
+ if (stringIds) {
715
+ var ids = stringIds.split(",");
716
+ fetchResults(ids);
69
717
  }
70
- };
718
+ });
71
719
 
72
- var getClientPerformance = function() {
73
- return window.performance === null ? null : window.performance;
720
+ send.call(this, data);
74
721
  };
75
722
 
76
- var fetchResults = function (ids) {
77
- var clientPerformance, clientProbes, i, j, p, id, idx;
78
-
79
- for (i = 0; i < ids.length; i++) {
80
- id = ids[i];
81
-
82
- clientPerformance = null;
83
- clientProbes = null;
84
-
85
- if (window.mPt) {
86
- clientProbes = mPt.results();
87
- for (j = 0; j < clientProbes.length; j++) {
88
- clientProbes[j].d = clientProbes[j].d.getTime();
89
- }
90
- mPt.flush();
723
+ // fetch results after ASP Ajax calls
724
+ if (
725
+ typeof Sys != "undefined" &&
726
+ typeof Sys.WebForms != "undefined" &&
727
+ typeof Sys.WebForms.PageRequestManager != "undefined"
728
+ ) {
729
+ // Get the instance of PageRequestManager.
730
+ var PageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
731
+
732
+ PageRequestManager.add_endRequest((sender, args) => {
733
+ if (args) {
734
+ var response = args.get_response();
735
+ if (
736
+ response.get_responseAvailable() &&
737
+ response._xmlHttpRequest !== null
738
+ ) {
739
+ var stringIds = args
740
+ .get_response()
741
+ .getResponseHeader("X-MiniProfiler-Ids");
742
+ if (stringIds) {
743
+ var ids = stringIds.split(",");
744
+ fetchResults(ids);
91
745
  }
746
+ }
747
+ }
748
+ });
749
+ }
750
+
751
+ // more Asp.Net callbacks
752
+ if (typeof WebForm_ExecuteCallback == "function") {
753
+ WebForm_ExecuteCallback = (callbackObject => {
754
+ // Store original function
755
+ var original = WebForm_ExecuteCallback;
756
+
757
+ return function(callbackObject) {
758
+ original(callbackObject);
759
+
760
+ var stringIds = callbackObject.xmlRequest.getResponseHeader(
761
+ "X-MiniProfiler-Ids"
762
+ );
763
+ if (stringIds) {
764
+ var ids = stringIds.split(",");
765
+ fetchResults(ids);
766
+ }
767
+ };
768
+ })();
769
+ }
770
+
771
+ // also fetch results after ExtJS requests, in case it is being used
772
+ if (
773
+ typeof Ext != "undefined" &&
774
+ typeof Ext.Ajax != "undefined" &&
775
+ typeof Ext.Ajax.on != "undefined"
776
+ ) {
777
+ // Ext.Ajax is a singleton, so we just have to attach to its 'requestcomplete' event
778
+ Ext.Ajax.on("requestcomplete", (e, xhr, settings) => {
779
+ //iframed file uploads don't have headers
780
+ if (!xhr || !xhr.getResponseHeader) {
781
+ return;
782
+ }
92
783
 
93
- if (id == options.currentId) {
94
-
95
- clientPerformance = getClientPerformance();
96
-
97
- if (clientPerformance !== null) {
98
- // ie is buggy strip out functions
99
- var copy = { navigation: {}, timing: {} };
100
-
101
- var timing = $.extend({}, clientPerformance.timing);
784
+ var stringIds = xhr.getResponseHeader("X-MiniProfiler-Ids");
785
+ if (stringIds) {
786
+ var ids = stringIds.split(",");
787
+ fetchResults(ids);
788
+ }
789
+ });
790
+ }
791
+
792
+ if (typeof MooTools != "undefined" && typeof Request != "undefined") {
793
+ Request.prototype.addEvents({
794
+ onComplete: function() {
795
+ var stringIds = this.xhr.getResponseHeader("X-MiniProfiler-Ids");
796
+ if (stringIds) {
797
+ var ids = stringIds.split(",");
798
+ fetchResults(ids);
799
+ }
800
+ }
801
+ });
802
+ }
803
+
804
+ // add support for AngularJS, which use the basic XMLHttpRequest object.
805
+ if (window.angular && typeof XMLHttpRequest != "undefined") {
806
+ var _send = XMLHttpRequest.prototype.send;
807
+
808
+ XMLHttpRequest.prototype.send = function sendReplacement(data) {
809
+ if (this.onreadystatechange) {
810
+ if (
811
+ typeof this.miniprofiler == "undefined" ||
812
+ typeof this.miniprofiler.prev_onreadystatechange == "undefined"
813
+ ) {
814
+ this.miniprofiler = {
815
+ prev_onreadystatechange: this.onreadystatechange
816
+ };
102
817
 
103
- for (p in timing) {
104
- if (timing.hasOwnProperty(p) && !$.isFunction(timing[p])) {
105
- copy.timing[p] = timing[p];
106
- }
107
- }
108
- if (clientPerformance.navigation) {
109
- copy.navigation.redirectCount = clientPerformance.navigation.redirectCount;
110
- }
111
- clientPerformance = copy;
818
+ this.onreadystatechange = function onReadyStateChangeReplacement() {
819
+ if (this.readyState == 4) {
820
+ var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");
821
+ if (stringIds) {
822
+ var ids = stringIds.split(",");
823
+ fetchResults(ids);
112
824
  }
113
- } else if (ajaxStartTime !== null && clientProbes && clientProbes.length > 0) {
114
- clientPerformance = { timing: { navigationStart: ajaxStartTime.getTime() } };
115
- ajaxStartTime = null;
116
- }
825
+ }
117
826
 
118
- if ($.inArray(id, fetchedIds) < 0 && $.inArray(id, fetchingIds) < 0) {
119
- idx = fetchingIds.push(id) - 1;
120
-
121
- $.ajax({
122
- url: options.path + 'results',
123
- data: { id: id, clientPerformance: clientPerformance, clientProbes: clientProbes, popup: 1 },
124
- dataType: 'json',
125
- global: false,
126
- type: 'POST',
127
- success: function (json) {
128
- fetchedIds.push(id);
129
- if (json != "hidden") {
130
- buttonShow(json);
131
- }
132
- },
133
- complete: function () {
134
- fetchingIds.splice(idx, 1);
135
- }
136
- });
137
- }
827
+ if (this.miniprofiler.prev_onreadystatechange !== null)
828
+ return this.miniprofiler.prev_onreadystatechange.apply(
829
+ this,
830
+ arguments
831
+ );
832
+ };
833
+ }
138
834
  }
139
- };
140
-
141
- var renderTemplate = function (json) {
142
- return $('#profilerTemplate').tmpl(json);
143
- };
144
-
145
-
146
- var buttonShow = function (json) {
147
- var result = renderTemplate(json);
148
835
 
149
- totalTime += parseFloat(json.duration_milliseconds, 10);
150
- totalSqlCount += parseInt(json.sql_count);
151
- reqs++;
152
-
153
- if (!controls && reqs > 1 && options.collapseResults && !expandedResults) {
154
- if (!totalsControl) {
155
- container.find('.profiler-result').hide();
156
-
157
- totalsControl = $("<div class='profiler-result'><div class='profiler-button profiler-totals'></div></div>");
158
- totalsControl.appendTo(container);
159
- totalsControl.on('click', function(){
160
- totalsControl.parent().find('.profiler-result').show();
161
- totalsControl.hide();
162
- expandedResults = true;
163
- });
164
-
165
- totalsControl.find('.profiler-button').show();
836
+ return _send.apply(this, arguments);
837
+ };
838
+ }
839
+
840
+ // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
841
+ if (
842
+ typeof window.fetch === "function" &&
843
+ window.fetch.__patchedByMiniProfiler === undefined
844
+ ) {
845
+ var __originalFetch = window.fetch;
846
+
847
+ window.fetch = function(input, init) {
848
+ var originalFetchRun = __originalFetch(input, init);
849
+
850
+ originalFetchRun.then(function(response) {
851
+ try {
852
+ // look for x-mini-profile-ids
853
+ var entries = response.headers.entries();
854
+ for (var i = 0; i < entries.length; i++) {
855
+ var pair = entries[i];
856
+ if (pair[0] && pair[0].toLowerCase() == "x-miniprofiler-ids") {
857
+ var ids = pair[1].split(",");
858
+ fetchResults(ids);
859
+ }
860
+ }
861
+ } catch (e) {
862
+ console.error(e);
166
863
  }
864
+ });
167
865
 
168
- var reqsHtml = reqs > 1 ? ("<span class='profiler-reqs'>" + reqs + "</span>") : "";
169
- var sqlHtml = options.showTotalSqlCount && totalSqlCount > 0 ? (" / <span class='profiler-number'>" + totalSqlCount + "</span> <span class='profiler-unit'>sql</span>") : "";
170
- totalsControl.find('.profiler-button').html("<span class='profiler-number'>" +
171
- totalTime.toFixed(1) + "</span> <span class='profiler-unit'>ms</span>" +
172
- sqlHtml +
173
- reqsHtml);
866
+ return originalFetchRun;
867
+ };
868
+ window.fetch.__patchedByMiniProfiler = true;
869
+ }
174
870
 
175
- result.hide();
176
- }
871
+ // some elements want to be hidden on certain doc events
872
+ bindDocumentEvents();
873
+ };
177
874
 
178
- if (controls)
179
- result.insertBefore(controls);
180
- else
181
- result.appendTo(container);
875
+ return {
876
+ init: function() {
877
+ var script = document.getElementById("mini-profiler");
878
+ if (!script || !script.getAttribute) return;
182
879
 
183
- var button = result.find('.profiler-button'),
184
- popup = result.find('.profiler-popup');
880
+ options = (function() {
881
+ var version = script.getAttribute("data-version");
882
+ var path = script.getAttribute("data-path");
185
883
 
186
- // button will appear in corner with the total profiling duration - click to show details
187
- button.on('click', function () { buttonClick(button, popup); });
884
+ var currentId = script.getAttribute("data-current-id");
188
885
 
189
- // small duration steps and the column with aggregate durations are hidden by default; allow toggling
190
- toggleHidden(popup);
886
+ var ids = script.getAttribute("data-ids");
887
+ if (ids) ids = ids.split(",");
191
888
 
192
- // lightbox in the queries
193
- popup.find('.profiler-queries-show').on('click', function () { queriesShow($(this), result); });
194
-
195
- // limit count
196
- if (container.find('.profiler-result').length > options.maxTracesToShow)
197
- container.find('.profiler-result').first().remove();
198
- button.show();
199
- };
889
+ var horizontal_position = script.getAttribute(
890
+ "data-horizontal-position"
891
+ );
892
+ var vertical_position = script.getAttribute("data-vertical-position");
200
893
 
201
- var toggleHidden = function (popup) {
202
- var trivial = popup.find('.profiler-toggle-trivial');
203
- var childrenTime = popup.find('.profiler-toggle-duration-with-children');
204
- var trivialGaps = popup.parent().find('.profiler-toggle-trivial-gaps');
894
+ var toggleShortcut = script.getAttribute("data-toggle-shortcut");
205
895
 
206
- var toggleIt = function (node) {
207
- var link = $(node),
208
- klass = "profiler-" + link.attr('class').substr('profiler-toggle-'.length),
209
- isHidden = link.text().indexOf('show') > -1;
210
-
211
- popup.parent().find('.' + klass).toggle(isHidden);
212
- link.text(link.text().replace(isHidden ? 'show' : 'hide', isHidden ? 'hide' : 'show'));
896
+ if (script.getAttribute("data-max-traces")) {
897
+ var maxTraces = parseInt(script.getAttribute("data-max-traces"), 10);
898
+ }
213
899
 
214
- popupPreventHorizontalScroll(popup);
900
+ var collapseResults =
901
+ script.getAttribute("data-collapse-results") === "true";
902
+ var trivial = script.getAttribute("data-trivial") === "true";
903
+ var children = script.getAttribute("data-children") === "true";
904
+ var controls = script.getAttribute("data-controls") === "true";
905
+ var totalSqlCount =
906
+ script.getAttribute("data-total-sql-count") === "true";
907
+ var authorized = script.getAttribute("data-authorized") === "true";
908
+ var startHidden =
909
+ script.getAttribute("data-start-hidden") === "true" ||
910
+ sessionStorage["rack-mini-profiler-start-hidden"] === "true";
911
+ var htmlContainer = script.getAttribute("data-html-container");
912
+ return {
913
+ ids: ids,
914
+ path: path,
915
+ version: version,
916
+ renderHorizontalPosition: horizontal_position,
917
+ renderVerticalPosition: vertical_position,
918
+ showTrivial: trivial,
919
+ showChildrenTime: children,
920
+ maxTracesToShow: maxTraces,
921
+ showControls: controls,
922
+ showTotalSqlCount: totalSqlCount,
923
+ currentId: currentId,
924
+ authorized: authorized,
925
+ toggleShortcut: toggleShortcut,
926
+ startHidden: startHidden,
927
+ collapseResults: collapseResults,
928
+ htmlContainer: htmlContainer
215
929
  };
216
-
217
- childrenTime.add(trivial).add(trivialGaps).on('click', function () {
218
- toggleIt(this);
219
- });
220
-
221
- // if option is set or all our timings are trivial, go ahead and show them
222
- if (options.showTrivial || trivial.data('show-on-load')) {
223
- toggleIt(trivial);
930
+ })();
931
+
932
+ var doInit = function() {
933
+ // when rendering a shared, full page, this div will exist
934
+ container = document.querySelectorAll(".profiler-result-full");
935
+ if (container.length) {
936
+ if (window.location.href.indexOf("&trivial=1") > 0) {
937
+ options.showTrivial = true;
938
+ }
939
+ initFullView();
940
+ } else {
941
+ initPopupView();
224
942
  }
225
- // if option is set, go ahead and show time with children
226
- if (options.showChildrenTime) {
227
- toggleIt(childrenTime);
943
+ };
944
+
945
+ // this preserves debugging
946
+ var load = function(s, f) {
947
+ var sc = document.createElement("script");
948
+ sc.async = "async";
949
+ sc.type = "text/javascript";
950
+ sc.src = s;
951
+ var done = false;
952
+ sc.onload = sc.onreadystatechange = function(_, abort) {
953
+ if (!sc.readyState || /loaded|complete/.test(sc.readyState)) {
954
+ if (!abort && !done) {
955
+ done = true;
956
+ f();
957
+ }
958
+ }
959
+ };
960
+ document.getElementsByTagName("head")[0].appendChild(sc);
961
+ };
962
+
963
+ var wait = 0;
964
+ var finish = false;
965
+ var deferInit = function() {
966
+ if (finish) return;
967
+ if (
968
+ window.performance &&
969
+ window.performance.timing &&
970
+ window.performance.timing.loadEventEnd === 0 &&
971
+ wait < 10000
972
+ ) {
973
+ setTimeout(deferInit, 100);
974
+ wait += 100;
975
+ } else {
976
+ finish = true;
977
+ init();
228
978
  }
229
- };
979
+ };
230
980
 
231
- var buttonClick = function (button, popup) {
232
- // we're toggling this button/popup
233
- if (popup.is(':visible')) {
234
- popupHide(button, popup);
981
+ var init = function() {
982
+ if (options.authorized) {
983
+ var url = options.path + "includes.css?v=" + options.version;
984
+ if (document.createStyleSheet) {
985
+ document.createStyleSheet(url);
986
+ } else {
987
+ const head = document.querySelector("head");
988
+ let link = document.createElement("link");
989
+ link.rel = "stylesheet";
990
+ link.type = "text/css";
991
+ link.href = url;
992
+ head.appendChild(link);
993
+ }
994
+ if (!window.doT) {
995
+ load(
996
+ options.path + "dot.1.1.2.min.js?v=" + options.version,
997
+ doInit
998
+ );
999
+ } else {
1000
+ doInit();
1001
+ }
1002
+ } else {
1003
+ doInit();
235
1004
  }
236
- else {
237
- var visiblePopups = container.find('.profiler-popup:visible'),
238
- theirButtons = visiblePopups.siblings('.profiler-button');
239
-
240
- // hide any other popups
241
- popupHide(theirButtons, visiblePopups);
242
-
243
- // before showing the one we clicked
244
- popupShow(button, popup);
1005
+ };
1006
+
1007
+ deferInit();
1008
+ },
1009
+
1010
+ cleanUp: function() {
1011
+ unbindDocumentEvents();
1012
+ },
1013
+
1014
+ pageTransition: function() {
1015
+ if (totalsControl) {
1016
+ totalsControl.remove();
1017
+ totalsControl = null;
1018
+ }
1019
+ reqs = 0;
1020
+ totalTime = 0;
1021
+ expandedResults = false;
1022
+ document
1023
+ .querySelectorAll(".profiler-results .profiler-result")
1024
+ .forEach(el => el.remove());
1025
+ },
1026
+
1027
+ getClientTimingByName: function(clientTiming, name) {
1028
+ for (var i = 0; i < clientTiming.timings.length; i++) {
1029
+ if (clientTiming.timings[i].name == name) {
1030
+ return clientTiming.timings[i];
245
1031
  }
246
- };
247
-
248
- var popupShow = function (button, popup) {
249
- button.addClass('profiler-button-active');
250
-
251
- popupSetDimensions(button, popup);
252
-
253
- popup.show();
254
-
255
- popupPreventHorizontalScroll(popup);
256
- };
257
-
258
- var popupSetDimensions = function (button, popup) {
259
- var px = button.position().top - 1, // position next to the button we clicked
260
- windowHeight = $(window).height(),
261
- maxHeight = windowHeight - 40; // make sure the popup doesn't extend below the fold
262
-
263
- popup
264
- .css(options.renderVerticalPosition, px)
265
- .css('max-height', maxHeight)
266
- .css(options.renderHorizontalPosition, button.outerWidth() - 3); // move left or right, based on config
267
- };
268
-
269
- var popupPreventHorizontalScroll = function (popup) {
270
- var childrenHeight = 0;
1032
+ }
1033
+ return { Name: name, Duration: "", Start: "" };
1034
+ },
1035
+
1036
+ renderDate: function(jsonDate) {
1037
+ // JavaScriptSerializer sends dates as /Date(1308024322065)/
1038
+ if (jsonDate) {
1039
+ return typeof jsonDate === "string"
1040
+ ? new Date(
1041
+ parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10)
1042
+ ).toUTCString()
1043
+ : jsonDate;
1044
+ }
1045
+ },
1046
+
1047
+ renderIndent: function(depth) {
1048
+ var result = "";
1049
+ for (var i = 0; i < depth; i++) {
1050
+ result += "&nbsp;";
1051
+ }
1052
+ return result;
1053
+ },
1054
+
1055
+ renderExecuteType: function(typeId) {
1056
+ // see StackExchange.Profiling.ExecuteType enum
1057
+ switch (typeId) {
1058
+ case 0:
1059
+ return "None";
1060
+ case 1:
1061
+ return "NonQuery";
1062
+ case 2:
1063
+ return "Scalar";
1064
+ case 3:
1065
+ return "Reader";
1066
+ }
1067
+ },
1068
+
1069
+ shareUrl: function(id) {
1070
+ return options.path + "results?id=" + id;
1071
+ },
1072
+
1073
+ moreUrl: function(requestName) {
1074
+ var requestParts = requestName.split(" ");
1075
+ var linkSrc =
1076
+ requestParts[0] == "GET" ? requestParts[1] : window.location.href;
1077
+ var linkSuffix = linkSrc.indexOf("?") > 0 ? "&pp=help" : "?pp=help";
1078
+ return linkSrc + linkSuffix;
1079
+ },
1080
+
1081
+ getClientTimings: function(clientTimings) {
1082
+ var list = [];
1083
+ var t;
1084
+
1085
+ if (!clientTimings.timings) return [];
1086
+
1087
+ for (var i = 0; i < clientTimings.timings.length; i++) {
1088
+ t = clientTimings.timings[i];
1089
+ var trivial = t.Name != "Dom Complete" && t.Name != "Response";
1090
+ trivial = t.Duration < 2 ? trivial : false;
1091
+ list.push({
1092
+ isTrivial: trivial,
1093
+ name: t.Name,
1094
+ duration: t.Duration,
1095
+ start: t.Start
1096
+ });
1097
+ }
1098
+
1099
+ // Use the Paint Timing API for render performance.
1100
+ if (window.performance && window.performance.getEntriesByName) {
1101
+ var firstPaint = window.performance.getEntriesByName("first-paint");
1102
+
1103
+ if (firstPaint !== undefined && firstPaint.length >= 1) {
1104
+ list.push({
1105
+ isTrivial: false,
1106
+ name: "First Paint Time",
1107
+ duration: firstPaint[0].duration,
1108
+ start: firstPaint[0].startTime
1109
+ });
1110
+ }
1111
+ }
1112
+
1113
+ list.sort(function(a, b) {
1114
+ return a.start - b.start;
1115
+ });
1116
+ return list;
1117
+ },
1118
+
1119
+ getSqlTimings: function(root) {
1120
+ var result = [],
1121
+ addToResults = function(timing) {
1122
+ if (timing.sql_timings) {
1123
+ for (var i = 0, sqlTiming; i < timing.sql_timings.length; i++) {
1124
+ sqlTiming = timing.sql_timings[i];
1125
+
1126
+ // HACK: add info about the parent Timing to each SqlTiming so UI can render
1127
+ sqlTiming.parent_timing_name = timing.name;
1128
+
1129
+ if (sqlTiming.duration_milliseconds > 50) {
1130
+ sqlTiming.row_class = "slow";
1131
+ }
271
1132
 
272
- popup.children().each(function () { childrenHeight += $(this).height(); });
1133
+ if (sqlTiming.duration_milliseconds > 200) {
1134
+ sqlTiming.row_class = "very-slow";
1135
+ }
273
1136
 
274
- popup.css({ 'padding-right': childrenHeight > popup.height() ? 40 : 10 });
275
- };
1137
+ if (sqlTiming.duration_milliseconds > 400) {
1138
+ sqlTiming.row_class = "very-very-slow";
1139
+ }
276
1140
 
277
- var popupHide = function (button, popup) {
278
- button.removeClass('profiler-button-active');
279
- popup.hide();
280
- };
1141
+ result.push(sqlTiming);
1142
+ }
1143
+ }
281
1144
 
282
- var queriesShow = function (link, result) {
1145
+ if (timing.children) {
1146
+ for (var i = 0; i < timing.children.length; i++) {
1147
+ addToResults(timing.children[i]);
1148
+ }
1149
+ }
1150
+ };
283
1151
 
284
- var px = 30,
285
- win = $(window),
286
- width = win.width() - 2 * px,
287
- height = win.height() - 2 * px,
288
- queries = result.find('.profiler-queries');
1152
+ // start adding at the root and recurse down
1153
+ addToResults(root);
1154
+
1155
+ var removeDuration = function(list, duration) {
1156
+ var newList = [];
1157
+ for (var i = 0; i < list.length; i++) {
1158
+ var item = list[i];
1159
+ if (duration.start > item.start) {
1160
+ if (duration.start > item.finish) {
1161
+ newList.push(item);
1162
+ continue;
1163
+ }
1164
+ newList.push({ start: item.start, finish: duration.start });
1165
+ }
289
1166
 
290
- // opaque background
291
- $('<div class="profiler-queries-bg"/>').appendTo('body').css({ 'height': $(document).height() }).show();
1167
+ if (duration.finish < item.finish) {
1168
+ if (duration.finish < item.start) {
1169
+ newList.push(item);
1170
+ continue;
1171
+ }
1172
+ newList.push({ start: duration.finish, finish: item.finish });
1173
+ }
1174
+ }
292
1175
 
293
- // center the queries and ensure long content is scrolled
294
- queries.css(options.renderVerticalPosition, px).css({'max-height': height, 'width': width }).css(options.renderHorizontalPosition, px)
295
- .find('table').css({ 'width': width });
1176
+ return newList;
1177
+ };
296
1178
 
297
- // have to show everything before we can get a position for the first query
298
- queries.show();
1179
+ var processTimes = function(elem, parent) {
1180
+ var duration = {
1181
+ start: elem.start_milliseconds,
1182
+ finish: elem.start_milliseconds + elem.duration_milliseconds
1183
+ };
1184
+ elem.richTiming = [duration];
1185
+ if (parent !== null) {
1186
+ elem.parent = parent;
1187
+ elem.parent.richTiming = removeDuration(
1188
+ elem.parent.richTiming,
1189
+ duration
1190
+ );
1191
+ }
299
1192
 
300
- queriesScrollIntoView(link, queries, queries);
1193
+ if (elem.children) {
1194
+ for (var i = 0; i < elem.children.length; i++) {
1195
+ processTimes(elem.children[i], elem);
1196
+ }
1197
+ }
1198
+ };
301
1199
 
302
- // syntax highlighting
303
- prettyPrint();
304
- };
1200
+ processTimes(root, null);
305
1201
 
306
- var queriesScrollIntoView = function (link, queries, whatToScroll) {
307
- var id = link.closest('tr').attr('data-timing-id'),
308
- cells = queries.find('tr[data-timing-id="' + id + '"]');
309
-
310
- // ensure they're in view
311
- whatToScroll.scrollTop(whatToScroll.scrollTop() + cells.first().position().top - 100);
312
-
313
- // highlight and then fade back to original bg color; do it ourselves to prevent any conflicts w/ jquery.UI or other implementations of Resig's color plugin
314
- cells.each(function () {
315
- var cell = $(this),
316
- highlightHex = '#FFFFBB',
317
- highlightRgb = getRGB(highlightHex),
318
- originalRgb = getRGB(cell.css('background-color')),
319
- getColorDiff = function (fx, i) {
320
- // adapted from John Resig's color plugin: http://plugins.jquery.com/project/color
321
- return Math.max(Math.min(parseInt((fx.pos * (originalRgb[i] - highlightRgb[i])) + highlightRgb[i], 10), 255), 0);
322
- };
323
-
324
- // we need to animate some other property to piggy-back on the step function, so I choose you, opacity!
325
- cell.css({ 'opacity': 1, 'background-color': highlightHex })
326
- .animate({ 'opacity': 1 }, { duration: 2000, step: function (now, fx) {
327
- fx.elem.style.backgroundColor = "rgb(" + [getColorDiff(fx, 0), getColorDiff(fx, 1), getColorDiff(fx, 2)].join(",") + ")";
328
- }
329
- });
330
- });
331
- };
1202
+ // sort results by time
1203
+ result.sort(function(a, b) {
1204
+ return a.start_milliseconds - b.start_milliseconds;
1205
+ });
332
1206
 
333
- // Color Conversion functions from highlightFade
334
- // By Blair Mitchelmore
335
- // http://jquery.offput.ca/highlightFade/
336
- // Parse strings looking for color tuples [255,255,255]
337
- var getRGB = function (color) {
338
- var result;
1207
+ var determineOverlap = function(gap, node) {
1208
+ var overlap = 0;
1209
+ for (var i = 0; i < node.richTiming.length; i++) {
1210
+ var current = node.richTiming[i];
1211
+ if (current.start > gap.finish) {
1212
+ break;
1213
+ }
1214
+ if (current.finish < gap.start) {
1215
+ continue;
1216
+ }
339
1217
 
340
- // Check if we're already dealing with an array of colors
341
- if (color && color.constructor == Array && color.length == 3) return color;
1218
+ overlap +=
1219
+ Math.min(gap.finish, current.finish) -
1220
+ Math.max(gap.start, current.start);
1221
+ }
1222
+ return overlap;
1223
+ };
1224
+
1225
+ var determineGap = function(gap, node, match) {
1226
+ var overlap = determineOverlap(gap, node);
1227
+ if (match === null || overlap > match.duration) {
1228
+ match = { name: node.name, duration: overlap };
1229
+ } else if (match.name == node.name) {
1230
+ match.duration += overlap;
1231
+ }
342
1232
 
343
- // Look for rgb(num,num,num)
344
- if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
1233
+ if (node.children) {
1234
+ for (var i = 0; i < node.children.length; i++) {
1235
+ match = determineGap(gap, node.children[i], match);
1236
+ }
1237
+ }
1238
+ return match;
1239
+ };
345
1240
 
346
- // Look for rgb(num%,num%,num%)
347
- if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55];
1241
+ var time = 0;
1242
+ var prev = null;
348
1243
 
349
- // Look for #a0b1c2
350
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)];
1244
+ result.forEach(r => {
1245
+ r.prevGap = {
1246
+ duration: (r.start_milliseconds - time).toFixed(2),
1247
+ start: time,
1248
+ finish: r.start_milliseconds
1249
+ };
351
1250
 
352
- // Look for #fff
353
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)];
1251
+ r.prevGap.topReason = determineGap(r.prevGap, root, null);
354
1252
 
355
- // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
356
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) return [0,0,0,0];
1253
+ time = r.start_milliseconds + r.duration_milliseconds;
1254
+ prev = r;
1255
+ });
357
1256
 
358
- return null;
359
- };
1257
+ if (result.length > 0) {
1258
+ var me = result[result.length - 1];
1259
+ me.nextGap = {
1260
+ duration: (root.duration_milliseconds - time).toFixed(2),
1261
+ start: time,
1262
+ finish: root.duration_milliseconds
1263
+ };
1264
+ me.nextGap.topReason = determineGap(me.nextGap, root, null);
1265
+ }
360
1266
 
361
- var bindDocumentEvents = function () {
362
- $(document).on('click.mini-profiler keyup.mini-profiler', function (e) {
1267
+ return result;
1268
+ },
363
1269
 
364
- // this happens on every keystroke, and :visible is crazy expensive in IE <9
365
- // and in this case, the display:none check is sufficient.
366
- var popup = $('.profiler-popup').filter(function () { return $(this).css("display") !== "none"; });
1270
+ getSqlTimingsCount: function(root) {
1271
+ var result = 0,
1272
+ countSql = function(timing) {
1273
+ if (timing.sql_timings) {
1274
+ result += timing.sql_timings.length;
1275
+ }
367
1276
 
368
- if (!popup.length) {
369
- return;
1277
+ if (timing.children) {
1278
+ for (var i = 0; i < timing.children.length; i++) {
1279
+ countSql(timing.children[i]);
370
1280
  }
1281
+ }
1282
+ };
1283
+ countSql(root);
1284
+ return result;
1285
+ },
1286
+
1287
+ fetchResultsExposed: function(ids) {
1288
+ return fetchResults(ids);
1289
+ },
1290
+
1291
+ formatParameters: function(parameters) {
1292
+ if (parameters != null) {
1293
+ return parameters
1294
+ .map(function(item, index) {
1295
+ return "[" + item[0] + ", " + item[1] + "]";
1296
+ })
1297
+ .join(", ");
1298
+ } else {
1299
+ return "";
1300
+ }
1301
+ },
1302
+
1303
+ formatDuration: function(duration) {
1304
+ return (duration || 0).toFixed(1);
1305
+ },
1306
+
1307
+ showTotalSqlCount: function() {
1308
+ return options.showTotalSqlCount;
1309
+ }
1310
+ };
1311
+ })();
371
1312
 
372
- var button = popup.siblings('.profiler-button'),
373
- queries = popup.closest('.profiler-result').find('.profiler-queries'),
374
- bg = $('.profiler-queries-bg'),
375
- isEscPress = e.type == 'keyup' && e.which == 27,
376
- hidePopup = false,
377
- hideQueries = false;
378
-
379
- if (bg.is(':visible')) {
380
- hideQueries = isEscPress || (e.type == 'click' && !$.contains(queries[0], e.target) && !$.contains(popup[0], e.target));
381
- }
382
- else if (popup.is(':visible')) {
383
- hidePopup = isEscPress || (e.type == 'click' && !$.contains(popup[0], e.target) && !$.contains(button[0], e.target) && button[0] != e.target);
384
- }
1313
+ MiniProfiler.init();
385
1314
 
386
- if (hideQueries) {
387
- bg.remove();
388
- queries.hide();
1315
+ if (typeof prettyPrint === "undefined") {
1316
+ // prettify.js
1317
+ // http://code.google.com/p/google-code-prettify/
1318
+ // prettier-ignore
1319
+ window.PR_SHOULD_USE_CONTINUATION=true;
1320
+ window.PR_TAB_WIDTH = 8;
1321
+ window.PR_normalizedHtml = window.PR = window.prettyPrintOne = window.prettyPrint = void 0;
1322
+ window._pr_isIE6 = function() {
1323
+ var y =
1324
+ navigator &&
1325
+ navigator.userAgent &&
1326
+ navigator.userAgent.match(/\bMSIE ([678])\./);
1327
+ y = y ? +y[1] : false;
1328
+ window._pr_isIE6 = function() {
1329
+ return y;
1330
+ };
1331
+ return y;
1332
+ };
1333
+ (function() {
1334
+ function y(b) {
1335
+ return b
1336
+ .replace(L, "&amp;")
1337
+ .replace(M, "&lt;")
1338
+ .replace(N, "&gt;");
1339
+ }
1340
+ function H(b, f, i) {
1341
+ switch (b.nodeType) {
1342
+ case 1:
1343
+ var o = b.tagName.toLowerCase();
1344
+ f.push("<", o);
1345
+ var l = b.attributes,
1346
+ n = l.length;
1347
+ if (n) {
1348
+ if (i) {
1349
+ for (var r = [], j = n; --j >= 0; ) r[j] = l[j];
1350
+ r.sort(function(q, m) {
1351
+ return q.name < m.name ? -1 : q.name === m.name ? 0 : 1;
1352
+ });
1353
+ l = r;
389
1354
  }
390
-
391
- if (hidePopup) {
392
- popupHide(button, popup);
1355
+ for (j = 0; j < n; ++j) {
1356
+ r = l[j];
1357
+ r.specified &&
1358
+ f.push(
1359
+ " ",
1360
+ r.name.toLowerCase(),
1361
+ '="',
1362
+ r.value
1363
+ .replace(L, "&amp;")
1364
+ .replace(M, "&lt;")
1365
+ .replace(N, "&gt;")
1366
+ .replace(X, "&quot;"),
1367
+ '"'
1368
+ );
393
1369
  }
394
- });
395
- $(document).on('keydown.mini-profiler', null, options.toggleShortcut, function(e) {
396
- $('.profiler-results').toggle();
397
- sessionStorage['rack-mini-profiler-start-hidden'] = $('.profiler-results').is(':hidden');
398
- });
399
-
400
- if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
401
- $(document).on('page:change.mini-profiler turbolinks:load.mini-profiler', function() {
402
- unbindDocumentEvents();
403
- });
1370
+ }
1371
+ f.push(">");
1372
+ for (l = b.firstChild; l; l = l.nextSibling) H(l, f, i);
1373
+ if (b.firstChild || !/^(?:br|link|img)$/.test(o))
1374
+ f.push("</", o, ">");
1375
+ break;
1376
+ case 3:
1377
+ case 4:
1378
+ f.push(y(b.nodeValue));
1379
+ break;
1380
+ }
1381
+ }
1382
+ function O(b) {
1383
+ function f(c) {
1384
+ if (c.charAt(0) !== "\\") return c.charCodeAt(0);
1385
+ switch (c.charAt(1)) {
1386
+ case "b":
1387
+ return 8;
1388
+ case "t":
1389
+ return 9;
1390
+ case "n":
1391
+ return 10;
1392
+ case "v":
1393
+ return 11;
1394
+ case "f":
1395
+ return 12;
1396
+ case "r":
1397
+ return 13;
1398
+ case "u":
1399
+ case "x":
1400
+ return parseInt(c.substring(2), 16) || c.charCodeAt(1);
1401
+ case "0":
1402
+ case "1":
1403
+ case "2":
1404
+ case "3":
1405
+ case "4":
1406
+ case "5":
1407
+ case "6":
1408
+ case "7":
1409
+ return parseInt(c.substring(1), 8);
1410
+ default:
1411
+ return c.charCodeAt(1);
404
1412
  }
405
- };
406
-
407
- var unbindDocumentEvents = function() {
408
- $(document).off('.mini-profiler');
409
- };
410
-
411
- var initFullView = function () {
412
-
413
- // first, get jquery tmpl, then render and bind handlers
414
- fetchTemplates(function () {
415
-
416
- // profiler will be defined in the full page's head
417
- renderTemplate(profiler).appendTo(container);
418
-
419
- var popup = $('.profiler-popup');
420
-
421
- toggleHidden(popup);
422
-
423
- prettyPrint();
424
-
425
- // since queries are already shown, just highlight and scroll when clicking a "1 sql" link
426
- popup.find('.profiler-queries-show').on('click', function () {
427
- queriesScrollIntoView($(this), $('.profiler-queries'), $(document));
428
- });
429
- });
430
- };
431
-
432
- var initControls = function (container) {
433
- if (options.showControls) {
434
- controls = $('<div class="profiler-controls"><span class="profiler-min-max">m</span><span class="profiler-clear">c</span></div>').appendTo(container);
435
-
436
- $('.profiler-controls .profiler-min-max').on('click', function () {
437
- container.toggleClass('profiler-min');
438
- });
439
-
440
- container.hover(function () {
441
- if ($(this).hasClass('profiler-min')) {
442
- $(this).find('.profiler-min-max').show();
443
- }
444
- },
445
- function () {
446
- if ($(this).hasClass('profiler-min')) {
447
- $(this).find('.profiler-min-max').hide();
448
- }
449
- });
450
-
451
- $('.profiler-controls .profiler-clear').on('click', function () {
452
- container.find('.profiler-result').remove();
453
- });
1413
+ }
1414
+ function i(c) {
1415
+ if (c < 32) return (c < 16 ? "\\x0" : "\\x") + c.toString(16);
1416
+ c = String.fromCharCode(c);
1417
+ if (c === "\\" || c === "-" || c === "[" || c === "]") c = "\\" + c;
1418
+ return c;
1419
+ }
1420
+ function o(c) {
1421
+ var d = c
1422
+ .substring(1, c.length - 1)
1423
+ .match(
1424
+ RegExp(
1425
+ "\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]",
1426
+ "g"
1427
+ )
1428
+ );
1429
+ c = [];
1430
+ for (
1431
+ var a = [], k = d[0] === "^", e = k ? 1 : 0, h = d.length;
1432
+ e < h;
1433
+ ++e
1434
+ ) {
1435
+ var g = d[e];
1436
+ switch (g) {
1437
+ case "\\B":
1438
+ case "\\b":
1439
+ case "\\D":
1440
+ case "\\d":
1441
+ case "\\S":
1442
+ case "\\s":
1443
+ case "\\W":
1444
+ case "\\w":
1445
+ c.push(g);
1446
+ continue;
1447
+ }
1448
+ g = f(g);
1449
+ var s;
1450
+ if (e + 2 < h && "-" === d[e + 1]) {
1451
+ s = f(d[e + 2]);
1452
+ e += 2;
1453
+ } else s = g;
1454
+ a.push([g, s]);
1455
+ if (!(s < 65 || g > 122)) {
1456
+ s < 65 ||
1457
+ g > 90 ||
1458
+ a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
1459
+ s < 97 ||
1460
+ g > 122 ||
1461
+ a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
1462
+ }
454
1463
  }
455
- else {
456
- container.addClass('profiler-no-controls');
1464
+ a.sort(function(v, w) {
1465
+ return v[0] - w[0] || w[1] - v[1];
1466
+ });
1467
+ d = [];
1468
+ g = [NaN, NaN];
1469
+ for (e = 0; e < a.length; ++e) {
1470
+ h = a[e];
1471
+ if (h[0] <= g[1] + 1) g[1] = Math.max(g[1], h[1]);
1472
+ else d.push((g = h));
457
1473
  }
458
- };
459
-
460
- var initPopupView = function () {
461
-
462
- if (options.authorized) {
463
- // all fetched profilings will go in here
464
- container = $('<div class="profiler-results"/>').appendTo(options.htmlContainer);
465
-
466
- // MiniProfiler.RenderIncludes() sets which corner to render in - default is upper left
467
- container.addClass("profiler-" + options.renderHorizontalPosition);
468
- container.addClass("profiler-" + options.renderVerticalPosition);
469
-
470
- //initialize the controls
471
- initControls(container);
472
-
473
- // we'll render results json via a jquery.tmpl - after we get the templates, we'll fetch the initial json to populate it
474
- fetchTemplates(function () {
475
- // get master page profiler results
476
- fetchResults(options.ids);
477
- });
478
- if (options.startHidden) container.hide();
1474
+ a = ["["];
1475
+ k && a.push("^");
1476
+ a.push.apply(a, c);
1477
+ for (e = 0; e < d.length; ++e) {
1478
+ h = d[e];
1479
+ a.push(i(h[0]));
1480
+ if (h[1] > h[0]) {
1481
+ h[1] + 1 > h[0] && a.push("-");
1482
+ a.push(i(h[1]));
1483
+ }
479
1484
  }
480
- else {
481
- fetchResults(options.ids);
1485
+ a.push("]");
1486
+ return a.join("");
1487
+ }
1488
+ function l(c) {
1489
+ for (
1490
+ var d = c.source.match(
1491
+ RegExp(
1492
+ "(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)",
1493
+ "g"
1494
+ )
1495
+ ),
1496
+ a = d.length,
1497
+ k = [],
1498
+ e = 0,
1499
+ h = 0;
1500
+ e < a;
1501
+ ++e
1502
+ ) {
1503
+ var g = d[e];
1504
+ if (g === "(") ++h;
1505
+ else if ("\\" === g.charAt(0))
1506
+ if ((g = +g.substring(1)) && g <= h) k[g] = -1;
482
1507
  }
483
-
484
- var jQueryAjaxComplete = function (e, xhr, settings) {
485
- if (xhr) {
486
- // should be an array of strings, e.g. ["008c4813-9bd7-443d-9376-9441ec4d6a8c","16ff377b-8b9c-4c20-a7b5-97cd9fa7eea7"]
487
- var stringIds = xhr.getResponseHeader('X-MiniProfiler-Ids');
488
- if (stringIds) {
489
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
490
- fetchResults(ids);
491
- }
492
- }
493
- };
494
-
495
- // fetch profile results for any ajax calls
496
- // note, this does not use $ cause we want to hook into the main jQuery
497
- if (jQuery && jQuery(document) && jQuery(document).ajaxComplete) {
498
- jQuery(document).on('ajaxComplete.mini-profiler', jQueryAjaxComplete);
1508
+ for (e = 1; e < k.length; ++e) if (-1 === k[e]) k[e] = ++n;
1509
+ for (h = e = 0; e < a; ++e) {
1510
+ g = d[e];
1511
+ if (g === "(") {
1512
+ ++h;
1513
+ if (k[h] === undefined) d[e] = "(?:";
1514
+ } else if ("\\" === g.charAt(0))
1515
+ if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
499
1516
  }
500
-
501
- if (jQuery && jQuery(document).ajaxStart)
502
- jQuery(document).on('ajaxStart.mini-profiler', function () { ajaxStartTime = new Date(); });
503
-
504
- // fetch results after ASP Ajax calls
505
- if (typeof (Sys) != 'undefined' && typeof (Sys.WebForms) != 'undefined' && typeof (Sys.WebForms.PageRequestManager) != 'undefined') {
506
- // Get the instance of PageRequestManager.
507
- var PageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
508
-
509
- PageRequestManager.add_endRequest(function (sender, args) {
510
- if (args) {
511
- var response = args.get_response();
512
- if (response.get_responseAvailable() && response._xmlHttpRequest !== null) {
513
- var stringIds = args.get_response().getResponseHeader('X-MiniProfiler-Ids');
514
- if (stringIds) {
515
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
516
- fetchResults(ids);
517
- }
518
- }
519
- }
520
- });
1517
+ for (h = e = 0; e < a; ++e)
1518
+ if ("^" === d[e] && "^" !== d[e + 1]) d[e] = "";
1519
+ if (c.ignoreCase && r)
1520
+ for (e = 0; e < a; ++e) {
1521
+ g = d[e];
1522
+ c = g.charAt(0);
1523
+ if (g.length >= 2 && c === "[") d[e] = o(g);
1524
+ else if (c !== "\\")
1525
+ d[e] = g.replace(/[a-zA-Z]/g, function(s) {
1526
+ s = s.charCodeAt(0);
1527
+ return "[" + String.fromCharCode(s & -33, s | 32) + "]";
1528
+ });
1529
+ }
1530
+ return d.join("");
1531
+ }
1532
+ for (var n = 0, r = false, j = false, q = 0, m = b.length; q < m; ++q) {
1533
+ var t = b[q];
1534
+ if (t.ignoreCase) j = true;
1535
+ else if (
1536
+ /[a-z]/i.test(
1537
+ t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, "")
1538
+ )
1539
+ ) {
1540
+ r = true;
1541
+ j = false;
1542
+ break;
521
1543
  }
522
-
523
- // more Asp.Net callbacks
524
- if (typeof (WebForm_ExecuteCallback) == "function") {
525
- WebForm_ExecuteCallback = (function (callbackObject) {
526
- // Store original function
527
- var original = WebForm_ExecuteCallback;
528
-
529
- return function (callbackObject) {
530
- original(callbackObject);
531
-
532
- var stringIds = callbackObject.xmlRequest.getResponseHeader('X-MiniProfiler-Ids');
533
- if (stringIds) {
534
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
535
- fetchResults(ids);
536
- }
537
- };
538
-
539
- })();
1544
+ }
1545
+ var p = [];
1546
+ q = 0;
1547
+ for (m = b.length; q < m; ++q) {
1548
+ t = b[q];
1549
+ if (t.global || t.multiline) throw Error("" + t);
1550
+ p.push("(?:" + l(t) + ")");
1551
+ }
1552
+ return RegExp(p.join("|"), j ? "gi" : "g");
1553
+ }
1554
+ function Y(b) {
1555
+ var f = 0;
1556
+ return function(i) {
1557
+ for (var o = null, l = 0, n = 0, r = i.length; n < r; ++n)
1558
+ switch (i.charAt(n)) {
1559
+ case "\t":
1560
+ o || (o = []);
1561
+ o.push(i.substring(l, n));
1562
+ l = b - (f % b);
1563
+ for (f += l; l >= 0; l -= 16)
1564
+ o.push(" ".substring(0, l));
1565
+ l = n + 1;
1566
+ break;
1567
+ case "\n":
1568
+ f = 0;
1569
+ break;
1570
+ default:
1571
+ ++f;
1572
+ }
1573
+ if (!o) return i;
1574
+ o.push(i.substring(l));
1575
+ return o.join("");
1576
+ };
1577
+ }
1578
+ function I(b, f, i, o) {
1579
+ if (f) {
1580
+ b = { source: f, c: b };
1581
+ i(b);
1582
+ o.push.apply(o, b.d);
1583
+ }
1584
+ }
1585
+ function B(b, f) {
1586
+ var i = {},
1587
+ o;
1588
+ (function() {
1589
+ for (
1590
+ var r = b.concat(f), j = [], q = {}, m = 0, t = r.length;
1591
+ m < t;
1592
+ ++m
1593
+ ) {
1594
+ var p = r[m],
1595
+ c = p[3];
1596
+ if (c) for (var d = c.length; --d >= 0; ) i[c.charAt(d)] = p;
1597
+ p = p[1];
1598
+ c = "" + p;
1599
+ if (!q.hasOwnProperty(c)) {
1600
+ j.push(p);
1601
+ q[c] = null;
1602
+ }
540
1603
  }
541
-
542
- // also fetch results after ExtJS requests, in case it is being used
543
- if (typeof (Ext) != 'undefined' && typeof (Ext.Ajax) != 'undefined' && typeof (Ext.Ajax.on) != 'undefined') {
544
- // Ext.Ajax is a singleton, so we just have to attach to its 'requestcomplete' event
545
- Ext.Ajax.on('requestcomplete', function (e, xhr, settings) {
546
- //iframed file uploads don't have headers
547
- if (!xhr || !xhr.getResponseHeader) {
548
- return;
549
- }
550
-
551
- var stringIds = xhr.getResponseHeader('X-MiniProfiler-Ids');
552
- if (stringIds) {
553
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
554
- fetchResults(ids);
1604
+ j.push(/[\0-\uffff]/);
1605
+ o = O(j);
1606
+ })();
1607
+ var l = f.length;
1608
+ function n(r) {
1609
+ for (
1610
+ var j = r.c,
1611
+ q = [j, z],
1612
+ m = 0,
1613
+ t = r.source.match(o) || [],
1614
+ p = {},
1615
+ c = 0,
1616
+ d = t.length;
1617
+ c < d;
1618
+ ++c
1619
+ ) {
1620
+ var a = t[c],
1621
+ k = p[a],
1622
+ e = void 0,
1623
+ h;
1624
+ if (typeof k === "string") h = false;
1625
+ else {
1626
+ var g = i[a.charAt(0)];
1627
+ if (g) {
1628
+ e = a.match(g[1]);
1629
+ k = g[0];
1630
+ } else {
1631
+ for (h = 0; h < l; ++h) {
1632
+ g = f[h];
1633
+ if ((e = a.match(g[1]))) {
1634
+ k = g[0];
1635
+ break;
555
1636
  }
556
- });
557
- }
558
-
559
- if (typeof (MooTools) != 'undefined' && typeof (Request) != 'undefined') {
560
- Request.prototype.addEvents({
561
- onComplete: function() {
562
- var stringIds = this.xhr.getResponseHeader('X-MiniProfiler-Ids');
563
- if (stringIds) {
564
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
565
- fetchResults(ids);
566
1637
  }
1638
+ e || (k = z);
567
1639
  }
568
- });
569
- }
570
-
571
- // add support for AngularJS, which use the basic XMLHttpRequest object.
572
- if (window.angular && typeof (XMLHttpRequest) != 'undefined') {
573
- var _send = XMLHttpRequest.prototype.send;
574
-
575
- XMLHttpRequest.prototype.send = function sendReplacement(data) {
576
- if (this.onreadystatechange) {
577
- if (typeof (this.miniprofiler) == 'undefined' || typeof (this.miniprofiler.prev_onreadystatechange) == 'undefined') {
578
- this.miniprofiler = { prev_onreadystatechange: this.onreadystatechange };
579
-
580
- this.onreadystatechange = function onReadyStateChangeReplacement() {
581
- if (this.readyState == 4) {
582
- var stringIds = this.getResponseHeader('X-MiniProfiler-Ids');
583
- if (stringIds) {
584
- var ids = typeof JSON != 'undefined' ? JSON.parse(stringIds) : eval(stringIds);
585
- fetchResults(ids);
586
- }
587
- }
588
-
589
- if (this.miniprofiler.prev_onreadystatechange !== null)
590
- return this.miniprofiler.prev_onreadystatechange.apply(this, arguments);
591
- };
592
- }
1640
+ if (
1641
+ (h = k.length >= 5 && "lang-" === k.substring(0, 5)) &&
1642
+ !(e && typeof e[1] === "string")
1643
+ ) {
1644
+ h = false;
1645
+ k = P;
593
1646
  }
594
-
595
- return _send.apply(this, arguments);
596
- };
1647
+ h || (p[a] = k);
1648
+ }
1649
+ g = m;
1650
+ m += a.length;
1651
+ if (h) {
1652
+ h = e[1];
1653
+ var s = a.indexOf(h),
1654
+ v = s + h.length;
1655
+ if (e[2]) {
1656
+ v = a.length - e[2].length;
1657
+ s = v - h.length;
1658
+ }
1659
+ k = k.substring(5);
1660
+ I(j + g, a.substring(0, s), n, q);
1661
+ I(j + g + s, h, Q(k, h), q);
1662
+ I(j + g + v, a.substring(v), n, q);
1663
+ } else q.push(j + g, k);
597
1664
  }
598
-
599
- // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
600
- if(typeof(window.fetch) === 'function' && window.fetch.__patchedByMiniProfiler === undefined) {
601
- var __originalFetch = window.fetch;
602
-
603
- window.fetch = function(input,init) {
604
- return new Promise(function(resolve,reject) {
605
- __originalFetch(input,init).then(function(response) {
606
- // look for x-mini-profile-ids
607
- var entries = response.headers.entries();
608
- for (var i = 0; i < entries.length; i++) {
609
- var pair = entries[i];
610
- if(pair[0] && (pair[0].toLowerCase() == 'x-miniprofiler-ids')) {
611
- var ids = JSON.parse(pair[1]);
612
- fetchResults(ids);
613
- }
614
- }
615
- resolve(response);
616
- }).catch(function(error) {
617
- reject(error);
618
- });
619
- });
1665
+ r.d = q;
1666
+ }
1667
+ return n;
1668
+ }
1669
+ function x(b) {
1670
+ var f = [],
1671
+ i = [];
1672
+ if (b.tripleQuotedStrings)
1673
+ f.push([
1674
+ A,
1675
+ /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
1676
+ null,
1677
+ "'\""
1678
+ ]);
1679
+ else
1680
+ b.multiLineStrings
1681
+ ? f.push([
1682
+ A,
1683
+ /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
1684
+ null,
1685
+ "'\"`"
1686
+ ])
1687
+ : f.push([
1688
+ A,
1689
+ /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
1690
+ null,
1691
+ "\"'"
1692
+ ]);
1693
+ b.verbatimStrings && i.push([A, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
1694
+ if (b.hashComments)
1695
+ if (b.cStyleComments) {
1696
+ f.push([
1697
+ C,
1698
+ /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,
1699
+ null,
1700
+ "#"
1701
+ ]);
1702
+ i.push([
1703
+ A,
1704
+ /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
1705
+ null
1706
+ ]);
1707
+ } else f.push([C, /^#[^\r\n]*/, null, "#"]);
1708
+ if (b.cStyleComments) {
1709
+ i.push([C, /^\/\/[^\r\n]*/, null]);
1710
+ i.push([C, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
1711
+ }
1712
+ b.regexLiterals &&
1713
+ i.push([
1714
+ "lang-regex",
1715
+ RegExp(
1716
+ "^" +
1717
+ Z +
1718
+ "(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)"
1719
+ )
1720
+ ]);
1721
+ b = b.keywords.replace(/^\s+|\s+$/g, "");
1722
+ b.length &&
1723
+ i.push([R, RegExp("^(?:" + b.replace(/\s+/g, "|") + ")\\b"), null]);
1724
+ f.push([z, /^\s+/, null, " \r\n\t\u00a0"]);
1725
+ i.push(
1726
+ [J, /^@[a-z_$][a-z_$@0-9]*/i, null],
1727
+ [S, /^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, null],
1728
+ [z, /^[a-z_$][a-z_$@0-9]*/i, null],
1729
+ [
1730
+ J,
1731
+ /^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,
1732
+ null,
1733
+ "0123456789"
1734
+ ],
1735
+ [E, /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
1736
+ );
1737
+ return B(f, i);
1738
+ }
1739
+ function $(b) {
1740
+ function f(D) {
1741
+ if (D > r) {
1742
+ if (j && j !== q) {
1743
+ n.push("</span>");
1744
+ j = null;
1745
+ }
1746
+ if (!j && q) {
1747
+ j = q;
1748
+ n.push('<span class="', j, '">');
620
1749
  }
621
- window.fetch.__patchedByMiniProfiler = true;
1750
+ var T = y(p(i.substring(r, D))).replace(e ? d : c, "$1&#160;");
1751
+ e = k.test(T);
1752
+ n.push(T.replace(a, s));
1753
+ r = D;
622
1754
  }
623
-
624
- // some elements want to be hidden on certain doc events
625
- bindDocumentEvents();
626
- };
627
-
628
- return {
629
-
630
- init: function () {
631
- var script = document.getElementById('mini-profiler');
632
- if (!script || !script.getAttribute) return;
633
-
634
- options = (function () {
635
- var version = script.getAttribute('data-version');
636
- var path = script.getAttribute('data-path');
637
-
638
- var currentId = script.getAttribute('data-current-id');
639
-
640
- var ids = script.getAttribute('data-ids');
641
- if (ids) ids = ids.split(',');
642
-
643
- var horizontal_position = script.getAttribute('data-horizontal-position');
644
- var vertical_position = script.getAttribute('data-vertical-position');
645
-
646
- var toggleShortcut = script.getAttribute('data-toggle-shortcut');
647
-
648
- if (script.getAttribute('data-max-traces')) {
649
- var maxTraces = parseInt(script.getAttribute('data-max-traces'), 10);
650
- }
651
-
652
- var collapseResults = script.getAttribute('data-collapse-results') === 'true';
653
- var trivial = script.getAttribute('data-trivial') === 'true';
654
- var children = script.getAttribute('data-children') === 'true';
655
- var controls = script.getAttribute('data-controls') === 'true';
656
- var totalSqlCount = script.getAttribute('data-total-sql-count') === 'true';
657
- var authorized = script.getAttribute('data-authorized') === 'true';
658
- var startHidden = script.getAttribute('data-start-hidden') === 'true' || sessionStorage['rack-mini-profiler-start-hidden'] === 'true';
659
- var htmlContainer = script.getAttribute('data-html-container');
660
-
661
- return {
662
- ids: ids,
663
- path: path,
664
- version: version,
665
- renderHorizontalPosition: horizontal_position,
666
- renderVerticalPosition: vertical_position,
667
- showTrivial: trivial,
668
- showChildrenTime: children,
669
- maxTracesToShow: maxTraces,
670
- showControls: controls,
671
- showTotalSqlCount: totalSqlCount,
672
- currentId: currentId,
673
- authorized: authorized,
674
- toggleShortcut: toggleShortcut,
675
- startHidden: startHidden,
676
- collapseResults: collapseResults,
677
- htmlContainer: htmlContainer
678
- };
679
- })();
680
-
681
- var doInit = function () {
682
- // when rendering a shared, full page, this div will exist
683
- container = $('.profiler-result-full');
684
- if (container.length) {
685
- if (window.location.href.indexOf("&trivial=1") > 0) {
686
- options.showTrivial = true;
687
- }
688
- initFullView();
689
- }
690
- else {
691
- initPopupView();
692
- }
693
- };
694
-
695
- // this preserves debugging
696
- var load = function (s, f) {
697
- var sc = document.createElement("script");
698
- sc.async = "async";
699
- sc.type = "text/javascript";
700
- sc.src = s;
701
- var done = false;
702
- sc.onload = sc.onreadystatechange = function (_, abort) {
703
- if (!sc.readyState || /loaded|complete/.test(sc.readyState)) {
704
- if (!abort && !done) { done = true; f(); }
705
- }
706
- };
707
- document.getElementsByTagName('head')[0].appendChild(sc);
708
- };
709
-
710
- var wait = 0;
711
- var finish = false;
712
- var deferInit = function() {
713
- if (finish) return;
714
- if (window.performance && window.performance.timing && window.performance.timing.loadEventEnd === 0 && wait < 10000) {
715
- setTimeout(deferInit, 100);
716
- wait += 100;
717
- } else {
718
- finish = true;
719
- init();
720
- }
721
- };
722
-
723
- var init = function() {
724
-
725
- // jquery.hotkeys.js
726
- // https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
727
-
728
- if (MiniProfiler.jQuery.hotkeys === undefined) {
729
- (function(d){function h(g){if("string"===typeof g.data){var h=g.handler,j=g.data.toLowerCase().split(" ");g.handler=function(b){if(!(this!==b.target&&(/textarea|select/i.test(b.target.nodeName)||"text"===b.target.type))){var c="keypress"!==b.type&&d.hotkeys.specialKeys[b.which],e=String.fromCharCode(b.which).toLowerCase(),a="",f={};b.altKey&&"alt"!==c&&(a+="alt+");b.ctrlKey&&"ctrl"!==c&&(a+="ctrl+");b.metaKey&&(!b.ctrlKey&&"meta"!==c)&&(a+="meta+");b.shiftKey&&"shift"!==c&&(a+="shift+");c?f[a+c]=
730
- !0:(f[a+e]=!0,f[a+d.hotkeys.shiftNums[e]]=!0,"shift+"===a&&(f[d.hotkeys.shiftNums[e]]=!0));c=0;for(e=j.length;c<e;c++)if(f[j[c]])return h.apply(this,arguments)}}}}d.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",
731
- 109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};d.each(["keydown","keyup","keypress"],function(){d.event.special[this]={add:h}})})(MiniProfiler.jQuery);
732
- }
733
-
734
- if (options.authorized) {
735
- var url = options.path + "includes.css?v=" + options.version;
736
- if (document.createStyleSheet) {
737
- document.createStyleSheet(url);
738
- } else {
739
- $('head').append($('<link rel="stylesheet" type="text/css" href="' + url + '" />'));
740
- }
741
- if (!$.tmpl) {
742
- load(options.path + 'jquery.tmpl.js?v=' + options.version, doInit);
743
- } else {
744
- doInit();
1755
+ }
1756
+ var i = b.source,
1757
+ o = b.g,
1758
+ l = b.d,
1759
+ n = [],
1760
+ r = 0,
1761
+ j = null,
1762
+ q = null,
1763
+ m = 0,
1764
+ t = 0,
1765
+ p = Y(window.PR_TAB_WIDTH),
1766
+ c = /([\r\n ]) /g,
1767
+ d = /(^| ) /gm,
1768
+ a = /\r\n?|\n/g,
1769
+ k = /[ \r\n]$/,
1770
+ e = true,
1771
+ h = window._pr_isIE6();
1772
+ h = h
1773
+ ? b.b.tagName === "PRE"
1774
+ ? h === 6
1775
+ ? "&#160;\r\n"
1776
+ : h === 7
1777
+ ? "&#160;<br>\r"
1778
+ : "&#160;\r"
1779
+ : "&#160;<br />"
1780
+ : "<br />";
1781
+ var g = b.b.className.match(/\blinenums\b(?::(\d+))?/),
1782
+ s;
1783
+ if (g) {
1784
+ for (var v = [], w = 0; w < 10; ++w)
1785
+ v[w] = h + '</li><li class="L' + w + '">';
1786
+ var F = g[1] && g[1].length ? g[1] - 1 : 0;
1787
+ n.push('<ol class="linenums"><li class="L', F % 10, '"');
1788
+ F && n.push(' value="', F + 1, '"');
1789
+ n.push(">");
1790
+ s = function() {
1791
+ var D = v[++F % 10];
1792
+ return j ? "</span>" + D + '<span class="' + j + '">' : D;
1793
+ };
1794
+ } else s = h;
1795
+ for (;;)
1796
+ if (m < o.length ? (t < l.length ? o[m] <= l[t] : true) : false) {
1797
+ f(o[m]);
1798
+ if (j) {
1799
+ n.push("</span>");
1800
+ j = null;
1801
+ }
1802
+ n.push(o[m + 1]);
1803
+ m += 2;
1804
+ } else if (t < l.length) {
1805
+ f(l[t]);
1806
+ q = l[t + 1];
1807
+ t += 2;
1808
+ } else break;
1809
+ f(i.length);
1810
+ j && n.push("</span>");
1811
+ g && n.push("</li></ol>");
1812
+ b.a = n.join("");
1813
+ }
1814
+ function u(b, f) {
1815
+ for (var i = f.length; --i >= 0; ) {
1816
+ var o = f[i];
1817
+ if (G.hasOwnProperty(o))
1818
+ "console" in window &&
1819
+ console.warn("cannot override language handler %s", o);
1820
+ else G[o] = b;
1821
+ }
1822
+ }
1823
+ function Q(b, f) {
1824
+ (b && G.hasOwnProperty(b)) ||
1825
+ (b = /^\s*</.test(f) ? "default-markup" : "default-code");
1826
+ return G[b];
1827
+ }
1828
+ function U(b) {
1829
+ var f = b.f,
1830
+ i = b.e;
1831
+ b.a = f;
1832
+ try {
1833
+ var o,
1834
+ l = f.match(aa);
1835
+ f = [];
1836
+ var n = 0,
1837
+ r = [];
1838
+ if (l)
1839
+ for (var j = 0, q = l.length; j < q; ++j) {
1840
+ var m = l[j];
1841
+ if (m.length > 1 && m.charAt(0) === "<") {
1842
+ if (!ba.test(m))
1843
+ if (ca.test(m)) {
1844
+ f.push(m.substring(9, m.length - 3));
1845
+ n += m.length - 12;
1846
+ } else if (da.test(m)) {
1847
+ f.push("\n");
1848
+ ++n;
1849
+ } else if (
1850
+ m.indexOf(V) >= 0 &&
1851
+ m
1852
+ .replace(
1853
+ /\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,
1854
+ ' $1="$2$3$4"'
1855
+ )
1856
+ .match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)
1857
+ ) {
1858
+ var t = m.match(W)[2],
1859
+ p = 1,
1860
+ c;
1861
+ c = j + 1;
1862
+ a: for (; c < q; ++c) {
1863
+ var d = l[c].match(W);
1864
+ if (d && d[2] === t)
1865
+ if (d[1] === "/") {
1866
+ if (--p === 0) break a;
1867
+ } else ++p;
1868
+ }
1869
+ if (c < q) {
1870
+ r.push(n, l.slice(j, c + 1).join(""));
1871
+ j = c;
1872
+ } else r.push(n, m);
1873
+ } else r.push(n, m);
1874
+ } else {
1875
+ var a;
1876
+ p = m;
1877
+ var k = p.indexOf("&");
1878
+ if (k < 0) a = p;
1879
+ else {
1880
+ for (--k; (k = p.indexOf("&#", k + 1)) >= 0; ) {
1881
+ var e = p.indexOf(";", k);
1882
+ if (e >= 0) {
1883
+ var h = p.substring(k + 3, e),
1884
+ g = 10;
1885
+ if (h && h.charAt(0) === "x") {
1886
+ h = h.substring(1);
1887
+ g = 16;
745
1888
  }
746
- } else {
747
- doInit();
1889
+ var s = parseInt(h, g);
1890
+ isNaN(s) ||
1891
+ (p =
1892
+ p.substring(0, k) +
1893
+ String.fromCharCode(s) +
1894
+ p.substring(e + 1));
1895
+ }
748
1896
  }
749
-
750
- };
751
-
752
- var major, minor;
753
- if (typeof(jQuery) == 'function') {
754
- var jQueryVersion = jQuery.fn.jquery.split('.');
755
- major = parseInt(jQueryVersion[0], 10);
756
- minor = parseInt(jQueryVersion[1], 10);
757
- }
758
-
759
-
760
- if (major === 3 || major === 2 || (major === 1 && minor >= 7)) {
761
- MiniProfiler.jQuery = $ = jQuery;
762
- $(deferInit);
763
- } else {
764
- load(options.path + "jquery.1.7.1.js?v=" + options.version, function() {
765
- MiniProfiler.jQuery = $ = jQuery.noConflict(true);
766
- $(deferInit);
767
- });
1897
+ a = p
1898
+ .replace(ea, "<")
1899
+ .replace(fa, ">")
1900
+ .replace(ga, "'")
1901
+ .replace(ha, '"')
1902
+ .replace(ia, " ")
1903
+ .replace(ja, "&");
1904
+ }
1905
+ f.push(a);
1906
+ n += a.length;
768
1907
  }
769
- },
770
-
771
- cleanUp: function() {
772
- unbindDocumentEvents();
773
- },
774
-
775
- pageTransition: function() {
776
- if (totalsControl) {
777
- totalsControl.remove();
778
- totalsControl = null;
779
1908
  }
780
- reqs = 0;
781
- totalTime = 0;
782
- expandedResults = false;
783
- $('.profiler-results .profiler-result').remove();
784
- },
785
-
786
- getClientTimingByName: function (clientTiming, name) {
787
-
788
- for (var i = 0; i < clientTiming.timings.length; i++) {
789
- if (clientTiming.timings[i].name == name) {
790
- return clientTiming.timings[i];
791
- }
792
- }
793
- return { Name: name, Duration: "", Start: "" };
794
- },
795
-
796
- renderDate: function (jsonDate) { // JavaScriptSerializer sends dates as /Date(1308024322065)/
797
- if (jsonDate) {
798
- return (typeof jsonDate === 'string') ? new Date(parseInt(jsonDate.replace("/Date(", "").replace(")/", ""), 10)).toUTCString() : jsonDate;
799
- }
800
- },
801
-
802
- renderIndent: function (depth) {
803
- var result = '';
804
- for (var i = 0; i < depth; i++) {
805
- result += '&nbsp;';
806
- }
807
- return result;
808
- },
809
-
810
- renderExecuteType: function (typeId) {
811
- // see StackExchange.Profiling.ExecuteType enum
812
- switch (typeId) {
813
- case 0: return 'None';
814
- case 1: return 'NonQuery';
815
- case 2: return 'Scalar';
816
- case 3: return 'Reader';
817
- }
818
- },
819
-
820
- shareUrl: function (id) {
821
- return options.path + 'results?id=' + id;
822
- },
823
-
824
- moreUrl: function () {
825
- var loc = window.location.href;
826
- loc = loc.indexOf("?") > 0 ? loc + "&pp=help" : "?pp=help";
827
- return loc;
828
- },
829
-
830
- getClientTimings: function (clientTimings) {
831
- var list = [];
832
- var t;
833
-
834
- if (!clientTimings.timings) return [];
835
-
836
- for (var i = 0; i < clientTimings.timings.length; i++) {
837
- t = clientTimings.timings[i];
838
- var trivial = t.Name != "Dom Complete" && t.Name != "Response"
839
- trivial = t.Duration < 2 ? trivial : false;
840
- list.push(
841
- {
842
- isTrivial: trivial,
843
- name: t.Name,
844
- duration: t.Duration,
845
- start: t.Start
846
- });
847
- }
848
-
849
-
850
- // Use the Paint Timing API for render performance.
851
- if (window.performance && window.performance.getEntriesByName) {
852
- var firstPaint = window.performance.getEntriesByName("first-paint");
853
-
854
- if(firstPaint !== undefined && firstPaint.length >= 1){
855
- list.push(
856
- {
857
- isTrivial: false,
858
- name: "First Paint Time",
859
- duration: firstPaint[0].duration,
860
- start: firstPaint[0].startTime
861
- });
1909
+ o = { source: f.join(""), h: r };
1910
+ var v = o.source;
1911
+ b.source = v;
1912
+ b.c = 0;
1913
+ b.g = o.h;
1914
+ Q(i, v)(b);
1915
+ $(b);
1916
+ } catch (w) {
1917
+ if ("console" in window) console.log(w && w.stack ? w.stack : w);
1918
+ }
1919
+ }
1920
+ var A = "str",
1921
+ R = "kwd",
1922
+ C = "com",
1923
+ S = "typ",
1924
+ J = "lit",
1925
+ E = "pun",
1926
+ z = "pln",
1927
+ P = "src",
1928
+ V = "nocode",
1929
+ Z = (function() {
1930
+ for (
1931
+ var b = [
1932
+ "!",
1933
+ "!=",
1934
+ "!==",
1935
+ "#",
1936
+ "%",
1937
+ "%=",
1938
+ "&",
1939
+ "&&",
1940
+ "&&=",
1941
+ "&=",
1942
+ "(",
1943
+ "*",
1944
+ "*=",
1945
+ "+=",
1946
+ ",",
1947
+ "-=",
1948
+ "->",
1949
+ "/",
1950
+ "/=",
1951
+ ":",
1952
+ "::",
1953
+ ";",
1954
+ "<",
1955
+ "<<",
1956
+ "<<=",
1957
+ "<=",
1958
+ "=",
1959
+ "==",
1960
+ "===",
1961
+ ">",
1962
+ ">=",
1963
+ ">>",
1964
+ ">>=",
1965
+ ">>>",
1966
+ ">>>=",
1967
+ "?",
1968
+ "@",
1969
+ "[",
1970
+ "^",
1971
+ "^=",
1972
+ "^^",
1973
+ "^^=",
1974
+ "{",
1975
+ "|",
1976
+ "|=",
1977
+ "||",
1978
+ "||=",
1979
+ "~",
1980
+ "break",
1981
+ "case",
1982
+ "continue",
1983
+ "delete",
1984
+ "do",
1985
+ "else",
1986
+ "finally",
1987
+ "instanceof",
1988
+ "return",
1989
+ "throw",
1990
+ "try",
1991
+ "typeof"
1992
+ ],
1993
+ f = "(?:^^|[+-]",
1994
+ i = 0;
1995
+ i < b.length;
1996
+ ++i
1997
+ )
1998
+ f += "|" + b[i].replace(/([^=<>:&a-z])/g, "\\$1");
1999
+ f += ")\\s*";
2000
+ return f;
2001
+ })(),
2002
+ L = /&/g,
2003
+ M = /</g,
2004
+ N = />/g,
2005
+ X = /\"/g,
2006
+ ea = /&lt;/g,
2007
+ fa = /&gt;/g,
2008
+ ga = /&apos;/g,
2009
+ ha = /&quot;/g,
2010
+ ja = /&amp;/g,
2011
+ ia = /&nbsp;/g,
2012
+ ka = /[\r\n]/g,
2013
+ K = null,
2014
+ aa = RegExp(
2015
+ "[^<]+|<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<",
2016
+ "g"
2017
+ ),
2018
+ ba = /^<\!--/,
2019
+ ca = /^<!\[CDATA\[/,
2020
+ da = /^<br\b/i,
2021
+ W = /^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
2022
+ la = x({
2023
+ keywords:
2024
+ "break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
2025
+ hashComments: true,
2026
+ cStyleComments: true,
2027
+ multiLineStrings: true,
2028
+ regexLiterals: true
2029
+ }),
2030
+ G = {};
2031
+ u(la, ["default-code"]);
2032
+ u(
2033
+ B(
2034
+ [],
2035
+ [
2036
+ [z, /^[^<?]+/],
2037
+ ["dec", /^<!\w[^>]*(?:>|$)/],
2038
+ [C, /^<\!--[\s\S]*?(?:-\->|$)/],
2039
+ ["lang-", /^<\?([\s\S]+?)(?:\?>|$)/],
2040
+ ["lang-", /^<%([\s\S]+?)(?:%>|$)/],
2041
+ [E, /^(?:<[%?]|[%?]>)/],
2042
+ ["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
2043
+ ["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
2044
+ ["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
2045
+ ["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i]
2046
+ ]
2047
+ ),
2048
+ ["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"]
2049
+ );
2050
+ u(
2051
+ B(
2052
+ [
2053
+ [z, /^[\s]+/, null, " \t\r\n"],
2054
+ ["atv", /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, "\"'"]
2055
+ ],
2056
+ [
2057
+ ["tag", /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
2058
+ ["atn", /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
2059
+ ["lang-uq.val", /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
2060
+ [E, /^[=<>\/]+/],
2061
+ ["lang-js", /^on\w+\s*=\s*\"([^\"]+)\"/i],
2062
+ ["lang-js", /^on\w+\s*=\s*\'([^\']+)\'/i],
2063
+ ["lang-js", /^on\w+\s*=\s*([^\"\'>\s]+)/i],
2064
+ ["lang-css", /^style\s*=\s*\"([^\"]+)\"/i],
2065
+ ["lang-css", /^style\s*=\s*\'([^\']+)\'/i],
2066
+ ["lang-css", /^style\s*=\s*([^\"\'>\s]+)/i]
2067
+ ]
2068
+ ),
2069
+ ["in.tag"]
2070
+ );
2071
+ u(B([], [["atv", /^[\s\S]+/]]), ["uq.val"]);
2072
+ u(
2073
+ x({
2074
+ keywords:
2075
+ "break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ",
2076
+ hashComments: true,
2077
+ cStyleComments: true
2078
+ }),
2079
+ ["c", "cc", "cpp", "cxx", "cyc", "m"]
2080
+ );
2081
+ u(x({ keywords: "null true false" }), ["json"]);
2082
+ u(
2083
+ x({
2084
+ keywords:
2085
+ "break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
2086
+ hashComments: true,
2087
+ cStyleComments: true,
2088
+ verbatimStrings: true
2089
+ }),
2090
+ ["cs"]
2091
+ );
2092
+ u(
2093
+ x({
2094
+ keywords:
2095
+ "break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",
2096
+ cStyleComments: true
2097
+ }),
2098
+ ["java"]
2099
+ );
2100
+ u(
2101
+ x({
2102
+ keywords:
2103
+ "break continue do else for if return while case done elif esac eval fi function in local set then until ",
2104
+ hashComments: true,
2105
+ multiLineStrings: true
2106
+ }),
2107
+ ["bsh", "csh", "sh"]
2108
+ );
2109
+ u(
2110
+ x({
2111
+ keywords:
2112
+ "break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",
2113
+ hashComments: true,
2114
+ multiLineStrings: true,
2115
+ tripleQuotedStrings: true
2116
+ }),
2117
+ ["cv", "py"]
2118
+ );
2119
+ u(
2120
+ x({
2121
+ keywords:
2122
+ "caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",
2123
+ hashComments: true,
2124
+ multiLineStrings: true,
2125
+ regexLiterals: true
2126
+ }),
2127
+ ["perl", "pl", "pm"]
2128
+ );
2129
+ u(
2130
+ x({
2131
+ keywords:
2132
+ "break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",
2133
+ hashComments: true,
2134
+ multiLineStrings: true,
2135
+ regexLiterals: true
2136
+ }),
2137
+ ["rb"]
2138
+ );
2139
+ u(
2140
+ x({
2141
+ keywords:
2142
+ "break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",
2143
+ cStyleComments: true,
2144
+ regexLiterals: true
2145
+ }),
2146
+ ["js"]
2147
+ );
2148
+ u(B([], [[A, /^[\s\S]+/]]), ["regex"]);
2149
+ window.PR_normalizedHtml = H;
2150
+ window.prettyPrintOne = function(b, f) {
2151
+ var i = { f: b, e: f };
2152
+ U(i);
2153
+ return i.a;
2154
+ };
2155
+ window.prettyPrint = function(b) {
2156
+ function f() {
2157
+ for (
2158
+ var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity;
2159
+ q < o.length && j.now() < t;
2160
+ q++
2161
+ ) {
2162
+ var p = o[q];
2163
+ if (p.className && p.className.indexOf("prettyprint") >= 0) {
2164
+ var c = p.className.match(/\blang-(\w+)\b/);
2165
+ if (c) c = c[1];
2166
+ for (var d = false, a = p.parentNode; a; a = a.parentNode)
2167
+ if (
2168
+ (a.tagName === "pre" ||
2169
+ a.tagName === "code" ||
2170
+ a.tagName === "xmp") &&
2171
+ a.className &&
2172
+ a.className.indexOf("prettyprint") >= 0
2173
+ ) {
2174
+ d = true;
2175
+ break;
862
2176
  }
863
- }
864
-
865
- list.sort(function (a, b) { return a.start - b.start; });
866
- return list;
867
- },
868
-
869
- getSqlTimings: function (root) {
870
- var result = [],
871
- addToResults = function (timing) {
872
- if (timing.sql_timings) {
873
- for (var i = 0, sqlTiming; i < timing.sql_timings.length; i++) {
874
- sqlTiming = timing.sql_timings[i];
875
-
876
- // HACK: add info about the parent Timing to each SqlTiming so UI can render
877
- sqlTiming.parent_timing_name = timing.name;
878
-
879
- if(sqlTiming.duration_milliseconds > 50) {
880
- sqlTiming.row_class = "slow";
881
- }
882
-
883
- if(sqlTiming.duration_milliseconds > 200) {
884
- sqlTiming.row_class = "very-slow";
885
- }
886
-
887
- if(sqlTiming.duration_milliseconds > 400) {
888
- sqlTiming.row_class = "very-very-slow";
889
- }
890
-
891
- result.push(sqlTiming);
892
- }
893
- }
894
-
895
- if (timing.children) {
896
- for (var i = 0; i < timing.children.length; i++) {
897
- addToResults(timing.children[i]);
898
- }
899
- }
900
- };
901
-
902
- // start adding at the root and recurse down
903
- addToResults(root);
904
-
905
- var removeDuration = function(list, duration) {
906
-
907
- var newList = [];
908
- for (var i = 0; i < list.length; i++) {
909
-
910
- var item = list[i];
911
- if (duration.start > item.start) {
912
- if (duration.start > item.finish) {
913
- newList.push(item);
914
- continue;
915
- }
916
- newList.push({ start: item.start, finish: duration.start });
917
- }
918
-
919
- if (duration.finish < item.finish) {
920
- if (duration.finish < item.start) {
921
- newList.push(item);
922
- continue;
923
- }
924
- newList.push({ start: duration.finish, finish: item.finish });
925
- }
926
- }
927
-
928
- return newList;
929
- };
930
-
931
- var processTimes = function (elem, parent) {
932
- var duration = { start: elem.start_milliseconds, finish: (elem.start_milliseconds + elem.duration_milliseconds) };
933
- elem.richTiming = [duration];
934
- if (parent !== null) {
935
- elem.parent = parent;
936
- elem.parent.richTiming = removeDuration(elem.parent.richTiming, duration);
937
- }
938
-
939
- if (elem.children) {
940
- for (var i = 0; i < elem.children.length; i++) {
941
- processTimes(elem.children[i], elem);
942
- }
943
- }
944
- };
945
-
946
- processTimes(root, null);
947
-
948
- // sort results by time
949
- result.sort(function (a, b) { return a.start_milliseconds - b.start_milliseconds; });
950
-
951
- var determineOverlap = function(gap, node) {
952
- var overlap = 0;
953
- for (var i = 0; i < node.richTiming.length; i++) {
954
- var current = node.richTiming[i];
955
- if (current.start > gap.finish) {
956
- break;
957
- }
958
- if (current.finish < gap.start) {
959
- continue;
960
- }
961
-
962
- overlap += Math.min(gap.finish, current.finish) - Math.max(gap.start, current.start);
963
- }
964
- return overlap;
965
- };
966
-
967
- var determineGap = function (gap, node, match) {
968
- var overlap = determineOverlap(gap, node);
969
- if (match === null || overlap > match.duration) {
970
- match = { name: node.name, duration: overlap };
971
- }
972
- else if (match.name == node.name) {
973
- match.duration += overlap;
974
- }
975
-
976
- if (node.children) {
977
- for (var i = 0; i < node.children.length; i++) {
978
- match = determineGap(gap, node.children[i], match);
979
- }
2177
+ if (!d) {
2178
+ a = p;
2179
+ if (null === K) {
2180
+ d = document.createElement("PRE");
2181
+ d.appendChild(
2182
+ document.createTextNode(
2183
+ '<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'
2184
+ )
2185
+ );
2186
+ K = !/</.test(d.innerHTML);
2187
+ }
2188
+ if (K) {
2189
+ d = a.innerHTML;
2190
+ if ("XMP" === a.tagName) d = y(d);
2191
+ else {
2192
+ a = a;
2193
+ if ("PRE" === a.tagName) a = true;
2194
+ else if (ka.test(d)) {
2195
+ var k = "";
2196
+ if (a.currentStyle) k = a.currentStyle.whiteSpace;
2197
+ else if (window.getComputedStyle)
2198
+ k = window.getComputedStyle(a, null).whiteSpace;
2199
+ a = !k || k === "pre";
2200
+ } else a = true;
2201
+ a ||
2202
+ (d = d
2203
+ .replace(/(<br\s*\/?>)[\r\n]+/g, "$1")
2204
+ .replace(/(?:[\r\n]+[ \t]*)+/g, " "));
980
2205
  }
981
- return match;
982
- };
983
-
984
- var time = 0;
985
- var prev = null;
986
- $.each(result, function () {
987
- this.prevGap = {
988
- duration: (this.start_milliseconds - time).toFixed(2),
989
- start: time,
990
- finish: this.start_milliseconds
991
- };
992
-
993
- this.prevGap.topReason = determineGap(this.prevGap, root, null);
994
-
995
- time = this.start_milliseconds + this.duration_milliseconds;
996
- prev = this;
997
- });
998
-
999
-
1000
- if (result.length > 0) {
1001
- var me = result[result.length - 1];
1002
- me.nextGap = {
1003
- duration: (root.duration_milliseconds - time).toFixed(2),
1004
- start: time,
1005
- finish: root.duration_milliseconds
1006
- };
1007
- me.nextGap.topReason = determineGap(me.nextGap, root, null);
1008
- }
1009
-
1010
- return result;
1011
- },
1012
-
1013
- getSqlTimingsCount: function (root) {
1014
- var result = 0,
1015
- countSql = function (timing) {
1016
- if (timing.sql_timings) {
1017
- result += timing.sql_timings.length;
1018
- }
1019
-
1020
- if (timing.children) {
1021
- for (var i = 0; i < timing.children.length; i++) {
1022
- countSql(timing.children[i]);
1023
- }
1024
- }
1025
- };
1026
- countSql(root);
1027
- return result;
1028
- },
1029
-
1030
- fetchResultsExposed: function (ids) {
1031
- return fetchResults(ids);
1032
- },
1033
-
1034
- formatParameters: function (parameters) {
1035
- if (parameters != null) {
1036
- return parameters.map(function(item, index){ return "["+item[0]+", "+ item[1] +"]";}).join(', ');
1037
- }
1038
- else {
1039
- return '';
2206
+ d = d;
2207
+ } else {
2208
+ d = [];
2209
+ for (a = a.firstChild; a; a = a.nextSibling) H(a, d);
2210
+ d = d.join("");
2211
+ }
2212
+ d = d.replace(/(?:\r\n?|\n)$/, "");
2213
+ m = { f: d, e: c, b: p };
2214
+ U(m);
2215
+ if ((p = m.a)) {
2216
+ c = m.b;
2217
+ if ("XMP" === c.tagName) {
2218
+ d = document.createElement("PRE");
2219
+ for (a = 0; a < c.attributes.length; ++a) {
2220
+ k = c.attributes[a];
2221
+ if (k.specified)
2222
+ if (k.name.toLowerCase() === "class")
2223
+ d.className = k.value;
2224
+ else d.setAttribute(k.name, k.value);
2225
+ }
2226
+ d.innerHTML = p;
2227
+ c.parentNode.replaceChild(d, c);
2228
+ } else c.innerHTML = p;
2229
+ }
1040
2230
  }
1041
- },
1042
-
1043
- formatDuration: function (duration) {
1044
- return (duration || 0).toFixed(1);
1045
- },
1046
-
1047
- showTotalSqlCount: function () {
1048
- return options.showTotalSqlCount
2231
+ }
1049
2232
  }
2233
+ if (q < o.length) setTimeout(f, 250);
2234
+ else b && b();
2235
+ }
2236
+ for (
2237
+ var i = [
2238
+ document.getElementsByTagName("pre"),
2239
+ document.getElementsByTagName("code"),
2240
+ document.getElementsByTagName("xmp")
2241
+ ],
2242
+ o = [],
2243
+ l = 0;
2244
+ l < i.length;
2245
+ ++l
2246
+ )
2247
+ for (var n = 0, r = i[l].length; n < r; ++n) o.push(i[l][n]);
2248
+ i = null;
2249
+ var j = Date;
2250
+ j.now ||
2251
+ (j = {
2252
+ now: function() {
2253
+ return new Date().getTime();
2254
+ }
2255
+ });
2256
+ var q = 0,
2257
+ m;
2258
+ f();
1050
2259
  };
1051
- })();
1052
-
1053
- MiniProfiler.init();
1054
-
1055
- if (typeof prettyPrint === "undefined") {
2260
+ window.PR = {
2261
+ combinePrefixPatterns: O,
2262
+ createSimpleLexer: B,
2263
+ registerLangHandler: u,
2264
+ sourceDecorator: x,
2265
+ PR_ATTRIB_NAME: "atn",
2266
+ PR_ATTRIB_VALUE: "atv",
2267
+ PR_COMMENT: C,
2268
+ PR_DECLARATION: "dec",
2269
+ PR_KEYWORD: R,
2270
+ PR_LITERAL: J,
2271
+ PR_NOCODE: V,
2272
+ PR_PLAIN: z,
2273
+ PR_PUNCTUATION: E,
2274
+ PR_SOURCE: P,
2275
+ PR_STRING: A,
2276
+ PR_TAG: "tag",
2277
+ PR_TYPE: S
2278
+ };
2279
+ })();
1056
2280
 
1057
- // prettify.js
1058
- // http://code.google.com/p/google-code-prettify/
1059
-
1060
- window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y};
1061
- (function(){function y(b){return b.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name<m.name?-1:q.name===m.name?0:1});l=r}for(j=0;j<n;++j){r=l[j];r.specified&&f.push(" ",r.name.toLowerCase(),'="',r.value.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;").replace(X,"&quot;"),'"')}}f.push(">");
1062
- for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("</",o,">");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1),
1063
- 8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e<h;++e){var g=d[e];switch(g){case "\\B":case "\\b":case "\\D":case "\\d":case "\\S":case "\\s":case "\\W":case "\\w":c.push(g);
1064
- continue}g=f(g);var s;if(e+2<h&&"-"===d[e+1]){s=f(d[e+2]);e+=2}else s=g;a.push([g,s]);if(!(s<65||g>122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;e<a.length;++e){h=a[e];if(h[0]<=g[1]+1)g[1]=Math.max(g[1],h[1]);else d.push(g=h)}a=["["];k&&a.push("^");a.push.apply(a,c);for(e=0;e<d.length;++e){h=d[e];a.push(i(h[0]));if(h[1]>h[0]){h[1]+1>h[0]&&a.push("-");
1065
- a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e<a;++e){var g=d[e];if(g==="(")++h;else if("\\"===g.charAt(0))if((g=+g.substring(1))&&g<=h)k[g]=-1}for(e=1;e<k.length;++e)if(-1===k[e])k[e]=++n;for(h=e=0;e<a;++e){g=d[e];if(g==="("){++h;if(k[h]===undefined)d[e]="(?:"}else if("\\"===
1066
- g.charAt(0))if((g=+g.substring(1))&&g<=h)d[e]="\\"+k[h]}for(h=e=0;e<a;++e)if("^"===d[e]&&"^"!==d[e+1])d[e]="";if(c.ignoreCase&&r)for(e=0;e<a;++e){g=d[e];c=g.charAt(0);if(g.length>=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q<m;++q){var t=b[q];if(t.ignoreCase)j=true;else if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,
1067
- ""))){r=true;j=false;break}}var p=[];q=0;for(m=b.length;q<m;++q){t=b[q];if(t.global||t.multiline)throw Error(""+t);p.push("(?:"+l(t)+")")}return RegExp(p.join("|"),j?"gi":"g")}function Y(b){var f=0;return function(i){for(var o=null,l=0,n=0,r=i.length;n<r;++n)switch(i.charAt(n)){case "\t":o||(o=[]);o.push(i.substring(l,n));l=b-f%b;for(f+=l;l>=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b,
1068
- f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m<t;++m){var p=r[m],c=p[3];if(c)for(var d=c.length;--d>=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c<d;++c){var a=t[c],k=p[a],e=void 0,h;if(typeof k==="string")h=false;else{var g=i[a.charAt(0)];
1069
- if(g){e=a.match(g[1]);k=g[0]}else{for(h=0;h<l;++h){g=f[h];if(e=a.match(g[1])){k=g[0];break}}e||(k=z)}if((h=k.length>=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
1070
- null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
1071
- null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,
1072
- null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("</span>");j=null}if(!j&&q){j=q;n.push('<span class="',j,'">')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1&#160;");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g,
1073
- d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?"&#160;\r\n":h===7?"&#160;<br>\r":"&#160;\r":"&#160;<br />":"<br />";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'</li><li class="L'+w+'">';var F=g[1]&&g[1].length?g[1]-1:0;n.push('<ol class="linenums"><li class="L',F%10,'"');F&&n.push(' value="',F+1,'"');n.push(">");s=function(){var D=v[++F%10];return j?"</span>"+D+'<span class="'+j+'">':D}}else s=h;
1074
- for(;;)if(m<o.length?t<l.length?o[m]<=l[t]:true:false){f(o[m]);if(j){n.push("</span>");j=null}n.push(o[m+1]);m+=2}else if(t<l.length){f(l[t]);q=l[t+1];t+=2}else break;f(i.length);j&&n.push("</span>");g&&n.push("</li></ol>");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*</.test(f)?"default-markup":"default-code");return G[b]}
1075
- function U(b){var f=b.f,i=b.e;b.a=f;try{var o,l=f.match(aa);f=[];var n=0,r=[];if(l)for(var j=0,q=l.length;j<q;++j){var m=l[j];if(m.length>1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c<q;++c){var d=l[c].match(W);if(d&&
1076
- d[2]===t)if(d[1]==="/"){if(--p===0)break a}else++p}if(c<q){r.push(n,l.slice(j,c+1).join(""));j=c}else r.push(n,m)}else r.push(n,m)}else{var a;p=m;var k=p.indexOf("&");if(k<0)a=p;else{for(--k;(k=p.indexOf("&#",k+1))>=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja,
1077
- "&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=",
1078
- "~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i<b.length;++i)f+="|"+b[i].replace(/([^=<>:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=/</g,N=/>/g,X=/\"/g,ea=/&lt;/g,fa=/&gt;/g,ga=/&apos;/g,ha=/&quot;/g,ja=/&amp;/g,ia=/&nbsp;/g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|<!--[\\s\\S]*?--\>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<","g"),ba=/^<\!--/,ca=/^<!\[CDATA\[/,da=/^<br\b/i,W=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
1079
- la=x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
1080
- hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),G={};u(la,["default-code"]);u(B([],[[z,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup",
1081
- "htm","html","mxml","xhtml","xml","xsl"]);u(B([[z,/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],
1082
- ["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);u(B([],[["atv",/^[\s\S]+/]]),["uq.val"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ",
1083
- hashComments:true,cStyleComments:true}),["c","cc","cpp","cxx","cyc","m"]);u(x({keywords:"null true false"}),["json"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
1084
- hashComments:true,cStyleComments:true,verbatimStrings:true}),["cs"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",
1085
- cStyleComments:true}),["java"]);u(x({keywords:"break continue do else for if return while case done elif esac eval fi function in local set then until ",hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);u(x({keywords:"break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);
1086
- u(x({keywords:"caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);u(x({keywords:"break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",hashComments:true,
1087
- multiLineStrings:true,regexLiterals:true}),["rb"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",cStyleComments:true,regexLiterals:true}),["js"]);u(B([],[[A,/^[\s\S]+/]]),
1088
- ["regex"]);window.PR_normalizedHtml=H;window.prettyPrintOne=function(b,f){var i={f:b,e:f};U(i);return i.a};window.prettyPrint=function(b){function f(){for(var t=window.PR_SHOULD_USE_CONTINUATION?j.now()+250:Infinity;q<o.length&&j.now()<t;q++){var p=o[q];if(p.className&&p.className.indexOf("prettyprint")>=0){var c=p.className.match(/\blang-(\w+)\b/);if(c)c=c[1];for(var d=false,a=p.parentNode;a;a=a.parentNode)if((a.tagName==="pre"||a.tagName==="code"||a.tagName==="xmp")&&a.className&&a.className.indexOf("prettyprint")>=
1089
- 0){d=true;break}if(!d){a=p;if(null===K){d=document.createElement("PRE");d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));K=!/</.test(d.innerHTML)}if(K){d=a.innerHTML;if("XMP"===a.tagName)d=y(d);else{a=a;if("PRE"===a.tagName)a=true;else if(ka.test(d)){var k="";if(a.currentStyle)k=a.currentStyle.whiteSpace;else if(window.getComputedStyle)k=window.getComputedStyle(a,null).whiteSpace;a=!k||k==="pre"}else a=true;a||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,"$1").replace(/(?:[\r\n]+[ \t]*)+/g,
1090
- " "))}d=d}else{d=[];for(a=a.firstChild;a;a=a.nextSibling)H(a,d);d=d.join("")}d=d.replace(/(?:\r\n?|\n)$/,"");m={f:d,e:c,b:p};U(m);if(p=m.a){c=m.b;if("XMP"===c.tagName){d=document.createElement("PRE");for(a=0;a<c.attributes.length;++a){k=c.attributes[a];if(k.specified)if(k.name.toLowerCase()==="class")d.className=k.value;else d.setAttribute(k.name,k.value)}d.innerHTML=p;c.parentNode.replaceChild(d,c)}else c.innerHTML=p}}}}if(q<o.length)setTimeout(f,250);else b&&b()}for(var i=[document.getElementsByTagName("pre"),
1091
- document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],o=[],l=0;l<i.length;++l)for(var n=0,r=i[l].length;n<r;++n)o.push(i[l][n]);i=null;var j=Date;j.now||(j={now:function(){return(new Date).getTime()}});var q=0,m;f()};window.PR={combinePrefixPatterns:O,createSimpleLexer:B,registerLangHandler:u,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:C,PR_DECLARATION:"dec",PR_KEYWORD:R,PR_LITERAL:J,PR_NOCODE:V,PR_PLAIN:z,PR_PUNCTUATION:E,PR_SOURCE:P,PR_STRING:A,
1092
- PR_TAG:"tag",PR_TYPE:S}})()
1093
-
1094
- ;
1095
-
1096
- // lang-sql.js
1097
- // http://code.google.com/p/google-code-prettify/
1098
-
1099
- PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
1100
- null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"])
1101
-
1102
- ;
2281
+ // prettier-ignore
2282
+ // lang-sql.js
2283
+ // http://code.google.com/p/google-code-prettify/
2284
+ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
2285
+ null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"]);
1103
2286
  }