I've got a page which uses both the unofficial github buttons, and code which I highlight using this syntax highlighter.
The problem is, the two github buttons are iframes which both make requests to api.github.com
, and it can sometimes take a while for them to load.
While the buttons are loading (and chrome says "waiting for api.github.com"), the syntax highlighter's javascript can't execute. It doesn't execute until the iframes are fully loaded, which sometimes can take quite a while.
I'd much prefer to have no github buttons and have my code highlighted faster than have the github buttons load first. How can I achieve this?
I've tried loading the buttons asynchronously with javascript, but they don't load properly because the javascript in the iframes doesn't execute for some reason.
Here's how I load up the SyntaxHighlighter (in the <head>
)
<script type="text/javascript" src="js/shCore.min.js"></script>
<script type="text/javascript" src="js/brushes.min.js"></script>
<script type="text/javascript">
SyntaxHighlighter.defaults['gutter'] = false;
SyntaxHighlighter.defaults['toolbar'] = false;
SyntaxHighlighter.all();
</script>
And the iframe HTML looks like this:
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=user&repo=repo&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="165px" height="30px"></iframe>
<iframe src="http://markdotto.github.com/github-buttons/github-btn.html?user=user&repo=repo&type=fork&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="165px" height="30px"></iframe>
How can I stop the buttons from blocking my JS?