//last updated for 2021/22 model -- June 30, 2021 -- Nirav var vehicleFeaturesSpecs = /** @class */ (function () { function vehicleFeaturesSpecs() { this.selectedCodes = []; //Select trims to compare -- NO restriction on how many trim needs to be compared... always decided by UI this.selectedTrimNames = []; //Populate trim names for selected trims this.vehicleFeaturesDataSource = {}; //Store Source data for features -- Same model - all trims one time call this.vehicleSpecsDataSource = {}; //Store Source data for Specifications this.vehicleCompareFeaturesDataSource = {}; // Cross vehicle trim compare data - Features this.vehicleCompareSpecsDataSource = {}; //Cross vehicle trim compare data - Specs this.selectedFeatures = []; this.language = "en"; this.languageIntCode = 0; this.myModelName = ''; //End of function } vehicleFeaturesSpecs.prototype.vehicleFeaturesSpecs = function () { }; vehicleFeaturesSpecs.prototype.loadData = function (modelId, userTrimCodes, userLanguage, modelName) { var _this = this; if (modelName === void 0) { modelName = ''; } // console.log('Inside constructor'); this.mid = modelId; this.language = userLanguage; this.myModelName = modelName.trim().toLowerCase(); this.languageIntCode = this.language.trim() == "en" ? 0 : 1; userTrimCodes.forEach(function (trimCode) { _this.selectedCodes.push(trimCode); }); this.loadInitialVehicleData(this.languageIntCode); }; vehicleFeaturesSpecs.prototype.loadInitialVehicleData = function (language) { //For same model different trims -- Add authentication piece once API is changed from local UAT to staging UAT //console.log('Inside load data'); //Model id and language required for API call var hostname = location.host; var _APIURL = (location.host.toLowerCase().trim() == "kia.ca" || location.host.toLowerCase().trim() == "www.kia.ca") ? "https://api.kia.ca/" : "https://api-uat.kia.ca/"; var settingsFeatures = { "async": true, "crossDomain": true, "url": _APIURL + "api/get_model_features/" + this.mid + "/" + language, "headers": { 'KCI-ApiKey': 'Ab2s3rEAs4!' }, "method": "GET" }; var settingsSpecs = { "async": true, "crossDomain": true, "url": _APIURL + "api/get_model_specs/" + this.mid + "/" + language, "headers": { 'KCI-ApiKey': 'Ab2s3rEAs4!' }, "method": "GET" }; // console.log("calling"); var that = this; //Use for compare between trims in same model $.ajax(settingsFeatures).done(function (response) { //console.log(response); that.vehicleFeaturesDataSource = response; getVehicleFeatures(that.vehicleFeaturesDataSource, that.languageIntCode, that.selectedCodes, that.myModelName); }); $.ajax(settingsSpecs).done(function (response) { //console.log(response); that.vehicleSpecsDataSource = response; getVehicleSpecs(that.vehicleSpecsDataSource, that.languageIntCode, that.selectedCodes, that.myModelName); }); }; return vehicleFeaturesSpecs; }()); function getVehicleSpecs(vehicleSpecsDataSource, lang, selectedCodes, modelName) { if (vehicleSpecsDataSource) { var winWidth = $(window).width(); $(window).resize(function () { winWidth = $(window).width(); }); var isBattery = false; var tmpMechanicalString = ""; var tmpFuelString = ""; var tmpBatteryString = ""; var vdata = JSON.parse(JSON.stringify(vehicleSpecsDataSource)); //$("#divModelId").html(vdata.modelId); //console.log('showing what we got in vdata'); // console.log(vdata); vdata.specTypeDetail.forEach(function (obj) { var fstring = ""; fstring += ""; selectedCodes.forEach(function (vcodeObj) { vdata.trimDetail.filter(function (obj) { return (vcodeObj == obj.vehicleCode); }).forEach(function (obj) { fstring += ""; }); }); fstring += ""; var tmpTypeId = obj.id; //Spec type e.g. Mechanical/Body/Brakes etc. //Particular spec type var typeSpecs = vdata.specs.filter(function (obj) { return obj.specTypeId == tmpTypeId; }); //8-Fuel economy , 2 -- Battery if (tmpTypeId == 2) { isBattery = true; fstring = ""; } if (tmpTypeId == 8) fstring = ""; //-- Uncomment below line when colspan is back if (winWidth < 560) { typeSpecs.forEach(function (obj) { //console.log(obj.legalNotes); fstring += ""; selectedCodes.forEach(function (vcodeObj) { //console.log(vcodeObj + "-- "); obj.trimSpecs.filter(function (trimObj) { return (vcodeObj == trimObj.vehicleCode); }).forEach(function (trimObj) { //console.log(trimObj.isFeaturePresent); //console.log(trimObj.vehicleCode + "-- " + trimObj.isFeaturePresent ); vdata.trimDetail.filter(function (tmpTrimNameObj) { return (trimObj.vehicleCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); }); }); fstring += ""; }); } else { typeSpecs.forEach(function (obj) { //console.log(obj.legalNotes); fstring += ""; var totalTrimInspected = 0; var cspan = 0; var coldTrimCode = ""; var ctrimDesc = ""; selectedCodes.forEach(function (vcodeObj) { //console.log(vcodeObj + "-- "); obj.trimSpecs.filter(function (trimObj) { return (vcodeObj == trimObj.vehicleCode); }).forEach(function (trimObj) { if (totalTrimInspected == 0 || cspan == 0) { totalTrimInspected++; cspan++; coldTrimCode = trimObj.vehicleCode; ctrimDesc = trimObj.specDescription.trim(); } else { totalTrimInspected++; //Start comparing and advancing if (trimObj.specDescription.trim() == ctrimDesc && totalTrimInspected < selectedCodes.length) { cspan++; } else if (trimObj.specDescription.trim() == ctrimDesc && totalTrimInspected == selectedCodes.length) { cspan++; vdata.trimDetail.filter(function (tmpTrimNameObj) { return (trimObj.vehicleCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); } else if (trimObj.specDescription.trim() != ctrimDesc && totalTrimInspected == selectedCodes.length) { //put old and new -- last one vdata.trimDetail.filter(function (tmpTrimNameObj) { return (coldTrimCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); vdata.trimDetail.filter(function (tmpTrimNameObj) { return (trimObj.vehicleCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); } else if (trimObj.specDescription.trim() != ctrimDesc && totalTrimInspected < selectedCodes.length) { //First match which is not matching -- Put old code and save current vdata.trimDetail.filter(function (tmpTrimNameObj) { return (coldTrimCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); cspan = 1; coldTrimCode = trimObj.vehicleCode; ctrimDesc = trimObj.specDescription.trim(); } } }); }); fstring += ""; }); } if (isBattery) { if (tmpTypeId != 1 && tmpTypeId != 8 && tmpTypeId != 2) fstring += ""; } else { if (tmpTypeId != 1 && tmpTypeId != 8) fstring += ""; } if (tmpTypeId == 1) { // $("#tblPowertrain").html(fstring); tmpMechanicalString = fstring; if (isBattery == false) { if (tmpFuelString != "") { tmpMechanicalString += tmpFuelString; tmpMechanicalString += ""; $("#tblPowertrain").html(tmpMechanicalString); } } else { if (tmpFuelString != "" && tmpBatteryString != "") { tmpMechanicalString += tmpBatteryString; tmpMechanicalString += tmpFuelString; tmpMechanicalString += ""; tmpMechanicalString += ""; tmpMechanicalString += ""; $("#tblPowertrain").html(tmpMechanicalString); } } } if (tmpTypeId == 2) { //add legal to footnote tmpBatteryString = fstring; if (tmpMechanicalString != "" && tmpFuelString != "") { tmpMechanicalString += tmpBatteryString; tmpMechanicalString += tmpFuelString; tmpMechanicalString += ""; tmpMechanicalString += ""; tmpMechanicalString += ""; $("#tblPowertrain").html(tmpMechanicalString); } } if (tmpTypeId == 3) $("#tblBodyChasis").html(fstring); if (tmpTypeId == 4) $("#tblBrakes").html(fstring); if (tmpTypeId == 5) { if (modelName == "sorento" || modelName == "sportage" || modelName == "sedona") { fstring += ""; } $("#tblWeight").html(fstring); } if (tmpTypeId == 6) $("#tblCapacities").html(fstring); if (tmpTypeId == 7) $("#tblDimensions").html(fstring); if (tmpTypeId == 8) { // $("#tblFuel").html(fstring); tmpFuelString = fstring; if (isBattery == false) { if (tmpMechanicalString != "") { tmpMechanicalString += tmpFuelString; tmpMechanicalString += ""; $("#tblPowertrain").html(tmpMechanicalString); } } else { if (tmpMechanicalString != "" && tmpBatteryString != "") { tmpMechanicalString += tmpBatteryString; tmpMechanicalString += tmpFuelString; tmpMechanicalString += ""; tmpMechanicalString += ""; tmpMechanicalString += ""; $("#tblPowertrain").html(tmpMechanicalString); } } } }); } } //End of function function getVehicleFeatures(vehicleFeaturesDataSource, lang, selectedCodes, modelName) { if (vehicleFeaturesDataSource) { //var filteredFeatures = vehicleFeaturesDataSource.features.filter(obj => { // return (this.selectedFeatures.indexOf(obj.modelFeatureId) > -1); //}); //console.log("Filtered Features down"); //console.log(filteredFeatures); var vdata = JSON.parse(JSON.stringify(vehicleFeaturesDataSource)); vdata.featureTypeDetail.forEach(function (obj) { //fstring += ""; var fstring = ""; fstring += "
  "; obj.trimName.split(" ").forEach(function (tmpTxt) { fstring += "" + tmpTxt + ""; }); fstring += "
