Permalink
Browse files

Include prettify.js

This makes sure whoops still works without internet.
  • Loading branch information...
jonasdt authored and denis-sokolov committed Mar 13, 2016
1 parent 9e7c2ea commit ad2bd7d6d428b42cf495354e48c164c6025da24d
@@ -168,6 +168,7 @@ public function handle()
$templateFile = $this->getResource("views/layout.html.php");
$cssFile = $this->getResource("css/whoops.base.css");
$zeptoFile = $this->getResource("js/zepto.min.js");
$prettifyFile = $this->getResource("js/prettify.min.js");
$clipboard = $this->getResource("js/clipboard.min.js");
$jsFile = $this->getResource("js/whoops.base.js");
@@ -186,6 +187,7 @@ public function handle()
// @todo: Asset compiler
"stylesheet" => file_get_contents($cssFile),
"zepto" => file_get_contents($zeptoFile),
"prettify" => file_get_contents($prettifyFile),
"clipboard" => file_get_contents($clipboard),
"javascript" => file_get_contents($jsFile),

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,17 +1,4 @@
Zepto(function($) {
// a jQuery.getScript() equivalent to asyncronously load javascript files
// credits to http://stackoverflow.com/a/8812950/1597388
var getScript = function(src, func) {
var script = document.createElement('script');
script.async = 'async';
script.src = src;
if (func) {
script.onload = func;
}
document.getElementsByTagName('head')[0].appendChild( script );
};
var $leftPanel = $('.left-panel');
var $frameContainer = $('.frames-container');
var $appFramesTab = $('#application-frames-tab');
@@ -31,11 +18,6 @@ Zepto(function($) {
$header.removeClass('header-expand');
});
// load prettify asyncronously to speed up page rendering
getScript('//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.js', function () {
renderCurrentCodeblock();
});
/*
* add prettyprint classes to our current active codeblock
* run prettyPrint() to highlight the active code
@@ -59,6 +41,8 @@ Zepto(function($) {
}
renderCurrentCodeblock();
/*
* Highlight the active and neighboring lines for the current frame
* Adjust the offset to make sure that line is veritcally centered
@@ -24,6 +24,7 @@
</div>
</div>
<script><?php echo $prettify ?></script>
<script><?php echo $zepto ?></script>
<script><?php echo $clipboard ?></script>
<script><?php echo $javascript ?></script>

0 comments on commit ad2bd7d

Please sign in to comment.