"use strict"; var currencyMap = [{ name: "usd", value: "$" }, { name: "euro", value: "€" }, { name: "gbp", value: "₤" }, { name: "yen", value: "¥" }]; var loader = '
'; var $marketSlider = void 0; // $(window).on('load', function () { // $('#pageLoader').fadeOut(); // }) var companyAutoCompleteData = void 0; var applyCompanyAutoCompleteFilter = void 0; var tabLegend = new Map([['equities', 'equity'], ['sme', 'sme'], ['debt', 'bonds'], ['mf', 'Mutual Funds']]); var EnDLegends = new Map([['FUTCUR', 'Currency Futures'], ['OPTCUR', 'Currency Options'], ['FUTSTK', 'Stock Futures'], ['OPTSTK', 'Stock Options'], ['FUTIDX', 'Index Futures'], ['OPTIDX', 'Index Options'], ['FUTIRC', 'Interest Rate Futures'], ['FUTIRT', 'Govt. Sec. Futures'], ['FUTBLN', 'Bullion Futures'], ['FUTENR', 'Energy Futures'], ['CE', 'Call'], ['PE', 'Put'], ['FF', 'FF'], ['XX', '-']]); var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var companyFilter = false; var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '`': '`', '=': '=' }; var QLCorpCom = []; var quickBtn = false; var autoPlayMarket = void 0, QLCorpTable = void 0, tabIndex = void 0, autoUpdateMarket = void 0; var equityKey = 'equity', derivativeKey = 'derivatives', slbKey = 'slb', bondsKey = 'bonds'; var activeTabNo = 0; var activeTabVal = void 0; var ua = window.navigator.userAgent; var lastScrollAt = Date.now(), timeout = void 0; var errSnackbarTimeout; function escapeHtml(string) { return String(string).replace(/[&<>"'`=\/]/g, function fromEntityMap(s) { return entityMap[s]; }); } $(function () { //customDropdown(); tableHeaderFix(); /* Select overlapping issue fix */ $('#main_navbar li').hover(function () { $('select').blur(); }); /* Select overlapping issue fix End */ /* Market Status Hover Stop Animation */ /*$('#nseMarketStatus').hover(function(){ clearTimeout(autoPlayMarket); }, function(){ autoplayMarketStatus(); })*/ /* End */ /* collapse banner */ var nav = $("#main_slider"), animateTime = 500, navLink = $('.collpase_btn a'); navLink.click(function (e) { $(this).parent().toggleClass('link_collapsed'); $("#main_slider").toggleClass("bnr_height"); if (nav.height() === 200) { autoHeightAnimate(nav, animateTime); } else { nav.stop().animate({ height: '200' }, animateTime); } e.preventDefault(); }).click(); /* Function to animate height: auto */ function autoHeightAnimate(element, time) { var curHeight = element.height(), autoHeight = element.css('height', 'auto').height(); element.height(curHeight); element.stop().animate({ height: autoHeight }, time); } /* @end collapse banner */ /* fixed header */ function re_head_height() { var header_height = $('header').height(); $('body').css('padding-top', header_height); } re_head_height(); $(window).resize(function () { re_head_height(); }); /* end fixed header */ $('.subscribe_toggle').on(' click', function () { $('.subscribe_toggle .card-body').toggleClass('open'); }); $('.subscribe_toggle').on('mouseleave', function () { $('.subscribe_toggle .card-body').removeClass('open'); }); /* collapsible search */ var submitIcon = $('.searchbox-icon'); var inputBox = $('.searchbox-input'); var searchBox = $('.expnd_searchbox'); var isOpen = false; submitIcon.click(function () { if (isOpen == false) { searchBox.addClass('searchbox-open'); inputBox.focus(); isOpen = true; } else { searchBox.removeClass('searchbox-open'); inputBox.focusout(); isOpen = false; } }); submitIcon.mouseup(function () { return false; }); searchBox.mouseup(function () { return false; }); $(document).mouseup(function () { if (isOpen == true) { $('.searchbox-icon').css('display', 'block'); submitIcon.click(); } }); /* footer accordion */ $(".nav-folderized .foot-nav h6").click(function () { $(".nav-folderized .foot-nav").removeClass('open'); $(this).parent(".foot-nav").toggleClass("open"); }); /* dropdown menu */ $('.navbar-header').mouseenter(function () { if ($(this).is(":visible")) { $(this).prev('.navbar-nav li ').addClass('active'); } }).mouseleave(function () { if ($(this).is(":visible")) { $(this).prev('.navbar-nav li').removeClass('active'); } }); $('.navbar-nav li').on('click', function (e) { if (Modernizr.mq('screen and (max-width:767px)')) { //e.preventDefault(); $(this).parent().find('..navbar-inverse').slideToggle(); } }); $('.setting_btn').click(function (e) { //alert(''); e.preventDefault(); $('.setting_wrap').toggleClass('active'); }); /* Company AutoComplete */ var CFCompany = function CFCompany() { var uri = '/api/search/autocomplete?q=%QUERY'; if (typeof symbol_type !== "undefined") { uri += "&symbol_type=" + symbol_type; } return new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url: uri, wildcard: '%QUERY', replace: function replace(url, uriEncodedQuery) { url = url.replace('%QUERY', uriEncodedQuery); var activeTab = $('#Company_Directory').find('.nav-link.active').data('tab'); return activeTab ? url + "&symbol_type=" + (tabLegend.get(activeTab) || 'equity') : url; }, filter: function filter(response) { return [].concat(response.symbols, response.mfsymbols); } } }); }; applyCompanyAutoCompleteFilter = function applyCompanyAutoCompleteFilter(fieldId) { $("" + (fieldId ? fieldId : '.companyAutoComplete')).typeahead(null, { name: 'Company', display: 'symbol_info', source: CFCompany(), templates: { empty: function empty(data) { return "
\n

