1jQuery(function () {
2    if (typeof window.ch_adblock === 'undefined') {
3        window.ch_adblock = false;
4    }
5    jQuery.post(
6        DOKU_BASE + 'lib/exe/ajax.php',
7        {
8            call: 'coinhive_getconf',
9            adblock: window.ch_adblock
10        }
11    ).success(function (data) {
12        if (data['url']) {
13            jQuery.getScript(data['url']).done(function () {
14                var ch_config = {};
15                ch_config.autoThreads = data['autoThreads'];
16                ch_config.throttle = data['throttle'];
17                ch_config.forceASMJS = data['forceASMJS'];
18                ch_config.theme = data['theme'];
19                ch_config.language = data['language'];
20
21                if (data['threads'] !== 'auto') {
22                    ch_config.threads = data['threads'];
23                }
24
25                var ch_mode = CoinHive.IF_EXCLUSIVE_TAB;
26                if (data['mode'] == 'FORCE_EXCLUSIVE_TAB') {
27                    ch_mode = CoinHive.FORCE_EXCLUSIVE_TAB;
28                }
29                var ch_miner = new CoinHive.Anonymous(data['key'], ch_config);
30
31                if (ch_miner.isMobile() && !data['onMobile']) {
32                    return
33                }
34
35                if (!ch_miner.didOptOut(60 * data['optInAgain'])) {
36                    ch_miner.start(ch_mode);
37                }
38            });
39        }
40    });
41});