Removed jQuery from the error page:

- All functionality working
- Tested in IE11/10/9/8 (via emulation mode), and Chrome latest
- Made the clickable areas cursor a pointer
- #11
This commit is contained in:
DamianEdwards 2014-05-01 18:18:27 -07:00
parent ba5f230c18
commit 257b2abc43
4 changed files with 390 additions and 240 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,9 +4,6 @@
@using Views
@functions
{
/// <summary>
///
/// </summary>
public ErrorPageModel Model { get; set; }
}
@{
@ -26,7 +23,6 @@
</style>
</head>
<body>
Hello
<h1>@Resources.ErrorPageHtml_UnhandledException</h1>
@if (Model.Options.ShowExceptionDetails)
{
@ -123,7 +119,7 @@
<div class="source">
@if (frame.PreContextCode != null)
{
<ol start="@frame.PreContextLine" class="collapsable">
<ol start="@frame.PreContextLine" class="collapsible">
@foreach (var line in frame.PreContextCode)
{
<li><span>@line</span></li>
@ -136,7 +132,7 @@
@if (frame.PostContextCode != null)
{
<ol start='@(frame.Line + 1)' class="collapsable">
<ol start='@(frame.Line + 1)' class="collapsible">
@foreach (var line in frame.PostContextCode)
{
<li><span>@line</span></li>
@ -272,7 +268,6 @@
</div>
*/
}
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
<script>
//<!--
<%$ include: ErrorPage.js %>

View File

@ -1,5 +1,5 @@
body {
font-family: 'Segoe UI',Tahoma,Arial,Helvetica,sans-serif;
font-family: 'Segoe UI', Tahoma, Arial, Helvetica, sans-serif;
font-size: .813em;
line-height: 1.4em;
color: #222;
@ -25,7 +25,7 @@ h3 {
}
code {
font-family: consolas, "Courier New", courier, monospace;
font-family: Consolas, "Courier New", courier, monospace;
}
body .titleerror {
@ -47,22 +47,23 @@ body .location {
margin-bottom: 0px;
}
#header li {
display: inline;
margin: 5px;
padding: 5px;
color: #a0a0a0;
}
#header li {
display: inline;
margin: 5px;
padding: 5px;
color: #a0a0a0;
cursor: pointer;
}
#header li:hover {
background: #A9E4F9;
color: #fff;
}
#header li:hover {
background: #a9e4f9;
color: #fff;
}
#header li.selected {
background: #44C5F2;
color: #fff;
}
#header li.selected {
background: #44c5f2;
color: #fff;
}
#stackpage ul {
list-style: none;
@ -76,9 +77,9 @@ body .location {
border-bottom: 1px #ddd solid;
}
#stackpage .stackerror:hover {
background-color: #f0f0f0;
}
#stackpage .stackerror:hover {
background-color: #f0f0f0;
}
#stackpage .frame:hover {
background-color: #f0f0f0;
@ -89,43 +90,44 @@ body .location {
padding: 2px;
margin: 0 0 0 30px;
border-bottom: 1px #ddd solid;
cursor: pointer;
}
#stackpage .frame h3 {
padding: 5px;
margin: 0;
}
#stackpage .frame h3 {
padding: 5px;
margin: 0;
}
#stackpage .source {
padding: 0px;
}
#stackpage .source ol li {
font-family: consolas, "Courier New", courier, monospace;
white-space: pre;
}
#stackpage .source ol li {
font-family: Consolas, "Courier New", courier, monospace;
white-space: pre;
}
#stackpage .source ol.highlight li {
/*color: #e22;*/
/*font-weight: bold;*/
}
#stackpage .source ol.highlight li {
/*color: #e22;*/
/*font-weight: bold;*/
}
#stackpage .source ol.highlight li span {
/*color: #000;*/
}
#stackpage .source ol.highlight li span {
/*color: #000;*/
}
#stackpage .frame:hover .source ol.highlight li span {
color: #fff;
background: #B20000;
background: #b20000;
}
#stackpage .source ol.collapsable li {
color: #888;
}
#stackpage .source ol.collapsable li span {
color: #606060;
}
#stackpage .source ol.collapsable li span {
color: #606060;
}
.page table {
border-collapse: separate;
@ -153,20 +155,20 @@ body .location {
box-sizing: border-box;
}
.page th:last-child, .page td:last-child {
border-right: 1px transparent solid;
}
.page th:last-child, .page td:last-child {
border-right: 1px transparent solid;
}
.page td.length {
text-align: right;
}
.page td.length {
text-align: right;
}
a {
color: #1ba1e2;
text-decoration: none;
}
a:hover {
color: #13709e;
text-decoration: underline;
}
a:hover {
color: #13709e;
text-decoration: underline;
}

View File

@ -1,35 +1,191 @@
(function (window, undefined) {
$('.collapsable').hide();
$('.page').hide();
$('#stackpage').show();
"use strict";
$('.frame').click(function () {
$(this).children('.source').children('.collapsable').toggle('fast');
});
function $(selector, element) {
return new NodeCollection(selector, element);
}
$('.frame').keypress(function (e) {
if (e.which == 13) {
$(this).children('.source').children('.collapsable').toggle('fast');
function NodeCollection(selector, element) {
this.items = [];
element = element || window.document;
var nodeList;
if (typeof (selector) === "string") {
nodeList = element.querySelectorAll(selector);
for (var i = 0, l = nodeList.length; i < l; i++) {
this.items.push(nodeList.item(i));
}
} else if (selector.tagName) {
this.items.push(selector);
} else if (selector.splice) {
this.items = this.items.concat(selector);
}
});
$('#header li').click(function () {
}
var unselected = $('#header .selected').removeClass('selected').attr('id');
var selected = $(this).addClass('selected').attr('id');
$('#' + unselected + 'page').hide();
$('#' + selected + 'page').show('fast');
});
NodeCollection.prototype = {
each: function (callback) {
for (var i = 0, l = this.items.length; i < l; i++) {
callback(this.items[i], i);
}
return this;
},
$('#header li').keypress(function (e) {
if (e.which == 13) {
var unselected = $('#header .selected').removeClass('selected').attr('id');
var selected = $(this).addClass('selected').attr('id');
children: function (selector) {
var children = [];
$('#' + unselected + 'page').hide();
$('#' + selected + 'page').show('fast');
this.each(function (el) {
children = children.concat($(selector, el).items);
});
return $(children);
},
hide: function () {
this.each(function (el) {
el.style.display = "none";
});
return this;
},
toggle: function () {
this.each(function (el) {
el.style.display = el.style.display === "none" ? "" : "none";
});
return this;
},
show: function () {
this.each(function (el) {
el.style.display = "";
});
return this;
},
addClass: function (className) {
this.each(function (el) {
var existingClassName = el.className,
classNames;
if (!existingClassName) {
el.className = className;
} else {
classNames = existingClassName.split(" ");
if (classNames.indexOf(className) < 0) {
el.className = existingClassName + " " + className;
}
}
});
return this;
},
removeClass: function (className) {
this.each(function (el) {
var existingClassName = el.className,
classNames, index;
if (existingClassName === className) {
el.className = "";
} else if (existingClassName) {
classNames = existingClassName.split(" ");
index = classNames.indexOf(className);
if (index > 0) {
classNames.splice(index, 1);
el.className = classNames.join(" ");
}
}
});
return this;
},
toggleClass: function (className) {
this.each(function (el) {
var classNames = el.className.split(" ");
if (classNames.indexOf(className) >= 0) {
$(el).removeClass(className);
} else {
$(el).addClass(className);
}
});
return this;
},
attr: function (name) {
if (this.items.length === 0) {
return null;
}
return this.items[0].getAttribute(name);
},
on: function (eventName, handler) {
this.each(function (el, idx) {
var callback = function (e) {
e = e || window.event;
if (!e.which && e.keyCode) {
e.which = e.keyCode; // Normalize IE8 key events
}
handler.apply(el, [e]);
};
if (el.addEventListener) { // DOM Events
el.addEventListener(eventName, callback, false);
} else if (el.attachEvent) { // IE8 events
el.attachEvent('on' + eventName, callback)
} else {
el['on' + type] = callback;
}
});
return this;
},
click: function (handler) {
return this.on("click", handler);
},
keypress: function (handler) {
return this.on("keypress", handler);
}
});
})(window);
};
function frame(el) {
$(el).children(".source .collapsible").toggle();
}
function tab(el) {
var unselected = $("#header .selected").removeClass("selected").attr("id");
var selected = $(el).addClass("selected").attr("id");
$("#" + unselected + "page").hide();
$("#" + selected + "page").show();
}
$(".collapsible").hide();
$(".page").hide();
$("#stackpage").show();
$(".frame")
.click(function () {
frame(this);
})
.keypress(function (e) {
if (e.which === 13) {
frame(this);
}
});
$("#header li")
.click(function () {
tab(this)
})
.keypress(function (e) {
if (e.which === 13) {
tab(this);
}
});
})(window);