Permalink
Browse files

Few new tips, and errors => warnings, plus notify of fatal error.

  • Loading branch information...
1 parent a586b88 commit 224e1ca7bf6fb1294034afb10490b7faa5a303f4 @remy remy committed Jun 23, 2011
Showing with 18 additions and 20 deletions.
  1. +1 −1 VERSION
  2. +12 −18 js/chrome/errors.js
  3. +5 −1 tips.json
View
2 VERSION
@@ -1 +1 @@
-2.8.3
+2.8.4
View
30 js/chrome/errors.js
@@ -36,11 +36,13 @@ JSHINT._data = JSHINT.data;
JSHINT.data = function (onlyErrors) {
var data = JSHINT._data(),
errors = [];
-
+
if (onlyErrors && data.errors) {
for (var i = 0; i < data.errors.length; i++) {
if (data.errors[i] !== null && data.errors[i].evidence) { // ignore JSHINT just quitting
errors.push(data.errors[i]);
+ } else if (data.errors[i] !== null && data.errors[i].reason.indexOf('Stopping') === 0) {
+ errors.push('Fatal errors, unable to continue');
}
}
return {
@@ -52,26 +54,14 @@ JSHINT.data = function (onlyErrors) {
}
};
-// $error.tipsy({
-// title: function () {
-// var html = ['<ul>'],
-// errors = JSHINT.data(true).errors;
-// for (var i = 0; i < errors.length; i++) {
-// html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
-// }
-//
-// return html.join('<li>') + '</ul>';
-// },
-// gravity: 'nw',
-// html: true
-// });
-
$error.delegate('li', 'click', function () {
var errors = JSHINT.data(true).errors;
if (errors.length) {
var i = $error.find('li').index(this);
- editors.javascript.setSelection({ line: errors[i].line - 1, ch: 0 }, { line: errors[i].line - 1 });
- editors.javascript.focus();
+ if (errors[i].reason) {
+ editors.javascript.setSelection({ line: errors[i].line - 1, ch: 0 }, { line: errors[i].line - 1 });
+ editors.javascript.focus();
+ }
// var line = editors.javascript.nthLine(errors[0].line);
// editors.javascript.jumpToLine(line);
// editors.javascript.selectLines(line, 0, editors.javascript.nthLine(errors[0].line + 1), 0);
@@ -92,7 +82,11 @@ var checkForErrors = function () {
var html = ['<ol>'],
errors = jshintErrors.errors;
for (var i = 0; i < errors.length; i++) {
- html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
+ if (typeof errors[i] == 'string') {
+ html.push(errors[i]);
+ } else {
+ html.push('Line ' + errors[i].line + ': ' + errors[i].evidence + ' --- ' + errors[i].reason);
+ }
}
html = html.join('<li>') + '</ol>';
View
6 tips.json
@@ -1,5 +1,9 @@
// feel free to add tips to this file to help other users - just append to the end
[
'Use ctrl+shift+? to show the keyboard shortcuts',
-'Make sure you check out the help and tutorials - a blog of screencasts'
+'Make sure you check out the help and tutorials - a blog of screencasts',
+'To only show the HTML panel use #html on the end of the url, such as http://jsbin.com/#html',
+'Refreshing the window will not lose your changes.',
+'Use console.log to display debug information. If a web console is present, then the logging goes there, otherwise it will show in a custom console window.',
+'To view only the JavaScript append /js to the url, i.e. http://jsbin.com/ujayi/js - useful for Ajax testing'
]

0 comments on commit 224e1ca

Please sign in to comment.