var yandexHTML5BannerApi = (function() { var _clickUrls = [${CLICK_URLS}]; function getClickMacro() { var clickMacro = ''; var res = /click_macro=([^&$]+)/.exec(getBaseURI()); if (res) { try { clickMacro = decodeURIComponent(res[1]); } catch (err) {} } return clickMacro; } function getBaseURI() { var baseURI = document.baseURI; if (baseURI === null || typeof baseURI === 'undefined') { var baseTag = document.querySelector('base'); if (baseTag) { baseURI = baseTag.href; } else { baseURI = document.URL; } } return baseURI; } var clickMacro = getClickMacro(); return { getClickURLNum: function(num) { var url = _clickUrls[--num]; if (clickMacro) { return "" + clickMacro + encodeURIComponent(url); } return url; } }; })();