/** * Globale setting */ (async function () { window.knoseSetting = {}; let domain = window.location.origin; let options = { method: 'GET', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, }; const isLocal = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.0/8 are considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); const isTest = isLocal || domain === 'https://quick-quote-staging.knose.com.au' || domain === 'https://quick-quote-qa.knose.com.au' ? true : false; let wait_url = domain + '/' + (isLocal ? 'wait-dev.json' : 'wait.json'); let version_url = isTest ? 'https://uat.knose.com.au/OrigamiKnose/web/version' : 'https://portal.knose.com.au/OrigamiKnose/web/version'; knoseSetting.isTest = isTest; knoseSetting.isLocal = isLocal; try { let response = await fetch(wait_url, options); let data = await response.json(); knoseSetting = {...knoseSetting,...data}; } catch( error ) { console.log(error) } })(); function reloadQuoteSidebar() { var width = $( window ).width(); var height = $( window ).height(); var hContent = $( 'html' ).height(); if(width > 1444) { let extra = (width - 1444) / 2; let right = extra + 'px'; let bottom = (height - hContent + 60) + 'px'; if(height < hContent) { bottom = '60px'; } $('#wrapper').css('background-position', 'right ' + right + ' bottom ' + bottom); } else { $('#wrapper').removeAttr('style'); } } function reloadStickyLine() { var width = $( 'header' ).width(); var wSticky = $( '.sticky' ).width(); $('.sticky-line').css('width', width + 'px'); $('.sticky-line').css('left', '-' + ((width - wSticky)/2).toFixed(2) + 'px'); } $(document).ready(function() { // reloadQuoteSidebar(); $(window).resize(function() { reloadStickyLine(); }); $(document).on('click', '.tooltip-close', function() { $('[data-toggle="popover"]').popover('hide'); }); }); function loadTooltip() { var isMobile = ('ontouchstart' in document.documentElement && navigator.userAgent.match(/Mobi/)); $('[data-toggle="popover"]').popover({ // trigger: isMobile ? 'click' : 'hover', trigger: 'click', placement: 'left', html: true, template: '