Skip to content

Commit

Permalink
Fix Glimpse#439 - Finial updates to glimpse.axd
Browse files Browse the repository at this point in the history
  • Loading branch information
avanderhoorn committed Jul 4, 2013
1 parent 5d70046 commit 8ef1916
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions source/Glimpse.Core/Resource/ConfigurationResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c
var packages = FindPacakges();

content.Append("<!DOCTYPE html><html><head><title>Glimpse - Configuration Page</title><link rel=\"shortcut icon\" href=\"http://getglimpse.com/content/_v1/app-config-favicon.png?version=" + GlimpseRuntime.Version + "\" />");
content.Append("<style>*, *:before, *:after{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;-ms-box-sizing: border-box;-o-box-sizing: border-box;box-sizing: border-box;}body{margin: 0;font-family: \"Segoe UI Web Regular\",\"Segoe UI\",\"Helvetica Neue\",Helvetica,Arial serif;font-size: 1em;line-height: 1.6em;}pre{margin:0}.code{font-size: 1.45em;font-family:monospace;}h1, h2, h3{font-weight: normal;}header{color: #fff;background-color: #323d42;height: 450px;}header table{width: 100%;}header .detail{text-align: center;width: 250px;}header h2{position: relative;margin-bottom:0;}header .find-more{color: white;font-size: 0.8em;margin-top: 0; }header .find-more:hover,header .find-more:active{color: white;}.inner{margin:0 auto;max-width: 1200px;width: 80%;min-width: 900px;vertical-align: top;padding-top: 1em;}.button{width: 250px;line-height: 1.2em;margin: 0.5em auto;text-align: center;font-size: 24px;padding: 10px 41px;text-decoration: none;display: block;color: white;border: 3px solid white;background-color: #434f54;}.button:hover{background-color: #3f4a4f;}.button-small{font-size: 0.95em;}.inner .button{border-color: #ccc;}.message{font-size: 0.5em;line-height: 1em;width: 125px;left: -150px;top: 20px;position: absolute; font-style:italic;}img{border:0px;}.center{text-align: center;}.notification{ padding: 17px; font-size: 1.2em; text-align: center; }.notification-success{background-color: #B5CDA4; color: #486E25;}.notification-fail{background-color: #E4BBB1; color: #DA6953;}.notification-warn{background-color: #E4D1A9; color: #DA9221;}.version span{font-size:0.8em;font-style:italic;}.warn{color:red; font-weight:bold;}.package-version{font-size:0.7em;}.root > li {margin-bottom:15px;}.more-help h3{margin: 40px 0 5px; text-align: center;}.side-bar{float:right;width:250px;margin-top:22px;}.out-dated{padding-bottom:15px;text-align:center;background-color: lightyellow;border: 1px solid goldenrod;color: goldenrod;}.code-holder{padding:10px; margin:10px 0; background-color: #eee;font-family: monospace;line-height: 1.3em;}.close-section { position: absolute; right: -13px; border-radius: 15px; background-color: #323D42; color: white; font-weight: bold; height: 30px; width: 30px; text-align: center; font-size: 140%; line-height: 100%; margin-top: -13px; cursor: pointer; }.code-comment{color:#486E25;}.code-content{margin-bottom:10px}.configuration-holder{display:none;position: relative}.description{text-align:center}.configuration-options{position: absolute; right: 20px;}.configuration-options-item,.code-section-child{display:none;}</style>");
content.Append("<style>*, *:before, *:after{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;-ms-box-sizing: border-box;-o-box-sizing: border-box;box-sizing: border-box;}body{margin: 0;font-family: \"Segoe UI Web Regular\",\"Segoe UI\",\"Helvetica Neue\",Helvetica,Arial serif;font-size: 1em;line-height: 1.6em;}pre{margin:0}.code{font-size: 1.45em;font-family:monospace;}h1, h2, h3{font-weight: normal;}header{color: #fff;background-color: #323d42;height: 450px;}header table{width: 100%;}header .detail{text-align: center;width: 250px;}header h2{position: relative;margin-bottom:0;}header .find-more{color: white;font-size: 0.8em;margin-top: 0; }header .find-more:hover,header .find-more:active{color: white;}.inner{margin:0 auto;max-width: 1200px;width: 80%;min-width: 900px;vertical-align: top;padding-top: 1em;}.button{width: 250px;line-height: 1.2em;margin: 0.5em auto;text-align: center;font-size: 24px;padding: 10px 41px;text-decoration: none;display: block;color: white;border: 3px solid white;background-color: #434f54;}.button:hover{background-color: #3f4a4f;}.button-small{font-size: 0.95em;}.inner .button{border-color: #ccc;}.message{font-size: 0.5em;line-height: 1em;width: 125px;left: -150px;top: 20px;position: absolute; font-style:italic;}img{border:0px;}.center{text-align: center;}.notification{ padding: 17px; font-size: 1.2em; text-align: center; }.notification-success{background-color: #B5CDA4; color: #486E25;}.notification-fail{background-color: #E4BBB1; color: #DA6953;}.notification-warn{background-color: #E4D1A9; color: #DA9221;}.version span{font-size:0.8em;font-style:italic;}.warn{color:red; font-weight:bold;}.package-version{font-size:0.7em;}.root > li {margin-bottom:15px;}.more-help h3{margin: 40px 0 5px; text-align: center;}.side-bar{float:right;width:250px;margin-top:22px;}.out-dated{padding-bottom:15px;text-align:center;background-color: lightyellow;border: 1px solid goldenrod;color: goldenrod;}.code-holder{padding:10px; margin:10px 0; background-color: #eee;font-family: monospace;line-height: 1.3em;font-size: 1.3em;}.close-section { position: absolute; right: -19px; border-radius: 20px; font-weight: bold; height: 40px; width: 40px; text-align: center; font-size: 140%; line-height: 120%; margin-top: -9px; cursor: pointer; padding:0}.code-comment{color:#52AA00;}.code-content{margin-bottom:10px}.configuration-holder{display:none;position: relative}.description{text-align:center;text-align: center;font-size: 1.2em;font-weight: normal;}.description strong{text-decoration: underline;font-size: 1.1em;}.configuration-options-item,.code-section-child{display:none;}</style>");
content.Append("<script type=\"text/javascript\">var toggleClass = function(name) { toggleItems(document.getElementsByClassName(name)); }, toggleItems = function(e) { for(var i = 0; i < e.length; i++) { toggleItem(e[i]); } }, toggleItem = function(e) { if(e.style.display == 'none') { e.style.display = ''; } else { e.style.display = 'none'; } };</script>");
content.Append("</head><body>");
content.Append("<header><div class=\"inner\"><table><tr><td class=\"logo\"><a href=\"http://getglimpse.com/\" title=\"Glimpse Home :D\"><img width=\"325\" src=\"http://getglimpse.com/content/_v1/app-config-logo.png?version=" + GlimpseRuntime.Version + "\" alt=\"Glimpse Home :D\"/></a></td><td class=\"detail\"><div class=\"version\">v" + GlimpseRuntime.Version + " <span>(core)</span></div><h2>Bookmarklets<div class=\"message\">“Drag us to your favorites bar for quick and easy access to Glimpse”</div></h2><a href=\"http://getglimpse.com/Help/First-Run#Glimpse-Bookmarklets\" class=\"find-more\" target=\"new\">find out more</a><a class=\"button\" href=\"javascript:(function(){document.cookie='glimpsePolicy=On;path=/;expires=Sat, 01 Jan 2050 12:00:00 GMT;';window.location.reload();})();\">Turn Glimpse On</a><a class=\"button\" href=\"javascript:(function(){document.cookie='glimpsePolicy=;path=/;expires=Sat, 01 Jan 2050 12:00:00 GMT;';window.location.reload();})();\">Turn Glimpse Off</a><a class=\"button\" href=\"javascript:(function(){document.cookie='glimpseId='+ prompt('Client Name?') +';path=/;expires=Sat, 01 Jan 2050 12:00:00 GMT;';window.location.reload();})();\">Set Glimpse Session Name</a></td></tr></table></div></header>");
Expand All @@ -100,16 +100,15 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c

