1(function($) { 2 var PmStellantisCPO = { 3 name: "StellantisCPO", 4 5 config: {}, 6 7 init: function() { 8 this.config = pm_cpo_config[0]; 9 }, 10 11 vlpInit: function() { 12 this.init(); 13 }, 14 15 createElement: function(common) { 16 //var src = "https://s3.us-west-2.amazonaws.com/secure.demo.dev.pixelmotiondemo.com/icons/cpov_badge.png"; 17 var src = common.stellantis.cpov.badge; 18 var tooltip = common.stellantis.cpov.tooltip; 19 20 var $link = $('<div>') 21 .addClass('stellantisCPO') 22 .attr({ 23 "data-toggle": "tooltip", 24 "data-html": "tooltip", 25 "title": tooltip 26 }); 27 var $img = $('<img>') 28 .attr({ 29 src: src, 30 alt: "stellantis_cpo_logo", 31 id: "stellantis_cpo_logo_img" 32 }); 33 34 $link.append($img); 35 var $outerDiv = $('<div>') 36 .addClass('stellantis-cpo-wrapper') 37 .append($link); 38 return $outerDiv 39 }, 40 41 createEmptyElement: function() { 42 var $outerDiv = $('<div>') 43 .addClass('stellantis-cpo-wraper empty-element'); 44 return $outerDiv 45 }, 46 47 48 vlpUpdate: function() { 49 var placement = this.config['vlp-location']; 50 let insertLocation = VLP.UI.getThirdPartyLocation(this.config); 51 const fcaMakes = ["jeep","ram","chrysler","dodge","fiat","wagoneer"]; 52 53 VLP.getCurrentVehicles().forEach(function(item) { 54 if (item.condition == "used" && item.certified && fcaMakes.includes(item.make.toLowerCase())) { 55 var $outerDiv = PmStellantisCPO.createElement(item); 56 } else{ 57 var $outerDiv = PmStellantisCPO.createEmptyElement(); 58 } 59 if (placement == "top") { 60 $('#' + item.vin).find(insertLocation).prepend($outerDiv); 61 } else { 62 $('#' + item.vin).find(insertLocation).append($outerDiv); 63 } 64 }); 65 66 $('.stellantisCPO').tooltip() 67 if($('.stellantisCPO').length == 0){ 68 $("div.stellantis-cpo-wraper.empty-element").remove(); 69 } 70 }, 71 72 vdpInit: function() { 73 var vehicle = VDP.store.vehicle; 74 if (vehicle.condition == 'used' && vehicle.certified) { 75 this.init(); 76 var $outerDiv = PmStellantisCPO.createElement(vehicle); 77 //VDP.appendThirdPartyBtn(this.config, $outerDiv); 78 $("#cta-buttons-left").append($outerDiv); 79 $('.stellantisCPO').tooltip() 80 } 81 82 } 83 }; 84 85 if ('VLP' in window) { 86 VLP.state.thirdParty.push(PmStellantisCPO); 87 } else if ('VDP' in window) { 88 VDP.state.thirdParty.push(PmStellantisCPO); 89 } 90})(jQuery);
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.