rack-mini-profiler 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/html/includes.js +797 -851
- data/lib/html/includes.tmpl +1 -1
- data/lib/mini_profiler/asset_version.rb +1 -1
- data/lib/mini_profiler/profiling_methods.rb +2 -6
- data/lib/mini_profiler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c284e06a7538c082f580dd74793d5a278e2c8fe4ac8f095e2f7db65f8162b6f0
|
4
|
+
data.tar.gz: a8e39352e06175a4acba8445cb0e850430e727fa9b5b80dd3115fa2248be3e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b89818251b38e988b8eb8084388e9cbfc52e43e2566bf29a3897707a80bcec6ec29b990539e47f9e4139f0b3beaa8e77c871c158745fe96ea288e6cbf99f2cc9
|
7
|
+
data.tar.gz: d616e5e78bd5db52f85d428d2657e90ba330373a7c5edb3f4304c23f268dbec3f1aff064d4bbebe63b7262ff90f86d99a569d826387402cff6846981f69f0dcb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.1.2 2019-24-10
|
4
|
+
|
5
|
+
- [FIX] JS payload was not working on IE11 and leading to errors
|
6
|
+
- [FIX] Remove global singleton_class which was injected
|
7
|
+
- [FIX] Regressions post removal of jQuery
|
8
|
+
|
3
9
|
## 1.1.1 2019-22-10
|
4
10
|
|
5
11
|
- [FIX] correct JavaScript fetch support header iteration (Jorge Manrubia)
|
data/lib/html/includes.js
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
"use strict";
|
2
|
+
|
2
3
|
var MiniProfiler = (function() {
|
4
|
+
var _arguments = arguments;
|
3
5
|
var options,
|
4
6
|
container,
|
5
7
|
controls,
|
6
8
|
fetchedIds = [],
|
7
|
-
fetchingIds = [],
|
9
|
+
fetchingIds = [],
|
10
|
+
// so we never pull down a profiler twice
|
8
11
|
ajaxStartTime,
|
9
12
|
totalsControl,
|
10
13
|
reqs = 0,
|
11
14
|
expandedResults = false,
|
12
15
|
totalTime = 0,
|
13
16
|
totalSqlCount = 0;
|
14
|
-
|
17
|
+
|
18
|
+
var hasLocalStorage = function hasLocalStorage(keyPrefix) {
|
15
19
|
try {
|
16
20
|
// attempt to save to localStorage as Safari private windows will throw an error
|
17
21
|
localStorage[keyPrefix + "-test"] = "1";
|
@@ -22,27 +26,52 @@ var MiniProfiler = (function() {
|
|
22
26
|
}
|
23
27
|
};
|
24
28
|
|
25
|
-
var getVersionedKey = function(keyPrefix) {
|
29
|
+
var getVersionedKey = function getVersionedKey(keyPrefix) {
|
26
30
|
return keyPrefix + "-" + options.version;
|
27
31
|
};
|
28
32
|
|
29
|
-
|
33
|
+
// polyfills as helper functions to avoid conflicts
|
34
|
+
// needed for IE11
|
35
|
+
// remove and replace with Element.closest when we drop IE11 support
|
36
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
|
37
|
+
|
38
|
+
var elementMatches =
|
39
|
+
Element.prototype.msMatchesSelector ||
|
40
|
+
Element.prototype.webkitMatchesSelector;
|
41
|
+
|
42
|
+
var elementClosest = function elementClosest(el, s) {
|
43
|
+
if (typeof el.closest === "function") {
|
44
|
+
return el.closest(s);
|
45
|
+
}
|
46
|
+
|
47
|
+
do {
|
48
|
+
if (typeof el.matches === "function") {
|
49
|
+
if (el.matches(s)) return el;
|
50
|
+
} else {
|
51
|
+
if (elementMatches.call(el, s)) return el;
|
52
|
+
}
|
53
|
+
|
54
|
+
el = el.parentElement || el.parentNode;
|
55
|
+
} while (el !== null && el.nodeType === 1);
|
56
|
+
|
57
|
+
return null;
|
58
|
+
};
|
59
|
+
|
60
|
+
var save = function save(keyPrefix, value) {
|
30
61
|
if (!hasLocalStorage(keyPrefix)) {
|
31
62
|
return;
|
32
|
-
}
|
63
|
+
} // clear old keys with this prefix, if any
|
33
64
|
|
34
|
-
// clear old keys with this prefix, if any
|
35
65
|
for (var i = 0; i < localStorage.length; i++) {
|
36
66
|
if ((localStorage.key(i) || "").indexOf(keyPrefix) > -1) {
|
37
67
|
localStorage.removeItem(localStorage.key(i));
|
38
68
|
}
|
39
|
-
}
|
69
|
+
} // save under this version
|
40
70
|
|
41
|
-
// save under this version
|
42
71
|
localStorage[getVersionedKey(keyPrefix)] = value;
|
43
72
|
};
|
44
73
|
|
45
|
-
var load = function(keyPrefix) {
|
74
|
+
var load = function load(keyPrefix) {
|
46
75
|
if (!hasLocalStorage(keyPrefix)) {
|
47
76
|
return null;
|
48
77
|
}
|
@@ -50,19 +79,21 @@ var MiniProfiler = (function() {
|
|
50
79
|
return localStorage[getVersionedKey(keyPrefix)];
|
51
80
|
};
|
52
81
|
|
53
|
-
var compileTemplates = function(data) {
|
82
|
+
var compileTemplates = function compileTemplates(data) {
|
54
83
|
var element = document.createElement("DIV");
|
55
84
|
element.innerHTML = data;
|
56
85
|
var templates = {};
|
57
86
|
var children = element.children;
|
87
|
+
|
58
88
|
for (var i = 0; i < children.length; i++) {
|
59
89
|
var child = children[i];
|
60
90
|
templates[child.id] = doT.compile(child.innerHTML);
|
61
91
|
}
|
92
|
+
|
62
93
|
MiniProfiler.templates = templates;
|
63
94
|
};
|
64
95
|
|
65
|
-
var fetchTemplates = function(success) {
|
96
|
+
var fetchTemplates = function fetchTemplates(success) {
|
66
97
|
var key = "templates",
|
67
98
|
cached = load(key);
|
68
99
|
|
@@ -73,9 +104,11 @@ var MiniProfiler = (function() {
|
|
73
104
|
var request = new XMLHttpRequest();
|
74
105
|
var url = options.path + "includes.tmpl?v=" + options.version;
|
75
106
|
request.open("GET", url, true);
|
107
|
+
|
76
108
|
request.onload = function() {
|
77
109
|
if (request.status >= 200 && request.status < 400) {
|
78
|
-
|
110
|
+
var data = request.response;
|
111
|
+
|
79
112
|
if (data) {
|
80
113
|
save(key, data);
|
81
114
|
compileTemplates(data);
|
@@ -83,29 +116,31 @@ var MiniProfiler = (function() {
|
|
83
116
|
}
|
84
117
|
}
|
85
118
|
};
|
119
|
+
|
86
120
|
request.setRequestHeader("Content-Type", "text/plain");
|
87
121
|
request.send();
|
88
122
|
}
|
89
123
|
};
|
90
124
|
|
91
|
-
var getClientPerformance = function() {
|
125
|
+
var getClientPerformance = function getClientPerformance() {
|
92
126
|
return window.performance === null ? null : window.performance;
|
93
127
|
};
|
94
128
|
|
95
|
-
var fetchResults = function(ids) {
|
129
|
+
var fetchResults = function fetchResults(ids) {
|
96
130
|
var clientPerformance, clientProbes, i, j, p, id, idx;
|
97
131
|
|
98
132
|
for (i = 0; i < ids.length; i++) {
|
99
133
|
id = ids[i];
|
100
|
-
|
101
134
|
clientPerformance = null;
|
102
135
|
clientProbes = null;
|
103
136
|
|
104
137
|
if (window.mPt) {
|
105
138
|
clientProbes = mPt.results();
|
139
|
+
|
106
140
|
for (j = 0; j < clientProbes.length; j++) {
|
107
141
|
clientProbes[j].d = clientProbes[j].d.getTime();
|
108
142
|
}
|
143
|
+
|
109
144
|
mPt.flush();
|
110
145
|
}
|
111
146
|
|
@@ -114,8 +149,12 @@ var MiniProfiler = (function() {
|
|
114
149
|
|
115
150
|
if (clientPerformance !== null) {
|
116
151
|
// ie is buggy strip out functions
|
117
|
-
var copy = {
|
152
|
+
var copy = {
|
153
|
+
navigation: {},
|
154
|
+
timing: {}
|
155
|
+
};
|
118
156
|
var timing = extend({}, clientPerformance.timing);
|
157
|
+
|
119
158
|
for (p in timing) {
|
120
159
|
if (
|
121
160
|
timing.hasOwnProperty(p) &&
|
@@ -124,10 +163,12 @@ var MiniProfiler = (function() {
|
|
124
163
|
copy.timing[p] = timing[p];
|
125
164
|
}
|
126
165
|
}
|
166
|
+
|
127
167
|
if (clientPerformance.navigation) {
|
128
168
|
copy.navigation.redirectCount =
|
129
169
|
clientPerformance.navigation.redirectCount;
|
130
170
|
}
|
171
|
+
|
131
172
|
clientPerformance = copy;
|
132
173
|
}
|
133
174
|
} else if (
|
@@ -136,7 +177,9 @@ var MiniProfiler = (function() {
|
|
136
177
|
clientProbes.length > 0
|
137
178
|
) {
|
138
179
|
clientPerformance = {
|
139
|
-
timing: {
|
180
|
+
timing: {
|
181
|
+
navigationStart: ajaxStartTime.getTime()
|
182
|
+
}
|
140
183
|
};
|
141
184
|
ajaxStartTime = null;
|
142
185
|
}
|
@@ -147,19 +190,25 @@ var MiniProfiler = (function() {
|
|
147
190
|
(function() {
|
148
191
|
var request = new XMLHttpRequest();
|
149
192
|
var url = options.path + "results";
|
150
|
-
var params =
|
151
|
-
|
193
|
+
var params = "id="
|
194
|
+
.concat(id, "&clientPerformance=")
|
195
|
+
.concat(clientPerformance, "&clientProbes=")
|
196
|
+
.concat(clientProbes, "&popup=1");
|
152
197
|
request.open("POST", url, true);
|
198
|
+
|
153
199
|
request.onload = function() {
|
154
200
|
if (request.status >= 200 && request.status < 400) {
|
155
201
|
var json = JSON.parse(request.responseText);
|
156
202
|
fetchedIds.push(id);
|
203
|
+
|
157
204
|
if (json != "hidden") {
|
158
205
|
buttonShow(json);
|
159
206
|
}
|
160
207
|
}
|
208
|
+
|
161
209
|
fetchingIds.splice(idx, 1);
|
162
210
|
};
|
211
|
+
|
163
212
|
request.setRequestHeader("Accept", "application/json");
|
164
213
|
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
165
214
|
request.setRequestHeader(
|
@@ -172,25 +221,28 @@ var MiniProfiler = (function() {
|
|
172
221
|
}
|
173
222
|
};
|
174
223
|
|
175
|
-
var extend = out
|
224
|
+
var extend = function extend(out) {
|
176
225
|
out = out || {};
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
226
|
+
|
227
|
+
for (var i = 1; i < _arguments.length; i++) {
|
228
|
+
if (!_arguments[i]) continue;
|
229
|
+
|
230
|
+
for (var key in _arguments[i]) {
|
231
|
+
if (_arguments[i].hasOwnProperty(key)) out[key] = _arguments[i][key];
|
181
232
|
}
|
182
233
|
}
|
234
|
+
|
183
235
|
return out;
|
184
236
|
};
|
185
237
|
|
186
|
-
var renderTemplate = function(json) {
|
238
|
+
var renderTemplate = function renderTemplate(json) {
|
187
239
|
var textDom = MiniProfiler.templates.profilerTemplate(json);
|
188
240
|
var tempElement = document.createElement("DIV");
|
189
241
|
tempElement.innerHTML = textDom;
|
190
242
|
return tempElement.children[0];
|
191
243
|
};
|
192
244
|
|
193
|
-
var buttonShow = function(json) {
|
245
|
+
var buttonShow = function buttonShow(json) {
|
194
246
|
var result = renderTemplate(json);
|
195
247
|
totalTime += parseFloat(json.duration_milliseconds, 10);
|
196
248
|
totalSqlCount += parseInt(json.sql_count);
|
@@ -198,27 +250,30 @@ var MiniProfiler = (function() {
|
|
198
250
|
|
199
251
|
if (!controls && reqs > 1 && options.collapseResults && !expandedResults) {
|
200
252
|
if (!totalsControl) {
|
201
|
-
container
|
202
|
-
|
203
|
-
|
204
|
-
|
253
|
+
toArray(container.querySelectorAll(".profiler-result")).forEach(
|
254
|
+
function(el) {
|
255
|
+
return (el.style.display = "none");
|
256
|
+
}
|
257
|
+
);
|
205
258
|
totalsControl = document.createElement("div");
|
206
259
|
totalsControl.setAttribute("class", "profiler-result");
|
207
260
|
totalsControl.innerHTML =
|
208
261
|
"<div class='profiler-button profiler-totals'></div>";
|
209
|
-
|
210
262
|
container.appendChild(totalsControl);
|
211
263
|
totalsControl.addEventListener("click", function() {
|
212
|
-
|
213
|
-
.querySelectorAll(".profiler-result")
|
214
|
-
|
264
|
+
toArray(
|
265
|
+
totalsControl.parentNode.querySelectorAll(".profiler-result")
|
266
|
+
).forEach(function(el) {
|
267
|
+
return (el.style.display = "block");
|
268
|
+
});
|
215
269
|
totalsControl.style.display = "none";
|
216
270
|
expandedResults = true;
|
217
271
|
});
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
272
|
+
toArray(totalsControl.querySelectorAll(".profiler-button")).forEach(
|
273
|
+
function(el) {
|
274
|
+
return (el.style.display = "block");
|
275
|
+
}
|
276
|
+
);
|
222
277
|
}
|
223
278
|
|
224
279
|
var reqsHtml =
|
@@ -235,45 +290,43 @@ var MiniProfiler = (function() {
|
|
235
290
|
"</span> <span class='profiler-unit'>ms</span>" +
|
236
291
|
sqlHtml +
|
237
292
|
reqsHtml;
|
238
|
-
|
239
293
|
result.style.display = "none";
|
240
294
|
}
|
241
295
|
|
242
296
|
if (controls) result.insertBefore(controls);
|
243
297
|
else container.appendChild(result);
|
244
|
-
|
245
298
|
var button = result.querySelector(".profiler-button"),
|
246
|
-
popup = result.querySelector(".profiler-popup");
|
299
|
+
popup = result.querySelector(".profiler-popup"); // button will appear in corner with the total profiling duration - click to show details
|
247
300
|
|
248
|
-
// button will appear in corner with the total profiling duration - click to show details
|
249
301
|
button.addEventListener("click", function() {
|
250
302
|
buttonClick(button, popup);
|
251
|
-
});
|
303
|
+
}); // small duration steps and the column with aggregate durations are hidden by default; allow toggling
|
252
304
|
|
253
|
-
//
|
254
|
-
toggleHidden(popup);
|
305
|
+
toggleHidden(popup); // lightbox in the queries
|
255
306
|
|
256
|
-
|
257
|
-
|
307
|
+
toArray(popup.querySelectorAll(".profiler-queries-show")).forEach(function(
|
308
|
+
el
|
309
|
+
) {
|
258
310
|
el.addEventListener("click", function() {
|
259
311
|
queriesShow(this, result);
|
260
312
|
});
|
261
|
-
});
|
313
|
+
}); // limit count
|
262
314
|
|
263
|
-
// limit count
|
264
315
|
if (
|
265
316
|
container.querySelector(".profiler-result").length >
|
266
317
|
options.maxTracesToShow
|
267
318
|
) {
|
268
|
-
container
|
269
|
-
|
270
|
-
|
271
|
-
.
|
319
|
+
var elem = container.querySelector(".profiler-result");
|
320
|
+
|
321
|
+
if (elem) {
|
322
|
+
elem.parentElement.removeChild(elem);
|
323
|
+
}
|
272
324
|
}
|
325
|
+
|
273
326
|
button.style.display = "block";
|
274
327
|
};
|
275
328
|
|
276
|
-
var toggleHidden = popup
|
329
|
+
var toggleHidden = function toggleHidden(popup) {
|
277
330
|
var trivial = popup.querySelector(".profiler-toggle-trivial");
|
278
331
|
var childrenTime = popup.querySelector(
|
279
332
|
".profiler-toggle-duration-with-children"
|
@@ -282,108 +335,129 @@ var MiniProfiler = (function() {
|
|
282
335
|
".profiler-toggle-trivial-gaps"
|
283
336
|
);
|
284
337
|
|
285
|
-
var toggleIt = node
|
338
|
+
var toggleIt = function toggleIt(node) {
|
286
339
|
var link = node,
|
287
340
|
klass =
|
288
341
|
"profiler-" +
|
289
342
|
link.getAttribute("class").substr("profiler-toggle-".length),
|
290
343
|
isHidden = link.textContent.indexOf("show") > -1;
|
291
|
-
|
344
|
+
var elements = toArray(popup.parentNode.querySelectorAll("." + klass));
|
292
345
|
|
293
346
|
if (isHidden) {
|
294
|
-
elements.forEach(
|
347
|
+
elements.forEach(function(el) {
|
348
|
+
return (el.style.display = "table-row");
|
349
|
+
});
|
295
350
|
} else {
|
296
|
-
elements.forEach(
|
351
|
+
elements.forEach(function(el) {
|
352
|
+
return (el.style.display = "none");
|
353
|
+
});
|
297
354
|
}
|
298
355
|
|
299
|
-
|
356
|
+
var text = link.textContent;
|
300
357
|
link.textContent = text.replace(
|
301
358
|
isHidden ? "show" : "hide",
|
302
359
|
isHidden ? "hide" : "show"
|
303
360
|
);
|
304
|
-
|
305
361
|
popupPreventHorizontalScroll(popup);
|
306
362
|
};
|
307
363
|
|
308
|
-
[childrenTime, trivial, trivialGaps].forEach(el
|
364
|
+
[childrenTime, trivial, trivialGaps].forEach(function(el) {
|
309
365
|
if (el) {
|
310
366
|
el.addEventListener("click", function() {
|
311
367
|
toggleIt(this);
|
312
368
|
});
|
313
369
|
}
|
314
|
-
});
|
370
|
+
}); // if option is set or all our timings are trivial, go ahead and show them
|
315
371
|
|
316
|
-
// if option is set or all our timings are trivial, go ahead and show them
|
317
372
|
if (
|
318
373
|
trivial &&
|
319
374
|
(options.showTrivial || trivial.getAttribute("show-on-load"))
|
320
375
|
) {
|
321
376
|
toggleIt(trivial);
|
322
|
-
}
|
323
|
-
|
377
|
+
} // if option is set, go ahead and show time with children
|
378
|
+
|
324
379
|
if (childrenTime && options.showChildrenTime) {
|
325
380
|
toggleIt(childrenTime);
|
326
381
|
}
|
327
382
|
};
|
328
383
|
|
329
|
-
var
|
330
|
-
|
384
|
+
var toArray = function toArray(list) {
|
385
|
+
var arr = [];
|
386
|
+
|
387
|
+
if (!list) {
|
388
|
+
return arr;
|
389
|
+
}
|
331
390
|
|
391
|
+
for (var i = 0; i < list.length; i++) {
|
392
|
+
arr.push(list[i]);
|
393
|
+
}
|
394
|
+
|
395
|
+
return arr;
|
396
|
+
};
|
397
|
+
|
398
|
+
var buttonClick = function buttonClick(button, popup) {
|
399
|
+
// we're toggling this button/popup
|
332
400
|
if (popup.offsetWidth > 0 || popup.offsetHeight > 0) {
|
333
401
|
// if visible
|
334
402
|
popupHide(button, popup);
|
335
403
|
} else {
|
336
|
-
var visiblePopups =
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
404
|
+
var visiblePopups = toArray(
|
405
|
+
container.querySelectorAll(".profiler-popup")
|
406
|
+
).filter(function(el) {
|
407
|
+
return el.offsetWidth > 0 || el.offsetHeight > 0;
|
408
|
+
}); // theirButtons = visiblePopups.siblings(".profiler-button");
|
409
|
+
|
410
|
+
var theirButtons = [];
|
411
|
+
visiblePopups.forEach(function(el) {
|
343
412
|
theirButtons.push(el.parentNode.querySelector(".profiler-button"));
|
344
|
-
});
|
413
|
+
}); // hide any other popups
|
414
|
+
|
415
|
+
popupHide(theirButtons, visiblePopups); // before showing the one we clicked
|
345
416
|
|
346
|
-
// hide any other popups
|
347
|
-
popupHide(theirButtons, visiblePopups);
|
348
|
-
// before showing the one we clicked
|
349
417
|
popupShow(button, popup);
|
350
418
|
}
|
351
419
|
};
|
352
420
|
|
353
|
-
var popupShow = (button, popup)
|
421
|
+
var popupShow = function popupShow(button, popup) {
|
354
422
|
button.classList.add("profiler-button-active");
|
355
423
|
popupSetDimensions(button, popup);
|
356
424
|
popup.style.display = "block";
|
357
425
|
popupPreventHorizontalScroll(popup);
|
358
426
|
};
|
359
427
|
|
360
|
-
var popupSetDimensions = (button, popup)
|
361
|
-
var px = button.offsetTop - 1,
|
428
|
+
var popupSetDimensions = function popupSetDimensions(button, popup) {
|
429
|
+
var px = button.offsetTop - 1,
|
430
|
+
// position next to the button we clicked
|
362
431
|
windowHeight = window.innerHeight,
|
363
432
|
maxHeight = windowHeight - 40; // make sure the popup doesn't extend below the fold
|
364
433
|
|
365
|
-
popup.style[options.renderVerticalPosition] =
|
366
|
-
popup.style.maxHeight =
|
367
|
-
popup.style[options.renderHorizontalPosition] =
|
368
|
-
|
434
|
+
popup.style[options.renderVerticalPosition] = "".concat(px, "px");
|
435
|
+
popup.style.maxHeight = "".concat(maxHeight, "px");
|
436
|
+
popup.style[options.renderHorizontalPosition] = "".concat(
|
437
|
+
button.offsetWidth - 3,
|
438
|
+
"px"
|
439
|
+
); // move left or right, based on config
|
369
440
|
};
|
370
441
|
|
371
|
-
var popupPreventHorizontalScroll =
|
442
|
+
var popupPreventHorizontalScroll = function popupPreventHorizontalScroll(
|
443
|
+
popup
|
444
|
+
) {
|
372
445
|
var childrenHeight = 0;
|
373
|
-
|
374
|
-
[...popup.children].forEach(el => {
|
446
|
+
toArray(popup.children).forEach(function(el) {
|
375
447
|
childrenHeight += el.offsetHeight;
|
376
448
|
});
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
449
|
+
popup.style.paddingRight = "".concat(
|
450
|
+
childrenHeight > popup.offsetHeight ? 40 : 10,
|
451
|
+
"px"
|
452
|
+
);
|
381
453
|
};
|
382
454
|
|
383
|
-
var popupHide = (button, popup)
|
455
|
+
var popupHide = function popupHide(button, popup) {
|
384
456
|
if (button) {
|
385
457
|
if (Array.isArray(button)) {
|
386
|
-
button.forEach(el
|
458
|
+
button.forEach(function(el) {
|
459
|
+
return el.classList.remove("profiler-button-active");
|
460
|
+
});
|
387
461
|
} else {
|
388
462
|
button.classList.remove("profiler-button-active");
|
389
463
|
}
|
@@ -391,76 +465,82 @@ var MiniProfiler = (function() {
|
|
391
465
|
|
392
466
|
if (popup) {
|
393
467
|
if (Array.isArray(popup)) {
|
394
|
-
popup.forEach(
|
468
|
+
popup.forEach(function(el) {
|
469
|
+
return (el.style.display = "none");
|
470
|
+
});
|
395
471
|
} else {
|
396
472
|
popup.style.display = "none";
|
397
473
|
}
|
398
474
|
}
|
399
475
|
};
|
400
476
|
|
401
|
-
var queriesShow = function(link, result) {
|
477
|
+
var queriesShow = function queriesShow(link, result) {
|
402
478
|
result = result;
|
403
479
|
var px = 30,
|
404
480
|
win = window,
|
405
481
|
width = win.innerWidth - 2 * px,
|
406
482
|
height = win.innerHeight - 2 * px,
|
407
|
-
queries = result.querySelector(".profiler-queries");
|
483
|
+
queries = result.querySelector(".profiler-queries"); // opaque background
|
408
484
|
|
409
|
-
|
410
|
-
let background = document.createElement("div");
|
485
|
+
var background = document.createElement("div");
|
411
486
|
background.classList.add("profiler-queries-bg");
|
412
487
|
document.body.appendChild(background);
|
413
|
-
background.style.height =
|
414
|
-
background.style.display = "block";
|
488
|
+
background.style.height = "".concat(window.innerHeight, "px");
|
489
|
+
background.style.display = "block"; // center the queries and ensure long content is scrolled
|
415
490
|
|
416
|
-
|
417
|
-
queries.style
|
418
|
-
queries.style.
|
419
|
-
queries.style.
|
420
|
-
queries.style
|
421
|
-
queries.querySelector("table").style.width = `${width}px`;
|
491
|
+
queries.style[options.renderVerticalPosition] = "".concat(px, "px");
|
492
|
+
queries.style.maxHeight = "".concat(height, "px");
|
493
|
+
queries.style.width = "".concat(width, "px");
|
494
|
+
queries.style[options.renderHorizontalPosition] = "".concat(px, "px");
|
495
|
+
queries.querySelector("table").style.width = "".concat(width, "px"); // have to show everything before we can get a position for the first query
|
422
496
|
|
423
|
-
// have to show everything before we can get a position for the first query
|
424
497
|
queries.style.display = "block";
|
498
|
+
queriesScrollIntoView(link, queries, queries); // syntax highlighting
|
425
499
|
|
426
|
-
queriesScrollIntoView(link, queries, queries);
|
427
|
-
|
428
|
-
// syntax highlighting
|
429
500
|
prettyPrint();
|
430
501
|
};
|
431
502
|
|
432
|
-
var queriesScrollIntoView = (
|
433
|
-
|
434
|
-
|
435
|
-
|
503
|
+
var queriesScrollIntoView = function queriesScrollIntoView(
|
504
|
+
link,
|
505
|
+
queries,
|
506
|
+
whatToScroll
|
507
|
+
) {
|
508
|
+
var id = elementClosest(link, "tr").getAttribute("data-timing-id"),
|
509
|
+
cells = toArray(
|
510
|
+
queries.querySelectorAll('tr[data-timing-id="' + id + '"]')
|
511
|
+
); // ensure they're in view
|
512
|
+
|
436
513
|
whatToScroll.scrollTop =
|
437
|
-
(whatToScroll.scrollTop || 0) + cells[0].offsetTop - 100;
|
514
|
+
(whatToScroll.scrollTop || 0) + cells[0].offsetTop - 100; // 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
|
438
515
|
|
439
|
-
|
440
|
-
cells.forEach(el => {
|
516
|
+
cells.forEach(function(el) {
|
441
517
|
el.classList.add("higlight-animate");
|
442
518
|
});
|
443
|
-
setTimeout(()
|
444
|
-
cells.forEach(el
|
519
|
+
setTimeout(function() {
|
520
|
+
cells.forEach(function(el) {
|
521
|
+
return el.classList.remove("higlight-animate");
|
522
|
+
});
|
445
523
|
}, 3000);
|
446
524
|
};
|
447
525
|
|
448
|
-
|
526
|
+
var onClickEvents = function onClickEvents(e) {
|
449
527
|
// this happens on every keystroke, and :visible is crazy expensive in IE <9
|
450
528
|
// and in this case, the display:none check is sufficient.
|
451
|
-
var popup =
|
452
|
-
|
453
|
-
|
529
|
+
var popup = toArray(document.querySelectorAll(".profiler-popup")).filter(
|
530
|
+
function(el) {
|
531
|
+
return el.style.display === "block";
|
532
|
+
}
|
533
|
+
);
|
454
534
|
|
455
535
|
if (!popup.length) {
|
456
536
|
return;
|
457
537
|
}
|
458
|
-
popup = popup[0];
|
459
538
|
|
539
|
+
popup = popup[0];
|
460
540
|
var button = popup.parentNode.querySelector(".profiler-button"),
|
461
|
-
queries = popup
|
462
|
-
|
463
|
-
|
541
|
+
queries = elementClosest(popup, ".profiler-result").querySelector(
|
542
|
+
".profiler-queries"
|
543
|
+
),
|
464
544
|
bg = document.querySelector(".profiler-queries-bg"),
|
465
545
|
isEscPress = e.type == "keyup" && e.which == 27,
|
466
546
|
hidePopup = false,
|
@@ -482,7 +562,7 @@ var MiniProfiler = (function() {
|
|
482
562
|
}
|
483
563
|
|
484
564
|
if (hideQueries) {
|
485
|
-
bg.
|
565
|
+
bg.parentElement.removeChild(bg);
|
486
566
|
queries.style.display = "none";
|
487
567
|
}
|
488
568
|
|
@@ -491,8 +571,9 @@ var MiniProfiler = (function() {
|
|
491
571
|
}
|
492
572
|
};
|
493
573
|
|
494
|
-
|
495
|
-
|
574
|
+
var keydownEvent = function keydownEvent() {
|
575
|
+
var results = document.querySelector(".profiler-results");
|
576
|
+
|
496
577
|
if (results.style.display === "none") {
|
497
578
|
results.style.display = "block";
|
498
579
|
} else {
|
@@ -503,13 +584,13 @@ var MiniProfiler = (function() {
|
|
503
584
|
results.style.display === "none";
|
504
585
|
};
|
505
586
|
|
506
|
-
var toggleShortcutEvent = function(e) {
|
587
|
+
var toggleShortcutEvent = function toggleShortcutEvent(e) {
|
507
588
|
// simplified version of https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
|
508
589
|
var shortcut = options.toggleShortcut.toLowerCase();
|
509
590
|
var modifier = "";
|
510
|
-
["alt", "ctrl", "shift"].forEach(k
|
591
|
+
["alt", "ctrl", "shift"].forEach(function(k) {
|
511
592
|
if (e[k + "Key"]) {
|
512
|
-
modifier +=
|
593
|
+
modifier += "".concat(k, "+");
|
513
594
|
}
|
514
595
|
});
|
515
596
|
var specialKeys = {
|
@@ -563,7 +644,6 @@ var MiniProfiler = (function() {
|
|
563
644
|
"/": "?",
|
564
645
|
"\\": "|"
|
565
646
|
};
|
566
|
-
|
567
647
|
var character = String.fromCharCode(e.which).toLowerCase();
|
568
648
|
var special = specialKeys[e.which];
|
569
649
|
var keys = [];
|
@@ -574,6 +654,7 @@ var MiniProfiler = (function() {
|
|
574
654
|
keys.push(character);
|
575
655
|
keys.push(shiftNums[character]);
|
576
656
|
}
|
657
|
+
|
577
658
|
for (var i = 0; i < keys.length; i++) {
|
578
659
|
if (modifier + keys[i] === shortcut) {
|
579
660
|
keydownEvent();
|
@@ -582,7 +663,7 @@ var MiniProfiler = (function() {
|
|
582
663
|
}
|
583
664
|
};
|
584
665
|
|
585
|
-
var bindDocumentEvents = function() {
|
666
|
+
var bindDocumentEvents = function bindDocumentEvents() {
|
586
667
|
document.addEventListener("click", onClickEvents);
|
587
668
|
document.addEventListener("keyup", onClickEvents);
|
588
669
|
document.addEventListener("keyup", toggleShortcutEvent);
|
@@ -593,7 +674,7 @@ var MiniProfiler = (function() {
|
|
593
674
|
}
|
594
675
|
};
|
595
676
|
|
596
|
-
var unbindDocumentEvents = function() {
|
677
|
+
var unbindDocumentEvents = function unbindDocumentEvents() {
|
597
678
|
document.removeEventListener("click", onClickEvents);
|
598
679
|
document.removeEventListener("keyup", onClickEvents);
|
599
680
|
document.removeEventListener("keyup", toggleShortcutEvent);
|
@@ -601,126 +682,116 @@ var MiniProfiler = (function() {
|
|
601
682
|
document.removeEventListener("turbolinks:load", unbindDocumentEvents);
|
602
683
|
};
|
603
684
|
|
604
|
-
var initFullView = function() {
|
685
|
+
var initFullView = function initFullView() {
|
605
686
|
// first, get jquery tmpl, then render and bind handlers
|
606
687
|
fetchTemplates(function() {
|
607
688
|
// profiler will be defined in the full page's head
|
608
689
|
container[0].appendChild(renderTemplate(profiler));
|
609
|
-
|
610
690
|
var popup = document.querySelector(".profiler-popup");
|
611
|
-
|
612
691
|
toggleHidden(popup);
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
);
|
624
|
-
}
|
625
|
-
|
692
|
+
prettyPrint(); // since queries are already shown, just highlight and scroll when clicking a "1 sql" link
|
693
|
+
|
694
|
+
toArray(popup.querySelectorAll(".profiler-queries-show")).forEach(
|
695
|
+
function(el) {
|
696
|
+
el.addEventListener("click", function() {
|
697
|
+
queriesScrollIntoView(
|
698
|
+
this,
|
699
|
+
document.querySelector(".profiler-queries"),
|
700
|
+
document.body
|
701
|
+
);
|
702
|
+
});
|
703
|
+
}
|
704
|
+
);
|
626
705
|
});
|
627
706
|
};
|
628
707
|
|
629
|
-
var initControls = function(container) {
|
708
|
+
var initControls = function initControls(container) {
|
630
709
|
if (options.showControls) {
|
631
|
-
|
632
|
-
controls.classList.add("profiler-controls");
|
633
|
-
controls.innerHTML =
|
634
|
-
'<span class="profiler-min-max">m</span><span class="profiler-clear">c</span>';
|
710
|
+
var _controls = document.createElement("div");
|
635
711
|
|
636
|
-
|
712
|
+
_controls.classList.add("profiler-controls");
|
637
713
|
|
714
|
+
_controls.innerHTML =
|
715
|
+
'<span class="profiler-min-max">m</span><span class="profiler-clear">c</span>';
|
716
|
+
container.appendChild(_controls);
|
638
717
|
document
|
639
718
|
.querySelector(".profiler-controls .profiler-min-max")
|
640
|
-
.addEventListener("click", ()
|
641
|
-
toggleClass(container, "profiler-min")
|
642
|
-
);
|
643
|
-
|
719
|
+
.addEventListener("click", function() {
|
720
|
+
return toggleClass(container, "profiler-min");
|
721
|
+
});
|
644
722
|
container.addEventListener("mouseenter", function() {
|
645
723
|
if (this.classList.contains("profiler-min")) {
|
646
724
|
this.querySelector(".profiler-min-max").style.display = "block";
|
647
725
|
}
|
648
726
|
});
|
649
|
-
|
650
727
|
container.addEventListener("mouseleave", function() {
|
651
728
|
if (this.classList.contains("profiler-min")) {
|
652
729
|
this.querySelector(".profiler-min-max").style.display = "none";
|
653
730
|
}
|
654
731
|
});
|
655
|
-
|
656
732
|
document
|
657
733
|
.querySelector(".profiler-controls .profiler-clear")
|
658
|
-
.addEventListener("click", ()
|
659
|
-
container
|
660
|
-
|
661
|
-
|
734
|
+
.addEventListener("click", function() {
|
735
|
+
toArray(container.querySelectorAll(".profiler-result")).forEach(
|
736
|
+
function(el) {
|
737
|
+
return el.parentElement.removeChild(el);
|
738
|
+
}
|
739
|
+
);
|
662
740
|
});
|
663
741
|
} else {
|
664
742
|
container.classList.add("profiler-no-controls");
|
665
743
|
}
|
666
744
|
};
|
667
745
|
|
668
|
-
var toggleClass = (el, className)
|
746
|
+
var toggleClass = function toggleClass(el, className) {
|
669
747
|
if (el.classList) {
|
670
748
|
el.classList.toggle(className);
|
671
749
|
} else {
|
672
750
|
var classes = el.className.split(" ");
|
673
751
|
var existingIndex = classes.indexOf(className);
|
674
|
-
|
675
752
|
if (existingIndex >= 0) classes.splice(existingIndex, 1);
|
676
753
|
else classes.push(className);
|
677
|
-
|
678
754
|
el.className = classes.join(" ");
|
679
755
|
}
|
680
756
|
};
|
681
757
|
|
682
|
-
var initPopupView = ()
|
758
|
+
var initPopupView = function initPopupView() {
|
683
759
|
if (options.authorized) {
|
684
760
|
// all fetched profilings will go in here
|
685
761
|
container = document.createElement("div");
|
686
762
|
container.className = "profiler-results";
|
687
|
-
document.querySelector(options.htmlContainer).appendChild(container);
|
763
|
+
document.querySelector(options.htmlContainer).appendChild(container); // MiniProfiler.RenderIncludes() sets which corner to render in - default is upper left
|
688
764
|
|
689
|
-
// MiniProfiler.RenderIncludes() sets which corner to render in - default is upper left
|
690
765
|
container.classList.add("profiler-" + options.renderHorizontalPosition);
|
691
|
-
container.classList.add("profiler-" + options.renderVerticalPosition);
|
766
|
+
container.classList.add("profiler-" + options.renderVerticalPosition); //initialize the controls
|
692
767
|
|
693
|
-
//
|
694
|
-
initControls(container);
|
768
|
+
initControls(container); // we'll render results json via a jquery.tmpl - after we get the templates, we'll fetch the initial json to populate it
|
695
769
|
|
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
770
|
fetchTemplates(function() {
|
698
771
|
// get master page profiler results
|
699
772
|
fetchResults(options.ids);
|
700
773
|
});
|
701
|
-
|
702
774
|
if (options.startHidden) container.style.display = "none";
|
703
775
|
} else {
|
704
776
|
fetchResults(options.ids);
|
705
777
|
}
|
706
778
|
|
707
779
|
var send = XMLHttpRequest.prototype.send;
|
780
|
+
|
708
781
|
XMLHttpRequest.prototype.send = function(data) {
|
709
782
|
ajaxStartTime = new Date();
|
710
|
-
|
711
783
|
this.addEventListener("load", function() {
|
712
784
|
// should be an array of strings, e.g. ["008c4813-9bd7-443d-9376-9441ec4d6a8c","16ff377b-8b9c-4c20-a7b5-97cd9fa7eea7"]
|
713
785
|
var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");
|
786
|
+
|
714
787
|
if (stringIds) {
|
715
788
|
var ids = stringIds.split(",");
|
716
789
|
fetchResults(ids);
|
717
790
|
}
|
718
791
|
});
|
719
|
-
|
720
792
|
send.call(this, data);
|
721
|
-
};
|
793
|
+
}; // fetch results after ASP Ajax calls
|
722
794
|
|
723
|
-
// fetch results after ASP Ajax calls
|
724
795
|
if (
|
725
796
|
typeof Sys != "undefined" &&
|
726
797
|
typeof Sys.WebForms != "undefined" &&
|
@@ -728,10 +799,10 @@ var MiniProfiler = (function() {
|
|
728
799
|
) {
|
729
800
|
// Get the instance of PageRequestManager.
|
730
801
|
var PageRequestManager = Sys.WebForms.PageRequestManager.getInstance();
|
731
|
-
|
732
|
-
PageRequestManager.add_endRequest((sender, args) => {
|
802
|
+
PageRequestManager.add_endRequest(function(sender, args) {
|
733
803
|
if (args) {
|
734
804
|
var response = args.get_response();
|
805
|
+
|
735
806
|
if (
|
736
807
|
response.get_responseAvailable() &&
|
737
808
|
response._xmlHttpRequest !== null
|
@@ -739,6 +810,7 @@ var MiniProfiler = (function() {
|
|
739
810
|
var stringIds = args
|
740
811
|
.get_response()
|
741
812
|
.getResponseHeader("X-MiniProfiler-Ids");
|
813
|
+
|
742
814
|
if (stringIds) {
|
743
815
|
var ids = stringIds.split(",");
|
744
816
|
fetchResults(ids);
|
@@ -746,42 +818,40 @@ var MiniProfiler = (function() {
|
|
746
818
|
}
|
747
819
|
}
|
748
820
|
});
|
749
|
-
}
|
821
|
+
} // more Asp.Net callbacks
|
750
822
|
|
751
|
-
// more Asp.Net callbacks
|
752
823
|
if (typeof WebForm_ExecuteCallback == "function") {
|
753
|
-
WebForm_ExecuteCallback = (callbackObject
|
824
|
+
WebForm_ExecuteCallback = (function(callbackObject) {
|
754
825
|
// Store original function
|
755
826
|
var original = WebForm_ExecuteCallback;
|
756
|
-
|
757
827
|
return function(callbackObject) {
|
758
828
|
original(callbackObject);
|
759
|
-
|
760
829
|
var stringIds = callbackObject.xmlRequest.getResponseHeader(
|
761
830
|
"X-MiniProfiler-Ids"
|
762
831
|
);
|
832
|
+
|
763
833
|
if (stringIds) {
|
764
834
|
var ids = stringIds.split(",");
|
765
835
|
fetchResults(ids);
|
766
836
|
}
|
767
837
|
};
|
768
838
|
})();
|
769
|
-
}
|
839
|
+
} // also fetch results after ExtJS requests, in case it is being used
|
770
840
|
|
771
|
-
// also fetch results after ExtJS requests, in case it is being used
|
772
841
|
if (
|
773
842
|
typeof Ext != "undefined" &&
|
774
843
|
typeof Ext.Ajax != "undefined" &&
|
775
844
|
typeof Ext.Ajax.on != "undefined"
|
776
845
|
) {
|
777
846
|
// Ext.Ajax is a singleton, so we just have to attach to its 'requestcomplete' event
|
778
|
-
Ext.Ajax.on("requestcomplete", (e, xhr, settings)
|
847
|
+
Ext.Ajax.on("requestcomplete", function(e, xhr, settings) {
|
779
848
|
//iframed file uploads don't have headers
|
780
849
|
if (!xhr || !xhr.getResponseHeader) {
|
781
850
|
return;
|
782
851
|
}
|
783
852
|
|
784
853
|
var stringIds = xhr.getResponseHeader("X-MiniProfiler-Ids");
|
854
|
+
|
785
855
|
if (stringIds) {
|
786
856
|
var ids = stringIds.split(",");
|
787
857
|
fetchResults(ids);
|
@@ -791,17 +861,17 @@ var MiniProfiler = (function() {
|
|
791
861
|
|
792
862
|
if (typeof MooTools != "undefined" && typeof Request != "undefined") {
|
793
863
|
Request.prototype.addEvents({
|
794
|
-
onComplete: function() {
|
864
|
+
onComplete: function onComplete() {
|
795
865
|
var stringIds = this.xhr.getResponseHeader("X-MiniProfiler-Ids");
|
866
|
+
|
796
867
|
if (stringIds) {
|
797
868
|
var ids = stringIds.split(",");
|
798
869
|
fetchResults(ids);
|
799
870
|
}
|
800
871
|
}
|
801
872
|
});
|
802
|
-
}
|
873
|
+
} // add support for AngularJS, which use the basic XMLHttpRequest object.
|
803
874
|
|
804
|
-
// add support for AngularJS, which use the basic XMLHttpRequest object.
|
805
875
|
if (window.angular && typeof XMLHttpRequest != "undefined") {
|
806
876
|
var _send = XMLHttpRequest.prototype.send;
|
807
877
|
|
@@ -818,6 +888,7 @@ var MiniProfiler = (function() {
|
|
818
888
|
this.onreadystatechange = function onReadyStateChangeReplacement() {
|
819
889
|
if (this.readyState == 4) {
|
820
890
|
var stringIds = this.getResponseHeader("X-MiniProfiler-Ids");
|
891
|
+
|
821
892
|
if (stringIds) {
|
822
893
|
var ids = stringIds.split(",");
|
823
894
|
fetchResults(ids);
|
@@ -835,9 +906,8 @@ var MiniProfiler = (function() {
|
|
835
906
|
|
836
907
|
return _send.apply(this, arguments);
|
837
908
|
};
|
838
|
-
}
|
909
|
+
} // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
839
910
|
|
840
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
841
911
|
if (
|
842
912
|
typeof window.fetch === "function" &&
|
843
913
|
window.fetch.__patchedByMiniProfiler === undefined
|
@@ -851,45 +921,65 @@ var MiniProfiler = (function() {
|
|
851
921
|
try {
|
852
922
|
// look for x-mini-profile-ids
|
853
923
|
var entries = response.headers.entries();
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
924
|
+
var _iteratorNormalCompletion = true;
|
925
|
+
var _didIteratorError = false;
|
926
|
+
var _iteratorError = undefined;
|
927
|
+
|
928
|
+
try {
|
929
|
+
for (
|
930
|
+
var _iterator = entries[Symbol.iterator](), _step;
|
931
|
+
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
932
|
+
_iteratorNormalCompletion = true
|
933
|
+
) {
|
934
|
+
var pair = _step.value;
|
935
|
+
|
936
|
+
if (pair[0] && pair[0].toLowerCase() == "x-miniprofiler-ids") {
|
937
|
+
var ids = pair[1].split(",");
|
938
|
+
fetchResults(ids);
|
939
|
+
}
|
940
|
+
}
|
941
|
+
} catch (err) {
|
942
|
+
_didIteratorError = true;
|
943
|
+
_iteratorError = err;
|
944
|
+
} finally {
|
945
|
+
try {
|
946
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
947
|
+
_iterator.return();
|
948
|
+
}
|
949
|
+
} finally {
|
950
|
+
if (_didIteratorError) {
|
951
|
+
throw _iteratorError;
|
952
|
+
}
|
858
953
|
}
|
859
954
|
}
|
860
955
|
} catch (e) {
|
861
956
|
console.error(e);
|
862
957
|
}
|
863
958
|
});
|
864
|
-
|
865
959
|
return originalFetchRun;
|
866
960
|
};
|
961
|
+
|
867
962
|
window.fetch.__patchedByMiniProfiler = true;
|
868
|
-
}
|
963
|
+
} // some elements want to be hidden on certain doc events
|
869
964
|
|
870
|
-
// some elements want to be hidden on certain doc events
|
871
965
|
bindDocumentEvents();
|
872
966
|
};
|
873
967
|
|
874
968
|
return {
|
875
|
-
init: function() {
|
969
|
+
init: function init() {
|
876
970
|
var script = document.getElementById("mini-profiler");
|
877
971
|
if (!script || !script.getAttribute) return;
|
878
972
|
|
879
973
|
options = (function() {
|
880
974
|
var version = script.getAttribute("data-version");
|
881
975
|
var path = script.getAttribute("data-path");
|
882
|
-
|
883
976
|
var currentId = script.getAttribute("data-current-id");
|
884
|
-
|
885
977
|
var ids = script.getAttribute("data-ids");
|
886
978
|
if (ids) ids = ids.split(",");
|
887
|
-
|
888
979
|
var horizontal_position = script.getAttribute(
|
889
980
|
"data-horizontal-position"
|
890
981
|
);
|
891
982
|
var vertical_position = script.getAttribute("data-vertical-position");
|
892
|
-
|
893
983
|
var toggleShortcut = script.getAttribute("data-toggle-shortcut");
|
894
984
|
|
895
985
|
if (script.getAttribute("data-max-traces")) {
|
@@ -928,26 +1018,28 @@ var MiniProfiler = (function() {
|
|
928
1018
|
};
|
929
1019
|
})();
|
930
1020
|
|
931
|
-
var doInit = function() {
|
1021
|
+
var doInit = function doInit() {
|
932
1022
|
// when rendering a shared, full page, this div will exist
|
933
1023
|
container = document.querySelectorAll(".profiler-result-full");
|
1024
|
+
|
934
1025
|
if (container.length) {
|
935
1026
|
if (window.location.href.indexOf("&trivial=1") > 0) {
|
936
1027
|
options.showTrivial = true;
|
937
1028
|
}
|
1029
|
+
|
938
1030
|
initFullView();
|
939
1031
|
} else {
|
940
1032
|
initPopupView();
|
941
1033
|
}
|
942
|
-
};
|
1034
|
+
}; // this preserves debugging
|
943
1035
|
|
944
|
-
|
945
|
-
var load = function(s, f) {
|
1036
|
+
var load = function load(s, f) {
|
946
1037
|
var sc = document.createElement("script");
|
947
1038
|
sc.async = "async";
|
948
1039
|
sc.type = "text/javascript";
|
949
1040
|
sc.src = s;
|
950
1041
|
var done = false;
|
1042
|
+
|
951
1043
|
sc.onload = sc.onreadystatechange = function(_, abort) {
|
952
1044
|
if (!sc.readyState || /loaded|complete/.test(sc.readyState)) {
|
953
1045
|
if (!abort && !done) {
|
@@ -956,13 +1048,16 @@ var MiniProfiler = (function() {
|
|
956
1048
|
}
|
957
1049
|
}
|
958
1050
|
};
|
1051
|
+
|
959
1052
|
document.getElementsByTagName("head")[0].appendChild(sc);
|
960
1053
|
};
|
961
1054
|
|
962
1055
|
var wait = 0;
|
963
1056
|
var finish = false;
|
964
|
-
|
1057
|
+
|
1058
|
+
var deferInit = function deferInit() {
|
965
1059
|
if (finish) return;
|
1060
|
+
|
966
1061
|
if (
|
967
1062
|
window.performance &&
|
968
1063
|
window.performance.timing &&
|
@@ -977,19 +1072,21 @@ var MiniProfiler = (function() {
|
|
977
1072
|
}
|
978
1073
|
};
|
979
1074
|
|
980
|
-
var init = function() {
|
1075
|
+
var init = function init() {
|
981
1076
|
if (options.authorized) {
|
982
1077
|
var url = options.path + "includes.css?v=" + options.version;
|
1078
|
+
|
983
1079
|
if (document.createStyleSheet) {
|
984
1080
|
document.createStyleSheet(url);
|
985
1081
|
} else {
|
986
|
-
|
987
|
-
|
1082
|
+
var head = document.querySelector("head");
|
1083
|
+
var link = document.createElement("link");
|
988
1084
|
link.rel = "stylesheet";
|
989
1085
|
link.type = "text/css";
|
990
1086
|
link.href = url;
|
991
1087
|
head.appendChild(link);
|
992
1088
|
}
|
1089
|
+
|
993
1090
|
if (!window.doT) {
|
994
1091
|
load(
|
995
1092
|
options.path + "dot.1.1.2.min.js?v=" + options.version,
|
@@ -1005,34 +1102,38 @@ var MiniProfiler = (function() {
|
|
1005
1102
|
|
1006
1103
|
deferInit();
|
1007
1104
|
},
|
1008
|
-
|
1009
|
-
cleanUp: function() {
|
1105
|
+
cleanUp: function cleanUp() {
|
1010
1106
|
unbindDocumentEvents();
|
1011
1107
|
},
|
1012
|
-
|
1013
|
-
pageTransition: function() {
|
1108
|
+
pageTransition: function pageTransition() {
|
1014
1109
|
if (totalsControl) {
|
1015
|
-
totalsControl.
|
1110
|
+
totalsControl.parentElement.removeChild(totalsControl);
|
1016
1111
|
totalsControl = null;
|
1017
1112
|
}
|
1113
|
+
|
1018
1114
|
reqs = 0;
|
1019
1115
|
totalTime = 0;
|
1020
1116
|
expandedResults = false;
|
1021
|
-
|
1022
|
-
.querySelectorAll(".profiler-results .profiler-result")
|
1023
|
-
|
1117
|
+
toArray(
|
1118
|
+
document.querySelectorAll(".profiler-results .profiler-result")
|
1119
|
+
).forEach(function(el) {
|
1120
|
+
return el.parentElement.removeChild(el);
|
1121
|
+
});
|
1024
1122
|
},
|
1025
|
-
|
1026
|
-
getClientTimingByName: function(clientTiming, name) {
|
1123
|
+
getClientTimingByName: function getClientTimingByName(clientTiming, name) {
|
1027
1124
|
for (var i = 0; i < clientTiming.timings.length; i++) {
|
1028
1125
|
if (clientTiming.timings[i].name == name) {
|
1029
1126
|
return clientTiming.timings[i];
|
1030
1127
|
}
|
1031
1128
|
}
|
1032
|
-
return { Name: name, Duration: "", Start: "" };
|
1033
|
-
},
|
1034
1129
|
|
1035
|
-
|
1130
|
+
return {
|
1131
|
+
Name: name,
|
1132
|
+
Duration: "",
|
1133
|
+
Start: ""
|
1134
|
+
};
|
1135
|
+
},
|
1136
|
+
renderDate: function renderDate(jsonDate) {
|
1036
1137
|
// JavaScriptSerializer sends dates as /Date(1308024322065)/
|
1037
1138
|
if (jsonDate) {
|
1038
1139
|
return typeof jsonDate === "string"
|
@@ -1042,45 +1143,44 @@ var MiniProfiler = (function() {
|
|
1042
1143
|
: jsonDate;
|
1043
1144
|
}
|
1044
1145
|
},
|
1045
|
-
|
1046
|
-
renderIndent: function(depth) {
|
1146
|
+
renderIndent: function renderIndent(depth) {
|
1047
1147
|
var result = "";
|
1148
|
+
|
1048
1149
|
for (var i = 0; i < depth; i++) {
|
1049
1150
|
result += " ";
|
1050
1151
|
}
|
1152
|
+
|
1051
1153
|
return result;
|
1052
1154
|
},
|
1053
|
-
|
1054
|
-
renderExecuteType: function(typeId) {
|
1155
|
+
renderExecuteType: function renderExecuteType(typeId) {
|
1055
1156
|
// see StackExchange.Profiling.ExecuteType enum
|
1056
1157
|
switch (typeId) {
|
1057
1158
|
case 0:
|
1058
1159
|
return "None";
|
1160
|
+
|
1059
1161
|
case 1:
|
1060
1162
|
return "NonQuery";
|
1163
|
+
|
1061
1164
|
case 2:
|
1062
1165
|
return "Scalar";
|
1166
|
+
|
1063
1167
|
case 3:
|
1064
1168
|
return "Reader";
|
1065
1169
|
}
|
1066
1170
|
},
|
1067
|
-
|
1068
|
-
shareUrl: function(id) {
|
1171
|
+
shareUrl: function shareUrl(id) {
|
1069
1172
|
return options.path + "results?id=" + id;
|
1070
1173
|
},
|
1071
|
-
|
1072
|
-
moreUrl: function(requestName) {
|
1174
|
+
moreUrl: function moreUrl(requestName) {
|
1073
1175
|
var requestParts = requestName.split(" ");
|
1074
1176
|
var linkSrc =
|
1075
1177
|
requestParts[0] == "GET" ? requestParts[1] : window.location.href;
|
1076
1178
|
var linkSuffix = linkSrc.indexOf("?") > 0 ? "&pp=help" : "?pp=help";
|
1077
1179
|
return linkSrc + linkSuffix;
|
1078
1180
|
},
|
1079
|
-
|
1080
|
-
getClientTimings: function(clientTimings) {
|
1181
|
+
getClientTimings: function getClientTimings(clientTimings) {
|
1081
1182
|
var list = [];
|
1082
1183
|
var t;
|
1083
|
-
|
1084
1184
|
if (!clientTimings.timings) return [];
|
1085
1185
|
|
1086
1186
|
for (var i = 0; i < clientTimings.timings.length; i++) {
|
@@ -1093,9 +1193,8 @@ var MiniProfiler = (function() {
|
|
1093
1193
|
duration: t.Duration,
|
1094
1194
|
start: t.Start
|
1095
1195
|
});
|
1096
|
-
}
|
1196
|
+
} // Use the Paint Timing API for render performance.
|
1097
1197
|
|
1098
|
-
// Use the Paint Timing API for render performance.
|
1099
1198
|
if (window.performance && window.performance.getEntriesByName) {
|
1100
1199
|
var firstPaint = window.performance.getEntriesByName("first-paint");
|
1101
1200
|
|
@@ -1114,15 +1213,13 @@ var MiniProfiler = (function() {
|
|
1114
1213
|
});
|
1115
1214
|
return list;
|
1116
1215
|
},
|
1117
|
-
|
1118
|
-
getSqlTimings: function(root) {
|
1216
|
+
getSqlTimings: function getSqlTimings(root) {
|
1119
1217
|
var result = [],
|
1120
|
-
addToResults = function(timing) {
|
1218
|
+
addToResults = function addToResults(timing) {
|
1121
1219
|
if (timing.sql_timings) {
|
1122
1220
|
for (var i = 0, sqlTiming; i < timing.sql_timings.length; i++) {
|
1123
|
-
sqlTiming = timing.sql_timings[i];
|
1221
|
+
sqlTiming = timing.sql_timings[i]; // HACK: add info about the parent Timing to each SqlTiming so UI can render
|
1124
1222
|
|
1125
|
-
// HACK: add info about the parent Timing to each SqlTiming so UI can render
|
1126
1223
|
sqlTiming.parent_timing_name = timing.name;
|
1127
1224
|
|
1128
1225
|
if (sqlTiming.duration_milliseconds > 50) {
|
@@ -1146,21 +1243,26 @@ var MiniProfiler = (function() {
|
|
1146
1243
|
addToResults(timing.children[i]);
|
1147
1244
|
}
|
1148
1245
|
}
|
1149
|
-
};
|
1246
|
+
}; // start adding at the root and recurse down
|
1150
1247
|
|
1151
|
-
// start adding at the root and recurse down
|
1152
1248
|
addToResults(root);
|
1153
1249
|
|
1154
|
-
var removeDuration = function(list, duration) {
|
1250
|
+
var removeDuration = function removeDuration(list, duration) {
|
1155
1251
|
var newList = [];
|
1252
|
+
|
1156
1253
|
for (var i = 0; i < list.length; i++) {
|
1157
1254
|
var item = list[i];
|
1255
|
+
|
1158
1256
|
if (duration.start > item.start) {
|
1159
1257
|
if (duration.start > item.finish) {
|
1160
1258
|
newList.push(item);
|
1161
1259
|
continue;
|
1162
1260
|
}
|
1163
|
-
|
1261
|
+
|
1262
|
+
newList.push({
|
1263
|
+
start: item.start,
|
1264
|
+
finish: duration.start
|
1265
|
+
});
|
1164
1266
|
}
|
1165
1267
|
|
1166
1268
|
if (duration.finish < item.finish) {
|
@@ -1168,19 +1270,24 @@ var MiniProfiler = (function() {
|
|
1168
1270
|
newList.push(item);
|
1169
1271
|
continue;
|
1170
1272
|
}
|
1171
|
-
|
1273
|
+
|
1274
|
+
newList.push({
|
1275
|
+
start: duration.finish,
|
1276
|
+
finish: item.finish
|
1277
|
+
});
|
1172
1278
|
}
|
1173
1279
|
}
|
1174
1280
|
|
1175
1281
|
return newList;
|
1176
1282
|
};
|
1177
1283
|
|
1178
|
-
var processTimes = function(elem, parent) {
|
1284
|
+
var processTimes = function processTimes(elem, parent) {
|
1179
1285
|
var duration = {
|
1180
1286
|
start: elem.start_milliseconds,
|
1181
1287
|
finish: elem.start_milliseconds + elem.duration_milliseconds
|
1182
1288
|
};
|
1183
1289
|
elem.richTiming = [duration];
|
1290
|
+
|
1184
1291
|
if (parent !== null) {
|
1185
1292
|
elem.parent = parent;
|
1186
1293
|
elem.parent.richTiming = removeDuration(
|
@@ -1196,20 +1303,22 @@ var MiniProfiler = (function() {
|
|
1196
1303
|
}
|
1197
1304
|
};
|
1198
1305
|
|
1199
|
-
processTimes(root, null);
|
1306
|
+
processTimes(root, null); // sort results by time
|
1200
1307
|
|
1201
|
-
// sort results by time
|
1202
1308
|
result.sort(function(a, b) {
|
1203
1309
|
return a.start_milliseconds - b.start_milliseconds;
|
1204
1310
|
});
|
1205
1311
|
|
1206
|
-
var determineOverlap = function(gap, node) {
|
1312
|
+
var determineOverlap = function determineOverlap(gap, node) {
|
1207
1313
|
var overlap = 0;
|
1314
|
+
|
1208
1315
|
for (var i = 0; i < node.richTiming.length; i++) {
|
1209
1316
|
var current = node.richTiming[i];
|
1317
|
+
|
1210
1318
|
if (current.start > gap.finish) {
|
1211
1319
|
break;
|
1212
1320
|
}
|
1321
|
+
|
1213
1322
|
if (current.finish < gap.start) {
|
1214
1323
|
continue;
|
1215
1324
|
}
|
@@ -1218,13 +1327,18 @@ var MiniProfiler = (function() {
|
|
1218
1327
|
Math.min(gap.finish, current.finish) -
|
1219
1328
|
Math.max(gap.start, current.start);
|
1220
1329
|
}
|
1330
|
+
|
1221
1331
|
return overlap;
|
1222
1332
|
};
|
1223
1333
|
|
1224
|
-
var determineGap = function(gap, node, match) {
|
1334
|
+
var determineGap = function determineGap(gap, node, match) {
|
1225
1335
|
var overlap = determineOverlap(gap, node);
|
1336
|
+
|
1226
1337
|
if (match === null || overlap > match.duration) {
|
1227
|
-
match = {
|
1338
|
+
match = {
|
1339
|
+
name: node.name,
|
1340
|
+
duration: overlap
|
1341
|
+
};
|
1228
1342
|
} else if (match.name == node.name) {
|
1229
1343
|
match.duration += overlap;
|
1230
1344
|
}
|
@@ -1234,21 +1348,19 @@ var MiniProfiler = (function() {
|
|
1234
1348
|
match = determineGap(gap, node.children[i], match);
|
1235
1349
|
}
|
1236
1350
|
}
|
1351
|
+
|
1237
1352
|
return match;
|
1238
1353
|
};
|
1239
1354
|
|
1240
1355
|
var time = 0;
|
1241
1356
|
var prev = null;
|
1242
|
-
|
1243
|
-
result.forEach(r => {
|
1357
|
+
result.forEach(function(r) {
|
1244
1358
|
r.prevGap = {
|
1245
1359
|
duration: (r.start_milliseconds - time).toFixed(2),
|
1246
1360
|
start: time,
|
1247
1361
|
finish: r.start_milliseconds
|
1248
1362
|
};
|
1249
|
-
|
1250
1363
|
r.prevGap.topReason = determineGap(r.prevGap, root, null);
|
1251
|
-
|
1252
1364
|
time = r.start_milliseconds + r.duration_milliseconds;
|
1253
1365
|
prev = r;
|
1254
1366
|
});
|
@@ -1265,10 +1377,9 @@ var MiniProfiler = (function() {
|
|
1265
1377
|
|
1266
1378
|
return result;
|
1267
1379
|
},
|
1268
|
-
|
1269
|
-
getSqlTimingsCount: function(root) {
|
1380
|
+
getSqlTimingsCount: function getSqlTimingsCount(root) {
|
1270
1381
|
var result = 0,
|
1271
|
-
countSql = function(timing) {
|
1382
|
+
countSql = function countSql(timing) {
|
1272
1383
|
if (timing.sql_timings) {
|
1273
1384
|
result += timing.sql_timings.length;
|
1274
1385
|
}
|
@@ -1279,15 +1390,14 @@ var MiniProfiler = (function() {
|
|
1279
1390
|
}
|
1280
1391
|
}
|
1281
1392
|
};
|
1393
|
+
|
1282
1394
|
countSql(root);
|
1283
1395
|
return result;
|
1284
1396
|
},
|
1285
|
-
|
1286
|
-
fetchResultsExposed: function(ids) {
|
1397
|
+
fetchResultsExposed: function fetchResultsExposed(ids) {
|
1287
1398
|
return fetchResults(ids);
|
1288
1399
|
},
|
1289
|
-
|
1290
|
-
formatParameters: function(parameters) {
|
1400
|
+
formatParameters: function formatParameters(parameters) {
|
1291
1401
|
if (parameters != null) {
|
1292
1402
|
return parameters
|
1293
1403
|
.map(function(item, index) {
|
@@ -1298,12 +1408,10 @@ var MiniProfiler = (function() {
|
|
1298
1408
|
return "";
|
1299
1409
|
}
|
1300
1410
|
},
|
1301
|
-
|
1302
|
-
formatDuration: function(duration) {
|
1411
|
+
formatDuration: function formatDuration(duration) {
|
1303
1412
|
return (duration || 0).toFixed(1);
|
1304
1413
|
},
|
1305
|
-
|
1306
|
-
showTotalSqlCount: function() {
|
1414
|
+
showTotalSqlCount: function showTotalSqlCount() {
|
1307
1415
|
return options.showTotalSqlCount;
|
1308
1416
|
}
|
1309
1417
|
};
|
@@ -1315,88 +1423,98 @@ if (typeof prettyPrint === "undefined") {
|
|
1315
1423
|
// prettify.js
|
1316
1424
|
// http://code.google.com/p/google-code-prettify/
|
1317
1425
|
// prettier-ignore
|
1318
|
-
window.PR_SHOULD_USE_CONTINUATION=true;
|
1426
|
+
window.PR_SHOULD_USE_CONTINUATION = true;
|
1319
1427
|
window.PR_TAB_WIDTH = 8;
|
1320
1428
|
window.PR_normalizedHtml = window.PR = window.prettyPrintOne = window.prettyPrint = void 0;
|
1429
|
+
|
1321
1430
|
window._pr_isIE6 = function() {
|
1322
1431
|
var y =
|
1323
1432
|
navigator &&
|
1324
1433
|
navigator.userAgent &&
|
1325
1434
|
navigator.userAgent.match(/\bMSIE ([678])\./);
|
1326
1435
|
y = y ? +y[1] : false;
|
1436
|
+
|
1327
1437
|
window._pr_isIE6 = function() {
|
1328
1438
|
return y;
|
1329
1439
|
};
|
1440
|
+
|
1330
1441
|
return y;
|
1331
1442
|
};
|
1332
|
-
|
1443
|
+
|
1444
|
+
(function () {
|
1333
1445
|
function y(b) {
|
1334
|
-
return b
|
1335
|
-
.replace(L, "&")
|
1336
|
-
.replace(M, "<")
|
1337
|
-
.replace(N, ">");
|
1446
|
+
return b.replace(L, "&").replace(M, "<").replace(N, ">");
|
1338
1447
|
}
|
1448
|
+
|
1339
1449
|
function H(b, f, i) {
|
1340
1450
|
switch (b.nodeType) {
|
1341
1451
|
case 1:
|
1342
1452
|
var o = b.tagName.toLowerCase();
|
1343
1453
|
f.push("<", o);
|
1344
1454
|
var l = b.attributes,
|
1345
|
-
|
1455
|
+
n = l.length;
|
1456
|
+
|
1346
1457
|
if (n) {
|
1347
1458
|
if (i) {
|
1348
|
-
for (var r = [], j = n; --j >= 0;
|
1349
|
-
|
1459
|
+
for (var r = [], j = n; --j >= 0;) {
|
1460
|
+
r[j] = l[j];
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
r.sort(function (q, m) {
|
1350
1464
|
return q.name < m.name ? -1 : q.name === m.name ? 0 : 1;
|
1351
1465
|
});
|
1352
1466
|
l = r;
|
1353
1467
|
}
|
1468
|
+
|
1354
1469
|
for (j = 0; j < n; ++j) {
|
1355
1470
|
r = l[j];
|
1356
|
-
r.specified &&
|
1357
|
-
f.push(
|
1358
|
-
" ",
|
1359
|
-
r.name.toLowerCase(),
|
1360
|
-
'="',
|
1361
|
-
r.value
|
1362
|
-
.replace(L, "&")
|
1363
|
-
.replace(M, "<")
|
1364
|
-
.replace(N, ">")
|
1365
|
-
.replace(X, """),
|
1366
|
-
'"'
|
1367
|
-
);
|
1471
|
+
r.specified && f.push(" ", r.name.toLowerCase(), '="', r.value.replace(L, "&").replace(M, "<").replace(N, ">").replace(X, """), '"');
|
1368
1472
|
}
|
1369
1473
|
}
|
1474
|
+
|
1370
1475
|
f.push(">");
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1476
|
+
|
1477
|
+
for (l = b.firstChild; l; l = l.nextSibling) {
|
1478
|
+
H(l, f, i);
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
if (b.firstChild || !/^(?:br|link|img)$/.test(o)) f.push("</", o, ">");
|
1374
1482
|
break;
|
1483
|
+
|
1375
1484
|
case 3:
|
1376
1485
|
case 4:
|
1377
1486
|
f.push(y(b.nodeValue));
|
1378
1487
|
break;
|
1379
1488
|
}
|
1380
1489
|
}
|
1490
|
+
|
1381
1491
|
function O(b) {
|
1382
1492
|
function f(c) {
|
1383
1493
|
if (c.charAt(0) !== "\\") return c.charCodeAt(0);
|
1494
|
+
|
1384
1495
|
switch (c.charAt(1)) {
|
1385
1496
|
case "b":
|
1386
1497
|
return 8;
|
1498
|
+
|
1387
1499
|
case "t":
|
1388
1500
|
return 9;
|
1501
|
+
|
1389
1502
|
case "n":
|
1390
1503
|
return 10;
|
1504
|
+
|
1391
1505
|
case "v":
|
1392
1506
|
return 11;
|
1507
|
+
|
1393
1508
|
case "f":
|
1394
1509
|
return 12;
|
1510
|
+
|
1395
1511
|
case "r":
|
1396
1512
|
return 13;
|
1513
|
+
|
1397
1514
|
case "u":
|
1398
1515
|
case "x":
|
1399
1516
|
return parseInt(c.substring(2), 16) || c.charCodeAt(1);
|
1517
|
+
|
1400
1518
|
case "0":
|
1401
1519
|
case "1":
|
1402
1520
|
case "2":
|
@@ -1406,32 +1524,26 @@ if (typeof prettyPrint === "undefined") {
|
|
1406
1524
|
case "6":
|
1407
1525
|
case "7":
|
1408
1526
|
return parseInt(c.substring(1), 8);
|
1527
|
+
|
1409
1528
|
default:
|
1410
1529
|
return c.charCodeAt(1);
|
1411
1530
|
}
|
1412
1531
|
}
|
1532
|
+
|
1413
1533
|
function i(c) {
|
1414
1534
|
if (c < 32) return (c < 16 ? "\\x0" : "\\x") + c.toString(16);
|
1415
1535
|
c = String.fromCharCode(c);
|
1416
1536
|
if (c === "\\" || c === "-" || c === "[" || c === "]") c = "\\" + c;
|
1417
1537
|
return c;
|
1418
1538
|
}
|
1539
|
+
|
1419
1540
|
function o(c) {
|
1420
|
-
var d = c
|
1421
|
-
.substring(1, c.length - 1)
|
1422
|
-
.match(
|
1423
|
-
RegExp(
|
1424
|
-
"\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]",
|
1425
|
-
"g"
|
1426
|
-
)
|
1427
|
-
);
|
1541
|
+
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"));
|
1428
1542
|
c = [];
|
1429
|
-
|
1430
|
-
|
1431
|
-
e < h;
|
1432
|
-
++e
|
1433
|
-
) {
|
1543
|
+
|
1544
|
+
for (var a = [], k = d[0] === "^", e = k ? 1 : 0, h = d.length; e < h; ++e) {
|
1434
1545
|
var g = d[e];
|
1546
|
+
|
1435
1547
|
switch (g) {
|
1436
1548
|
case "\\B":
|
1437
1549
|
case "\\b":
|
@@ -1444,297 +1556,257 @@ if (typeof prettyPrint === "undefined") {
|
|
1444
1556
|
c.push(g);
|
1445
1557
|
continue;
|
1446
1558
|
}
|
1559
|
+
|
1447
1560
|
g = f(g);
|
1448
1561
|
var s;
|
1562
|
+
|
1449
1563
|
if (e + 2 < h && "-" === d[e + 1]) {
|
1450
1564
|
s = f(d[e + 2]);
|
1451
1565
|
e += 2;
|
1452
1566
|
} else s = g;
|
1567
|
+
|
1453
1568
|
a.push([g, s]);
|
1569
|
+
|
1454
1570
|
if (!(s < 65 || g > 122)) {
|
1455
|
-
s < 65 ||
|
1456
|
-
|
1457
|
-
a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
|
1458
|
-
s < 97 ||
|
1459
|
-
g > 122 ||
|
1460
|
-
a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
|
1571
|
+
s < 65 || g > 90 || a.push([Math.max(65, g) | 32, Math.min(s, 90) | 32]);
|
1572
|
+
s < 97 || g > 122 || a.push([Math.max(97, g) & -33, Math.min(s, 122) & -33]);
|
1461
1573
|
}
|
1462
1574
|
}
|
1463
|
-
|
1575
|
+
|
1576
|
+
a.sort(function (v, w) {
|
1464
1577
|
return v[0] - w[0] || w[1] - v[1];
|
1465
1578
|
});
|
1466
1579
|
d = [];
|
1467
1580
|
g = [NaN, NaN];
|
1581
|
+
|
1468
1582
|
for (e = 0; e < a.length; ++e) {
|
1469
1583
|
h = a[e];
|
1470
|
-
if (h[0] <= g[1] + 1) g[1] = Math.max(g[1], h[1]);
|
1471
|
-
else d.push((g = h));
|
1584
|
+
if (h[0] <= g[1] + 1) g[1] = Math.max(g[1], h[1]);else d.push(g = h);
|
1472
1585
|
}
|
1586
|
+
|
1473
1587
|
a = ["["];
|
1474
1588
|
k && a.push("^");
|
1475
1589
|
a.push.apply(a, c);
|
1590
|
+
|
1476
1591
|
for (e = 0; e < d.length; ++e) {
|
1477
1592
|
h = d[e];
|
1478
1593
|
a.push(i(h[0]));
|
1594
|
+
|
1479
1595
|
if (h[1] > h[0]) {
|
1480
1596
|
h[1] + 1 > h[0] && a.push("-");
|
1481
1597
|
a.push(i(h[1]));
|
1482
1598
|
}
|
1483
1599
|
}
|
1600
|
+
|
1484
1601
|
a.push("]");
|
1485
1602
|
return a.join("");
|
1486
1603
|
}
|
1604
|
+
|
1487
1605
|
function l(c) {
|
1488
|
-
for (
|
1489
|
-
var d = c.source.match(
|
1490
|
-
RegExp(
|
1491
|
-
"(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)",
|
1492
|
-
"g"
|
1493
|
-
)
|
1494
|
-
),
|
1495
|
-
a = d.length,
|
1496
|
-
k = [],
|
1497
|
-
e = 0,
|
1498
|
-
h = 0;
|
1499
|
-
e < a;
|
1500
|
-
++e
|
1501
|
-
) {
|
1606
|
+
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) {
|
1502
1607
|
var g = d[e];
|
1503
|
-
if (g === "(") ++h;
|
1504
|
-
|
1505
|
-
|
1608
|
+
if (g === "(") ++h;else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) k[g] = -1;
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
for (e = 1; e < k.length; ++e) {
|
1612
|
+
if (-1 === k[e]) k[e] = ++n;
|
1506
1613
|
}
|
1507
|
-
|
1614
|
+
|
1508
1615
|
for (h = e = 0; e < a; ++e) {
|
1509
1616
|
g = d[e];
|
1617
|
+
|
1510
1618
|
if (g === "(") {
|
1511
1619
|
++h;
|
1512
1620
|
if (k[h] === undefined) d[e] = "(?:";
|
1513
|
-
} else if ("\\" === g.charAt(0))
|
1514
|
-
if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
|
1621
|
+
} else if ("\\" === g.charAt(0)) if ((g = +g.substring(1)) && g <= h) d[e] = "\\" + k[h];
|
1515
1622
|
}
|
1516
|
-
|
1623
|
+
|
1624
|
+
for (h = e = 0; e < a; ++e) {
|
1517
1625
|
if ("^" === d[e] && "^" !== d[e + 1]) d[e] = "";
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
}
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
if (c.ignoreCase && r) for (e = 0; e < a; ++e) {
|
1629
|
+
g = d[e];
|
1630
|
+
c = g.charAt(0);
|
1631
|
+
if (g.length >= 2 && c === "[") d[e] = o(g);else if (c !== "\\") d[e] = g.replace(/[a-zA-Z]/g, function (s) {
|
1632
|
+
s = s.charCodeAt(0);
|
1633
|
+
return "[" + String.fromCharCode(s & -33, s | 32) + "]";
|
1634
|
+
});
|
1635
|
+
}
|
1529
1636
|
return d.join("");
|
1530
1637
|
}
|
1638
|
+
|
1531
1639
|
for (var n = 0, r = false, j = false, q = 0, m = b.length; q < m; ++q) {
|
1532
1640
|
var t = b[q];
|
1533
|
-
if (t.ignoreCase) j = true;
|
1534
|
-
else if (
|
1535
|
-
/[a-z]/i.test(
|
1536
|
-
t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, "")
|
1537
|
-
)
|
1538
|
-
) {
|
1641
|
+
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, ""))) {
|
1539
1642
|
r = true;
|
1540
1643
|
j = false;
|
1541
1644
|
break;
|
1542
1645
|
}
|
1543
1646
|
}
|
1647
|
+
|
1544
1648
|
var p = [];
|
1545
1649
|
q = 0;
|
1650
|
+
|
1546
1651
|
for (m = b.length; q < m; ++q) {
|
1547
1652
|
t = b[q];
|
1548
1653
|
if (t.global || t.multiline) throw Error("" + t);
|
1549
1654
|
p.push("(?:" + l(t) + ")");
|
1550
1655
|
}
|
1656
|
+
|
1551
1657
|
return RegExp(p.join("|"), j ? "gi" : "g");
|
1552
1658
|
}
|
1659
|
+
|
1553
1660
|
function Y(b) {
|
1554
1661
|
var f = 0;
|
1555
|
-
return function(i) {
|
1556
|
-
for (var o = null, l = 0, n = 0, r = i.length; n < r; ++n)
|
1662
|
+
return function (i) {
|
1663
|
+
for (var o = null, l = 0, n = 0, r = i.length; n < r; ++n) {
|
1557
1664
|
switch (i.charAt(n)) {
|
1558
1665
|
case "\t":
|
1559
1666
|
o || (o = []);
|
1560
1667
|
o.push(i.substring(l, n));
|
1561
|
-
l = b -
|
1562
|
-
|
1668
|
+
l = b - f % b;
|
1669
|
+
|
1670
|
+
for (f += l; l >= 0; l -= 16) {
|
1563
1671
|
o.push(" ".substring(0, l));
|
1672
|
+
}
|
1673
|
+
|
1564
1674
|
l = n + 1;
|
1565
1675
|
break;
|
1676
|
+
|
1566
1677
|
case "\n":
|
1567
1678
|
f = 0;
|
1568
1679
|
break;
|
1680
|
+
|
1569
1681
|
default:
|
1570
1682
|
++f;
|
1571
1683
|
}
|
1684
|
+
}
|
1685
|
+
|
1572
1686
|
if (!o) return i;
|
1573
1687
|
o.push(i.substring(l));
|
1574
1688
|
return o.join("");
|
1575
1689
|
};
|
1576
1690
|
}
|
1691
|
+
|
1577
1692
|
function I(b, f, i, o) {
|
1578
1693
|
if (f) {
|
1579
|
-
b = {
|
1694
|
+
b = {
|
1695
|
+
source: f,
|
1696
|
+
c: b
|
1697
|
+
};
|
1580
1698
|
i(b);
|
1581
1699
|
o.push.apply(o, b.d);
|
1582
1700
|
}
|
1583
1701
|
}
|
1702
|
+
|
1584
1703
|
function B(b, f) {
|
1585
1704
|
var i = {},
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
m < t;
|
1591
|
-
++m
|
1592
|
-
) {
|
1705
|
+
o;
|
1706
|
+
|
1707
|
+
(function () {
|
1708
|
+
for (var r = b.concat(f), j = [], q = {}, m = 0, t = r.length; m < t; ++m) {
|
1593
1709
|
var p = r[m],
|
1594
|
-
|
1595
|
-
if (c) for (var d = c.length; --d >= 0;
|
1710
|
+
c = p[3];
|
1711
|
+
if (c) for (var d = c.length; --d >= 0;) {
|
1712
|
+
i[c.charAt(d)] = p;
|
1713
|
+
}
|
1596
1714
|
p = p[1];
|
1597
1715
|
c = "" + p;
|
1716
|
+
|
1598
1717
|
if (!q.hasOwnProperty(c)) {
|
1599
1718
|
j.push(p);
|
1600
1719
|
q[c] = null;
|
1601
1720
|
}
|
1602
1721
|
}
|
1722
|
+
|
1603
1723
|
j.push(/[\0-\uffff]/);
|
1604
1724
|
o = O(j);
|
1605
1725
|
})();
|
1726
|
+
|
1606
1727
|
var l = f.length;
|
1728
|
+
|
1607
1729
|
function n(r) {
|
1608
|
-
for (
|
1609
|
-
var j = r.c,
|
1610
|
-
q = [j, z],
|
1611
|
-
m = 0,
|
1612
|
-
t = r.source.match(o) || [],
|
1613
|
-
p = {},
|
1614
|
-
c = 0,
|
1615
|
-
d = t.length;
|
1616
|
-
c < d;
|
1617
|
-
++c
|
1618
|
-
) {
|
1730
|
+
for (var j = r.c, q = [j, z], m = 0, t = r.source.match(o) || [], p = {}, c = 0, d = t.length; c < d; ++c) {
|
1619
1731
|
var a = t[c],
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
if (typeof k === "string") h = false;
|
1624
|
-
else {
|
1732
|
+
k = p[a],
|
1733
|
+
e = void 0,
|
1734
|
+
h;
|
1735
|
+
if (typeof k === "string") h = false;else {
|
1625
1736
|
var g = i[a.charAt(0)];
|
1737
|
+
|
1626
1738
|
if (g) {
|
1627
1739
|
e = a.match(g[1]);
|
1628
1740
|
k = g[0];
|
1629
1741
|
} else {
|
1630
1742
|
for (h = 0; h < l; ++h) {
|
1631
1743
|
g = f[h];
|
1632
|
-
|
1744
|
+
|
1745
|
+
if (e = a.match(g[1])) {
|
1633
1746
|
k = g[0];
|
1634
1747
|
break;
|
1635
1748
|
}
|
1636
1749
|
}
|
1750
|
+
|
1637
1751
|
e || (k = z);
|
1638
1752
|
}
|
1639
|
-
|
1640
|
-
|
1641
|
-
!(e && typeof e[1] === "string")
|
1642
|
-
) {
|
1753
|
+
|
1754
|
+
if ((h = k.length >= 5 && "lang-" === k.substring(0, 5)) && !(e && typeof e[1] === "string")) {
|
1643
1755
|
h = false;
|
1644
1756
|
k = P;
|
1645
1757
|
}
|
1758
|
+
|
1646
1759
|
h || (p[a] = k);
|
1647
1760
|
}
|
1648
1761
|
g = m;
|
1649
1762
|
m += a.length;
|
1763
|
+
|
1650
1764
|
if (h) {
|
1651
1765
|
h = e[1];
|
1652
1766
|
var s = a.indexOf(h),
|
1653
|
-
|
1767
|
+
v = s + h.length;
|
1768
|
+
|
1654
1769
|
if (e[2]) {
|
1655
1770
|
v = a.length - e[2].length;
|
1656
1771
|
s = v - h.length;
|
1657
1772
|
}
|
1773
|
+
|
1658
1774
|
k = k.substring(5);
|
1659
1775
|
I(j + g, a.substring(0, s), n, q);
|
1660
1776
|
I(j + g + s, h, Q(k, h), q);
|
1661
1777
|
I(j + g + v, a.substring(v), n, q);
|
1662
1778
|
} else q.push(j + g, k);
|
1663
1779
|
}
|
1780
|
+
|
1664
1781
|
r.d = q;
|
1665
1782
|
}
|
1783
|
+
|
1666
1784
|
return n;
|
1667
1785
|
}
|
1786
|
+
|
1668
1787
|
function x(b) {
|
1669
1788
|
var f = [],
|
1670
|
-
|
1671
|
-
if (b.tripleQuotedStrings)
|
1672
|
-
f.push([
|
1673
|
-
A,
|
1674
|
-
/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
|
1675
|
-
null,
|
1676
|
-
"'\""
|
1677
|
-
]);
|
1678
|
-
else
|
1679
|
-
b.multiLineStrings
|
1680
|
-
? f.push([
|
1681
|
-
A,
|
1682
|
-
/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
|
1683
|
-
null,
|
1684
|
-
"'\"`"
|
1685
|
-
])
|
1686
|
-
: f.push([
|
1687
|
-
A,
|
1688
|
-
/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
|
1689
|
-
null,
|
1690
|
-
"\"'"
|
1691
|
-
]);
|
1789
|
+
i = [];
|
1790
|
+
if (b.tripleQuotedStrings) f.push([A, /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/, null, "'\""]);else b.multiLineStrings ? f.push([A, /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/, null, "'\"`"]) : f.push([A, /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/, null, "\"'"]);
|
1692
1791
|
b.verbatimStrings && i.push([A, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
|
1693
|
-
if (b.hashComments)
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
null,
|
1699
|
-
"#"
|
1700
|
-
]);
|
1701
|
-
i.push([
|
1702
|
-
A,
|
1703
|
-
/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
|
1704
|
-
null
|
1705
|
-
]);
|
1706
|
-
} else f.push([C, /^#[^\r\n]*/, null, "#"]);
|
1792
|
+
if (b.hashComments) if (b.cStyleComments) {
|
1793
|
+
f.push([C, /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/, null, "#"]);
|
1794
|
+
i.push([A, /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, null]);
|
1795
|
+
} else f.push([C, /^#[^\r\n]*/, null, "#"]);
|
1796
|
+
|
1707
1797
|
if (b.cStyleComments) {
|
1708
1798
|
i.push([C, /^\/\/[^\r\n]*/, null]);
|
1709
1799
|
i.push([C, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
|
1710
1800
|
}
|
1711
|
-
|
1712
|
-
|
1713
|
-
"lang-regex",
|
1714
|
-
RegExp(
|
1715
|
-
"^" +
|
1716
|
-
Z +
|
1717
|
-
"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)"
|
1718
|
-
)
|
1719
|
-
]);
|
1801
|
+
|
1802
|
+
b.regexLiterals && i.push(["lang-regex", RegExp("^" + Z + "(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);
|
1720
1803
|
b = b.keywords.replace(/^\s+|\s+$/g, "");
|
1721
|
-
b.length &&
|
1722
|
-
|
1723
|
-
|
1724
|
-
i.push(
|
1725
|
-
[J, /^@[a-z_$][a-z_$@0-9]*/i, null],
|
1726
|
-
[S, /^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, null],
|
1727
|
-
[z, /^[a-z_$][a-z_$@0-9]*/i, null],
|
1728
|
-
[
|
1729
|
-
J,
|
1730
|
-
/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,
|
1731
|
-
null,
|
1732
|
-
"0123456789"
|
1733
|
-
],
|
1734
|
-
[E, /^.[^\s\w\.$@\'\"\`\/\#]*/, null]
|
1735
|
-
);
|
1804
|
+
b.length && i.push([R, RegExp("^(?:" + b.replace(/\s+/g, "|") + ")\\b"), null]);
|
1805
|
+
f.push([z, /^\s+/, null, " \r\n\t\xA0"]);
|
1806
|
+
i.push([J, /^@[a-z_$][a-z_$@0-9]*/i, null], [S, /^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/, 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]);
|
1736
1807
|
return B(f, i);
|
1737
1808
|
}
|
1809
|
+
|
1738
1810
|
function $(b) {
|
1739
1811
|
function f(D) {
|
1740
1812
|
if (D > r) {
|
@@ -1742,62 +1814,65 @@ if (typeof prettyPrint === "undefined") {
|
|
1742
1814
|
n.push("</span>");
|
1743
1815
|
j = null;
|
1744
1816
|
}
|
1817
|
+
|
1745
1818
|
if (!j && q) {
|
1746
1819
|
j = q;
|
1747
1820
|
n.push('<span class="', j, '">');
|
1748
1821
|
}
|
1822
|
+
|
1749
1823
|
var T = y(p(i.substring(r, D))).replace(e ? d : c, "$1 ");
|
1750
1824
|
e = k.test(T);
|
1751
1825
|
n.push(T.replace(a, s));
|
1752
1826
|
r = D;
|
1753
1827
|
}
|
1754
1828
|
}
|
1829
|
+
|
1755
1830
|
var i = b.source,
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
? h === 6
|
1774
|
-
? " \r\n"
|
1775
|
-
: h === 7
|
1776
|
-
? " <br>\r"
|
1777
|
-
: " \r"
|
1778
|
-
: " <br />"
|
1779
|
-
: "<br />";
|
1831
|
+
o = b.g,
|
1832
|
+
l = b.d,
|
1833
|
+
n = [],
|
1834
|
+
r = 0,
|
1835
|
+
j = null,
|
1836
|
+
q = null,
|
1837
|
+
m = 0,
|
1838
|
+
t = 0,
|
1839
|
+
p = Y(window.PR_TAB_WIDTH),
|
1840
|
+
c = /([\r\n ]) /g,
|
1841
|
+
d = /(^| ) /gm,
|
1842
|
+
a = /\r\n?|\n/g,
|
1843
|
+
k = /[ \r\n]$/,
|
1844
|
+
e = true,
|
1845
|
+
h = window._pr_isIE6();
|
1846
|
+
|
1847
|
+
h = h ? b.b.tagName === "PRE" ? h === 6 ? " \r\n" : h === 7 ? " <br>\r" : " \r" : " <br />" : "<br />";
|
1780
1848
|
var g = b.b.className.match(/\blinenums\b(?::(\d+))?/),
|
1781
|
-
|
1849
|
+
s;
|
1850
|
+
|
1782
1851
|
if (g) {
|
1783
|
-
for (var v = [], w = 0; w < 10; ++w)
|
1852
|
+
for (var v = [], w = 0; w < 10; ++w) {
|
1784
1853
|
v[w] = h + '</li><li class="L' + w + '">';
|
1854
|
+
}
|
1855
|
+
|
1785
1856
|
var F = g[1] && g[1].length ? g[1] - 1 : 0;
|
1786
1857
|
n.push('<ol class="linenums"><li class="L', F % 10, '"');
|
1787
1858
|
F && n.push(' value="', F + 1, '"');
|
1788
1859
|
n.push(">");
|
1789
|
-
|
1860
|
+
|
1861
|
+
s = function s() {
|
1790
1862
|
var D = v[++F % 10];
|
1791
1863
|
return j ? "</span>" + D + '<span class="' + j + '">' : D;
|
1792
1864
|
};
|
1793
1865
|
} else s = h;
|
1794
|
-
|
1795
|
-
|
1866
|
+
|
1867
|
+
for (;;) {
|
1868
|
+
if (m < o.length ? t < l.length ? o[m] <= l[t] : true : false) {
|
1796
1869
|
f(o[m]);
|
1870
|
+
|
1797
1871
|
if (j) {
|
1798
1872
|
n.push("</span>");
|
1799
1873
|
j = null;
|
1800
1874
|
}
|
1875
|
+
|
1801
1876
|
n.push(o[m + 1]);
|
1802
1877
|
m += 2;
|
1803
1878
|
} else if (t < l.length) {
|
@@ -1805,107 +1880,97 @@ if (typeof prettyPrint === "undefined") {
|
|
1805
1880
|
q = l[t + 1];
|
1806
1881
|
t += 2;
|
1807
1882
|
} else break;
|
1883
|
+
}
|
1884
|
+
|
1808
1885
|
f(i.length);
|
1809
1886
|
j && n.push("</span>");
|
1810
1887
|
g && n.push("</li></ol>");
|
1811
1888
|
b.a = n.join("");
|
1812
1889
|
}
|
1890
|
+
|
1813
1891
|
function u(b, f) {
|
1814
|
-
for (var i = f.length; --i >= 0;
|
1892
|
+
for (var i = f.length; --i >= 0;) {
|
1815
1893
|
var o = f[i];
|
1816
|
-
if (G.hasOwnProperty(o))
|
1817
|
-
"console" in window &&
|
1818
|
-
console.warn("cannot override language handler %s", o);
|
1819
|
-
else G[o] = b;
|
1894
|
+
if (G.hasOwnProperty(o)) "console" in window && console.warn("cannot override language handler %s", o);else G[o] = b;
|
1820
1895
|
}
|
1821
1896
|
}
|
1897
|
+
|
1822
1898
|
function Q(b, f) {
|
1823
|
-
|
1824
|
-
(b = /^\s*</.test(f) ? "default-markup" : "default-code");
|
1899
|
+
b && G.hasOwnProperty(b) || (b = /^\s*</.test(f) ? "default-markup" : "default-code");
|
1825
1900
|
return G[b];
|
1826
1901
|
}
|
1902
|
+
|
1827
1903
|
function U(b) {
|
1828
1904
|
var f = b.f,
|
1829
|
-
|
1905
|
+
i = b.e;
|
1830
1906
|
b.a = f;
|
1907
|
+
|
1831
1908
|
try {
|
1832
1909
|
var o,
|
1833
|
-
|
1910
|
+
l = f.match(aa);
|
1834
1911
|
f = [];
|
1835
1912
|
var n = 0,
|
1836
|
-
|
1837
|
-
if (l)
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
p = m;
|
1876
|
-
var k = p.indexOf("&");
|
1877
|
-
if (k < 0) a = p;
|
1878
|
-
else {
|
1879
|
-
for (--k; (k = p.indexOf("&#", k + 1)) >= 0; ) {
|
1880
|
-
var e = p.indexOf(";", k);
|
1881
|
-
if (e >= 0) {
|
1882
|
-
var h = p.substring(k + 3, e),
|
1913
|
+
r = [];
|
1914
|
+
if (l) for (var j = 0, q = l.length; j < q; ++j) {
|
1915
|
+
var m = l[j];
|
1916
|
+
|
1917
|
+
if (m.length > 1 && m.charAt(0) === "<") {
|
1918
|
+
if (!ba.test(m)) if (ca.test(m)) {
|
1919
|
+
f.push(m.substring(9, m.length - 3));
|
1920
|
+
n += m.length - 12;
|
1921
|
+
} else if (da.test(m)) {
|
1922
|
+
f.push("\n");
|
1923
|
+
++n;
|
1924
|
+
} 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/)) {
|
1925
|
+
var t = m.match(W)[2],
|
1926
|
+
p = 1,
|
1927
|
+
c;
|
1928
|
+
c = j + 1;
|
1929
|
+
|
1930
|
+
a: for (; c < q; ++c) {
|
1931
|
+
var d = l[c].match(W);
|
1932
|
+
if (d && d[2] === t) if (d[1] === "/") {
|
1933
|
+
if (--p === 0) break a;
|
1934
|
+
} else ++p;
|
1935
|
+
}
|
1936
|
+
|
1937
|
+
if (c < q) {
|
1938
|
+
r.push(n, l.slice(j, c + 1).join(""));
|
1939
|
+
j = c;
|
1940
|
+
} else r.push(n, m);
|
1941
|
+
} else r.push(n, m);
|
1942
|
+
} else {
|
1943
|
+
var a;
|
1944
|
+
p = m;
|
1945
|
+
var k = p.indexOf("&");
|
1946
|
+
if (k < 0) a = p;else {
|
1947
|
+
for (--k; (k = p.indexOf("&#", k + 1)) >= 0;) {
|
1948
|
+
var e = p.indexOf(";", k);
|
1949
|
+
|
1950
|
+
if (e >= 0) {
|
1951
|
+
var h = p.substring(k + 3, e),
|
1883
1952
|
g = 10;
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
var s = parseInt(h, g);
|
1889
|
-
isNaN(s) ||
|
1890
|
-
(p =
|
1891
|
-
p.substring(0, k) +
|
1892
|
-
String.fromCharCode(s) +
|
1893
|
-
p.substring(e + 1));
|
1953
|
+
|
1954
|
+
if (h && h.charAt(0) === "x") {
|
1955
|
+
h = h.substring(1);
|
1956
|
+
g = 16;
|
1894
1957
|
}
|
1958
|
+
|
1959
|
+
var s = parseInt(h, g);
|
1960
|
+
isNaN(s) || (p = p.substring(0, k) + String.fromCharCode(s) + p.substring(e + 1));
|
1895
1961
|
}
|
1896
|
-
a = p
|
1897
|
-
.replace(ea, "<")
|
1898
|
-
.replace(fa, ">")
|
1899
|
-
.replace(ga, "'")
|
1900
|
-
.replace(ha, '"')
|
1901
|
-
.replace(ia, " ")
|
1902
|
-
.replace(ja, "&");
|
1903
1962
|
}
|
1904
|
-
|
1905
|
-
|
1963
|
+
|
1964
|
+
a = p.replace(ea, "<").replace(fa, ">").replace(ga, "'").replace(ha, '"').replace(ia, " ").replace(ja, "&");
|
1906
1965
|
}
|
1966
|
+
f.push(a);
|
1967
|
+
n += a.length;
|
1907
1968
|
}
|
1908
|
-
|
1969
|
+
}
|
1970
|
+
o = {
|
1971
|
+
source: f.join(""),
|
1972
|
+
h: r
|
1973
|
+
};
|
1909
1974
|
var v = o.source;
|
1910
1975
|
b.source = v;
|
1911
1976
|
b.c = 0;
|
@@ -1916,312 +1981,178 @@ if (typeof prettyPrint === "undefined") {
|
|
1916
1981
|
if ("console" in window) console.log(w && w.stack ? w.stack : w);
|
1917
1982
|
}
|
1918
1983
|
}
|
1984
|
+
|
1919
1985
|
var A = "str",
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
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
|
-
"break",
|
1980
|
-
"case",
|
1981
|
-
"continue",
|
1982
|
-
"delete",
|
1983
|
-
"do",
|
1984
|
-
"else",
|
1985
|
-
"finally",
|
1986
|
-
"instanceof",
|
1987
|
-
"return",
|
1988
|
-
"throw",
|
1989
|
-
"try",
|
1990
|
-
"typeof"
|
1991
|
-
],
|
1992
|
-
f = "(?:^^|[+-]",
|
1993
|
-
i = 0;
|
1994
|
-
i < b.length;
|
1995
|
-
++i
|
1996
|
-
)
|
1997
|
-
f += "|" + b[i].replace(/([^=<>:&a-z])/g, "\\$1");
|
1998
|
-
f += ")\\s*";
|
1999
|
-
return f;
|
2000
|
-
})(),
|
2001
|
-
L = /&/g,
|
2002
|
-
M = /</g,
|
2003
|
-
N = />/g,
|
2004
|
-
X = /\"/g,
|
2005
|
-
ea = /</g,
|
2006
|
-
fa = />/g,
|
2007
|
-
ga = /'/g,
|
2008
|
-
ha = /"/g,
|
2009
|
-
ja = /&/g,
|
2010
|
-
ia = / /g,
|
2011
|
-
ka = /[\r\n]/g,
|
2012
|
-
K = null,
|
2013
|
-
aa = RegExp(
|
2014
|
-
"[^<]+|<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<",
|
2015
|
-
"g"
|
2016
|
-
),
|
2017
|
-
ba = /^<\!--/,
|
2018
|
-
ca = /^<!\[CDATA\[/,
|
2019
|
-
da = /^<br\b/i,
|
2020
|
-
W = /^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
|
2021
|
-
la = x({
|
2022
|
-
keywords:
|
2023
|
-
"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 ",
|
2024
|
-
hashComments: true,
|
2025
|
-
cStyleComments: true,
|
2026
|
-
multiLineStrings: true,
|
2027
|
-
regexLiterals: true
|
2028
|
-
}),
|
2029
|
-
G = {};
|
1986
|
+
R = "kwd",
|
1987
|
+
C = "com",
|
1988
|
+
S = "typ",
|
1989
|
+
J = "lit",
|
1990
|
+
E = "pun",
|
1991
|
+
z = "pln",
|
1992
|
+
P = "src",
|
1993
|
+
V = "nocode",
|
1994
|
+
Z = function () {
|
1995
|
+
for (var b = ["!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=", "&=", "(", "*", "*=", "+=", ",", "-=", "->", "/", "/=", ":", "::", ";", "<", "<<", "<<=", "<=", "=", "==", "===", ">", ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[", "^", "^=", "^^", "^^=", "{", "|", "|=", "||", "||=", "~", "break", "case", "continue", "delete", "do", "else", "finally", "instanceof", "return", "throw", "try", "typeof"], f = "(?:^^|[+-]", i = 0; i < b.length; ++i) {
|
1996
|
+
f += "|" + b[i].replace(/([^=<>:&a-z])/g, "\\$1");
|
1997
|
+
}
|
1998
|
+
|
1999
|
+
f += ")\\s*";
|
2000
|
+
return f;
|
2001
|
+
}(),
|
2002
|
+
L = /&/g,
|
2003
|
+
M = /</g,
|
2004
|
+
N = />/g,
|
2005
|
+
X = /\"/g,
|
2006
|
+
ea = /</g,
|
2007
|
+
fa = />/g,
|
2008
|
+
ga = /'/g,
|
2009
|
+
ha = /"/g,
|
2010
|
+
ja = /&/g,
|
2011
|
+
ia = / /g,
|
2012
|
+
ka = /[\r\n]/g,
|
2013
|
+
K = null,
|
2014
|
+
aa = RegExp("[^<]+|<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<", "g"),
|
2015
|
+
ba = /^<\!--/,
|
2016
|
+
ca = /^<!\[CDATA\[/,
|
2017
|
+
da = /^<br\b/i,
|
2018
|
+
W = /^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
|
2019
|
+
la = x({
|
2020
|
+
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 ",
|
2021
|
+
hashComments: true,
|
2022
|
+
cStyleComments: true,
|
2023
|
+
multiLineStrings: true,
|
2024
|
+
regexLiterals: true
|
2025
|
+
}),
|
2026
|
+
G = {};
|
2027
|
+
|
2030
2028
|
u(la, ["default-code"]);
|
2031
|
-
u(
|
2032
|
-
|
2033
|
-
[],
|
2034
|
-
[
|
2035
|
-
[z, /^[^<?]+/],
|
2036
|
-
["dec", /^<!\w[^>]*(?:>|$)/],
|
2037
|
-
[C, /^<\!--[\s\S]*?(?:-\->|$)/],
|
2038
|
-
["lang-", /^<\?([\s\S]+?)(?:\?>|$)/],
|
2039
|
-
["lang-", /^<%([\s\S]+?)(?:%>|$)/],
|
2040
|
-
[E, /^(?:<[%?]|[%?]>)/],
|
2041
|
-
["lang-", /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
|
2042
|
-
["lang-js", /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
|
2043
|
-
["lang-css", /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
|
2044
|
-
["lang-in.tag", /^(<\/?[a-z][^<>]*>)/i]
|
2045
|
-
]
|
2046
|
-
),
|
2047
|
-
["default-markup", "htm", "html", "mxml", "xhtml", "xml", "xsl"]
|
2048
|
-
);
|
2049
|
-
u(
|
2050
|
-
B(
|
2051
|
-
[
|
2052
|
-
[z, /^[\s]+/, null, " \t\r\n"],
|
2053
|
-
["atv", /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, "\"'"]
|
2054
|
-
],
|
2055
|
-
[
|
2056
|
-
["tag", /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
|
2057
|
-
["atn", /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
|
2058
|
-
["lang-uq.val", /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
|
2059
|
-
[E, /^[=<>\/]+/],
|
2060
|
-
["lang-js", /^on\w+\s*=\s*\"([^\"]+)\"/i],
|
2061
|
-
["lang-js", /^on\w+\s*=\s*\'([^\']+)\'/i],
|
2062
|
-
["lang-js", /^on\w+\s*=\s*([^\"\'>\s]+)/i],
|
2063
|
-
["lang-css", /^style\s*=\s*\"([^\"]+)\"/i],
|
2064
|
-
["lang-css", /^style\s*=\s*\'([^\']+)\'/i],
|
2065
|
-
["lang-css", /^style\s*=\s*([^\"\'>\s]+)/i]
|
2066
|
-
]
|
2067
|
-
),
|
2068
|
-
["in.tag"]
|
2069
|
-
);
|
2029
|
+
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", "htm", "html", "mxml", "xhtml", "xml", "xsl"]);
|
2030
|
+
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], ["lang-css", /^style\s*=\s*([^\"\'>\s]+)/i]]), ["in.tag"]);
|
2070
2031
|
u(B([], [["atv", /^[\s\S]+/]]), ["uq.val"]);
|
2071
|
-
u(
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
);
|
2118
|
-
u(
|
2119
|
-
x({
|
2120
|
-
keywords:
|
2121
|
-
"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 ",
|
2122
|
-
hashComments: true,
|
2123
|
-
multiLineStrings: true,
|
2124
|
-
regexLiterals: true
|
2125
|
-
}),
|
2126
|
-
["perl", "pl", "pm"]
|
2127
|
-
);
|
2128
|
-
u(
|
2129
|
-
x({
|
2130
|
-
keywords:
|
2131
|
-
"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 ",
|
2132
|
-
hashComments: true,
|
2133
|
-
multiLineStrings: true,
|
2134
|
-
regexLiterals: true
|
2135
|
-
}),
|
2136
|
-
["rb"]
|
2137
|
-
);
|
2138
|
-
u(
|
2139
|
-
x({
|
2140
|
-
keywords:
|
2141
|
-
"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 ",
|
2142
|
-
cStyleComments: true,
|
2143
|
-
regexLiterals: true
|
2144
|
-
}),
|
2145
|
-
["js"]
|
2146
|
-
);
|
2032
|
+
u(x({
|
2033
|
+
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 ",
|
2034
|
+
hashComments: true,
|
2035
|
+
cStyleComments: true
|
2036
|
+
}), ["c", "cc", "cpp", "cxx", "cyc", "m"]);
|
2037
|
+
u(x({
|
2038
|
+
keywords: "null true false"
|
2039
|
+
}), ["json"]);
|
2040
|
+
u(x({
|
2041
|
+
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 ",
|
2042
|
+
hashComments: true,
|
2043
|
+
cStyleComments: true,
|
2044
|
+
verbatimStrings: true
|
2045
|
+
}), ["cs"]);
|
2046
|
+
u(x({
|
2047
|
+
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 ",
|
2048
|
+
cStyleComments: true
|
2049
|
+
}), ["java"]);
|
2050
|
+
u(x({
|
2051
|
+
keywords: "break continue do else for if return while case done elif esac eval fi function in local set then until ",
|
2052
|
+
hashComments: true,
|
2053
|
+
multiLineStrings: true
|
2054
|
+
}), ["bsh", "csh", "sh"]);
|
2055
|
+
u(x({
|
2056
|
+
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 ",
|
2057
|
+
hashComments: true,
|
2058
|
+
multiLineStrings: true,
|
2059
|
+
tripleQuotedStrings: true
|
2060
|
+
}), ["cv", "py"]);
|
2061
|
+
u(x({
|
2062
|
+
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 ",
|
2063
|
+
hashComments: true,
|
2064
|
+
multiLineStrings: true,
|
2065
|
+
regexLiterals: true
|
2066
|
+
}), ["perl", "pl", "pm"]);
|
2067
|
+
u(x({
|
2068
|
+
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 ",
|
2069
|
+
hashComments: true,
|
2070
|
+
multiLineStrings: true,
|
2071
|
+
regexLiterals: true
|
2072
|
+
}), ["rb"]);
|
2073
|
+
u(x({
|
2074
|
+
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 ",
|
2075
|
+
cStyleComments: true,
|
2076
|
+
regexLiterals: true
|
2077
|
+
}), ["js"]);
|
2147
2078
|
u(B([], [[A, /^[\s\S]+/]]), ["regex"]);
|
2148
2079
|
window.PR_normalizedHtml = H;
|
2149
|
-
|
2150
|
-
|
2080
|
+
|
2081
|
+
window.prettyPrintOne = function (b, f) {
|
2082
|
+
var i = {
|
2083
|
+
f: b,
|
2084
|
+
e: f
|
2085
|
+
};
|
2151
2086
|
U(i);
|
2152
2087
|
return i.a;
|
2153
2088
|
};
|
2154
|
-
|
2089
|
+
|
2090
|
+
window.prettyPrint = function (b) {
|
2155
2091
|
function f() {
|
2156
|
-
for (
|
2157
|
-
var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity;
|
2158
|
-
q < o.length && j.now() < t;
|
2159
|
-
q++
|
2160
|
-
) {
|
2092
|
+
for (var t = window.PR_SHOULD_USE_CONTINUATION ? j.now() + 250 : Infinity; q < o.length && j.now() < t; q++) {
|
2161
2093
|
var p = o[q];
|
2094
|
+
|
2162
2095
|
if (p.className && p.className.indexOf("prettyprint") >= 0) {
|
2163
2096
|
var c = p.className.match(/\blang-(\w+)\b/);
|
2164
2097
|
if (c) c = c[1];
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
a.tagName === "code" ||
|
2169
|
-
a.tagName === "xmp") &&
|
2170
|
-
a.className &&
|
2171
|
-
a.className.indexOf("prettyprint") >= 0
|
2172
|
-
) {
|
2098
|
+
|
2099
|
+
for (var d = false, a = p.parentNode; a; a = a.parentNode) {
|
2100
|
+
if ((a.tagName === "pre" || a.tagName === "code" || a.tagName === "xmp") && a.className && a.className.indexOf("prettyprint") >= 0) {
|
2173
2101
|
d = true;
|
2174
2102
|
break;
|
2175
2103
|
}
|
2104
|
+
}
|
2105
|
+
|
2176
2106
|
if (!d) {
|
2177
2107
|
a = p;
|
2108
|
+
|
2178
2109
|
if (null === K) {
|
2179
2110
|
d = document.createElement("PRE");
|
2180
|
-
d.appendChild(
|
2181
|
-
document.createTextNode(
|
2182
|
-
'<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'
|
2183
|
-
)
|
2184
|
-
);
|
2111
|
+
d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));
|
2185
2112
|
K = !/</.test(d.innerHTML);
|
2186
2113
|
}
|
2114
|
+
|
2187
2115
|
if (K) {
|
2188
2116
|
d = a.innerHTML;
|
2189
|
-
if ("XMP" === a.tagName) d = y(d);
|
2190
|
-
else {
|
2117
|
+
if ("XMP" === a.tagName) d = y(d);else {
|
2191
2118
|
a = a;
|
2192
|
-
if ("PRE" === a.tagName) a = true;
|
2193
|
-
else if (ka.test(d)) {
|
2119
|
+
if ("PRE" === a.tagName) a = true;else if (ka.test(d)) {
|
2194
2120
|
var k = "";
|
2195
|
-
if (a.currentStyle) k = a.currentStyle.whiteSpace;
|
2196
|
-
else if (window.getComputedStyle)
|
2197
|
-
k = window.getComputedStyle(a, null).whiteSpace;
|
2121
|
+
if (a.currentStyle) k = a.currentStyle.whiteSpace;else if (window.getComputedStyle) k = window.getComputedStyle(a, null).whiteSpace;
|
2198
2122
|
a = !k || k === "pre";
|
2199
2123
|
} else a = true;
|
2200
|
-
a ||
|
2201
|
-
(d = d
|
2202
|
-
.replace(/(<br\s*\/?>)[\r\n]+/g, "$1")
|
2203
|
-
.replace(/(?:[\r\n]+[ \t]*)+/g, " "));
|
2124
|
+
a || (d = d.replace(/(<br\s*\/?>)[\r\n]+/g, "$1").replace(/(?:[\r\n]+[ \t]*)+/g, " "));
|
2204
2125
|
}
|
2205
2126
|
d = d;
|
2206
2127
|
} else {
|
2207
2128
|
d = [];
|
2208
|
-
|
2129
|
+
|
2130
|
+
for (a = a.firstChild; a; a = a.nextSibling) {
|
2131
|
+
H(a, d);
|
2132
|
+
}
|
2133
|
+
|
2209
2134
|
d = d.join("");
|
2210
2135
|
}
|
2136
|
+
|
2211
2137
|
d = d.replace(/(?:\r\n?|\n)$/, "");
|
2212
|
-
m = {
|
2138
|
+
m = {
|
2139
|
+
f: d,
|
2140
|
+
e: c,
|
2141
|
+
b: p
|
2142
|
+
};
|
2213
2143
|
U(m);
|
2214
|
-
|
2144
|
+
|
2145
|
+
if (p = m.a) {
|
2215
2146
|
c = m.b;
|
2147
|
+
|
2216
2148
|
if ("XMP" === c.tagName) {
|
2217
2149
|
d = document.createElement("PRE");
|
2150
|
+
|
2218
2151
|
for (a = 0; a < c.attributes.length; ++a) {
|
2219
2152
|
k = c.attributes[a];
|
2220
|
-
if (k.specified)
|
2221
|
-
if (k.name.toLowerCase() === "class")
|
2222
|
-
d.className = k.value;
|
2223
|
-
else d.setAttribute(k.name, k.value);
|
2153
|
+
if (k.specified) if (k.name.toLowerCase() === "class") d.className = k.value;else d.setAttribute(k.name, k.value);
|
2224
2154
|
}
|
2155
|
+
|
2225
2156
|
d.innerHTML = p;
|
2226
2157
|
c.parentNode.replaceChild(d, c);
|
2227
2158
|
} else c.innerHTML = p;
|
@@ -2229,33 +2160,28 @@ if (typeof prettyPrint === "undefined") {
|
|
2229
2160
|
}
|
2230
2161
|
}
|
2231
2162
|
}
|
2232
|
-
|
2233
|
-
else b && b();
|
2163
|
+
|
2164
|
+
if (q < o.length) setTimeout(f, 250);else b && b();
|
2165
|
+
}
|
2166
|
+
|
2167
|
+
for (var i = [document.getElementsByTagName("pre"), document.getElementsByTagName("code"), document.getElementsByTagName("xmp")], o = [], l = 0; l < i.length; ++l) {
|
2168
|
+
for (var n = 0, r = i[l].length; n < r; ++n) {
|
2169
|
+
o.push(i[l][n]);
|
2170
|
+
}
|
2234
2171
|
}
|
2235
|
-
|
2236
|
-
var i = [
|
2237
|
-
document.getElementsByTagName("pre"),
|
2238
|
-
document.getElementsByTagName("code"),
|
2239
|
-
document.getElementsByTagName("xmp")
|
2240
|
-
],
|
2241
|
-
o = [],
|
2242
|
-
l = 0;
|
2243
|
-
l < i.length;
|
2244
|
-
++l
|
2245
|
-
)
|
2246
|
-
for (var n = 0, r = i[l].length; n < r; ++n) o.push(i[l][n]);
|
2172
|
+
|
2247
2173
|
i = null;
|
2248
2174
|
var j = Date;
|
2249
|
-
j.now ||
|
2250
|
-
(
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
});
|
2175
|
+
j.now || (j = {
|
2176
|
+
now: function now() {
|
2177
|
+
return new Date().getTime();
|
2178
|
+
}
|
2179
|
+
});
|
2255
2180
|
var q = 0,
|
2256
|
-
|
2181
|
+
m;
|
2257
2182
|
f();
|
2258
2183
|
};
|
2184
|
+
|
2259
2185
|
window.PR = {
|
2260
2186
|
combinePrefixPatterns: O,
|
2261
2187
|
createSimpleLexer: B,
|
@@ -2275,11 +2201,31 @@ if (typeof prettyPrint === "undefined") {
|
|
2275
2201
|
PR_TAG: "tag",
|
2276
2202
|
PR_TYPE: S
|
2277
2203
|
};
|
2278
|
-
})();
|
2279
|
-
|
2280
|
-
// prettier-ignore
|
2204
|
+
})(); // prettier-ignore
|
2281
2205
|
// lang-sql.js
|
2282
2206
|
// http://code.google.com/p/google-code-prettify/
|
2283
|
-
|
2284
|
-
|
2207
|
+
|
2208
|
+
PR.registerLangHandler(
|
2209
|
+
PR.createSimpleLexer(
|
2210
|
+
[
|
2211
|
+
["pln", /^[\t\n\r \xA0]+/, null, "\t\n\r \xA0"],
|
2212
|
+
["str", /^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/, null, "\"'"]
|
2213
|
+
],
|
2214
|
+
[
|
2215
|
+
["com", /^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],
|
2216
|
+
[
|
2217
|
+
"kwd",
|
2218
|
+
/^(?: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,
|
2219
|
+
null
|
2220
|
+
],
|
2221
|
+
[
|
2222
|
+
"lit",
|
2223
|
+
/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i
|
2224
|
+
],
|
2225
|
+
["pln", /^[a-z_][\w-]*/i],
|
2226
|
+
["pun", /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]
|
2227
|
+
]
|
2228
|
+
),
|
2229
|
+
["sql"]
|
2230
|
+
);
|
2285
2231
|
}
|