show-js-error
Advanced tools
Comparing version
# Changelog | ||
## v1.6.0 | ||
Added links to MDN and Stack Overflow for help. | ||
## v1.5.0 | ||
@@ -4,0 +7,0 @@ - Added output of total number of errors. |
@@ -14,2 +14,3 @@ /*! show-js-error | © 2016 Denis Seleznev | MIT License */ | ||
* @param {String} [settings.additionalText] | ||
* @param {Boolean} [settings.helpLinks] | ||
*/ | ||
@@ -221,2 +222,29 @@ init: function(settings) { | ||
if (this.settings.helpLinks) { | ||
this._helpLinks = this.elem({ | ||
name: 'help', | ||
container: this._body | ||
}); | ||
this._mdn = this.elem({ | ||
tag: 'a', | ||
name: 'mdn', | ||
props: { | ||
target: '_blank', | ||
innerHTML: 'MDN' | ||
}, | ||
container: this._helpLinks | ||
}); | ||
this._stackoverflow = this.elem({ | ||
tag: 'a', | ||
name: 'stackoverflow', | ||
props: { | ||
target: '_blank', | ||
innerHTML: 'Stack Overflow' | ||
}, | ||
container: this._helpLinks | ||
}); | ||
} | ||
this._filename = this.elem({ | ||
@@ -481,2 +509,7 @@ name: 'filename', | ||
if (this._helpLinks) { | ||
this._mdn.href = 'https://developer.mozilla.org/en-US/search?q=' + encodeURIComponent(e.message || e.stack || ''); | ||
this._stackoverflow.href = 'https://stackoverflow.com/search?q=' + encodeURIComponent('[js] ' + (e.message || e.stack || '')); | ||
} | ||
this._prev.disabled = !this._i; | ||
@@ -483,0 +516,0 @@ this._num.innerHTML = (this._i + 1) + ' / ' + this._buffer.length; |
@@ -14,2 +14,3 @@ /*! show-js-error | © 2016 Denis Seleznev | MIT License */ | ||
* @param {String} [settings.additionalText] | ||
* @param {Boolean} [settings.helpLinks] | ||
*/ | ||
@@ -221,2 +222,29 @@ init: function(settings) { | ||
if (this.settings.helpLinks) { | ||
this._helpLinks = this.elem({ | ||
name: 'help', | ||
container: this._body | ||
}); | ||
this._mdn = this.elem({ | ||
tag: 'a', | ||
name: 'mdn', | ||
props: { | ||
target: '_blank', | ||
innerHTML: 'MDN' | ||
}, | ||
container: this._helpLinks | ||
}); | ||
this._stackoverflow = this.elem({ | ||
tag: 'a', | ||
name: 'stackoverflow', | ||
props: { | ||
target: '_blank', | ||
innerHTML: 'Stack Overflow' | ||
}, | ||
container: this._helpLinks | ||
}); | ||
} | ||
this._filename = this.elem({ | ||
@@ -481,2 +509,7 @@ name: 'filename', | ||
if (this._helpLinks) { | ||
this._mdn.href = 'https://developer.mozilla.org/en-US/search?q=' + encodeURIComponent(e.message || e.stack || ''); | ||
this._stackoverflow.href = 'https://stackoverflow.com/search?q=' + encodeURIComponent('[js] ' + (e.message || e.stack || '')); | ||
} | ||
this._prev.disabled = !this._i; | ||
@@ -491,3 +524,4 @@ this._num.innerHTML = (this._i + 1) + ' / ' + this._buffer.length; | ||
showJSError.init({ | ||
userAgent: navigator.userAgent | ||
userAgent: navigator.userAgent, | ||
helpLinks: true | ||
}); |
{ | ||
"name": "show-js-error", | ||
"description": "Show a message about a js error in any browser", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Denis Seleznev", |
Sorry, the diff of this file is not supported yet
34188
7.86%1037
6.58%