Skip to content
Browse files

add .NET side of popup keyboard toggling and initial hiding; obsolete…

… Settings.UseExistingjQuery; add some semi-colons to the includes.js, because I like semi-colons
  • Loading branch information...
1 parent f024fcb commit 85609b6226eff71ac21dfa990dd1fa54aace237f @dixon dixon committed Feb 7, 2013
View
13 StackExchange.Profiling/MiniProfiler.Settings.cs
@@ -214,6 +214,18 @@ public static void ExcludeMethod(string methodName)
public static RenderPosition PopupRenderPosition { get; set; }
/// <summary>
+ /// Allows showing/hiding of popup results buttons via keyboard.
+ /// </summary>
+ [DefaultValue("Alt+P")]
+ public static string PopupToggleKeyboardShortcut { get; set; }
+
+ /// <summary>
+ /// When true, results buttons will not initially be shown, requiring keyboard activation via <see cref="PopupToggleKeyboardShortcut"/>.
+ /// </summary>
+ [DefaultValue(false)]
+ public static bool PopupStartHidden { get; set; }
+
+ /// <summary>
/// Determines if min-max, clear, etc are rendered; defaults to false.
/// For a per-page override you can use .RenderIncludes(showControls: true/false)
/// </summary>
@@ -225,6 +237,7 @@ public static void ExcludeMethod(string methodName)
/// For a per-page override you can use .RenderIncludes(useExistingjQuery: true/false)
/// </summary>
[DefaultValue(false)]
+ [Obsolete("Remove this; includes.js will automatically check for a valid version of jquery, loading ours if none is found.", true)]
public static bool UseExistingjQuery { get; set; }
/// <summary>
View
2 StackExchange.Profiling/MiniProfiler.cs
@@ -325,7 +325,7 @@ public static MiniProfiler FromJson(string json)
/// <returns>Script and link elements normally; an empty string when there is no active profiling session.</returns>
public static IHtmlString RenderIncludes(RenderPosition? position = null, bool? showTrivial = null, bool? showTimeWithChildren = null, int? maxTracesToShow = null, bool? showControls = null, bool? useExistingjQuery = null, bool samplingOnly = false)
{
- return UI.MiniProfilerHandler.RenderIncludes(Current, position, showTrivial, showTimeWithChildren, maxTracesToShow, showControls, useExistingjQuery);
+ return UI.MiniProfilerHandler.RenderIncludes(Current, position, showTrivial, showTimeWithChildren, maxTracesToShow, showControls);
}
/// <summary>
View
6 StackExchange.Profiling/UI/MiniProfilerHandler.cs
@@ -117,9 +117,8 @@ public void ProcessRequest(HttpContext context)
/// <param name="showTimeWithChildren">show the time with children.</param>
/// <param name="maxTracesToShow">max traces to show.</param>
/// <param name="showControls">show the controls.</param>
- /// <param name="useExistingjQuery">use the existing <c>jquery</c>.</param>
/// <returns>a string containing the html.</returns>
- internal static HtmlString RenderIncludes(MiniProfiler profiler, RenderPosition? position = null, bool? showTrivial = null, bool? showTimeWithChildren = null, int? maxTracesToShow = null, bool? showControls = null, bool? useExistingjQuery = null)
+ internal static HtmlString RenderIncludes(MiniProfiler profiler, RenderPosition? position = null, bool? showTrivial = null, bool? showTimeWithChildren = null, int? maxTracesToShow = null, bool? showControls = null)
{
string format = GetResource("include.partial.html");
@@ -158,7 +157,8 @@ internal static HtmlString RenderIncludes(MiniProfiler profiler, RenderPosition?
showControls = showControls ?? MiniProfiler.Settings.ShowControls ? "true" : "false",
currentId = profiler.Id,
authorized = authorized ? "true" : "false",
- useExistingjQuery = useExistingjQuery ?? MiniProfiler.Settings.UseExistingjQuery ? "true" : "false"
+ toggleShortcut = MiniProfiler.Settings.PopupToggleKeyboardShortcut,
+ startHidden = MiniProfiler.Settings.PopupStartHidden
});
}
View
18 StackExchange.Profiling/UI/includes.js
@@ -61,11 +61,10 @@ var MiniProfiler = (function () {
}
};
- var getClientPerformance = function () {
+ var getClientPerformance = function() {
return window.performance == null ? null : window.performance;
- }
+ };
- var waitedForEnd = 0;
var fetchResults = function (ids) {
var clientPerformance, clientProbes, i, j, p, id, idx;
@@ -650,11 +649,10 @@ var MiniProfiler = (function () {
} else {
doInit();
}
- }
- else {
+ } else {
doInit();
}
- }
+ };
if (typeof(jQuery) == 'function') {
var jQueryVersion = jQuery.fn.jquery.split('.');
@@ -754,7 +752,7 @@ var MiniProfiler = (function () {
// start adding at the root and recurse down
addToResults(root);
- var removeDuration = function (list, duration) {
+ var removeDuration = function(list, duration) {
var newList = [];
for (var i = 0; i < list.length; i++) {
@@ -778,7 +776,7 @@ var MiniProfiler = (function () {
}
return newList;
- }
+ };
var processTimes = function (elem, parent) {
var duration = { start: elem.StartMilliseconds, finish: (elem.StartMilliseconds + elem.DurationMilliseconds) };
@@ -800,7 +798,7 @@ var MiniProfiler = (function () {
// sort results by time
result.sort(function (a, b) { return a.StartMilliseconds - b.StartMilliseconds; });
- var determineOverlap = function (gap, node) {
+ var determineOverlap = function(gap, node) {
var overlap = 0;
for (var i = 0; i < node.richTiming.length; i++) {
var current = node.richTiming[i];
@@ -814,7 +812,7 @@ var MiniProfiler = (function () {
overlap += Math.min(gap.finish, current.finish) - Math.max(gap.start, current.start);
}
return overlap;
- }
+ };
var determineGap = function (gap, node, match) {
var overlap = determineOverlap(gap, node);

0 comments on commit 85609b6

Please sign in to comment.
Something went wrong with that request. Please try again.