{"version":3,"sources":["assets/src/modules/ElcaBlogHomePage/js/ElcaBlogHomePage.js"],"names":["removeParamFromCanonical","url","location","protocol","host","pathname","$","attr","document","ready","let","queryString","QueryStringProcessor","getUrlParams","$miCorpoBlogHomePageSelector","find","val","blogcategory","showResults","on","this","page","category","AsyncRequestManager","renderAsyncRequest","each","$this","click","e","change","preventDefault","window","resize","width","hide","show"],"mappings":"AAgEA,SAASA,2BACL,IAAIC,EAAMC,SAASC,SAAW,KAAOD,SAASE,KAAOF,SAASG,SAE9DC,EAAE,uBAAuBC,KAAK,OAAQN,GAnE1CK,EAAEE,UAAUC,MAAM,WAEdC,IAAIC,GAAc,IAAIC,sBAAuBC,eAU5CC,GAT2E,IAAxER,EAAE,qCAAqCS,KAAK,mBAAmBC,OAC/DL,EAAYM,cAAeC,EAAY,EAAGP,EAAYM,cAI7DX,EAAE,mCAAmCa,GAAG,QAAS,WAC1CD,EAAYZ,EAAEc,MAAMJ,MAAOF,EAA6BC,KAAK,mBAAmBC,SAGpDV,EAAE,sCA6BrC,SAASY,EAAYG,EAAMC,GAChBX,EAAc,eAAiBU,EAAO,qBAAuBC,EAAW,mBAAqBhB,EAAE,iCAAiCU,MAAQ,iBAAmBV,EAAE,2BAA2BU,OAC7K,IAAIO,qBACVC,mBAAmB,4BAA6Bb,EAAa,oCAAoC,GA9B9GG,EAA6BK,GAAG,SAAU,WAGtCD,EAAY,EADSJ,EAA6BC,KAAK,mBAAmBC,SAKjFV,EAAE,mCAAmCmB,KAAK,WACzC,IAAIC,EAAQpB,EAAEc,MACVE,EAAWI,EAAMnB,KAAK,iBAC1BmB,EAAMC,MAAM,SAASC,GAGpB,OAFAd,EAA6BE,IAAIM,GAAUO,SAC3CD,EAAEE,kBACK,MAINxB,EAAE,8BAA8BmB,KAAK,WACjC,IAAIC,EAAQpB,EAAEc,MACVE,EAAWI,EAAMnB,KAAK,iBAC1BmB,EAAMC,MAAM,SAAUC,GAGlB,OAFAd,EAA6BE,IAAIM,GAAUO,SAC3CD,EAAEE,kBACK,MAWfxB,EAAEyB,QAAQC,OAAO,WAEY,MAArB1B,EAAEyB,QAAQE,SACV3B,EAAE,6BAA6B4B,OAC/B5B,EAAE,gCAAgC6B,SAGlC7B,EAAE,6BAA6B6B,OAC/B7B,EAAE,gCAAgC4B,UAEvCF,SAEHhC","file":"ElcaBlogHomePage.js","sourcesContent":["$(document).ready(function() {\r\n\r\n let queryString = new QueryStringProcessor().getUrlParams();\r\n if ($('#mi-corpo-blog-home-page-selector').find('option:selected').val() == \"\") {\r\n queryString.blogcategory ? showResults(1, queryString.blogcategory) : \"\";\r\n }\r\n \r\n\r\n\t$(\".mi-corpo-blog-home-page-button\").on('click', function () {\r\n showResults($(this).val(), $miCorpoBlogHomePageSelector.find('option:selected').val());\r\n });\r\n\t\r\n\tvar $miCorpoBlogHomePageSelector = $('#mi-corpo-blog-home-page-selector');\r\n\t\r\n $miCorpoBlogHomePageSelector.on('change', function () {\r\n \r\n var selectedOption = $miCorpoBlogHomePageSelector.find('option:selected').val();\r\n showResults(1, selectedOption);\r\n\r\n });\r\n\t\r\n\t$('.mi-blog-article-body-tags-link').each(function() {\r\n\t\tvar $this = $(this);\r\n\t\tvar category = $this.attr('data-category');\r\n\t\t$this.click(function(e) {\r\n\t\t\t$miCorpoBlogHomePageSelector.val(category).change();\r\n\t\t\te.preventDefault();\r\n\t\t\treturn false;\r\n\t\t});\r\n });\r\n\r\n $('.mi-blog-category-tag-link').each(function () {\r\n var $this = $(this);\r\n var category = $this.attr('data-category');\r\n $this.click(function (e) {\r\n $miCorpoBlogHomePageSelector.val(category).change();\r\n e.preventDefault();\r\n return false;\r\n });\r\n });\r\n\r\n\tfunction showResults(page, category) {\r\n var queryString = \"?pageNumber=\" + page + \"&selectedCategory=\" + category + \"&selectedItemId=\" + $('#mi-corpo-blog-selectedItemId').val() + \"&postsPerPage=\" + $('#mi-blog-posts-per-page').val() ;\r\n\t\tvar requestManager = new AsyncRequestManager();\r\n\t\trequestManager.renderAsyncRequest('/bloghomepage/searchposts', queryString, '[data-widget=\"elcabloghomepage\"]', true);\r\n }\t\r\n\r\n\r\n $(window).resize(function () {\r\n // This will fire each time the window is resized:\r\n if ($(window).width() >= 1024) {\r\n $('#mi-blog-categories-combo').hide();\r\n $('#mi-blog-categories-tag-list').show();\r\n\r\n } else {\r\n $('#mi-blog-categories-combo').show();\r\n $('#mi-blog-categories-tag-list').hide();\r\n }\r\n }).resize(); // This will simulate a resize to trigger the initial run.\r\n\r\n removeParamFromCanonical();\r\n\r\n});\r\n\r\nfunction removeParamFromCanonical() {\r\n var url = location.protocol + '//' + location.host + location.pathname;\r\n\r\n $('link[rel=canonical]').attr('href', url);\r\n}"]}