1$('#navbar').on('active.uk.sticky', function() { 2 console.log('navbar active'); 3 }); 4 $('#navbar').on('inactive.uk.sticky', function() { 5 console.log('navbar inactive'); 6 }); 7 8 var isSafari = /Safari/.test(navigator.userAgent) && navigator.userAgent.indexOf('Chrome') == -1 && navigator.userAgent.indexOf('Chromium') == -1; 9 var isFBApp = /FBAN/.test(navigator.userAgent) || /FBAV/.test(navigator.userAgent); 10 11 function initApp() { 12 initContactUs(); 13 14 15 } 16 17 function initContactUs() { 18 19 } 20 21 22 function onErrorEvent(event) { 23 // Extract the shaka.util.Error object from the event. 24 onError(event.detail); 25 } 26 27 function onError(error) { 28 // Log the error. 29 console.error('Error code', error.code, 'object', error); 30 } 31 32 document.addEventListener('DOMContentLoaded', initApp); 33 34 35 36 37 38 39 function showWeb(url, ret_url, _min_scroll, callback) { 40 41 // delete window.zE; 42 window.zE('webWidget', 'close'); 43 44 $("#launcher").hide(); 45 46 var dlg = $.UIkit.modal("#builder_web_modal", {bgclose: false, minScrollHeight: _min_scroll, center: true}); 47 var $spinner = dlg.element.find("#web_modal_spinner"); 48 var web_frame = dlg.element.find("#web_frame"); 49 var content_window = dlg.element.find('.av-modal-dialog'); 50 var web_close = dlg.element.find("#web_close"); 51 var _this = this; 52 web_frame.on("load", function(event) { 53 console.log('showing web dialog'); 54 $spinner.hide(); 55 web_frame.show(); 56 // if (web_frame.css('display') != 'none') { 57 console.log(web_frame.css('height')); 58 web_frame.css('height', content_window.css('height')); 59 console.log(web_frame.css('height')); 60 // } 61 62 // Check redirected url 63 var new_url; 64 try { 65 new_url = this.contentWindow.location.href; 66 } catch (err) { 67 new_url = 'BLOCKED'; 68 } 69 console.log('Got redirect to: ' + new_url); 70 if (new_url.startsWith(ret_url)) { 71 web_frame.off("load"); 72 web_frame.attr('src', ''); 73 dlg.hide(true); 74 if(callback) { 75 callback(new_url); 76 } 77 } 78 }); 79 80 web_close.one("click", function(event){ 81 web_frame.off("load"); 82 web_frame.attr('src', ''); 83 dlg.hide(true); 84 if (callback) { 85 callback(); 86 } 87 }); 88 89 web_frame.hide(); 90 web_frame.attr('src', url); 91 dlg.show(); 92 dlg.on({ 'beforeshow': function() { 93 // debugger; 94 } }); 95 $spinner.show(); 96 } 97 98 function showMobileWeb(url, _min_scroll) { 99 100 var dlg = $.UIkit.modal("#builder_web_modal_mobile", {bgclose: false, minScrollHeight: _min_scroll, center: true}); 101 var $spinner = dlg.find("#web_modal_spinner"); 102 var web_frame = dlg.find("#web_frame"); 103 var _this = this; 104 web_frame.on("load", function(event) { 105 if (web_frame.css('display') != 'none') { 106 console.log('showing web dialog'); 107 $spinner.hide(); 108 } 109 // Check redirected url 110 var new_url; 111 try { 112 new_url = this.contentWindow.location.href; 113 } catch (err) { 114 new_url = 'BLOCKED'; 115 } 116 117 var match, 118 pl = /\+/g, // Regex for replacing addition symbol with a space 119 search = /([^&=]+)=?([^&]*)/g, 120 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, 121 query = new_url.substring(new_url.indexOf("?")).substring(1), 122 pathbase = new_url.substring(0, new_url.indexOf("?")); 123 124 var URL_PARAMS = {}; 125 while (match = search.exec(query)) { 126 URL_PARAMS[decode(match[1])] = decode(match[2]); 127 } 128 129 var debug_param = URL_PARAMS['is_debug'] ? "&is_debug=" + decodeURIComponent(URL_PARAMS['is_debug']) : ""; 130 131 console.log('Got redirect to: ' + new_url); 132 // Strip out f**cking code query param 133 if (URL_PARAMS['code'] != undefined && URL_PARAMS['jumpToLogin'] != undefined) { 134 web_frame.attr('src', pathbase + "?jumpToLogin=" + escape( URL_PARAMS['jumpToLogin'] ) + debug_param); 135 } 136 }); 137 web_frame.attr('src', url); 138 dlg.show(); 139 $spinner.show(); 140 } 141 142 $(".price-yearly").hide(); 143 144 function handleContactUs() { 145 // TODO: show wait until zendesk available
146 window.zE.setLocale(LANG.id); 147 window.zE.activate({hideOnClose: true}); 148 } 149 150 function preparePlans(utm_content) { 151 console.log('TESTEST Prepare plans'); 152 var data = JSON.stringify({ 153 command_name: "get_plans_html", 154 params: { 155 locale: LANG.id, 156 utm_content 157 } 158 }); 159 $.ajax({ 160 type: "POST", 161 url: SERVER_URL, 162 data: data, 163 contentType: "application/json; charset=utf-8", 164 //dataType: "text/html", 165 success: function(data) { 166 $(".panel-pricing-text").empty().append(data); 167 168 169 // Patch for fixing visual issue on FB in-app browser 170 if (isFBApp) { 171 $("#section-pricing-table-index .text-center").css("transform", "scale(0.85)"); 172 $("#section-pricing-table-index .cta-click-button").css("transform", "scale(0.85)"); 173 } 174 175 176 }.bind(this), 177 error: function(errObj) { 178 console.log('Response Error: ' + errObj.statusText + 'ReadyState: ' + errObj.readyState); 179 }.bind(this) 180 }); 181 } 182 183 $(document).ready(function() { 184 185 //window.location.href 186 // var isMobile = false; 187 // if( $('#section-slogan-shopping-bags').css('display')=='none') { 188 // isMobile = true; 189 // } 190 191 function getUrlParameter(name) { 192 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); 193 var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); 194 var results = regex.exec(location.search); 195 return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); 196 }; 197 198 preparePlans(getUrlParameter('utm_content')); 199 200 var isMobile = false; //initiate as false 201 // device detection 202 if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) 203 || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
203substr(0,4))) isMobile = true; 204 205 var ua = new UAParser(); 206 var browser_ua_name = ua.getResult().browser.name; 207 208 console.log('browser name: ' + browser_ua_name); 209 210 var isIE = false; 211 if (/(Internet Explorer|IE[0-9]|IE)/i.test(browser_ua_name)) { 212 isIE = true; 213 } 214 215 var isScrollHandled = false; 216 217 var menuItems = $('#menu-links'); 218 var menuItemsDesktop = $('#menu-large-links'); 219 var url = window.location.href; 220 var filename = url.substring(url.lastIndexOf('/')+1); 221 // <li><a href="#">Home</a></li> 222 223 menuItems.empty(); 224 menuItemsDesktop.empty(); 225 226 227 var $price_instead_of = $('.js-price-instead-of'); 228 var price_formated = LANG.pricing_currency.trim() + LANG.pricing_plan_0_monthly.split('\n')[0]; 229 if (LANG.pricing_plan_0_monthly.split('\n')[1] !== '') { 230 price_formated += "." + LANG.pricing_plan_0_monthly.split('\n')[1]; 231 } 232 var insteadof_html = LANG.monthly_price_instead_of_yearly.replace('{0}', price_formated); 233 $price_instead_of.html(insteadof_html); 234 235 236 // // Menu Pricing 237 // if (filename == 'pricing.html') { 238 // var item = '<li><a href="#">' + LANG.menu_price + '</a></li>' 239 // menuItems.append($(item)); 240 // menuItemsDesktop.append($(item)); 241 // } else { 242 // var href = '/public' + (LANG.id == 'en' ? '/' : ('/' + LANG.id + '/' )) + 'website/pricing.html'; 243 // var item = '<li><a href="' + href + '">' + LANG.menu_price + '</a></li>' 244 // menuItems.append($(item)); 245 // menuItemsDesktop.append($(item)); 246 // } 247 248 // Affiliate 249 // menuItems.append($('<li><a class="cta-click-button" style="font-weight: 500;">' + LANG.main_cta_button + '</a></li>')); 250 // menuItemsDesktop.append($('<li><a class="website-nav-menu-items" href="https://appv.leaddyno.com/" target="_blank">' + LANG.menu_affiliates + '</a></li>')); 251 252 // Menu Help 253 menuItems.append($('<li><a href="https://appv.co/support" target="_blank">' + LANG.menu_help + '</a></li>')); 254 menuItemsDesktop.append($('<li><a class="website-nav-menu-items" href="https://appv.co/support" target="_blank">' + LANG.menu_help + '</a></li>')); 255 256 // Contact Us 257 menuItems.append($('<li><a onclick="handleContactUs();">' + LANG.menu_contact + '</a></li>')); 258 menuItemsDesktop.append($('<li><a class="website-nav-menu-items" onclick="handleContactUs();">' + LANG.menu_contact + '</a></li>')); 259 260 // Investors relations 261 menuItems.append($('<li><a href="https://ad-rabbit.com/corporate" target="_blank">' + LANG.menu_investors + '</a></li>')); 262 menuItemsDesktop.append($('<li><a class="website-nav-menu-items" href="https://ad-rabbit.com/corporate" target="_blank">' + LANG.menu_investors + '</a></li>')); 263 264 265 // var langSwitchControl = $("#lang-selector"); 266 // var smallLangSwitchControl = $("#small-lang-selector"); 267 // var langSelect = $("#lang-select"); 268 // var langSelectList = $("#lang-select-list"); 269 var langSelectSmall = $("#lang-select-small"); 270 var langSelectListSmall = $("#lang-select-list-small"); 271 var langSelectListDesktop = $("#lang-select-list-desktop"); 272 273 274 var campaign = getUrlParameter('utm_campaign'); 275 var openBuilderParam = getUrlParameter('open_builder'); 276 var GLOBE = '<i class="uk-icon-globe"/> '; 277 // langSelectList.empty(); 278 // langSelectListSmall.empty(); 279 // langSelectListDesktop.empty(); 280 // for (var lang in LANGUAGE_NAMES) { 281 // var langName = LANGUAGE_NAMES[lang]; 282 // var currentLang = false; 283 // if (lang == LANG.id) { 284 // currentLang = true; 285 // } 286 // var href = '/public/website/'; 287 // var item; 288 // if (lang != 'en') { 289 290 // href = '/public/' + lang + '/website/'; 291 // var hrefOrNone = currentLang ? '' : 'href="' + href + ' '; 292 // item = '<li><a class="select-lang-item' + (currentLang ? '-active' : '') + '" ' + hrefOrNone + '">' + langName + '</a></li>';
293 // //langSelectList.append($(item)); 294 // langSelectListSmall.append($(item)); 295 // langSelectListDesktop.append($(item)); 296 // } else { 297 // var hrefOrNone = currentLang ? '' : 'href="' + href + ' '; 298 // item = '<li><a class="select-lang-item' + (currentLang ? '-active' : '') + '" ' + hrefOrNone + '">' + langName + '</a></li>'; 299 // //langSelectList.append($(item)); 300 // langSelectListSmall.append($(item)); 301 // langSelectListDesktop.append($(item)); 302 // } 303 // } 304 305 var $slider = $('#features_slider'); 306 $slider.slick({ 307 dots: true, 308 infinite: true, 309 centerMode: true, 310 centerPadding: '15vw', 311 slideToShow: 1 312 }); 313 $slider.on('afterChange', function(event, slick, currentSlide){ 314 }.bind(this)); 315 316 var $test_slider = $('#testimonials_slider') 317 $test_slider.show(); 318 $test_slider.slick({ 319 dots: true, 320 infinite: true, 321 slideToShow: 1 322 }); 323 $test_slider.on('afterChange', function(event, slick, currentSlide){ 324 }.bind(this)); 325 326 var $recent_apps_slider = $('#recent-app-slider'); 327 $recent_apps_slider.show(); 328 $recent_apps_slider.slick({ 329 centerPadding: '193px', 330 slidesToShow: 1, 331 centerMode: true, 332 arrows: true 333 }); 334 335 $recent_apps_slider.on('afterChange', function(event, slick, currentSlide){ 336 }.bind(this)); 337 338 // Jump to testimonials link 339 $('#jumpToTestimonials').click(function() { 340 var target = $('#section-testimonials'); 341 $('html,body').animate({ 342 scrollTop: target.offset().top 343 }, 1000); 344 }); 345 346 $('#close-modal-button').click(function() { 347 var web_close = $("#web_close"); 348 web_close.click(); 349 }); 350 351 // Handle open builder 352 // var openBuilder = function() { 353 // var builder = '../newappsetup/'; 354 // if (window.location.pathname.indexOf('website') == -1) { 355 // builder = 'newappsetup/'; 356 // } 357 // if (isMobile) { 358 // console.log('window.location.search=' + window.location.search); 359 // window.location.href = builder + window.location.search; 360 // // showMobileWeb(LANG.base_url + 'newappsetup', y); 361 // } else { 362 // if (isIE) { 363 // showWeb(builder + 'error_not_supported.html', null, 480); 364 // } else { 365 // showWeb(builder + window.location.search, null, 480); 366 // } 367 // } 368 369 // } 370 371 var openBuilder = function() { 372 var builder = 'https://builder.appsvillage.com'; 373 374 var app_id = getUrlParameter('app_id'); 375 var admin_id = getUrlParameter('admin_id'); 376 377 // if (app_id && admin_id) { 378 // builder = SERVER_URL + '/../builder'; 379 // } 380 381 if (getUrlParameter('same')) { 382 builder = '/public/builder/'; 383 } 384 385 if (isMobile) { 386 console.log('window.location.search=' + window.location.search); 387 window.location.href = builder + window.location.search; 388 // showMobileWeb(LANG.base_url + 'newappsetup', y); 389 } else { 390 if (isIE) { 391 showWeb(builder + 'error_not_supported.html', null, 480); 392 } else { 393 showWeb(builder + window.location.search, null, 480); 394 } 395 } 396 397 } 398 399 $('.cta-slogan-btn').click(openBuilder); 400 $('.cta-click-button').click(openBuilder); 401 if (openBuilderParam == "true") { 402 openBuilder(); 403 } 404 405 406 // 407 $('input[type=radio][name=plans_options]').change(function() { 408 if (this.value == 'monthly') { 409 $(".price-yearly").hide(); 410 $(".price-monthly").show(); 411 } 412 else if (this.value == 'yearly') { 413 $(".price-monthly").hide(); 414 $(".price-yearly").show(); 415 } 416 }); 417 418 419 // Back to top 420 var amountScrolled = 400; 421 var amountScrolledNav = 50; 422 423 $(window).scroll(function() { 424 if ( $(window).scrollTop() > amountScrolled ) { 425 $('button.back-to-top').addClass('show'); 426 } else { 427 $('button.back-to-top').removeClass('show'); 428 } 429 }); 430 431 $('button.back-to-top').click(function() { 432 $('html, body').animate({ 433 scrollTop: 0 434 }, 800); 435 return false;
436 }); 437 438 // CTA FAB 439 var ctaAmountScrolled = window.innerHeight; 440 441 $(window).scroll(function() { 442 if ( $(window).scrollTop() > ctaAmountScrolled ) { 443 $('.fab_cta_container').addClass('showing'); 444 } else { 445 $('.fab_cta_container').removeClass('showing'); 446 } 447 }); 448 449 function createFragment(htmlStr) { 450 451 var frag = document.createDocumentFragment(), 452 temp = document.createElement('div'); 453 454 temp.innerHTML = htmlStr; 455 456 while(temp.firstChild) { 457 frag.appendChild(temp.firstChild); 458 } 459 460 return frag; 461 } 462 463 var EMPTY_NODE = function(el) { 464 while (el.lastChild) { 465 el.removeChild(el.lastChild); 466 } 467 return el; 468 } 469 470 var REMOVE_PARENT_SECTION = function(el) { 471 el.parentNode.parentNode.parentNode.removeChild(el.parentNode.parentNode); 472 } 473 474 var REMOVE_ELEMENT = function(el) { 475 el.parentNode.removeChild(el); 476 } 477 478 var FETCH_STOCK_DATA = function(callback) { 479 var data = JSON.stringify({ 480 command_name: "get_stock_data", 481 params: {} 482 }); 483 $.ajax({ 484 type: "POST", 485 url: SERVER_URL, 486 data: data, 487 contentType: "application/json; charset=utf-8", 488 dataType: "json", 489 success: function(data) { 490 console.log('Response: ' + JSON.stringify(data)); 491 if (data.status != this.ERROR_OK) { 492 console.log('Server Error: ' + data.status + ' ' + (data.params ? data.params.message : '')); 493 } 494 callback(data.status, data.params); 495 }.bind(this), 496 error: function(errObj) { 497 console.log('Response Error: ' + errObj.statusText + 'ReadyState: ' + errObj.readyState); 498 callback(this.ERROR_GENERAL); 499 }.bind(this) 500 }); 501 } 502 503 var FETCH_INVESTOR_DATA = function(callback) { 504 var data = JSON.stringify({ 505 command_name: "get_investor_data", 506 params: {} 507 }); 508 $.ajax({ 509 type: "POST", 510 url: SERVER_URL, 511 data: data, 512 contentType: "application/json; charset=utf-8", 513 dataType: "json", 514 success: function(data) { 515 console.log('Response: ' + JSON.stringify(data)); 516 if (data.status != this.ERROR_OK) { 517 console.log('Server Error: ' + data.status + ' ' + (data.params ? data.params.message : '')); 518 } 519 callback(data.status, data.params); 520 }.bind(this), 521 error: function(errObj) { 522 console.log('Response Error: ' + errObj.statusText + 'ReadyState: ' + errObj.readyState); 523 callback(this.ERROR_GENERAL); 524 }.bind(this) 525 }); 526 } 527 528 function FORMAT_DATE( date, params ) { 529 var options = { 530 weekday: "short", 531 year: "numeric", 532 month: "long", 533 day: "numeric", 534 hour: "2-digit", 535 minute: "2-digit", 536 timeZone: "UTC", 537 timeZoneName: "short", 538 }; 539 540 if( params ) { 541 options = Object.assign( options, params ); 542 } 543 544 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString 545 return new Date( date ).toLocaleString( 'en-US', options ); 546 } 547 548 549 var APPEND_LOADING = function(el) { 550 var html_str = '<div class="stock-loading" style="display: inline-flex;"><i class="fa fa-spinner fa-spin"></i></div>'; 551 el.appendChild(createFragment(html_str)); 552 } 553 554 555 var startStockUpdate = function() { 556 var _price = APPEND_LOADING(EMPTY_NODE($(".js-stock-price")[0])); 557 var _change = APPEND_LOADING(EMPTY_NODE($(".js-stock-price-change")[0])); 558 var _volume = APPEND_LOADING(EMPTY_NODE($(".js-stock-volume")[0])); 559 var _update_time = $(".js-stock-update-time").html(FORMAT_DATE(Date.now())); 560 FETCH_STOCK_DATA(function(err, data) { 561 if (!err && !!data) { 562 updateStock(data.price, data.change, data.volume); 563 } else { 564 console.log("ERROR on update stock data. err: " + err); 565 } 566 }) 567 } 568 569 var updateStock = function(price, change, volume) { 570 var _price = EMPTY_NODE($(".js-stock-price")[0]); 571 var _change = EMPTY_NODE($(".js-stock-price-change")[0]); 572 var _volume = EMPTY_NODE($(".js-stock-volume")[0]); 573 var _update_time = $(".js-stock-update-time").html(FORMAT_DATE(Date.now())); 574 575 // todo update data 576 _price.innerHTML = price; 577 _change.innerHTML = change; 578 _volume.innerHTML = volume; 579 580 //schedule update in 15 minutes 581 setTimeout(startStockUpdate, 1000 * 60 * 15);// 15 582 } 583 584 var startInvestorsDataUpdate = function(callback) { 585 var _PR_CONTAINER = APPEND_LOADING(EMPTY_NODE($(".js-pr-container")[0])); 586 var _QTR_CONTAINER = APPEND_LOADING(EMPTY_NODE($(".js-qtr-container")[0])); 587 // var _CORP_GOV_CONTAINER = APPEND_LOADING(EMPTY_NODE($("")[0])); 588 // var _KEY_REPORTING_CONTAINER = APPEND_LOADING(EMPTY_NODE($("")[0])); 589 // var _AGM_CONTAINER = APPEND_LOADING(EMPTY_NODE($("")[0])); 590 591 FETCH_INVESTOR_DATA(function(err, data) { 592 if (!err && !!data) { 593 updateInvestorSections(data, callback); 594 } else { 595 console.log("ERROR on update investors data. err: " + err); 596 } 597 }) 598 } 599 600 var updateInvestorSections = function(_data, callback) { 601 602 if (Object.keys(_data.pr).length === 0 && _data.pr.constructor === Object) { 603 REMOVE_PARENT_SECTION($(".js-pr-container")[0]); 604 REMOVE_ELEMENT($('#main-nav [href="#press-releases-section"]')[0]); 605 } else { 606 var pr_list = $(_.template($('#prsTpl').html())(_data)); 607 var _PR_CONTAINER = EMPTY_NODE($(".js-pr-container")[0]); 608 $(".js-pr-container").append(pr_list); 609 } 610 611 if (Object.keys(_data.qtr).length === 0 && _data.qtr.constructor === Object) { 612 REMOVE_PARENT_SECTION($(".js-qtr-container")[0]); 613 REMOVE_ELEMENT($('#main-nav [href="#quarters-section"]')[0]); 614 } else { 615 var qtr_list = $(_.template($('#qtrTpl').html())(_data)); 616 var _QTR_CONTAINER = EMPTY_NODE($(".js-qtr-container")[0]); 617 $(".js-qtr-container").append(qtr_list); 618 } 619 620 if (Object.keys(_data.corp_gov).length === 0 && _data.corp_gov.constructor === Object) { 621 REMOVE_PARENT_SECTION($(".js-corp-gov-container")[0]); 622 REMOVE_ELEMENT($('#main-nav [href="#corporate-governance-section"]')[0]); 623 } else { 624 var gov_list = $(_.template($('#corpTpl').html())(_data)); 625 var _GOV_CONTAINER = EMPTY_NODE($(".js-corp-gov-container")[0]); 626 $(".js-corp-gov-container").append(gov_list); 627 } 628 629 if (Object.keys(_data.key_report).length === 0 && _data.key_report.constructor === Object) { 630 REMOVE_PARENT_SECTION($(".js-key-reporting-container")[0]); 631 REMOVE_ELEMENT($('#main-nav [href="#key-reporting-dates-section"]')[0]); 632 } else { 633 var key_report_list = $(_.template($('#keyReportTpl').html())(_data)); 634 var _KEY_REPORT_CONTAINER = EMPTY_NODE($(".js-key-reporting-container")[0]); 635 $(".js-key-reporting-container").append(key_report_list); 636 } 637 638 if (Object.keys(_data.agm).length === 0 && _data.agm.constructor === Object) { 639 REMOVE_PARENT_SECTION($(".js-agm-container")[0]); 640 REMOVE_ELEMENT($('#main-nav [href="#agm-section"]')[0]); 641 } else { 642 var agm_list = $(_.template($('#AGMTpl').html())(_data)); 643 var _AGM_CONTAINER = EMPTY_NODE($(".js-agm-container")[0]); 644 $(".js-agm-container").append(agm_list); 645 } 646 647 if (!!callback) { 648 callback(); 649 } 650 } 651 652
653 654 // Below should run in investor page only 655 if (!!($("#stock-data-section")[0])) { 656 657 // Anchors navigation handle 658 if (!isMobile) { 659 // debugger; 660 var _menu_investor = $("#menu-investor")[0]; 661 _menu_investor.classList.remove('collapse'); 662 var _menu_height = _menu_investor.clientHeight > 0 ? _menu_investor.clientHeight : 50; 663 664 $('.navigation__link').bind('click', function(e) { 665 e.preventDefault(); // prevent hard jump, the default behavior 666 var target = $(this).attr("href"); // Set the target as variable 667 // perform animated scrolling by getting top-position of target-element and set it as scroll target 668 $('html, body').stop().animate({ 669 scrollTop: $(target).offset().top - _menu_height 670 }, 600, function() { 671 location.hash = target; //attach the hash (#jumptarget) to the pageurl 672 }); 673 return false; 674 }); 675 676 $(window).scroll(function() { 677 var scrollDistance = $(window).scrollTop() + _menu_height + 5; 678 $('.av-section-anchor').each(function(i) { 679 if ($(this).position().top <= scrollDistance) { 680 $('#main-nav.navigation a.selected').removeClass('selected'); 681 $('#main-nav.navigation a').eq(i).addClass('selected'); 682 } 683 }); 684 }).scroll(); 685 } else { 686 var x, i, j, selElmnt, a, b, c; 687 /* Look for any elements with the class "custom-select": */ 688 x = document.getElementsByClassName("custom-anchor-select"); 689 for (i = 0; i < x.length; i++) { 690 selElmnt = x[i].getElementsByTagName("select")[0]; 691 /* For each element, create a new DIV that will act as the selected item: */ 692 a = document.createElement("DIV"); 693 a.setAttribute("class", "select-selected"); 694 a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML; 695 x[i].appendChild(a); 696 /* For each element, create a new DIV that will contain the option list: */ 697 b = document.createElement("DIV"); 698 b.setAttribute("class", "select-items select-hide"); 699 for (j = 1; j < selElmnt.length; j++) { 700 /* For each option in the original select element, 701 create a new DIV that will act as an option item: */ 702 c = document.createElement("DIV"); 703 c.innerHTML = selElmnt.options[j].innerHTML; 704 c.setAttribute("value", selElmnt.options[j].getAttribute("value")); 705 c.addEventListener("click", function(e) { 706 /* When an item is clicked, update the original select box, 707 and the selected item: */ 708 var y, i, k, s, h; 709 s = this.parentNode.parentNode.getElementsByTagName("select")[0]; 710 h = this.parentNode.previousSibling; 711 for (i = 0; i < s.length; i++) { 712 if (s.options[i].innerHTML == this.innerHTML) { 713 s.selectedIndex = i; 714 h.innerHTML = this.innerHTML; 715 h.setAttribute("value", this.getAttribute("value")); 716 y = this.parentNode.getElementsByClassName("same-as-selected"); 717 for (k = 0; k < y.length; k++) { 718 y[k].removeAttribute("class"); 719 } 720 this.setAttribute("class", "same-as-selected"); 721 break; 722 } 723 } 724 h.click(); 725 }); 726 b.appendChild(c); 727 } 728 x[i].appendChild(b); 729 a.addEventListener("click", function(e) { 730 /* When the select box is clicked, close any other select boxes, 731 and open/close the current select box: */ 732 e.stopPropagation(); 733 closeAllSelect(this); 734 var isOpened = true; 735 if (this.nextSibling.classList.contains('select-hide')) { 736 isOpened = false;
737 } 738 this.nextSibling.classList.toggle("select-hide"); 739 this.classList.toggle("select-arrow-active"); 740 var target = $(this).attr("value"); // Set the target as variable 741 if (!!target && isOpened) 742 { 743 // perform animated scrolling by getting top-position of target-element and set it as scroll target 744 $('html, body').stop().animate({ 745 scrollTop: $(target).offset().top 746 }, 600, function() { 747 location.hash = target; //attach the hash (#jumptarget) to the pageurl 748 }); 749 } 750 }); 751 } 752 753 function closeAllSelect(elmnt) { 754 /* A function that will close all select boxes in the document, 755 except the current select box: */ 756 var x, y, i, arrNo = []; 757 x = document.getElementsByClassName("select-items"); 758 y = document.getElementsByClassName("select-selected"); 759 for (i = 0; i < y.length; i++) { 760 if (elmnt == y[i]) { 761 arrNo.push(i) 762 } else { 763 y[i].classList.remove("select-arrow-active"); 764 } 765 } 766 for (i = 0; i < x.length; i++) { 767 if (arrNo.indexOf(i)) { 768 x[i].classList.add("select-hide"); 769 } 770 } 771 } 772 773 /* If the user clicks anywhere outside the select box, 774 then close all select boxes: */ 775 document.addEventListener("click", closeAllSelect); 776 } 777 // startStockUpdate(); 778 startInvestorsDataUpdate(function() { 779 $(".js-view-all-pr-btn").click(function() { 780 $(".js-view-all-pr-btn").hide(); 781 $(".list-press-releases")[0].classList.remove('pr-hide-all'); 782 }); 783 784 $(".js-view-all-qtr-btn").click(function() { 785 $(".js-view-all-qtr-btn").hide(); 786 $(".list-quarter-results")[0].classList.remove('qtr-hide-all'); 787 }) 788 }); 789 } 790 791 792 // $(document).scroll(function() { 793 // checkOffset(); 794 // }); 795 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.