" + obj.specName.trim() + "" + trimObj.specDescription.trim() + "
" + obj.specName.trim() + "" + trimObj.specDescription.trim() + "" + ctrimDesc + "" + trimObj.specDescription.trim() + "" + ctrimDesc + "
" + (lang == 0 ? "Estimates are based on Government of Canada approved criteria and testing methods. Actual range and mileage will vary with options, driving conditions, driving habits, and your vehicle’s condition." : "Estimations établies selon des méthodes d'essai et des critères approuvés par le gouvernement du Canada. L’autonomie et la consommation réelles peuvent varier en fonction des options, des conditions de conduite, des habitudes de conduite et de l’état de votre véhicule.") + "
" + (lang == 0 ? "Recharge times are based on a 0% state of charge (SOC)." : "La durée du chargement est calculée en partant de l’idée que la batterie est à 0 %.") + "
" + (lang == 0 ? "Estimates are based on Government of Canada approved criteria and testing methods. Actual range and mileage will vary with options, driving conditions, driving habits, and your vehicle’s condition." : "Estimations établies selon des méthodes d'essai et des critères approuvés par le gouvernement du Canada. L’autonomie et la consommation réelles peuvent varier en fonction des options, des conditions de conduite, des habitudes de conduite et de l’état de votre véhicule.") + "
" + (lang == 0 ? "Recharge times are based on a 0% state of charge (SOC)." : "La durée du chargement est calculée en partant de l’idée que la batterie est à 0 %.") + "
" + (lang == 0 ? "When properly equipped. Do not exceed any weight ratings and follow all towing instructions in your Owner’s Manual." : "Lorsqu’équipé convenablement. Ne pas dépasser les charges et les poids indiqués et suivre toutes les instructions de remorquage consignées dans le Manuel du propriétaire du véhicule.") + "
" + (lang == 0 ? "Estimates are based on Government of Canada approved criteria and testing methods. Actual range and mileage will vary with options, driving conditions, driving habits, and your vehicle’s condition." : "Estimations établies selon des méthodes d'essai et des critères approuvés par le gouvernement du Canada. L’autonomie et la consommation réelles peuvent varier en fonction des options, des conditions de conduite, des habitudes de conduite et de l’état de votre véhicule.") + "
" + (lang == 0 ? "Recharge times are based on a 0% state of charge (SOC)." : "La durée du chargement est calculée en partant de l’idée que la batterie est à 0 %.") + "