//Configuration generator
content.Append("<div class=\"configuration-holder\"><h3>Configuration Helper</h3>");
content.Append("<div class=\"description warn\">NOTE: The below is only designed to help generate the config which needs be copied over to your <strong>web.config</strong></div>");
content.Append("<div class=\"configuration-options\"><ul><li><input type=\"checkbox\" data-show=\"code-logging\"> Turn Logging On?</li><li><input type=\"checkbox\" data-show=\"code-runtimePolicies-blacklist\"> Blacklist URIs?</li><li><input type=\"checkbox\" data-show=\"code-runtimePolicies-statusCodes\"> Status Codes?</li><li><input type=\"checkbox\" data-show=\"code-runtimePolicies-contentTypes\"> Content Types?</li></ul></div>");
content.Append("<div class=\"close-section\">x</div>");
content.Append("<div class=\"description warn\">NOTE: The below is <strong>only designed</strong> to help generate the config which needs be copied over to your <strong>web.config</strong></div>");
content.Append("<div class=\"close-section button button-small\">x</div>");
content.Append("<div class=\"code-holder\">");

content.AppendFormat("<pre class=\"code-content\">{0}</pre>", Escape("<glimpse defaultRuntimePolicy=\"On\" endpointBaseUri=\"~/Glimpse.axd\">"));

