1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00

Check if hljs is defined

Really fixes #107 and #108
This commit is contained in:
Barry vd. Heuvel 2014-03-25 08:58:22 +01:00
parent 57403a83fd
commit ed30ed79c2

View File

@ -48,7 +48,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
*/
var highlight = PhpDebugBar.Widgets.highlight = function(code, lang) {
if (typeof(code) === 'string') {
if (!hljs) {
if (typeof(hljs) === 'undefined') {
return htmlize(code);
}
if (lang) {
@ -57,7 +57,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
return hljs.highlightAuto(code).value;
}
if (hljs) {
if (typeof(hljs) === 'object') {
code.each(function(i, e) { hljs.highlightBlock(e); });
}
return code;