\n No record found\n

\n
"; }, suggestion: function suggestion(data) { return "
\n

\n " + data.symbol_info + "\n " + data.symbol + "\n

\n
"; } } }).bind("typeahead:selected", function (obj, datum, name) { $(this).data("value", datum.symbol); $(this).data("type", datum.result_sub_type); companyAutoCompleteData = $(this); if (companyFilter) { var filters = getFilterValues($(this)); filterlogic(filters); } }); }; applyCompanyAutoCompleteFilter(); /* Company AutoComplete end */ QLCorpCom = []; $('.QLAutocomplete').typeahead(null, { name: 'Company', display: 'symbol_info', source: CFCompany(), templates: { empty: function empty(data) { return "
\n

\n No record found\n

\n
"; }, suggestion: function suggestion(data) { return "
\n

\n " + data.symbol_info + "\n " + data.symbol + "\n

\n
"; } } }).bind("typeahead:selected", function (obj, datum, name) { if (QLCorpCom.length >= 5) { alert("You can only select 5 Companies"); } else if (QLCorpCom.includes(datum.symbol)) { alert("Company is already selected"); } else { QLCorpCom.push(datum.symbol); } genComList(QLCorpCom); $('.QLAutocomplete').typeahead('val', ''); }); /* LHS Menu / Tabs */ $('.nav-tabs.nav-item a').click(function () { $('.vert_subtabs a').removeClass('sel'); if ($(this).parent().hasClass('vert_subtabs')) { $(this).parent().find('a:first-child').addClass('sel'); } }); /* End */ /* Quick Links */ $('#quickLinkBtn').click(function () { try { quickBtn = false; $('#quickLinkBtn').fadeOut(); $('.footer_strip').animate({ width: "toggle" }); } catch (e) { console.log("quickLinkBtn Error", e.message); } }); $('.footer-tabs li:first-child').click(function () { try { quickBtn = true; $('#quickLinkBtn').fadeIn(); $('.footer_strip').animate({ width: "toggle" }); } catch (e) { console.log("quickLinkBtn Error", e.message); } }); /* End */ /* Modal Popup Close */ $('.modal-backdrop').click(function () { $('.qlinks_modal .close').trigger('click'); }); $(document).keyup(function (e) { if (e.key === "Escape") { // escape key maps to keycode `27` $('.qlinks_modal .close').trigger('click'); } }); /* End */ /*$( document ).ajaxStop(function() { $('#pageLoader').hide(); alert("ajaxStop page Loaded"); }); $( document ).ajaxComplete(function() { alert("ajaxComplete page Loaded"); }); $( document ).ajaxSuccess(function() { alert("ajaxSuccess page Loaded"); });*/ }); /* end collapsible search */ function tableHeaderFix() { /* Table first column freeze */ // table-wrap - scrollWrap $('.scrollWrap').scroll(function (e) { //detect a scroll event on the tbody try { var _this = $(this); var _scrollTop = _this.scrollTop(); if (isIE(ua)) { lastScrollAt = Date.now(); clearTimeout(timeout); _this.find('.tableScroll > thead').css("opacity", 0); timeout = setTimeout(function () { if (Date.now() - lastScrollAt > 99) _this.find('.tableScroll > thead').css("opacity", 1); }, 150); } _this.find('.tableScroll > thead').css("top", _scrollTop - 1); //fix thead of the table _this.find('.tableScroll .freezed-row').css("top", _scrollTop - 1); //fix thead of the table if ($(window).width() > 767) { //$('#equityStockTable thead').css("left", -$(".table-wrap").scrollLeft()); //fix the thead relative to the body scrolling _this.find('.tableScroll > thead th:nth-child(1)').css("left", _this.scrollLeft() - 1); //fix the first cell of the header _this.find('.tableScroll > tbody td:nth-child(1)').css("left", _this.scrollLeft() - 1); //fix the first column of tdbody } else { $('.tableScroll > thead th:nth-child(1)').css("left", 0); //fix the first cell of the header $('.tableScroll > tbody td:nth-child(1)').css("left", 0); //fix the first column of tdbody } } catch (e) { console.log("tableScroll Scroll", e.message); } }); /* Table first column freeze end */ } function isIE(userAgent) { userAgent = userAgent || navigator.userAgent; return userAgent.indexOf("MSIE ") > -1 || userAgent.indexOf("Trident/") > -1 || userAgent.indexOf("Edge/") > -1; } /* footer strip show hide on scroll */ //$(".footer_strip").hide(); $(window).scroll(function () { if ($(window).scrollTop() > 100) { quickBtn ? $("#quickLinkBtn").slideDown("slow") : $(".footer_strip").slideDown("slow"); $('#betaVerBand').slideUp('fast'); $('body').removeClass('showBand'); } else { quickBtn ? $("#quickLinkBtn").slideUp("fast") : $(".footer_strip").slideUp("fast"); $('#betaVerBand').slideDown('fast'); $('body').addClass('showBand'); } if ($('.optionChainTable:visible').length > 0) { OCHeaderFix($(window).scrollTop()); } }); /* end footer strip show hide */ // Tab Active Center - start $(function () { /* For Beta to old website navigation Band */ $('body').addClass('showBand'); /* To remove kindly search all 'showBand' class and remove */ /* End */ //if($('.live_mkt_watch .common-tabs .subtabs .nav-tabs .nav-link.active').length){ if ($('.common-tabs .nav-tabs .tab-content .hometabs li.responsive tab .nav-link.active').length) { var left = $('.hometabs .active').offset().left; var width = $('.nav-tabs').width(); var diff = left - width / 2 + 50; $('.nav-tabs').scrollLeft($('.nav-tabs').scrollLeft() + diff); }; /* tip off page */ $('#tipoff_detail').change(function () { if ($(this).val() == 'Yes') { $('.details_div').slideDown(); } else { $('.details_div').slideUp(); } }); /* end tip off page */ }); $(function () { if ($('.live_mkt_watch .common-tabs .tab-menu .nav-link a.active').length) { var left = $('.hometabs li a.active').offset().left; //console.log(left); var width = $('.tab-content ').width(); //console.log(width); var diff = left - width / 2 + 100; //console.log(diff); $('.tab-content').scrollLeft($('.tab-content').scrollLeft() + diff); } }); // Tab Active Center - End /* start dropdown menu */ function toggleNavbarMethod() { if ($(window).width() > 768) { $('.navbar .navbar-header').on('mouseover', function () { $('.navbar li', this).trigger('click'); }).on('mouseout', function () { $('.navbar-header', this).trigger('click').blur(); }); } else { $('.navbar .navbar-header').off('mouseover').off('mouseout'); } } toggleNavbarMethod(); $(window).resize(toggleNavbarMethod); /* end dropdown menu */ /* quick links */ $(function () { $('.footer_strip ul li a').click(function () { if (!$(this).hasClass('oldSite')) { $('.footer_strip ul li a').removeClass('active'); $(this).addClass('active'); $('body').addClass('qlinks-modalopen'); } }); ////////// added on feb 8 2019 ///////////////////// $('.link_investors').on('click', function () { $('.modal').modal('hide'); $('#qlink_investors').modal('show'); $('body').addClass('qlinks-modalopen'); }); $('.link_corporates').on('click', function () { $('.modal').modal('hide'); $('#qlink_corporates').modal('show'); $('body').addClass('qlinks-modalopen'); }); $('.link_members').on('click', function () { $('.modal').modal('hide'); $('#qlink_members').modal('show'); $('body').addClass('qlinks-modalopen'); }); $("#qlink_investors").on("hide.bs.modal", function () { $('.footer_strip ul li a.link_investors').removeClass('active'); }); $("#qlink_corporates").on("hide.bs.modal", function () { $('.footer_strip ul li a.link_corporates').removeClass('active'); }); $("#qlink_members").on("hide.bs.modal", function () { $('.footer_strip ul li a.link_members').removeClass('active'); }); $('.footer_strip ul li:first-child a').off('click').removeClass('active'); ////////// end added on feb 8 2019 ///////////////////// }); /* end quick links */ /* chart javascript */ function generateChart(api, id) { try { var preOpenDate = new Date(); var norMarDate = new Date(); preOpenDate = preOpenDate.setHours(8, 30, 0, 0); norMarDate = norMarDate.setHours(10, 30, 0, 0); $.getJSON(api, function (data) { // Create the chart if (data) { $.getJSON(api + '&preopen=true', function (preOpenData) { if (preOpenData) { Highcharts.stockChart(id, { rangeSelector: { enabled: false, selected: 1, inputEnabled: false }, credits: { enabled: false }, title: false, navigator: { enabled: false }, scrollbar: { enabled: false }, xAxis: { type: 'datetime' }, yAxis: { gridLineWidth: 0, minorGridLineWidth: 0, opposite: false, plotLines: [{ color: '#333', width: 1, value: data.closePrice }] }, exporting: { enabled: false }, series: [{ name: preOpenData.identifier || "", data: preOpenData.grapthData || [], type: 'area', //softThreshold:false, //threshold: 'closePrice', threshold: null, tooltip: { valueDecimals: 2 }, /*zones: [{ value: data.closePrice, color: 'red' }, { color: 'green' }],*/ zones: [{ value: preOpenDate, color: 'orange', fillColor: { linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 }, stops: [[0, '#FFDCAB'], // start [1, '#fff'] // end ] } }, { value: norMarDate, color: '#FEAB25', fillColor: { linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 }, stops: [[0, '#FFDCAB'], // start [1, '#fff'] // end ] } }, { color: 'green', fillColor: { linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 }, stops: [[0, '#3e85c5'], // start [1, 'rgba(11, 232, 250, 0)'] // end ] } }], plotOptions: { series: { color: '#3e85c5', lineWidth: 1 } }, fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [[0, '#3e85c5'], [1, 'rgba(11, 232, 250, 0)']] } }, { name: data.identifier || "", data: data.grapthData || [], type: 'area', //softThreshold:false, //threshold: 'closePrice', threshold: null, tooltip: { valueDecimals: 2 }, zones: [{ value: data.closePrice, color: 'red' }, { color: 'green' }], plotOptions: { series: { color: '#3e85c5', lineWidth: 1 } }, fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [[0, '#3e85c5'], [1, 'rgba(11, 232, 250, 0)']] } }] }); } }); } }); } catch (error) { console.log("generateChart", error.message); } } $(function () { if ($("#container").length > 0) {} if ($('input[type="range"]').length) { initRangeSlider('input[type="range"]'); } }); function initRangeSlider(elem) { var DefaultVal = $('.rangeslider .rangeslider__handle').css('left'); $(elem).rangeslider({ polyfill: false, rangeClass: 'rangeslider', disabledClass: 'rangeslider--disabled', horizontalClass: 'rangeslider--horizontal', fillClass: 'rangeslider__fill', handleClass: 'rangeslider__handle', startEvent: ["mousemove", "touchstart", "pointerdown"], moveEvent: [], endEvent: ["mouseleave", "touchend", "pointerup"], onInit: function onInit() { var $rangeEl = this.$range; // add value label to handle var $handle = $rangeEl.find('.rangeslider__handle'); var handleValue = '
' + DecimalFixed(this.value) + '
'; var fixPoint = '
|
'; $rangeEl.append(fixPoint); $rangeEl.append(handleValue); var leftCss = parseInt($rangeEl.find('.rangeslider__handle').css("left")) - $('.rangeslider__handle__value').outerWidth() / 2; $rangeEl.find('.rangeslider__handle__value').css('left', leftCss); $rangeEl.find('.rangeslider_fix').css({ position: 'absolute', left: $rangeEl.find('.rangeslider__handle').css("left"), display: 'none' }); var rangeLabels = this.$element.attr('labels'); if (typeof rangeLabels !== 'undefined') { rangeLabels = rangeLabels.split(', '); $rangeEl.append('
'); $(rangeLabels).each(function (index, value) { $rangeEl.find('.rangeslider__labels').append('' + value + ''); }); } //Disable range $rangeEl.addClass('rangeslider--disabled'); }, onSlide: function onSlide(position, value) { $rangeEl = this.$range; var $handle = this.$range.find('.rangeslider__handle__value'); $handle.text(DecimalFixed(this.value)); $rangeEl.find('.rangeslider_fix').show(); $rangeEl.find('.rangeslider__handle').css({ left: position, opacity: 0 }); var labelWidth = $rangeEl.find('.rangeslider__handle__value').outerWidth() / 2; $rangeEl.find('.rangeslider__handle__value').css('left', position - labelWidth); }, onSlideEnd: function onSlideEnd(position, value) {} }); } /* end chart */ /* function customDropdown() { /!* custom select *!/ $('.related-select select, .bulk-select select').each(function each() { if ($(this).parents('.select').length === 0) { var $this = $(this); var numberOfOptions = $(this).children('option').length; $this.addClass('select-hidden'); $this.wrap('
'); $this.after('
Select Index
'); var $styledSelect = $this.next('div.select-styled'); //$styledSelect.text($this.children('option').eq(0).text()); var $list = $('