content.AppendFormat("<pre class=\"code-content code-logging configuration-options-item\">{0}</pre>", Escape(" <logging level=\"Trace\" />"));

content.AppendFormat("<pre class=\"code-comment code-content code-section-tabs-off\">{0}</pre>", Escape(" <!-- Tabs\n <tabs>\n <ignoredTypes>\n <add type=\"{Namespace.Type, AssemblyName}\"/>\n </ignoredTypes>\n </tabs>\n -->"));
content.AppendFormat("<pre class=\"code-comment code-content code-section-tabs-off\">{0}</pre>", Escape(" <!-- Tab Management\n <tabs>\n <ignoredTypes>\n <add type=\"{Namespace.Type, AssemblyName}\"/>\n </ignoredTypes>\n </tabs>\n -->"));

content.AppendFormat("<div class=\"code-content code-section-tabs code-section-child\" data-altState=\"code-section-tabs-off\"><pre>{0}</pre>", Escape(" <tabs>"));
content.Append("<div class=\"code-tabs-ignoredTypes\">");
Expand All @@ -119,7 +118,7 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c
content.Append("</div>");
content.AppendFormat("<pre>{0}</pre></div>", Escape(" </tabs>"));

content.AppendFormat("<pre class=\"code-comment code-content code-section-runtimePolicies-off\">{0}</pre>", Escape(" <!-- Runtime Policies\n <runtimePolicies>\n <ignoredTypes>\n <add type=\"{Namespace.Type, AssemblyName}\"/>\n </ignoredTypes>\n </runtimePolicies>\n -->"));
content.AppendFormat("<pre class=\"code-comment code-content code-section-runtimePolicies-off\">{0}</pre>", Escape(" <!-- Runtime Policy Management\n <runtimePolicies>\n <ignoredTypes>\n <add type=\"{Namespace.Type, AssemblyName}\"/>\n </ignoredTypes>\n </runtimePolicies>\n -->"));

content.AppendFormat("<div class=\"code-content code-section-runtimePolicies code-section-child\" data-altState=\"code-section-runtimePolicies-off\"><pre>{0}</pre>", Escape(" <runtimePolicies>"));
content.Append("<div class=\"code-runtimePolicies-ignoredTypes\">");
Expand Down Expand Up @@ -149,6 +148,15 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c
content.AppendFormat("<pre class=\"code-content\">{0}</pre>", Escape("</glimpse>"));

content.Append("</div>");
content.Append("<ul class=\"configuration-options\">");
content.Append("<li>Tab Management - Individual Tabs can be disabled by instructing Glimpse to ignore their types</li>");
content.Append("<li>Runtime Policy Management - Individual Policies can be disabled by instructing Glimpse to ignore their types<ul>");
content.Append("<li><input type=\"checkbox\" data-show=\"code-runtimePolicies-contentTypes\">Content Types - Filter what specific Content Types Glimpse will be enabled for</li>");
content.Append("<li><input type=\"checkbox\" data-show=\"code-runtimePolicies-blacklist\">Blacklist URIs - Filter Glimpse to only work on URIs that match specifc regular expressions</li>");
content.Append("<li><input type=\"checkbox\" data-show=\"code-runtimePolicies-statusCodes\">Status Codes - Filter what specific Status Codes Glimpse will be enabled for</li></ul>");
content.Append("<li><input type=\"checkbox\" data-show=\"code-logging\">Logging - An internal Glimpse diagnostics log can be enabled to help troubleshoot problems with Glimpse</li>");
content.Append("</ul><div style=\"text-align:center\"><a href=\"http://getglimpse.com/Help/Configuration\">find out more online</a></div>");

content.Append("</div>");

//Update notification
Expand All @@ -159,6 +167,8 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c
content.Append("<script type=\"text/javascript\"> var getCookie = function(name) { var re = new RegExp(name + \"=([^;]+)\"); var value = re.exec(document.cookie); return (value != null) ? unescape(value[1]) : null; }; var policy = getCookie('glimpsePolicy'); if (policy == 'On') { document.write(\"<div class='notification notification-success'><strong>Glimpse cookie set 'On'</strong> When you go back to your site, depending on your policies, you should see Glimpse at the bottom right of the page.</div>\"); } else if (policy == '' || policy == null) { document.write(\"<div class='notification notification-fail'><strong>Glimpse cookie set 'Off'</strong> By default for Glimpse to be visible, the `glimpsePolicy` cookie needs to be set 'On'. We have made this simple by providing the above buttons :D</div>\"); } else { document.write(\"<div class='notification notification-warn'><strong>Glimpse cookie set '\" + policy + \"'</strong> Looks like you are doing something custom. We don't have any specific buttons for your case, but if you ever want to just turn Glimpse On or Off simply use the above buttons.</div>\"); }</script>");
//Configuration help
content.Append("<div class=\"more-help\"><h3>Configuration Help?</h3>Want to learn more about configuring Glimpse or how to disable Tabs or Policies?<br /><a href=\"javascript:return true;\" class=\"config-open button button-small\">Start Config Helper</a></div>"); //head over to our <a href=\"http://getglimpse.com/Help/Configuration\" target=\"new\">config help page</a>
//Logging help
content.Append("<div class=\"more-help\"><h3>Glimpse Logging?</h3>Have an issue? help us figure it out by turning on logging.<br /><a href=\"javascript:return true;\" class=\"logging-on button button-small\">Find Out How</a></div>");
content.Append("</div>");