" + obj.featureTypeName + "

"; //console.log(selectedCodes.length + "Length"); selectedCodes.forEach(function (vcodeObj) { vdata.trimDetail.filter(function (obj) { return (vcodeObj == obj.vehicleCode); }).forEach(function (obj) { fstring += ""; }); }); fstring += ""; var tmpType = obj.type; //console.log(tmpType); var typeFeatures = vdata.features.filter(function (obj) { return obj.featureType == tmpType; }); //console.log(typeFeatures); typeFeatures.forEach(function (obj) { //console.log(obj.legalNotes); fstring += ""; selectedCodes.forEach(function (vcodeObj) { //console.log(vcodeObj + "-- "); obj.trimFeatures.filter(function (trimObj) { return (vcodeObj.trim() == trimObj.vehicleCode.trim()); }).forEach(function (trimObj) { //console.log(trimObj.isFeaturePresent); //console.log(trimObj.vehicleCode + "-- " + trimObj.isFeaturePresent ); vdata.trimDetail.filter(function (tmpTrimNameObj) { return (trimObj.vehicleCode == tmpTrimNameObj.vehicleCode); }).forEach(function (tmpFilteredTrimNameObj) { fstring += ""; }); }); }); fstring += ""; }); fstring += ""; fstring += ""; fstring += "
" + (lang == 0 ? "Feature Name" : "Caractéristique") + ""; obj.trimName.split(" ").forEach(function (tmpTxt) { fstring += "" + tmpTxt + ""; }); fstring += "
" + obj.name.trim() + "" + obj.legalNotes + "" + (trimObj.isFeaturePresent == true ? "checkmark" : "dash") + "
Checkmark icon = " + (lang == 0 ? "Standard" : "De série") + "Dash icon = " + (lang == 0 ? "Not available" : "Non disponible") + "
"; if (tmpType == 1) $("#tblExterior").html(fstring); if (tmpType == 3) $("#tblTechnology").html(fstring); if (tmpType == 2) $("#tblSafety").html(fstring); if (tmpType == 4) $("#tblComfort").html(fstring); }); //console.log('test'); var strLegals = ""; vdata.legals.forEach(function (obj) { //console.log(obj.legalDesc); strLegals += "
  • " + obj.legalDesc + "
  • "; }); $("#divLegalTexts").html(strLegals); //$("#divFeatures").html(fstring); //This should solve it var winWidth = $(window).width(); $(window).resize(function () { winWidth = $(window).width(); }); //June 29, 2021 -- Updating code from JS -- Ryan modified code -- Nirav //$('.rwd-table td.feature-name').click(function () { // if (winWidth < 560) { // $(this).parent().find('td:not(:nth-of-type(1))').toggleClass('visual'); // $(this).parent().find('td:not(:nth-of-type(1))').toggleClass('block'); // var parentHeight = $('.tabs-content li.selected').outerHeight(); // $('ul.tabs-content').animate({ // 'height': parentHeight // }, 200); // } //}); //Fix width of columns - Ryan addition if (winWidth > 767) { var tableChildren = $("#tblExterior .rwd-table thead tr").children().length; var cellWidth = 70 / (tableChildren - 1); $('.rwd-table td:not(:first), .rwd-table th:not(:first)').css('width', cellWidth + '%'); $('.rwd-table th:first-of-type').css('width', '30%'); } //New addition June 30, 2021 - Nirav if ($('#tblExterior').length) { var parentwidth = $("#tblExterior").width(); var el = $('#tblExterior'); var top = el.position().top + 116; var bottom = el.position().top + el.outerHeight(true) + 260; $(window).resize(function () { parentwidth = $(".rwd-table").width(); $(".rwd-table thead").attr('style', 'width: ' + parentwidth + 'px !important'); }); $(window).scroll(function () { var scroll = $(window).scrollTop(); if (scroll >= top && scroll <= bottom) { $("#features table thead").addClass("fixed").attr('style', 'width: ' + parentwidth + 'px !important'); } else { $("#features table thead").removeClass("fixed"); } }); $('#features nav li:nth-of-type(1) a').click(function () { el = $('#tblExterior'); bottom = el.position().top + el.outerHeight(true) + 170; }); $('#features nav li:nth-of-type(2) a').click(function () { el = $('#tblComfort'); bottom = el.position().top + el.outerHeight(true) + 170; }); $('#features nav li:nth-of-type(3) a').click(function () { el = $('#tblTechnology'); bottom = el.position().top + el.outerHeight(true) + 170; }); $('#features nav li:nth-of-type(4) a').click(function () { el = $('#tblSafety'); bottom = el.position().top + el.outerHeight(true) + 170; }); } } //end of if //Updating code to fix issue of trims and features not appearing in order. -- June 29, 2021 -- Nirav //Ryan addition - trim toggle var toggle = 0; function trimList() { $('.toggle-btn-wrapper ul li:nth-of-type(3) p').addClass('active'); $('.toggle-btn-wrapper ul li i').removeClass('fa-rotate-180'); var vdata = JSON.parse(JSON.stringify(vehicleFeaturesDataSource)); //Foreach trim we need to display all features selectedCodes.forEach(function (obj, aa) { var myTrimDetail = vdata.trimDetail.filter(function (tobj) { return (obj == tobj.vehicleCode); })[0]; console.log("Getting trim name", myTrimDetail); var newTable = "

    "; $('body').css('height', 'auto'); $(".features-toggle-wrapper").show(); $('#features, #specs, #measures').hide(); $(".features-toggle-wrapper .container").append(newTable); $('.features-toggle:nth-of-type(' + aa + ') h3').html(myTrimDetail.trimName); var trimName = myTrimDetail.vehicleCode.substr(0, 2) + "_" + myTrimDetail.vehicleCode.substr(3, 6); //var modelName = $('.page-nav-wrap').attr('id'); //old code from 2020 Not working anymore -- Nirav June 30, 2021 //$('.features-toggle:nth-of-type(' + aa + ') ul li:nth-of-type(1)').append("Kia " + modelName + ""); //if (myTrimDetail.vehicleCode == 'SK85CL') { // $('.features-toggle:nth-of-type(8) img').attr("src", "/pages/pricing/content/shoppingtools/buildandprice/Soul/shoppingtools-buildandprice-Soul-ClearWhiteandInfernoRed-SK_5CL.jpg"); //} //Adding new for 2021 model years -- Nirav var modelName = $('h1').attr('id'); var yearNum = $('h1').attr('class'); if (modelName == "rio5") { modelName = "rio5door"; } console.log(trimName); console.log(modelName); if (yearNum == 'glacial') { $('.features-toggle:nth-of-type(' + aa + ') ul li:nth-of-type(1)').append("Kia " + modelName + ""); } else { $('.features-toggle:nth-of-type(' + aa + ') ul li:nth-of-type(1)').append("Kia " + modelName + ""); } vdata.featureTypeDetail.forEach(function (ftype, findex) { vdata.features.filter(function (mfobj) { return mfobj.featureType == ftype.type; }).forEach(function (filteredFeatures) { var isFeaturePresent = filteredFeatures.trimFeatures.filter(function (isfobj) { return isfobj.vehicleCode == obj && isfobj.isFeaturePresent == true; }); console.log("Checking if feature is present for current trim", isFeaturePresent); if (isFeaturePresent.length > 0) { var featureName = "" + filteredFeatures.name + ""; $('.features-toggle:nth-of-type(' + aa + ') table tbody tr:nth-of-type(' + (findex + 1) + ')').append(featureName); } }); }); }); $('.features-toggle:not(:first) .trim-wrap').hide(); openClose(); $(".features-toggle:nth-of-type(1)").find('.fa').toggleClass('fa-minus-square fa-plus-square'); toggle = 1; } //Old code by Ryan&Vihang -- Not working as expected //function trimList() { // $('.toggle-btn-wrapper ul li:nth-of-type(3) p').addClass('active'); // $('.toggle-btn-wrapper ul li i').removeClass('fa-rotate-180'); // if (vehicleFeaturesDataSource) { // console.log(vehicleFeaturesDataSource); // var aa = 1; // var featuresArray = []; // var featuresExist = []; // selectedCodes.forEach(function (vcodeObj) { // vdata.trimDetail.filter(function (obj) { return (vcodeObj == obj.vehicleCode); }).forEach(function (obj) { // for (var a = 0; a < vehicleFeaturesDataSource.trimDetail.length; a++) { // if (vcodeObj == vehicleFeaturesDataSource.trimDetail[a].vehicleCode) { // var newTable = "

    "; // $('body').css('height', 'auto'); // $(".features-toggle-wrapper").show(); // $('#features, #specs, #measures').hide(); // $(".features-toggle-wrapper .container").append(newTable); // $('.features-toggle:nth-of-type(' + aa + ') h3').html(vehicleFeaturesDataSource.trimDetail[a].trimName); // var trimName = vehicleFeaturesDataSource.trimDetail[a].vehicleCode.substr(0, 2) + "_" + vehicleFeaturesDataSource.trimDetail[a].vehicleCode.substr(3, 6); // var modelName = $('.page-nav-wrap').attr('id'); // $('.features-toggle:nth-of-type(' + aa + ') ul li:nth-of-type(1)').append("Kia " + modelName + ""); // if (vehicleFeaturesDataSource.trimDetail[a].vehicleCode == 'SK85CL') { // $('.features-toggle:nth-of-type(8) img').attr("src", "/pages/pricing/content/shoppingtools/buildandprice/Soul/shoppingtools-buildandprice-Soul-ClearWhiteandInfernoRed-SK_5CL.jpg"); // } // for (var b = 0; b < vehicleFeaturesDataSource.features.length; b++) { // if (vehicleFeaturesDataSource.features[b].featureType == 1 && vehicleFeaturesDataSource.features[b].trimFeatures[a].isFeaturePresent == true) { // var ext = "" + vehicleFeaturesDataSource.features[b].name + ""; // $('.features-toggle:nth-of-type(' + aa + ') table tbody tr:nth-of-type(1)').append(ext); // } else if (vehicleFeaturesDataSource.features[b].featureType == 2 && vehicleFeaturesDataSource.features[b].trimFeatures[a].isFeaturePresent == true) { // var safety = "" + vehicleFeaturesDataSource.features[b].name + ""; // $('.features-toggle:nth-of-type(' + aa + ') table tbody tr:nth-of-type(2)').append(safety); // } else if (vehicleFeaturesDataSource.features[b].featureType == 3 && vehicleFeaturesDataSource.features[b].trimFeatures[a].isFeaturePresent == true) { // var tech = "" + vehicleFeaturesDataSource.features[b].name + ""; // $('.features-toggle:nth-of-type(' + aa + ') table tbody tr:nth-of-type(3)').append(tech); // } else if (vehicleFeaturesDataSource.features[b].featureType == 4 && vehicleFeaturesDataSource.features[b].trimFeatures[a].isFeaturePresent == true) { // var comfort = "" + vehicleFeaturesDataSource.features[b].name + ""; // $('.features-toggle:nth-of-type(' + aa + ') table tbody tr:nth-of-type(4)').append(comfort); // } // } // aa++; // } // } // }); // }); // $('.features-toggle:not(:first) .trim-wrap').hide(); // } // openClose(); // $(".features-toggle:nth-of-type(1)").find('.fa').toggleClass('fa-minus-square fa-plus-square'); // toggle = 1; //} function featureList() { $('.toggle-btn-wrapper ul li:nth-of-type(1) p').addClass('active'); $('.features-toggle').remove(); $('.features-toggle-wrapper').hide(); $('#features, #specs, #measures').show(); $('.toggle-btn-wrapper ul li i').addClass('fa-rotate-180'); toggle = 0; } $("#toggle").click(function () { $('.toggle-btn-wrapper ul li p').removeClass('active'); if (toggle == 0) { trimList(); } else { featureList(); } }); function openClose() { $(".open-close a").click(function (e) { e.preventDefault(); $(this).parent().prev().slideToggle(); $(this).find('.fa').toggleClass('fa-minus-square fa-plus-square'); }); $('.features-toggle h3').click(function () { $(this).next().slideToggle(); $(this).next().next().find('.fa').toggleClass('fa-minus-square fa-plus-square'); }); } $(".toggle-btn-wrapper ul li:nth-of-type(1)").click(function () { $('.toggle-btn-wrapper ul li p').removeClass('active'); featureList(); }); $(".toggle-btn-wrapper ul li:nth-of-type(3)").click(function () { $('.toggle-btn-wrapper ul li p').removeClass('active'); if (toggle == 0) { trimList(); } else { $('.toggle-btn-wrapper ul li:nth-of-type(3) p').addClass('active'); } }); } //$(function () { // //------- For vehicle and Model trim features comparision // var selectedCodes = []; //Select trims to compare -- NO restriction on how many trim needs to be compared... always decided by UI // var selectedTrimNames = []; //Populate trim names for selected trims // var vehicleFeaturesDataSource = {}; //Store Source data for features -- Same model - all trims one time call // var vehicleSpecsDataSource = {}; //Store Source data for Specifications // var vehicleCompareFeaturesDataSource = {}; // Cross vehicle trim compare data - Features // var vehicleCompareSpecsDataSource = {}; //Cross vehicle trim compare data - Specs // var selectedFeatures = []; //This array will be used for selecting features from drop down or some kind of list to find trim in a specifc model // var mid = 134; // //These are default vehicle code for Selected Model -- Below are for Rio 2018 -- Push new trims upon click or anything to this array // selectedCodes.push("SD751K"); // selectedCodes.push("SD752K"); // selectedCodes.push("SD753K"); // selectedCodes.push("SD754K"); // selectedCodes.push("SD755K"); // selectedCodes.push("SD756K"); // selectedCodes.push("SD757K"); // //Get language from website function and pass in load Initial Data -- change signature of method // console.log(GetLanguageCode()); // var lan = GetLanguageCode() == "en" ? 0 : 1; // loadInitialData(lan); // Change signature as loadInitialData(0); //English for French pass as 1 // //Pass language as 0/1 -- 0-English, 1 - French // //For UAT use https://api-uat.kia.ca and for Production use https://api.kia.ca domain for API call // //Pass language if writing categories manually else no need -- signature for with language -- getFeatures(0) // getFeatures(1) // //Pass language if writing categories manually else no need -- signature for with language -- getSpecs(0) // getSpecs(1) // function // //$('.rwd-table td.feature-name').click(function () { // // if (winWidth < 560) { // // $(this).parent().find('td:not(:nth-of-type(1))').toggleClass('visual'); // // $(this).parent().find('td:not(:nth-of-type(1))').toggleClass('block'); // // var parentHeight = $('.tabs-content li.selected').outerHeight(); // // $('ul.tabs-content').animate({ // // 'height': parentHeight // // }, 200); // // } // //}); // //vdata.specTypeDetail.forEach(obj => { // // //fstring += "

    " + obj.featureTypeName + "

    "; // // var fstring = ""; // // if (obj.id == 1) // // fstring += "Powertrain"; // // if (obj.id == 2) // // fstring += "Battery"; // // if (obj.id == 3) // // fstring += "Body"; // // if (obj.id == 4) // // fstring += "Brakes"; // // if (obj.id == 5) // // fstring += "Weight"; // // if (obj.id == 6) // // fstring += "Capacities"; // // if (obj.id == 7) // // fstring += "Dimensions"; // // if (obj.id == 8) // // fstring += "Fuel Consumption"; // // //console.log(selectedCodes.length + "Length"); // // selectedCodes.forEach(vcodeObj => { // // vdata.trimDetail.filter(obj => { return (vcodeObj == obj.vehicleCode); }).forEach(obj => { // // fstring += "" + obj.trimName + " "; // // }); // // }); // // fstring += ""; // // var tmpTypeId = obj.id; // // //console.log(tmpType); // // var typeSpecs = vdata.specs.filter(obj => { // // return obj.specTypeId == tmpTypeId // // }); // // //console.log(typeFeatures); // // var classToUse = selectedCodes.length == 3 ? "width33" : (selectedCodes.length == 2 ? "width50" : "width100"); // // typeSpecs.forEach(obj => { // // //console.log(obj.legalNotes); // // fstring += "" + obj.specName.trim() + " "; // // selectedCodes.forEach(vcodeObj => { // // //console.log(vcodeObj + "-- "); // // obj.trimSpecs.filter(trimObj => { return (vcodeObj == trimObj.vehicleCode); }).forEach(trimObj => { // // //console.log(trimObj.isFeaturePresent); // // //console.log(trimObj.vehicleCode + "-- " + trimObj.isFeaturePresent ); // // fstring += "" + trimObj.specDescription.trim() + ""; // // }); // // }); // // fstring += ""; // // }); // // fstring += ""; // // if (tmpTypeId == 1) // // $("#tblPowertrain").html(fstring); // // if (tmpTypeId == 2) // // $("#tblBattery").html(fstring); // // if (tmpTypeId == 3) // // $("#tblBodyChasis").html(fstring); // // if (tmpTypeId == 4) // // $("#tblBrakes").html(fstring); // // if (tmpTypeId == 5) // // $("#tblWeight").html(fstring); // // if (tmpTypeId == 6) // // $("#tblCapacities").html(fstring); // // if (tmpTypeId == 7) // // $("#tblDimensions").html(fstring); // // if (tmpTypeId == 8) // // $("#tblFuel").html(fstring); // //}); // //fstring +=""; // //$("#divSpecs").html(fstring); //});