blob: 0594b42aa3a4747b6ab16b8b4be7aa26be2aee5c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*globals document, window*/
window.addEventListener("load", function () {
"use strict";
var body = document.body,
base = window.__otpTopDocDir || "/doc/js/",
cssLink = document.createElement('link'),
script = document.createElement('script'),
intervalId, attempts = 0;
cssLink.rel = "stylesheet";
cssLink.href = base + "../highlight.css";
script.src = base + "highlight.pack.js";
body.appendChild(cssLink);
body.appendChild(script);
function doHighlight() {
attempts += 1;
if (attempts > 20) {
window.clearInterval(intervalId);
return;
}
if (!window.hljs) {
return;
}
window.clearInterval(intervalId);
var i, len, nodes = document.querySelectorAll('.example');
for (i = 0, len = nodes.length; i < len; i += 1) {
window.hljs.highlightBlock(nodes[i]);
}
}
intervalId = window.setInterval(doHighlight, 50);
});
|