//Registered Tabs
Expand Down Expand Up @@ -238,7 +248,7 @@ public IResourceResult Execute(IResourceContext context, IGlimpseConfiguration c
content.Append("</div>");
content.Append("<footer><div class=\"inner\"><p class=\"center\">For more info see <a href=\"http://getglimpse.com\">getGlimpse.com</a></p><div class=\"center\"><img src=\"http://getglimpse.com/content/github.gif\"> Found an <em>error</em>? <a href=\"https://github.com/glimpse/glimpse/issues\">Help us improve</a>.   <img src=\"http://getglimpse.com/content/twitter.png\"> Have a <em>question</em>? <a href=\"http://twitter.com/#search?q=%23glimpse\">Tweet us using #glimpse</a>.</div></div></div></footer>");
content.Append("<script src=\"//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js\"></script>");
content.Append("<script>$(function() { $('.configuration-holder .close-section').click(function(){ $('.configuration-holder').hide(); }); $('.config-open').click(function() { $('.configuration-holder').toggle(); }); $('.configuration-options input').change(function() { $('.'+ $(this).attr('data-show')).toggle(); adjustConfigState(); }); $('.code-ignoredTypes-controller input').change(function() { $('.configuration-holder').show(); var item=$(this),itemType=item.attr('data-type'),infoSection=item.closest('.code-ignoredTypes-controller'),configSection=$('.'+infoSection.attr('data-link')),ignoreItem=configSection.find(\"pre[data-type='\"+itemType+\"']\");if(ignoreItem.length==0){configSection.append('<pre data-type=\"'+itemType+'\"> &lt;add type=\"'+itemType+'\" /></pre>')}else{ignoreItem.remove()}adjustConfigState(); }); var adjustConfigState=function(){$('.code-ignoredTypes-options').each(function(){var holder=$(this),parent=holder.parent();if(holder.find('pre').length==0){parent.hide()}else{parent.show()}});$('.code-section-child').each(function(){var holder=$(this),alt=holder.attr('data-altState');holder.show();if(holder.find('div:visible').length==0){holder.hide();if(alt){$('.'+alt).show()}}else{holder.show();if(alt){$('.'+alt).hide()}}})}; });</script>");
content.Append("<script>$(function() { $('.logging-on').click(function() { $('.configuration-holder').show(); $('[data-show=\"code-logging\"]').click() }); $('.configuration-holder .close-section').click(function(){ $('.configuration-holder').hide(); }); $('.config-open').click(function() { $('.configuration-holder').toggle(); }); $('.configuration-options input').change(function() { $('.'+ $(this).attr('data-show')).toggle(); adjustConfigState(); }); $('.code-ignoredTypes-controller input').change(function() { $('.configuration-holder').show(); var item=$(this),itemType=item.attr('data-type'),infoSection=item.closest('.code-ignoredTypes-controller'),configSection=$('.'+infoSection.attr('data-link')),ignoreItem=configSection.find(\"pre[data-type='\"+itemType+\"']\");if(ignoreItem.length==0){configSection.append('<pre data-type=\"'+itemType+'\"> &lt;add type=\"'+itemType+'\" /></pre>')}else{ignoreItem.remove()}adjustConfigState(); }); var adjustConfigState=function(){$('.code-ignoredTypes-options').each(function(){var holder=$(this),parent=holder.parent();if(holder.find('pre').length==0){parent.hide()}else{parent.show()}});$('.code-section-child').each(function(){var holder=$(this),alt=holder.attr('data-altState');holder.show();if(holder.find('div:visible').length==0){holder.hide();if(alt){$('.'+alt).show()}}else{holder.show();if(alt){$('.'+alt).hide()}}})}; });</script>");
content.Append("</body></html>");

return new HtmlResourceResult(content.ToString());
Expand Down

0 comments on commit 8ef1916

Please sign in to comment.