1 |
- define(["jquery","knockout","viewModels/productListingViewModelFactory","CCi18n","ccConstants","pubsub","pageLayout/product","storageApi","ccStoreConfiguration","ccResourceLoader!global/OCS_BFService","navigation","ccRestClient","spinner"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){"use strict";var p,d=1,v=!1,m=i.DEFAULT_ITEMS_PER_PAGE,g=0,y="",b,w,E=300,S=300,x=600,T=400,N=300,C="",k="selectedProductsPerRow",L=!1,A=!1;return{productsPerRowArray:t.observableArray([t.observable(!1),t.observable(!1),t.observable(!1),t.observable(!1),t.observable(!1)]),selectedProductsPerRow:t.observable(),displayRefineResults:t.observable(!1),showListViewButton:t.observable(!1),productsSelectedForComparison:t.observableArray([]),showResultsPerPageSection:t.observable(!1),largeDimensions:t.observable("300,300"),mediumDimensions:t.observable("300,300"),imageSizes:[E,S,x,T,N],rowClass:t.observable("items4"),WIDGET_ID:"productListing",mobileSize:300,advertisingCard:t.observable(),gridMode:t.observable("grid"),listProducts:t.observableArray([]),isMobile:t.observable(!1),pricePrice:f.utils.product.parsePrice,onLoad:function(l){p=l,setTimeout(function(){e(document).ready(function(){e(".formatkm").each(function(t,n){e(this).text(e(this).text().toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."))})})},1e3);var c={};l.productTypes&&l.productTypes()&&t.utils.arrayForEach(l.productTypes(),function(e){for(var t=0;t<e.variants.length;t++)if(e.variants[t].listingVariant){c[e.id]=e.variants[t];break}}),l.productListingTypes=c;var h={};l.productListing=new Object,h[i.ENDPOINT_KEY]=i.ENDPOINT_PRODUCTS_LIST_PRODUCTS,h[i.IDENTIFIER_KEY]="productListingData";var d=a.getInstance().getFilterToUse(h);d&&(l.productListing.filterKey=d),e.Topic(s.topicNames.SEARCH_RESULTS_FOR_CATEGORY_UPDATED).subscribe(function(e){!this.navigation||this.navigation.length==0?l.displayRefineResults(!1):l.displayRefineResults(!0)}),e.Topic(s.topicNames.SEARCH_FAILED_TO_PERFORM).subscribe(function(e){l.displayRefineResults(!1)}),e.Topic("removeFromView").subscribe(function(e){l.removeFromView(e)});var b=this,E=[{id:"creationDate",displayText:r.t("ns.OCS_productListingAutosUsados:resources.sortByCreationDate"),order:t.observable("desc"),maintainSortOrder:!0,serverOnly:!0},{id:"listPrice",displayText:r.t("ns.OCS_productListingAutosUsados:resources.sortByPriceDescText"),order:t.observable("desc"),maintainSortOrder:!0,serverOnly:!0},{id:"listPrice",displayText:r.t("ns.OCS_productListingAutosUsados:resources.sortByPriceAscText"),order:t.observable("asc"),maintainSortOrder:!0,serverOnly:!0}],S=[{id:"sku.activePrice",displayText:r.t("ns.OCS_productListingAutosUsados:resources.sortByPriceDescText"),sortKey:"sku.activePrice",order:t.observable("desc"),maintainSortOrder:!0,serverOnly:!0},{id:"sku.activePrice",displayText:r.t("ns.OCS_productListingAutosUsados:resources.sortByPriceAscText"),sortKey:"sku.activePrice",order:t.observable("asc"),maintainSortOrder:!0,serverOnly:!0}];y=l.listType(),l.listingViewModel=t.observable(),l.listingViewModel(n.createListingViewModel(l)),l.listingViewModel().resetSortOptions_OCS=function(){var e=this.sortOptions()[0];this.selectedSort(e),this.sortDirectiveProp(e.id),this.sortDirectiveOrder(e.order())},l.listType()===i.LIST_VIEW_PRODUCTS?l.listingViewModel().sortOptions(E):l.listingViewModel().sortOptions(E),l.listingViewModel().buildResultsPerPageOption=function(e,t){return{id:t?i.RESULTS_PER_PAGE_ALL:"rec-per-page-"+e,displayText:t?r.t("ns.OCS_productListingAutosUsados:resources.resultsPerPageOptionAll"):e,value:e}},l.listingViewModel().productGridExtension=!0,l.listingViewModel().useGenericSort=!0,l.listingViewModel().isCacheEnabled=l.isViewModelCacheEnabled?l.isViewModelCacheEnabled():!1,l.listingViewModel().viewModelCacheLimit=l.viewModelCacheLimit?l.viewModelCacheLimit():3,l.user().catalog&&(l.listingViewModel().catalog=l.user().catalog.repositoryId),l.listingViewModel().category.subscribe(function(e){e.repositoryId!=l.lastCategoryId&&(l.listingViewModel().itemsPerPage=+l.productsPerPage(),l.listingViewModel().categoryOrSearchChanged=!0),l.lastCategoryId=e.repositoryId}),l.sortingCallback=function(e){},l.listingViewModel().itemsPerPage=+l.productsPerPage(),l.listingViewModel().recordsPerPage(+l.productsPerPage()),l.updateRefinements=function(){var t={recordsPerPage:m,recordOffSet:g,newSearch:!1,navigationDescriptors:l.dimensionId(),suppressResults:!0,searchType:i.SEARCH_TYPE_SIMPLE};e.Topic(s.topicNames.SEARCH_CREATE_CATEGORY_LISTING).publishWith(t,[{message:"success"}]);var n={categoryRoute:l.category().route,categoryName:l.category().displayName,repositoryId:l.category().repositoryId,dimensionId:l.dimensionId()};u.getInstance().setItem("category",JSON.stringify(n)),e.Topic(s.topicNames.CATEGORY_UPDATED).publish(n)},l.scrollHandler=function(t){var n=e(window).scrollTop(),r=e(window).height(),i=e("#product-grid").hasClass("active")?"#product-grid":"#product-list",s=e(i).height();n+r>=s/5*4&&l.listingViewModel().incrementPage()},l.scrollHandleOnViewPort=function(){e(window).off("scroll.page"),l.listingViewModel().isLoadOnScroll(!1)},l.productGrid=t.observableArray([]),l.changePageForSearch=function(e){window.scrollTo(0,0),l.productGrid([]),l.listProducts([]),l.listingViewModel().targetPage=1;if(this.parameters.type!=i.PARAMETERS_SEARCH_QUERY)return;this.parameters.page?(l.listingViewModel().pageNumber=parseInt(this.parameters.page),l.listingViewModel().targetPage=parseInt(this.parameters.page)):l.listingViewModel().pageNumber=1,l.listingViewModel().parameters=this.parameters,l.listType()==i.LIST_VIEW_SEARCH&&(l.listingViewModel().recordsPerPage&&l.listingViewModel().recordsPerPage()!=null&&!l.changedViaPagination&&(isNaN(l.productsPerPage())?l.listingViewModel().recordsPerPage(i.DEFAULT_SEARCH_RECORDS_PER_PAGE):l.listingViewModel().recordsPerPage(parseInt(l.productsPerPage()))),l.scrollHandleOnViewPort(),l.listingViewModel().load(1)),l.listingViewModel().paginationType(2)},e.Topic(s.topicNames.PAGE_CHANGED).subscribe(l.getPageUrlData.bind(l)),e.Topic(s.topicNames.PAGE_PAGINATION_CHANGE).subscribe(l.changePage.bind(l)),e.Topic(s.topicNames.PAGE_PAGINATION_CHANGE).subscribe(function(){l.setAdvertisingCard(l)}),e.Topic(s.topicNames.PAGE_PARAMETERS).subscribe(l.changePageForSearch),l.formatProducts=function(e){var t=[],n=e.length;for(var r=0;r<n;r++)e[r]&&t.push(new o(e[r]));return t},l.resultsText=t.computed(function(){return l.listingViewModel().resultsText()},l.listingViewModel()),l.updateFocus=function(){return e.Topic(s.topicNames.UPDATE_LISTING_FOCUS).publish(),!0},l.updateScrollPosition=function(){if(l.listingViewModel().isCacheEnabled){var e=l.listingViewModel().findCachedResultIndex();e!=undefined&&(l.listingViewModel().cachedViewModels[e].scrollPosition=window.pageYOffset||0)}},l.updateFocusAndDisableQV=function(t,n){return e(".quickViewElement").hide(),l.updateFocus()},l.productGridComputed=t.computed(function(){var e,n,r,i,s=[],o=l.listingViewModel().currentProductsComputed();if(!o)return;e=o.length,i=parseInt(l.listingViewModel().itemsPerRow(),10),n=0,r=n+i;for(var u=0;u<o.length;u++)o[u].allPrices=t.observable();while(r<=e)s.push(o.slice(n,r)),n=r,r+=i;return r>e&&n<e&&s.push(o.slice(n,e)),s},l),l.productGridComputed.subscribe(function(e){e&&e.length>0&&(l.listingViewModel().refreshValues==1?(l.productGrid(e),l.listingViewModel().refreshValues=!1):l.productGrid.push.apply(l.productGrid,e))}),l.adjustScrollPosition=function(){if(l.listingViewModel().isCacheEnabled&&l.productGrid()&&l.productGrid().length>1){var t=l.listingViewModel().findCachedResultIndex();t!=undefined&&l.listingViewModel().cachedViewModels[t].scrollPosition>0&&(e("html, body").stop(),e(window).scrollTop(l.listingViewModel().cachedViewModels[t].scrollPosition))}},l.categoryUpdate=function(e){if(!e)return;var t=l.listingViewModel().category();l.listType()!==i.LIST_VIEW_PRODUCTS&&(l.listType(i.LIST_VIEW_PRODUCTS),l.listingViewModel(n.createListingViewModel(l))),(!t||t.id!=e.id||v)&&l.listingViewModel().resetSortOptions_OCS();if(!t||t.id!=e.id||v||!l.listingViewModel().paginationOnly)l.listingViewModel().category(e),l.listingViewModel().clearOnLoad=!0,l.productGrid([]),l.listProducts([]),l.listingViewModel().targetPage=1,l.listingViewModel().load(1),l.listingViewModel().paginationType(1),v=!1},l.ensureActiveTab=function(){!e("#product-grid").hasClass("active")&&!e("#product-list").hasClass("active")&&e("#product-grid").addClass("active")},l.listType()!==i.LIST_VIEW_PRODUCTS&&e.Topic(s.topicNames.SEARCH_RESULTS_UPDATED).subscribe(function(e){l.category(null),v=!0,l.listType()!==i.LIST_VIEW_SEARCH&&(l.listType(i.LIST_VIEW_SEARCH),l.listingViewModel(n.createListingViewModel(l))),l.ensureActiveTab(),this.navigation&&this.navigation.length>0||this.breadcrumbs&&this.breadcrumbs.refinementCrumbs.length>0?l.displayRefineResults(!0):l.displayRefineResults(!1)}),e.Topic(s.topicNames.SEARCH_CREATE).subscribe(function(e){!l.listingViewModel().changedViaDropDown&&!l.changedViaPagination&&!l.productViewed?(l.listingViewModel().itemsPerPage=+l.productsPerPage(),l.listingViewModel().categoryOrSearchChanged=!0,l.changedViaPagination=!1):l.productViewed&&(l.changedViaPagination=!1,l.listingViewModel().categoryOrSearchChanged=!1,l.productViewed=!1)}),e.Topic(s.topicNames.PAGE_VIEW_CHANGED).subscribe(function(e){l.changedViaPagination=!1,e&&e.path=="searchresults"&&e.parameters!=null&&e.parameters.indexOf("&page=")>=0&&(l.changedViaPagination=!0,l.listingViewModel().categoryOrSearchChanged=!1)}),e.Topic(s.topicNames.PRODUCT_VIEWED).subscribe(function(e){l.productViewed=document.location.pathname!="/searchresults"?!0:!1}),w=e(window).width(),e(window).resize(function(){}),l.handlePageChanged=function(t){var n=this;t.pageId!="category"&&t.pageId!="searchresults"&&e(window).off("scroll.page",n.scrollHandler)},e.Topic(s.topicNames.PAGE_CHANGED).subscribe(l.handlePageChanged.bind(l)),l.selectedProductsPerRow(l.getSelectedProductsPerRow()),l.listingViewModel().itemsPerRowInLargeDesktopView(3),l.listingViewModel().itemsPerRowInDesktopView(3),l.listingViewModel().itemsPerRowInTabletView(2),l.listingViewModel().itemsPerRow(1),l.productsPerRowChange(2),l.listingViewModel().currentProducts.subscribe(function(n){var r=n;r&&r.length>0&&(r.forEach(function(e,n){l.loadAllPrices(n,e,"allPrices"),e.compairCheckBox=t.observable(!1);if(p.productsSelectedForComparison()!=undefined&&p.productsSelectedForComparison()!=""&&p.productsSelectedForComparison().length>0)for(var r=0;r<p.productsSelectedForComparison().length;r++){var i="";t.isObservable(p.productsSelectedForComparison()[r].id)?i=p.productsSelectedForComparison()[r].id():i=f.getValue(p.productsSelectedForComparison()[r].id),f.getValue(e.id().toString())===i&&e.compairCheckBox(!0)}l.listProducts.push(e)}),e.Topic("ga_view_item_list.memory").publish(l.category(),l.listProducts()))}),l.listingViewModel().handleResponsiveViewports=function(){var e=l.listingViewModel();e.viewportMode()==i.TABLET_VIEW&&(e.itemsPerRow(e.itemsPerRowInTabletView()),e.isMobileView(!0),e.isLoadOnScroll(!1)),e.viewportMode()==i.PHONE_VIEW&&(e.itemsPerRow(e.itemsPerRowInPhoneView),e.isMobileView(!0),e.isLoadOnScroll(!1)),e.refreshValues=!0,e.scrolledViewModels=[],e.isLoadOnScroll()?(e.productGridExtension&&(e.currentPage()===1?e.currentPage.notifySubscribers():e.currentPage(1)),e.scrollToTop=!1):e.scrollToTop=!0},(e(window)[0].innerWidth||e(window).width())<=i.VIEWPORT_TABLET_UPPER_WIDTH&&l.listingViewModel().isLoadOnScroll(!1),l.listingViewModel().totalNumber.subscribe(function(){l.listingViewModel().totalNumber()&&e.Topic("TOTAL_NUMBER_LISTING").publishWith(l.listingViewModel().totalNumber(),[{message:"success"}])}),t.components.isRegistered("product-properties")||t.components.register("product-properties",{viewModel:function(e){this.product=e.product,this.transmision=this.product.x_transmision(),l.isMobile()&&(this.product.x_transmision()==="Automática"?this.transmision="Aut.":this.product.x_transmision()==="Mecánica"&&(this.transmision="Mec."))},template:'<div class="cc-item-description" data-bind="with: product"> <span class="agno" data-bind="text: x_agno"></span> <span class="cc-separator"></span> <span class="formatkm" data-bind="text: x_kilometraje() + \' km\' "></span> <span class="cc-separator"></span> <span class="transmision" data-bind="text: $parent.transmision"></span> <span class="cc-separator"></span> <span class="combustible" data-bind="text: x_combustible"></span> </div>'}),t.components.isRegistered("toggle-view-buttons")||t.components.register("toggle-view-buttons",{viewModel:function(e){},template:"<div class=\"toggle-grid-btn\" data-bind=\"click: $widgetViewModel.setGridMode.bind($widgetViewModel, 'grid'), css: {'active': $widgetViewModel.gridMode() === 'grid'}\"> <span class=\"material-icons-outlined\"> view_week </span> </div> <div class=\"toggle-grid-btn\" data-bind=\"click: $widgetViewModel.setGridMode.bind($widgetViewModel, 'list'), css: {'active': $widgetViewModel.gridMode() === 'list'}\"> <span class=\"material-icons-outlined\"> format_list_bulleted </span> </div>"})},setGridMode:function(e){e&&(p.isMobile()?p.gridMode(p.gridMode()==="grid"?"list":"grid"):p.gridMode(e))},beforeAppear:function(t){var n=this;n.isMobile(window.innerWidth<992),window.onresize=function(){var e=n.isMobile(),t=window.innerWidth<992;e!=t&&n.isMobile(t)},n.setAdvertisingCard(n),y=n.listType(),n.listingViewModel().resetSortOptions_OCS(),n.listType()==i.LIST_VIEW_SEARCH&&(n.displayRefineResults(!1),n.listingViewModel().titleText(""),n.listingViewModel().noSearchResultsText(""),n.listingViewModel().suggestedSearches({})),n.category()&&n.listType()!=i.LIST_VIEW_SEARCH&&n.categoryUpdate(n.category()),n.listType()===i.LIST_VIEW_PRODUCTS&&(!n.displayRefineResults()||!n.listingViewModel().paginationOnly)&&(n.dimensionId()?n.updateRefinements():(n.displayRefineResults(!1),e.Topic(s.topicNames.OVERLAYED_GUIDEDNAVIGATION_CLEAR).publish())),n.showListViewOption&&n.showListViewButton(n.showListViewOption());if(n.showResultsPerPageOption){var r=n.isScrollEnabled&&n.isScrollEnabled();n.showResultsPerPageSection(n.showResultsPerPageOption()&&!r)}n.listingViewModel().handleResponsiveViewports(),n.productsPerRowChange(3),n.selectedProductsPerRow(3),n.productsSelectedForComparison(f.getValue(f.COMPARATOR.CART_PRODUCTS));var o=a.getInstance();o.enableSpinnerOnPageLoad=!0,setTimeout(function(){e(document).ready(function(){e(".formatkm").each(function(t,n){e(this).text(e(this).text().toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."))}),e(".text_x_version").each(function(t,n){e(this).text(e(this).text().replace("5P",""))})})},1200)},initTooltip:function(){e('[data-toggle="tooltip"]').tooltip()},getPageUrlData:function(e){var t=this;b=e;if(e.pageId==i.CATEGORY_CONTEXT||e.pageId==i.SEARCH_RESULTS)t.listingViewModel().pageId(e.pageId),t.listingViewModel().contextId(e.contextId),t.listingViewModel().seoslug(e.seoslug)},changePage:function(e){var t=this;window.scrollTo(0,0),e.page?t.listingViewModel().pageNumber=parseInt(e.page):(t.listingViewModel().pageNumber=1,t.listingViewModel().initializeIndex()),t.listType()==i.LIST_VIEW_PRODUCTS&&t.scrollHandleOnViewPort(),t.listType()==i.LIST_VIEW_PRODUCTS&&e.paginationOnly&&t.listingViewModel().getPage(t.listingViewModel().pageNumber),t.listingViewModel().paginationOnly=e.paginationOnly,t.listingViewModel().isLoadOnScroll()||(t.productGrid([]),t.listProducts([]))},handleSortingHelper:function(e,t){var n=this;n.productGrid([]),n.listProducts([]),n.listingViewModel().handleSorting(e,t)},handleRefineResults:function(t,n){return!e("#CC-overlayedGuidedNavigation-column").hasClass("open")&&!e("#CC-overlayedGuidedNavigation").hasClass("CC-overlayedGuidedNavigation-mobileView")&&(e("#CC-overlayedGuidedNavigation").addClass("CC-overlayedGuidedNavigation-mobileView"),e.Topic(s.topicNames.OVERLAYED_GUIDEDNAVIGATION_SHOW).publish()),(e(window)[0].innerWidth||e(window).width())<i.VIEWPORT_TABLET_LOWER_WIDTH&&(e(window).off("scroll.page"),e("html, body").css("overflow-y","hidden")),e("#CC-overlayedGuidedNavigation-done").focus(),!1},priceUnavailableText:function(){return r.t("ns.OCS_productListingAutosUsados:resources.priceUnavailable")},setItemsPerRow:function(e,t){var n=this;n.listingViewModel().itemsPerRow(e),n.productGrid([]),n.listProducts([]),n.listingViewModel().listingImageSize(null),n.listingViewModel().itemsPerRowInTabletView(e),n.listingViewModel().itemsPerRowInDesktopView(e),n.listingViewModel().itemsPerRowInLargeDesktopView(e),n.listingViewModel().listingImageSize(t),n.largeDimensions(t+","+t),n.mediumDimensions(t+","+t)},productsPerRowChange:function(t){var n=this,r="";if(t!=n.getSelectedProductsPerRow()){n.isScrollEnabled&&n.isScrollEnabled()&&(n.listingViewModel().currentPage(1),n.listingViewModel().currentPage.notifySubscribers()),n.listingViewModel().scrolledViewModels=[];if(t==0)n.setItemsPerRow(1,n.imageSizes[1]);else{if(t==-1){n.listingViewModel().viewportMode()==i.PHONE_VIEW?(t=2,r=" mobile"):t=2;if(!n.isScrollEnabled||n.isScrollEnabled&&!n.isScrollEnabled())n.listingViewModel().currentPage(1),n.listingViewModel().currentPage.notifySubscribers()}n.setItemsPerRow(t,n.imageSizes[t])}n.rowClass("items"+t+r),e.each(n.productsPerRowArray(),function(e,r){n.setProductsPerRowArrayElement(e,t==e)}),u.getInstance().setItem(k,t),n.selectedProductsPerRow(t)}},getSelectedProductsPerRow:function(){var e=this,t=u.getInstance().getItem(k);return t==null&&(e.listingViewModel().viewportMode()==i.PHONE_VIEW?t=i.PHONE_VIEW:e.listingViewModel().viewportMode()==i.TABLET_VIEW?t=i.TABLET_VIEW:t=i.TABLET_VIEW),t},setDefaultItemsPerRow:function(){var t=this,n=t.getSelectedProductsPerRow(),r=n;n==0&&(t.showListViewOption()?r=1:(u.getInstance().removeItem(k),n=t.getSelectedProductsPerRow(),r=n)),t.selectedProductsPerRow(n),u.getInstance().setItem(k,n),t.setItemsPerRow(r,t.imageSizes[n]),t.listingViewModel().viewportMode()==i.PHONE_VIEW?t.rowClass("items2 mobile"):t.rowClass("items"+n),e.each(t.productsPerRowArray(),function(e,r){t.setProductsPerRowArrayElement(e,n==e)})},setProductsPerRowArrayElement:function(e,t){var n=this;n.productsPerRowArray()[e](t)},getProductsPerRowClass:function(e){return this.productsPerRowArray()[e]()==1?"active":""},getGridCss:function(e){var t=this,n=t.getSelectedProductsPerRow();return e?n!=0?"active":"":n==0?"active":""},clickCotizarButton:function(){var t="SendUsados";t&&e.Topic(t).publish(this)},stockReservar:function(e){var n=e,r={ids:n.id()};n.showBtnReserve=t.observable(!1),c.request("listInventories",r,function(e){e[0].stockLevel>=1?n.showBtnReserve(!0):n.showBtnReserve(!1)},function(e){console.log(e)})},stockCyber:function(e){var e=e,n={ids:e.id()};e.showOverlay=t.observable(!1),c.request("listInventories",n,function(t){t[0].stockLevel===888?e.showOverlay(!0):e.showOverlay(!1)},function(e){console.log(e)})},showHighlyViewed:function(e){return f.showHighlyViewed(e.creationDate(),e.x_views())},clickReservarButton:function(e,t){var e=e;l.goTo(e.$data.route())},loadAllPrices:function(e,t,n){f.getAllPrices(t,n)},handleResultsPerPageHelper:function(e,t){var n=this;n.listingViewModel().itemsPerPage!=e.value&&(n.productGrid([]),n.listProducts([]),n.listingViewModel().handleResultsPerPage(e,t))},getProductsPerRowHasFocus:function(e){var t=this,n=t.getSelectedProductsPerRow();return n==e},resultsPerPageCallback:function(e){},selectCarVersion:function(t){e.Topic("addRemoveCartComparator").publish(t)},removeFromView:function(t){var n=this.listingViewModel().currentProducts();if(!n)return;for(var r=0;r<n.length;r++)f.getValue(n[r].id())==f.getValue(t)&&(n[r].compairCheckBox(!1),e("#CC-input-"+t).attr("checked",!1))},onRenderItem:function(t){t&&t.compairCheckBox&&e("#CC-input-"+t.id()).prop("checked",t.compairCheckBox())},onRenderListing:function(t){p.stockCyber(t),f.populateHighlightProperties(t,"productListing"),e(document).ready(function(){e(".formatkm").each(function(t,n){e(this).text(e(this).text().toString().replace(/\B(?=(\d{3})+(?!\d))/g,"."))}),e(".text_x_version").each(function(t,n){e(this).text(e(this).text().replace("5P",""))}),e(".x_agno").each(function(t,n){e(this).text(e(this).text().replace(".0",""))})})},go_product:function(e){l.goTo("/automovil-usado/"+e.brand.toLowerCase()+"/"+e.description.toLowerCase()+"/"+e.id)},updateOrderBy:function(){},setAdvertisingCard:function(e){if(e.advertisingCardConfig().split(";").length>=1){var t=e.advertisingCardConfig().split(";"),n=Math.floor(Math.random()*t.length);e.advertisingCard({isActive:!0,position:Math.floor(Math.random()*8)+3,img:t[n].split(",")[0],url:t[n].split(",")[1]})}else e.advertisingCard({isActive:!1})},showAdvertisingCard:function(e){return p.advertisingCard().isActive&&p.advertisingCard().position===e?!0:!1}}})
|