如何自定义Mini-Profiler UI [英] How to customize the Mini-Profiler UI

查看:117
本文介绍了如何自定义Mini-Profiler UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的MVC 4应用程序上安装了Mini-Profiler,它的工作原理很吸引人.我唯一的问题是UI覆盖了UI的关键部分.我可以使用css在页面上移动它,但理想情况下,我想使其移动,使其默认为带有抽屉按钮的隐藏状态以使其弹出.我尝试编写一个可操纵结果显示的javascript函数,但是当我将以下代码放在_Layout.cshtml文件的底部时,迷你分析器会将其所有代码都放在自定义函数之后的页面的最底部,因此自定义功能将在分析器之前运行.

I have installed Mini-Profiler on my MVC 4 application and it is working like a charm. The only problem I have with it is that the UI covers up a critical part of my UI. I can move it around the page using the css but ideally I would like to make it so it defaults to a hidden state with a drawer button to make it pop out. I tried writing a javascript function that would manipulate the results display but when I placed the following code at the bottom of my _Layout.cshtml file the mini-profiler would place all of it's code at the very bottom of the page after my customize function so the customize function would run before the profiler.

@MiniProfiler.RenderIncludes() 
<script type="text/javascript">
    $(function() {
        CustomizeMiniProfiler();
    });
</script>

有什么想法吗?理想情况下,我不想修改Mini-profiler的源代码,因为我想通过NuGet轻松进行升级.

Any ideas? Ideally I don't want to modify the source code of Mini-profiler as I would like to make it easy to upgrade going forward with NuGet.

推荐答案

Mini Profiler的许多初始化工作都推迟到jQuery.ready之后,因此Mini Profiler对页面加载行为的影响最小.请参阅: https://github.com/SamSaffron/MiniProfiler/blob/master/StackExchange.Profiling/UI/includes.js#L597

Much of the Mini Profiler initialisation is deferred till way after jQuery.ready, this is so Mini Profiler has minimal impact on page load behaviour. See: https://github.com/SamSaffron/MiniProfiler/blob/master/StackExchange.Profiling/UI/includes.js#L597

我建议一个请求请求挂接到Mini Profiler初始化过程中,也许是这样:

I would recommend a pull request that hooks into the Mini Profiler initialization process perhaps:

MiniProfiler.afterInit(
   function(){
      /* if called after init happens right away, else happens after init */
   });

这篇关于如何自定义Mini-Profiler UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