{"version":3,"sources":["search.js"],"names":["$","excluded_type","input_types","get_state","$inputs","data","each","$input","this","is","list","attr","value","prop","push","val","fn","formstate","a","find","filter","type","indexOf","jQuery","search","active","loaded","url","request","lastSearchTerm","stickyInstance","loading","timeout","wait","start","end","templates","count","filters","appliedFilters","resultsList","results","paginationPrev","paginationNext","noResults","error","preInit","site","html","location","hash","length","scrollTo","offset","top","init","pageLoad","_bindEvents","elements","filterOptions","wrapper","sortOptions","earlyCareers","jobPreviews","pagination","paginationPrevButton","paginationNextButton","paginationButtons","searchButtons","searchInput","searchLabel","clearFilter","clearAllFilters","parseInt","form","not","preview","off","on","elementId","page","currentPage","history","replaceState","serialize","addClass","link","_resetPagination","removeAttr","setTimeout","load","state","should_restore","popups","instance","close","closest","displayCount","show","i","oldVal","removeClass","header","loader","sort","jobs","doc","ajaxComplete","filterQuery","href","split","loadFilters","hasResults","showHideNoResults","window","onpopstate","e","OriginalQuery","Page","Query","stickyFilters","add","body","animate","scrollTop","parent","height","focus","appendResults","useHistory","altData","appending","prepending","anchorItem","last","first","abort","performance","now","hide","update","filtering","next","prev","ajax","success","response","pushState","clearTimeout","errorHtml","getTemplate","complete","displayedItems","DisplayedItems","totalItems","TotalItems","oldHeight","oldScroll","win","Items","translations","replace","item","MoreDetails","MoreDetailsLabel","Title","templateData","Jobs","append","prepend","ShowPreviousLabel","PrevPage","MinPage","ShowingTotalItems","ShowMoreLabel","NextPage","MaxPage","ReturnToFiltersText","earlyCareersList","getEarlyCareers","Filters","FiltersList","filtersList","getAppliedFilters","clearFilters","isFiltering","AppliedFilters","RemoveText","ClearFiltersButton","EarlyCareers","ShowClearFiltersButton","FilterResultsBy","trigger","time_taken","allow","target","query","Departments","ShowEarlyCareers","Territories","HasSelectedFilters","FiltersSelected","FilterGroups","ClearText","ApplyText","console","log","refParent","ParentName","refTitle","children","j","Children","child","Selected","Ref","Count","Id","templateRef","templateId","template","temp","Hogan","compile","render","toLowerCase","collapseFilters","click","endpoint","seralizedForm","filtersOverlay","text","save","restore","stickyElement","document","querySelector","utils","supportsSticky","insertAdjacentHTML","visibleTimeout","lastStickyPosition","lastStickyOffPosition","stickyOffElement","allowAnimation","IntersectionObserver","entries","y","boundingClientRect","down","undefined","classList","observe","remove","position","scrollY","addEventListener","scroll"],"mappings":"CA0BA,SAAAA,GAEA,IACAC,EAAA,mCACAC,EAAA,wBAEA,SAAAC,EAAAC,GACA,IAAAC,EAAA,GAyBA,OAvBAD,EAAAE,KAAA,WACA,IAAAC,EAAAP,EAAAQ,MAEA,IAAAD,EAAAE,GAAAR,GAIA,GAAAM,EAAAE,GAAA,aAAA,CACA,IAAAC,EAAAL,EAAAE,EAAAI,KAAA,UAAA,GACAC,EAAAL,EAAAI,KAAA,SACAJ,EAAAM,KAAA,YACAH,EAAAI,KAAAF,GAEAP,EAAAE,EAAAI,KAAA,SAAAD,OACAH,EAAAE,GAAA,UACAF,EAAAM,KAAA,aACAR,EAAAE,EAAAI,KAAA,SAAAJ,EAAAI,KAAA,UAGAN,EAAAE,EAAAI,KAAA,SAAAJ,EAAAQ,QAIAV,EAqBAL,EAAAgB,GAAAC,UAAA,SAAAC,GACA,IAnBAb,EAmBAD,GAAAI,KAAAC,GAAA,QAAAD,KAAAW,KAAAjB,GAAAM,KAAAY,OAAAlB,IACAkB,OAAA,UAEA,OAAAF,EAEA,WAAAlB,EAAAqB,KAAAH,GACAf,EAAAC,EAAAgB,OAAAF,KAzBAb,EA2BAa,EAAAd,EA1BAE,KAAA,WACA,IAAAC,EAAAP,EAAAQ,MAEAD,EAAAE,GAAAR,KAIAM,EAAAE,GAAA,aACAF,EAAAM,KAAA,WAAA,IAAAR,EAAAE,EAAAI,KAAA,UAAA,IAAAW,QAAAf,EAAAI,KAAA,WACAJ,EAAAE,GAAA,UACAF,EAAAM,KAAA,UAAAR,EAAAE,EAAAI,KAAA,WAAAJ,EAAAI,KAAA,UAEAJ,EAAAQ,IAAAV,EAAAE,EAAAI,KAAA,aAiBAH,MAPAL,EAAAC,I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ourcesContent":["/**\r\n * jQuery plugin to store/restore form-state as an object.\r\n *\r\n * This does not deal with encoding/decoding in JSON or any\r\n * other data-format, nor does it deal with storage-media.\r\n *\r\n * Minifies to < 1KB.\r\n *\r\n * To obtain the state of form elements:\r\n * \r\n * var state = $('form').formstate();\r\n *\r\n * To obtain the state of certain form elements:\r\n *\r\n * var state = $('form').formstate(':visible');\r\n *\r\n * To restore state to form elements:\r\n *\r\n * $('form').formstate(state);\r\n *\r\n * To restore state to certain form elements:\r\n *\r\n * $('form :input:visible').formstate(state);\r\n *\r\n * @author Rasmus Schultz \r\n */\r\n(function ($) {\r\n\r\n\tvar\r\n\t\texcluded_type = ':button,:submit,:reset,:password',\r\n\t\tinput_types = 'input,select,textarea';\r\n\r\n\tfunction get_state($inputs) {\r\n\t\tvar data = {};\r\n\r\n\t\t$inputs.each(function () {\r\n\t\t\tvar $input = $(this);\r\n\r\n\t\t\tif ($input.is(excluded_type)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ($input.is(':checkbox')) {\r\n\t\t\t\tvar list = data[$input.attr('name')] || [],\r\n\t\t\t\t\tvalue = $input.attr('value');\r\n\t\t\t\tif ($input.prop('checked')) {\r\n\t\t\t\t\tlist.push(value);\r\n\t\t\t\t}\r\n\t\t\t\tdata[$input.attr('name')] = list;\r\n\t\t\t} else if ($input.is(':radio')) {\r\n\t\t\t\tif ($input.prop('checked')) {\r\n\t\t\t\t\tdata[$input.attr('name')] = $input.attr('value');\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tdata[$input.attr('name')] = $input.val();\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\tfunction set_state($inputs, data) {\r\n\t\t$inputs.each(function () {\r\n\t\t\tvar $input = $(this);\r\n\r\n\t\t\tif ($input.is(excluded_type)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tif ($input.is(':checkbox')) {\r\n\t\t\t\t$input.prop('checked', (data[$input.attr('name')] || []).indexOf($input.attr('value')) != -1);\r\n\t\t\t} else if ($input.is(':radio')) {\r\n\t\t\t\t$input.prop('checked', data[$input.attr('name')] === $input.attr('value'));\r\n\t\t\t} else {\r\n\t\t\t\t$input.val(data[$input.attr('name')]);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t$.fn.formstate = function (a) {\r\n\t\tvar $inputs = (this.is('form') ? this.find(input_types) : this.filter(input_types))\r\n\t\t\t.filter('[name]');\r\n\r\n\t\tif (!a) {\r\n\t\t\treturn get_state($inputs);\r\n\t\t} else if ($.type(a) === 'string') {\r\n\t\t\treturn get_state($inputs.filter(a));\r\n\t\t} else {\r\n\t\t\tset_state($inputs, a);\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t};\r\n\r\n})(jQuery);\r\n\r\nvar search = {\r\n\r\n\r\n\r\n\tactive: false,\r\n\r\n\r\n\r\n\tloaded: false,\r\n\r\n\r\n\r\n\turl: null,\r\n\r\n\trequest: null,\r\n\r\n\r\n\r\n\tlastSearchTerm: '',\r\n\r\n\r\n\r\n\tstickyInstance: false,\r\n\r\n\r\n\r\n\tloading: {\r\n\r\n\t\ttimeout: null,\r\n\r\n\t\twait: 0,\r\n\r\n\t\tstart: false,\r\n\r\n\t\tend: false\r\n\r\n\t},\r\n\r\n\r\n\r\n\ttemplates: {\r\n\r\n\t\tcount: null,\r\n\r\n\t\tfilters: null,\r\n\r\n\t\tappliedFilters: null,\r\n\r\n\t\tresultsList: null,\r\n\r\n\t\tresults: null,\r\n\r\n\t\tpaginationPrev: null,\r\n\r\n\t\tpaginationNext: null,\r\n\r\n\t\tnoResults: null,\r\n\r\n\t\terror: null\r\n\r\n\t},\r\n\r\n\r\n\r\n\tpreInit: function () {\r\n\r\n\t\t// set url\r\n\r\n\t\tsearch.url = '/' + site.html.attr('lang') + '/api/search/jobs/';\r\n\r\n\t\t// scroll to job\r\n\r\n\t\tif (location.hash) {\r\n\r\n\t\t\tif ($(location.hash).length) {\r\n\r\n\t\t\t\tsite.scrollTo($(location.hash).offset().top);\r\n\r\n\t\t\t}\t\t\t\r\n\r\n\t\t}\r\n\r\n\t\t// continue\r\n\r\n\t\tsearch.init(true);\r\n\r\n\t},\r\n\r\n\r\n\r\n\tinit: function (pageLoad) {\r\n\r\n\r\n\r\n\t\t$('.js-replace-search:not(.js-replace-search-done)').each(function () {\r\n\r\n\t\t\tvar wrapper = $(this);\r\n\r\n\r\n\r\n\t\t\tvar elements = {\r\n\r\n\t\t\t\twrapper: wrapper,\r\n\r\n\t\t\t\tform: wrapper.find('form[data-replace-search=\"form\"]:first'),\r\n\r\n\t\t\t\theader: wrapper.find('[data-replace-search=\"header\"]'),\r\n\r\n\t\t\t\tfilters: wrapper.find('[data-replace-search=\"filters\"]'),\r\n\r\n\t\t\t\tfilterOptions: wrapper.find('.js-replace-search-filter'),\r\n\r\n\t\t\t\tappliedFilters: wrapper.find('[data-replace-search=\"applied-filters\"]'),\r\n\r\n\t\t\t\tcount: wrapper.find('[data-replace-search=\"count\"]'),\r\n\r\n\t\t\t\tloader: wrapper.find('[data-replace-search=\"loader\"]'),\r\n\r\n\t\t\t\tsort: wrapper.find('[data-replace-search=\"sort\"]'),\r\n\r\n\t\t\t\tsortOptions: wrapper.find('.js-replace-search-sort'),\r\n\r\n\t\t\t\tearlyCareers: wrapper.find('.js-replace-search-early-careers'),\r\n\r\n\t\t\t\tjobs: wrapper.find('[data-replace-search=\"jobs\"]'),\r\n\r\n\t\t\t\tjobPreviews: wrapper.find('.js-job-preview'),\r\n\r\n\t\t\t\tresults: wrapper.find('[data-replace-search=\"results\"]'),\r\n\r\n\t\t\t\tnoResults: wrapper.find('[data-replace-search=\"no-results\"]'),\r\n\r\n\t\t\t\tpagination: wrapper.find('[data-replace-search=\"pagination-prev\"], [data-replace-search=\"pagination-next\"]'),\r\n\r\n\t\t\t\tpaginationPrev: wrapper.find('[data-replace-search=\"pagination-prev\"]'),\r\n\r\n\t\t\t\tpaginationPrevButton: wrapper.find('[data-replace-search=\"pagination-prev-button\"]'),\r\n\r\n\t\t\t\tpaginationNext: wrapper.find('[data-replace-search=\"pagination-next\"]'),\r\n\r\n\t\t\t\tpaginationNextButton: wrapper.find('[data-replace-search=\"pagination-next-button\"]'),\r\n\r\n\t\t\t\tpaginationButtons: wrapper.find('[data-replace-search=\"pagination-prev-button\"], [data-replace-search=\"pagination-next-button\"]'),\r\n\r\n\t\t\t\tsearchButtons: wrapper.find('.js-replace-search-submit'),\r\n\r\n\t\t\t\tsearchInput: wrapper.find('.js-replace-search-input'),\r\n\r\n\t\t\t\tsearchLabel: wrapper.find('.js-replace-search-label'),\r\n\r\n\t\t\t\tclearFilter: wrapper.find('.js-replace-search-filter-clear'),\r\n\r\n\t\t\t\tclearAllFilters: wrapper.find('.js-replace-search-filter-clear-all')\r\n\r\n\t\t\t};\r\n\r\n\r\n\r\n\t\t\tvar currentPage = elements.form.find('[name=\"page\"]').val();\r\n\r\n\r\n\r\n\t\t\tvar _bindEvents = function () {\r\n\r\n\r\n\r\n\t\t\t\t// update elements\r\n\r\n\t\t\t\telements.filterOptions = wrapper.find('.js-replace-search-filter');\r\n\r\n\t\t\t\telements.sortOptions = wrapper.find('.js-replace-search-sort');\r\n\r\n\t\t\t\telements.earlyCareers = wrapper.find('.js-replace-search-early-careers');\r\n\r\n\t\t\t\telements.jobPreviews = wrapper.find('.js-job-preview');\r\n\r\n\t\t\t\telements.results = wrapper.find('[data-replace-search=\"results\"]');\r\n\r\n\t\t\t\telements.pagination = wrapper.find('[data-replace-search=\"pagination-prev\"], [data-replace-search=\"pagination-next\"]');\r\n\r\n\t\t\t\telements.paginationPrevButton = wrapper.find('[data-replace-search=\"pagination-prev-button\"]');\r\n\r\n\t\t\t\telements.paginationNextButton = wrapper.find('[data-replace-search=\"pagination-next-button\"]');\r\n\r\n\t\t\t\telements.paginationButtons = wrapper.find('[data-replace-search=\"pagination-prev-button\"], [data-replace-search=\"pagination-next-button\"]');\r\n\r\n\t\t\t\telements.searchButtons = wrapper.find('.js-replace-search-submit');\r\n\r\n\t\t\t\telements.searchInput = wrapper.find('.js-replace-search-input');\r\n\r\n\t\t\t\telements.searchLabel = wrapper.find('.js-replace-search-label');\r\n\r\n\t\t\t\telements.clearFilter = wrapper.find('.js-replace-search-filter-clear');\r\n\r\n\t\t\t\telements.clearAllFilters = wrapper.find('.js-replace-search-filter-clear-all');\r\n\r\n\r\n\r\n\t\t\t\t// update prev page\r\n\r\n\t\t\t\telements.paginationPrevButton.attr('data-page', parseInt(elements.form.find('[name=\"minpage\"]').val(), 10) - 1);\r\n\r\n\r\n\r\n\t\t\t\t// update next page\r\n\r\n\t\t\t\telements.paginationNextButton.attr('data-page', parseInt(elements.form.find('[name=\"maxpage\"]').val(), 10) + 1);\r\n\r\n\r\n\r\n\t\t\t\t// job click\r\n\r\n\t\t\t\telements.jobPreviews.not('.js-job-preview-done').each(function () {\r\n\r\n\t\t\t\t\tvar preview = $(this);\r\n\r\n\r\n\r\n\t\t\t\t\t// clicks\r\n\r\n\t\t\t\t\tpreview.find('a').off('click').on('click', function () {\r\n\r\n\t\t\t\t\t\tvar id = preview.attr('data-results-id');\r\n\r\n\t\t\t\t\t\tvar elementId = preview.attr('id');\r\n\r\n\t\t\t\t\t\tvar page = preview.attr('data-results-page') || currentPage;\r\n\r\n\r\n\r\n\t\t\t\t\t\t// update page\r\n\r\n\t\t\t\t\t\telements.form.find('[name=\"page\"]').val(page);\r\n\r\n\r\n\r\n\t\t\t\t\t\t// update history\r\n\r\n\t\t\t\t\t\thistory.replaceState(elements.form.serialize(), '', '?' + elements.form.serialize() + '#' + elementId);\r\n\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// done\r\n\r\n\t\t\t\t\tpreview.addClass('js-job-preview-done');\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// search click\r\n\r\n\t\t\t\telements.searchButtons.off('click').on('click', function () {\r\n\r\n\t\t\t\t\tvar link = $(this);\r\n\r\n\t\t\t\t\t// reset pagination\r\n\r\n\t\t\t\t\t_resetPagination();\r\n\r\n\t\t\t\t\t// clear filters\r\n\r\n\t\t\t\t\tif (link.attr('data-type') != 'undefined' && link.attr('data-type') != 'filter') {\r\n\r\n\t\t\t\t\t\telements.filterOptions.filter(':checked').removeAttr('checked');\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// scroll\r\n\r\n\t\t\t\t\tsetTimeout(function () {\r\n\r\n\r\n\r\n\t\t\t\t\t\t// check if search term has changed, @todo - could potentially be refactored\r\n\r\n\r\n\r\n\t\t\t\t\t\tif (search.lastSearchTerm !== elements.searchInput.val()) {\r\n\r\n\r\n\r\n\t\t\t\t\t\t\tsearch.lastSearchTerm = elements.searchInput.val();\r\n\r\n\t\t\t\t\t\t\telements.sortOptions.filter('[value=\"Score\"]').prop('checked', true);\r\n\r\n\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\t\t// load new results (this has to go in this timeout so the filters have time to be moved back inside the form for serialization)\r\n\r\n\t\t\t\t\t\tsearch.load(elements, elements.form.serialize(), '', 'pushState');\r\n\r\n\t\t\t\t\t}, 300);\r\n\r\n\t\t\t\t\t// don't restore seach state\r\n\r\n\t\t\t\t\tsearch.state.should_restore = false;\r\n\r\n\t\t\t\t\t// close all pop instances (can only be filters)\r\n\r\n\t\t\t\t\tpopups.instance.close();\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// clear filter click\r\n\r\n\t\t\t\telements.clearFilter.off('click').on('click', function () {\r\n\r\n\t\t\t\t\tvar target = $(this);\r\n\r\n\t\t\t\t\ttarget.closest('.mfp-filters-overlay').find('input[type=checkbox]').prop('checked', false);\r\n\r\n\t\t\t\t\tsearch.displayCount.show(elements);\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// clear all click\r\n\r\n\t\t\t\telements.clearAllFilters.off('click').on('click', function () {\r\n\r\n\t\t\t\t\t// uncheck filters\r\n\r\n\t\t\t\t\telements.filterOptions.filter(':checked').removeAttr('checked');\r\n\r\n\t\t\t\t\t// uncheck early careers\r\n\r\n\t\t\t\t\telements.earlyCareers.removeAttr('checked');\r\n\r\n\t\t\t\t\t// reset pagination\r\n\r\n\t\t\t\t\t_resetPagination();\r\n\r\n\t\t\t\t\t// load new results\r\n\r\n\t\t\t\t\tsearch.load(elements, elements.form.serialize(), '', 'pushState');\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// sort click\r\n\r\n\t\t\t\telements.sortOptions.off('change').on('change', function () {\r\n\r\n\t\t\t\t\tvar input = $(this);\r\n\r\n\t\t\t\t\t// reset pagination\r\n\r\n\t\t\t\t\t_resetPagination();\r\n\r\n\t\t\t\t\t// load new results\r\n\r\n\t\t\t\t\tsearch.load(elements, elements.form.serialize(), '', 'replaceState');\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// early careers click\r\n\r\n\t\t\t\telements.earlyCareers.off('change').on('change', function () {\r\n\r\n\t\t\t\t\tvar input = $(this);\r\n\r\n\t\t\t\t\t// reset pagination\r\n\r\n\t\t\t\t\t_resetPagination();\r\n\r\n\t\t\t\t\t// load new results\r\n\r\n\t\t\t\t\tsearch.load(elements, elements.form.serialize(), '', 'replaceState');\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// filter options change\r\n\r\n\t\t\t\telements.filterOptions.off('change').on('change', function () {\r\n\r\n\t\t\t\t\tsearch.displayCount.show(elements);\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// prev click\r\n\r\n\t\t\t\telements.paginationPrevButton.off('click').on('click', function () {\r\n\r\n\t\t\t\t\tvar link = $(this);\r\n\r\n\t\t\t\t\t// show loading anim\r\n\r\n\t\t\t\t\tif (link.is('.loading')) return false;\r\n\r\n\t\t\t\t\t// set page\r\n\r\n\t\t\t\t\telements.form.find('[name=\"page\"]').val(link.attr('data-page'));\r\n\r\n\t\t\t\t\t// update min\r\n\r\n\t\t\t\t\telements.form.find('[name=\"minpage\"]').val(function (i, oldVal) {\r\n\r\n\t\t\t\t\t\treturn parseInt(oldVal, 10) - 1;\r\n\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// load additional results\r\n\r\n\t\t\t\t\tsearch.load(elements, elements.form.serialize(), 'prepend', 'replaceState');\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// next click\r\n\r\n\t\t\t\telements.paginationNextButton.off('click').on('click', function () {\r\n\r\n\t\t\t\t\tvar link = $(this);\r\n\r\n\t\t\t\t\t// show loading anim\r\n\r\n\t\t\t\t\tif (link.is('.loading')) return false;\r\n\r\n\t\t\t\t\t// set page\r\n\r\n\t\t\t\t\telements.form.find('[name=\"page\"]').val(link.attr('data-page'));\r\n\r\n\t\t\t\t\t// update max\r\n\r\n\t\t\t\t\telements.form.find('[name=\"maxpage\"]').val(function (i, oldVal) {\r\n\r\n\t\t\t\t\t\treturn parseInt(oldVal, 10) + 1;\r\n\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// load additional results\r\n\r\n\t\t\t\t\tsearch.load(elements, elements.form.serialize(), 'append', 'pushState');\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// input setup\r\n\r\n\r\n\r\n\t\t\t\tif (elements.searchInput.val() !== '') { elements.searchLabel.addClass('m-search-block__label--move'); }\r\n\r\n\r\n\r\n\t\t\t\t// input focus\r\n\r\n\r\n\r\n\t\t\t\telements.searchInput.off('focus').on('focus', function () {\r\n\r\n\t\t\t\t\telements.searchLabel.addClass('m-search-block__label--move');\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t\t// input blur\r\n\r\n\r\n\r\n\t\t\t\telements.searchInput.off('blur').on('blur', function () {\r\n\r\n\t\t\t\t\tif (elements.searchInput.val() == '') { elements.searchLabel.removeClass('m-search-block__label--move'); }\r\n\r\n\t\t\t\t});\r\n\r\n\r\n\r\n\t\t\t};\r\n\r\n\r\n\r\n\t\t\tvar _resetPagination = function () {\r\n\r\n\t\t\t\t// reset page number to \"1\" along with min/max\r\n\r\n\t\t\t\telements.form.find('[name=\"page\"]').val(1);\r\n\r\n\t\t\t\telements.form.find('[name=\"minpage\"]').val(1);\r\n\r\n\t\t\t\telements.form.find('[name=\"maxpage\"]').val(1);\r\n\r\n\t\t\t};\r\n\r\n\r\n\r\n\t\t\t// init\r\n\r\n\t\t\t_bindEvents();\r\n\r\n\r\n\r\n\t\t\t// ajax\r\n\r\n\t\t\tsite.doc.ajaxComplete(function () {\r\n\r\n\t\t\t\t_bindEvents();\r\n\r\n\t\t\t});\r\n\r\n\r\n\r\n\t\t\t// load filters\r\n\r\n\t\t\tvar filterQuery = 'q=';\r\n\r\n\t\t\tif (location.href.indexOf('?')) {\r\n\r\n\t\t\t\tfilterQuery = location.href.split('?')[1];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tsearch.loadFilters(elements, filterQuery + '&includeSearchResults=false');\r\n\r\n\r\n\r\n\t\t\t// check if has jobs\r\n\r\n\t\t\tif (!search.hasResults(elements)) {\r\n\r\n\t\t\t\tsearch.showHideNoResults(elements, false);\r\n\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t\t// history\r\n\r\n\t\t\twindow.onpopstate = function (e) {\r\n\r\n\t\t\t\tif (e.state) {\r\n\r\n\t\t\t\t\t// set page\r\n\r\n\t\t\t\t\telements.form.find('[name=\"page\"]').val(e.state.OriginalQuery.Page);\r\n\r\n\t\t\t\t\t// update results\r\n\r\n\t\t\t\t\tsearch.load(elements, '', '', '', false, e.state);\r\n\r\n\t\t\t\t\t// update query // TODO\r\n\r\n\t\t\t\t\telements.form.find('[name=\"q\"]').val(e.state.OriginalQuery.Query);\r\n\r\n\t\t\t\t\t// scroll\r\n\r\n\t\t\t\t\tsetTimeout(function () {\r\n\r\n\t\t\t\t\t\tsite.scrollTo(elements.noResults.offset().top);\r\n\r\n\t\t\t\t\t}, 100);\r\n\r\n\t\t\t\t\t// events\r\n\r\n\t\t\t\t\t_bindEvents();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t};\r\n\r\n\r\n\r\n\t\t\t// set up sticky filters\r\n\r\n\r\n\r\n\t\t\tsearch.stickyFilters.init();\r\n\r\n\r\n\r\n\t\t\t// done\r\n\r\n\t\t\twrapper.addClass('js-replace-search-done');\r\n\r\n\r\n\r\n\t\t\t// set active flag to true\r\n\r\n\t\t\tsearch.active = true;\r\n\r\n\r\n\r\n\t\t\tif (pageLoad) {\r\n\r\n\r\n\r\n\t\t\t\tif (elements.searchInput.val() !== '' && !window.location.hash) {\r\n\r\n\r\n\r\n\t\t\t\t\tsite.html.add(site.body).animate({ scrollTop: (elements.appliedFilters.parent().offset().top - $('.l-header').height()) }, 500);\r\n\r\n\t\t\t\t\telements.count.focus();\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t});\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tload: function (elements, data, appendResults, useHistory, altData) {\r\n\r\n\r\n\r\n\t\tvar appending = appendResults == 'append';\r\n\r\n\t\tvar prepending = appendResults == 'prepend';\r\n\r\n\t\tvar anchorItem = appending ? elements.results.find('[data-results-id]').last() : prepending ? elements.results.find('[data-results-id]').first() : false;\r\n\r\n\r\n\r\n\t\t// clear prev request\r\n\r\n\t\tif (search.request != null) {\r\n\r\n\t\t\tsearch.request.abort();\r\n\r\n\t\t\tsearch.request = null;\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\t// disable buttons\r\n\r\n\t\tif (appending || prepending) {\r\n\r\n\t\t\telements.paginationButtons.addClass('loading');\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\r\n\r\n\r\n\t\t\tsearch.loading.wait = 0;\r\n\r\n\r\n\r\n\t\t\tsearch.loading.timeout = setTimeout(function () {\r\n\r\n\r\n\r\n\t\t\t\tif ('performance' in window !== false) {\r\n\r\n\r\n\r\n\t\t\t\t\tsearch.loading.start = performance.now();\r\n\r\n\t\t\t\t\tsearch.loading.wait = 500; // if the loader is to show, the minimum time it will show for\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\telements.loader.show();\r\n\r\n\r\n\r\n\t\t\t}, 500); // grace period before we might choose to show the loader\r\n\r\n\r\n\r\n\t\t\telements.jobs.hide();\r\n\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\t// new request\r\n\r\n\t\tif (data == '') {\r\n\r\n\t\t\t// update\r\n\r\n\t\t\tsearch.update(elements, altData, appendResults, filtering);\r\n\r\n\t\t\t// enable buttons\r\n\r\n\t\t\tif (appending || prepending) {\r\n\r\n\t\t\t\telements.paginationButtons.removeClass('loading');\r\n\r\n\r\n\r\n\t\t\t\tif (anchorItem.length) {\r\n\r\n\r\n\r\n\t\t\t\t\tif (appending) {\r\n\r\n\r\n\r\n\t\t\t\t\t\tanchorItem.next('[data-results-id]').find('.m-job-preview__title').focus();\r\n\r\n\r\n\r\n\t\t\t\t\t} else if (prepending) {\r\n\r\n\r\n\r\n\t\t\t\t\t\tanchorItem.prev('[data-results-id]').find('.m-job-preview__title').focus();\r\n\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\r\n\t\t\tsearch.request = $.ajax({\r\n\r\n\t\t\t\turl: search.url,\r\n\r\n\t\t\t\tdata: data,\r\n\r\n\t\t\t\tsuccess: function (response) {\r\n\r\n\r\n\r\n\t\t\t\t\t// reset page\r\n\r\n\t\t\t\t\tif (prepending) {\r\n\r\n\t\t\t\t\t\telements.form.find('[name=\"page\"]').val(parseInt(response.OriginalQuery.Page, 10) + 1);\r\n\r\n\t\t\t\t\t\tdata = elements.form.serialize();\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\t// history\r\n\r\n\t\t\t\t\tif (useHistory != null) {\r\n\r\n\t\t\t\t\t\tif (useHistory == 'pushState' && history.pushState) {\r\n\r\n\t\t\t\t\t\t\thistory.pushState(response, '', '?' + data);\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\telse if (useHistory == 'replaceState' && history.replaceState) {\r\n\r\n\t\t\t\t\t\t\thistory.replaceState(response, '', '?' + data);\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\t// update\r\n\r\n\t\t\t\t\tsearch.update(elements, response, appendResults);\r\n\r\n\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\terror: function (e) {\r\n\r\n\r\n\r\n\t\t\t\t\tif (search.loading.timeout) { clearTimeout(search.loading.timeout); }\r\n\r\n\r\n\r\n\t\t\t\t\tvar errorHtml = search.getTemplate(search.templates.error, '#searchErrorResultsTemplate', false);\r\n\r\n\t\t\t\t\telements.noResults.html(errorHtml);\r\n\r\n\r\n\r\n\t\t\t\t\telements.loader.hide();\r\n\r\n\t\t\t\t\telements.jobs.show();\r\n\r\n\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tcomplete: function () {\r\n\r\n\t\t\t\t\t// enable buttons\r\n\r\n\t\t\t\t\tif (appending || prepending) {\r\n\r\n\t\t\t\t\t\telements.paginationButtons.removeClass('loading');\r\n\r\n\r\n\r\n\t\t\t\t\t\tif (anchorItem.length) {\r\n\r\n\r\n\r\n\t\t\t\t\t\t\tif (appending) {\r\n\r\n\r\n\r\n\t\t\t\t\t\t\t\tanchorItem.next('[data-results-id]').find('.m-job-preview__title').focus();\r\n\r\n\r\n\r\n\t\t\t\t\t\t\t} else if (prepending) {\r\n\r\n\r\n\r\n\t\t\t\t\t\t\t\tanchorItem.prev('[data-results-id]').find('.m-job-preview__title').focus();\r\n\r\n\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// clear request\r\n\r\n\t\t\t\t\tsearch.request = null;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tupdate: function (elements, data, appendResults) {\r\n\r\n\r\n\r\n\t\tvar appending = appendResults == 'append';\r\n\r\n\t\tvar prepending = appendResults == 'prepend';\r\n\r\n\r\n\r\n\t\tvar displayedItems = data.DisplayedItems;\r\n\r\n\t\tvar totalItems = data.TotalItems;\r\n\r\n\r\n\r\n\t\t// get scroll position\r\n\r\n\t\tvar oldHeight = site.doc.height();\r\n\r\n\t\tvar oldScroll = site.win.scrollTop();\r\n\r\n\r\n\r\n\t\t// set has results\r\n\r\n\t\telements.wrapper.attr('data-replace-search-has-jobs', data.Items.length ? true : false);\r\n\r\n\r\n\r\n\t\t// update count\r\n\r\n\t\tif (!appending && !prepending) {\r\n\r\n\t\t\tdata.TotalItems = site.translations['settingsTranslationXJobsFound'].replace('%total%', totalItems);\r\n\r\n\t\t\telements.count.html(search.getTemplate(search.templates.count, '#searchResultsCountTemplate', data));\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\t// hide appropriate elements\r\n\r\n\t\tsearch.showHideNoResults(elements, search.hasResults(elements));\r\n\r\n\r\n\r\n\t\t// update results\r\n\r\n\t\tif (data.Items.length) {\r\n\r\n\t\t\tif (!elements.results.length) {\r\n\r\n\t\t\t\telements.noResults.html(search.getTemplate(search.templates.resultsList, '#searchResultsListTemplate'));\r\n\r\n\t\t\t\telements.results = elements.wrapper.find('[data-replace-search=\"results\"]');\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor (var i = 0; i < data.Items.length; i++) {\r\n\r\n\t\t\t\tvar item = data.Items[i];\r\n\r\n\t\t\t\titem.MoreDetails = site.translations['settingsTranslationMoreDetails'];\r\n\r\n\t\t\t\titem.MoreDetailsLabel = site.translations['settingsTranslationMoreDetailsAboutX'].replace('%title%', item.Title);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar templateData = {\r\n\r\n\t\t\t\tJobs: data.Items,\r\n\r\n\t\t\t\tPage: data.OriginalQuery.Page\r\n\r\n\t\t\t};\r\n\r\n\t\t\tif (appending) {\r\n\r\n\t\t\t\telements.results.append(search.getTemplate(search.templates.results, '#jobPreviewTemplate', templateData));\r\n\r\n\t\t\t}\r\n\r\n\t\t\telse if (prepending) {\r\n\r\n\t\t\t\telements.results.prepend(search.getTemplate(search.templates.results, '#jobPreviewTemplate', templateData));\r\n\r\n\t\t\t}\r\n\r\n\t\t\telse {\r\n\r\n\t\t\t\telements.results.html(search.getTemplate(search.templates.results, '#jobPreviewTemplate', templateData));\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\telse {\r\n\r\n\t\t\telements.noResults.html(search.getTemplate(search.templates.noResults, '#searchNoResultsTemplate'));\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\t// update prev\r\n\r\n\t\tif (prepending) {\r\n\r\n\t\t\t// load\r\n\r\n\t\t\tdata.ShowPreviousLabel = site.translations['settingsTranslationShowPrevious'];\r\n\r\n\t\t\tdata.PrevPage = parseInt(data.OriginalQuery.MinPage, 10);\r\n\r\n\t\t\telements.paginationPrev.html(search.getTemplate(search.templates.paginationPrev, '#searchResultsPrevTemplate', data));\r\n\r\n\t\t\t// restore scroll pos\r\n\r\n\t\t\tsite.doc.scrollTop(oldScroll + site.doc.height() - oldHeight);\r\n\r\n\t\t}\r\n\r\n\t\t// update next\r\n\r\n\t\tdata.ShowingTotalItems = site.translations['settingsTranslationShowingXOfYJobs'].replace('%total%', displayedItems).replace('%max%', totalItems);\r\n\r\n\t\tdata.ShowMoreLabel = site.translations['settingsTranslationShowMore'];\r\n\r\n\t\tdata.NextPage = parseInt(data.OriginalQuery.MaxPage, 10);\r\n\r\n\t\tdata.ReturnToFiltersText = site.translations['settingsTranslationReturnToFilters'] || 'Return to filters';\r\n\r\n\t\telements.paginationNext.html(search.getTemplate(search.templates.paginationNext, '#searchResultsNextTemplate', data));\r\n\r\n\r\n\r\n\t\t// update applied filters\r\n\r\n\r\n\r\n\t\tvar earlyCareersList = search.getEarlyCareers(data.Filters.FiltersList),\r\n\r\n\t\tfiltersList = search.getAppliedFilters(data.Filters.FiltersList),\r\n\r\n\t\tclearFilters = search.isFiltering(earlyCareersList, filtersList);\r\n\r\n\r\n\r\n\t\telements.appliedFilters.html(search.getTemplate(search.templates.appliedFilters, '#searchAppliedFiltersTemplate', {\r\n\r\n\t\t\tAppliedFilters: filtersList,\r\n\r\n\t\t\tRemoveText: site.translations[\"settingsTranslationRemove\"],\r\n\r\n\t\t\tClearFiltersButton: site.translations[\"settingsTranslationRemoveAllFilters\"],\r\n\r\n\t\t\tEarlyCareers: earlyCareersList,\r\n\r\n\t\t\tTitle: data.Filters.Title,\r\n\r\n\t\t\tShowClearFiltersButton: clearFilters,\r\n\r\n\t\t\tFilterResultsBy: site.translations[\"settingsTranslationFilterResultsBy\"]\r\n\r\n\t\t}));\r\n\r\n\r\n\r\n\t\t// trigger ajax update\r\n\r\n\t\tsite.doc.trigger('ajaxComplete');\r\n\r\n\r\n\r\n\t\t// show results\r\n\r\n\t\tif (!(appending || prepending)) {\r\n\r\n\r\n\r\n\t\t\tclearTimeout(search.loading.timeout);\r\n\r\n\r\n\r\n\t\t\tif ('performance' in window !== false) {\r\n\r\n\r\n\r\n\t\t\t\tsearch.loading.end = performance.now();\r\n\r\n\r\n\r\n\t\t\t\tvar time_taken = parseInt((search.loading.end - search.loading.start));\r\n\r\n\t\t\t\tif (time_taken < search.loading.wait) { search.loading.wait = (search.loading.wait - time_taken); }\r\n\r\n\r\n\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t\tsetTimeout(function () {\r\n\r\n\r\n\r\n\t\t\t\telements.loader.hide();\r\n\r\n\t\t\t\telements.jobs.show();\r\n\r\n\r\n\r\n\t\t\t\tsearch.stickyFilters.allow = false;\r\n\r\n\t\t\t\tsearch.stickyFilters.target.removeClass('sticky-filters--in');\r\n\r\n\t\t\t\tsite.html.add(site.body).animate({ scrollTop: (elements.appliedFilters.offset().top - $('.l-header').height()) }, 500);\r\n\r\n\t\t\t\tsetTimeout(function () { search.stickyFilters.allow = true; }, 550);\r\n\r\n\r\n\r\n\t\t\t\tif (elements.searchInput.val() !== '') { elements.count.focus(); }\r\n\r\n\r\n\r\n\t\t\t}, search.loading.wait);\r\n\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\tsearch.displayCount.show(elements);\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tloadFilters: function (elements, query) {\r\n\r\n\t\t$.ajax({\r\n\r\n\t\t\turl: search.url,\r\n\r\n\t\t\tdata: query,\r\n\r\n\t\t\tsuccess: function (response) {\r\n\r\n\t\t\t\t// early careers\r\n\r\n\t\t\t\tresponse.Filters.FiltersList.Departments.ShowEarlyCareers = true;\r\n\r\n\t\t\t\tresponse.Filters.FiltersList.Territories.ShowEarlyCareers = false;\r\n\r\n\t\t\t\t// update\r\n\r\n\t\t\t\telements.filters.html(search.getTemplate(search.templates.filters, '#searchFiltersTemplate', {\r\n\r\n\t\t\t\t\tHasSelectedFilters: response.Filters.FiltersSelected,\r\n\r\n\t\t\t\t\tFilterGroups: [\r\n\r\n\t\t\t\t\t\tresponse.Filters.FiltersList.Territories,\r\n\r\n\t\t\t\t\t\tresponse.Filters.FiltersList.Departments\r\n\r\n\t\t\t\t\t],\r\n\r\n\t\t\t\t\tEarlyCareers: response.Filters.FiltersList.EarlyCareers,\r\n\r\n\t\t\t\t\tClearText: site.translations[\"settingsTranslationClear\"],\r\n\r\n\t\t\t\t\tApplyText: site.translations[\"settingsTranslationApply\"]\r\n\r\n\t\t\t\t}));\r\n\r\n\r\n\r\n\t\t\t\t// selected\r\n\r\n\r\n\r\n\t\t\t\tvar earlyCareersList = search.getEarlyCareers(response.Filters.FiltersList),\r\n\r\n\t\t\t\tfiltersList = search.getAppliedFilters(response.Filters.FiltersList),\r\n\r\n\t\t\t\tclearFilters = search.isFiltering(earlyCareersList, filtersList);\r\n\r\n\r\n\r\n\t\t\t\telements.appliedFilters.html(search.getTemplate(search.templates.appliedFilters, '#searchAppliedFiltersTemplate', {\r\n\r\n\t\t\t\t\tAppliedFilters: filtersList,\r\n\r\n\t\t\t\t\tClearFiltersButton: site.translations[\"settingsTranslationRemoveAllFilters\"],\r\n\r\n\t\t\t\t\tEarlyCareers: earlyCareersList,\r\n\r\n\t\t\t\t\tTitle: response.Filters.Title,\r\n\r\n\t\t\t\t\tShowClearFiltersButton: clearFilters,\r\n\r\n\t\t\t\t\tFilterResultsBy: site.translations[\"settingsTranslationFilterResultsBy\"]\r\n\r\n\t\t\t\t}));\r\n\r\n\r\n\r\n\t\t\t\tif (elements.searchInput.val() !== '') { elements.count.focus(); }\r\n\r\n\r\n\r\n\t\t\t\tsearch.displayCount.show(elements);\r\n\r\n\r\n\r\n\t\t\t},\r\n\r\n\t\t\terror: function (e) {\r\n\r\n\t\t\t\tconsole.log(e);\r\n\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\r\n\r\n\t\t// cache last search term @todo - potentially move this in the future\r\n\r\n\r\n\r\n\t\tsearch.lastSearchTerm = elements.searchInput.val();\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tgetAppliedFilters: function (filters) {\r\n\r\n\t\tvar list = [];\r\n\r\n\t\t// departments\r\n\r\n\t\tvar refParent = filters.Departments.ParentName;\r\n\r\n\t\tvar refTitle = filters.Departments.Title;\r\n\r\n\t\tvar children = [];\r\n\r\n\t\tfor (var i = 0; i < filters.Departments.Items.length; i++) {\r\n\r\n\t\t\tvar item = filters.Departments.Items[i];\r\n\r\n\t\t\tfor (var j = 0; j < item.Children.length; j++) {\r\n\r\n\t\t\t\tvar child = item.Children[j];\r\n\r\n\t\t\t\tif (child.Selected) { children.push(child); }\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlist.push({\r\n\r\n\t\t\tRef: refParent,\r\n\r\n\t\t\tTitle: refTitle,\r\n\r\n\t\t\tCount: children.length,\r\n\r\n\t\t\tChildren: children\r\n\r\n\t\t});\r\n\r\n\t\t// territories\r\n\r\n\t\trefParent = filters.Territories.ParentName;\r\n\r\n\t\trefTitle = filters.Territories.Title;\r\n\r\n\t\tchildren = [];\r\n\r\n\t\tfor (var i = 0; i < filters.Territories.Items.length; i++) {\r\n\r\n\t\t\tvar item = filters.Territories.Items[i];\r\n\r\n\t\t\tfor (var j = 0; j < item.Children.length; j++) {\r\n\r\n\t\t\t\tvar child = item.Children[j];\r\n\r\n\t\t\t\tif (child.Selected) { children.push(child); }\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tlist.push({\r\n\r\n\t\t\tRef: refParent,\r\n\r\n\t\t\tTitle: refTitle,\r\n\r\n\t\t\tCount: children.length,\r\n\r\n\t\t\tChildren: children\r\n\r\n\t\t});\r\n\r\n\t\treturn list;\r\n\r\n\t},\r\n\r\n\r\n\r\n\tgetEarlyCareers: function (filters) {\r\n\r\n\t\tvar refParent = filters.EarlyCareers.ParentName;\r\n\r\n\t\tfor (var i = 0; i < filters.EarlyCareers.Items.length; i++) {\r\n\r\n\t\t\tvar item = filters.EarlyCareers.Items[i];\r\n\r\n\t\t\titem.Ref = refParent + '|' + item.Id;\r\n\r\n\t\t\titem.ParentName = refParent;\r\n\r\n\t\t\treturn item; // we only ever want one here\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\r\n\r\n\tgetTemplate: function (templateRef, templateId, data) {\r\n\r\n\t\tvar template = templateRef;\r\n\r\n\t\tif (template == null) {\r\n\r\n\t\t\tvar temp = $(templateId);\r\n\r\n\t\t\tif (!temp.length) {\r\n\r\n\t\t\t\tconsole.log('Error: cannot find template ' + templateId);\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttemplate = Hogan.compile(temp.html());\r\n\r\n\t\t\ttemplateRef = template;\r\n\r\n\t\t}\r\n\r\n\t\treturn template.render(data);\r\n\r\n\t},\r\n\r\n\r\n\r\n\tisFiltering: function (earlyCareersList, filtersList) {\r\n\r\n\r\n\r\n\t\tif (earlyCareersList.Selected) { return true; }\r\n\r\n\t\tfor (var i = 0; i < filtersList.length; i++) { if (filtersList[i].Count) { return true; } }\r\n\r\n\r\n\r\n\t\treturn false;\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\thasResults: function (elements) {\r\n\r\n\t\treturn elements.wrapper.attr('data-replace-search-has-jobs').toLowerCase() == 'true' ? true : false;\r\n\r\n\t},\r\n\r\n\r\n\r\n\tshowHideNoResults: function (elements, show) {\r\n\r\n\t\tvar e = elements.header\r\n\r\n\t\t\t.add(elements.paginationPrev)\r\n\r\n\t\t\t.add(elements.paginationNext)\r\n\r\n\t\t\t.add(elements.sort);\r\n\r\n\t\tshow ? e.removeClass('m-jobs-list__header--hidden') : e.addClass('m-jobs-list__header--hidden');\r\n\r\n\t},\r\n\r\n\r\n\r\n\tcollapseFilters: function (elements) {\r\n\r\n\t\telements.wrapper.find('.js-accordion-title.expanded').click();\r\n\r\n\t},\r\n\r\n\r\n\r\n\tdisplayCount: {\r\n\r\n\r\n\r\n\t\tendpoint: '/' + site.html.attr('lang') + '/api/search/jobs-count/',\r\n\r\n\r\n\r\n\t\tstart: 0,\r\n\r\n\r\n\r\n\t\tend: 0,\r\n\r\n\r\n\r\n\t\twait: 0,\r\n\r\n\r\n\r\n\t\ttimeout: null,\r\n\r\n\r\n\r\n\t\trequest: null,\r\n\r\n\r\n\r\n\t\tshow: function (elements) {\r\n\r\n\r\n\r\n\t\t\tsearch.displayCount.wait = 0;\r\n\r\n\t\t\tclearTimeout(search.displayCount.timeout);\r\n\r\n\r\n\r\n\t\t\tsearch.displayCount.timeout = setTimeout(function () {\r\n\r\n\r\n\r\n\t\t\t\tif ('performance' in window !== false) {\r\n\r\n\r\n\r\n\t\t\t\t\tsearch.displayCount.start = performance.now();\r\n\r\n\t\t\t\t\tsearch.displayCount.wait = 500; // if the loader is to show, the minimum time it will show for\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t$('.js-replace-search-job-count').hide();\r\n\r\n\t\t\t\t$('.js-replace-search-job-loader').show();\r\n\r\n\r\n\r\n\t\t\t}, 500); // grace period before we might choose to show the loader\r\n\r\n\r\n\r\n\t\t\t// cache serialized form and the filters overlay\r\n\r\n\r\n\r\n\t\t\tvar seralizedForm = elements.form.serialize(),\r\n\r\n\t\t\tfiltersOverlay = $('.mfp-filters-overlay');\r\n\r\n\r\n\r\n\t\t\t// if filters overlay exists, add the form elements inside to the serialized form string\r\n\r\n\r\n\r\n\t\t\tif (filtersOverlay.length) { seralizedForm += '&' + filtersOverlay.find(':input').serialize(); }\r\n\r\n\r\n\r\n\t\t\t// if there is an existing request, abort it\r\n\r\n\r\n\r\n\t\t\tif (search.displayCount.request != null) {\r\n\r\n\r\n\r\n\t\t\t\tsearch.displayCount.request.abort();\r\n\r\n\t\t\t\tsearch.displayCount.request = null;\r\n\r\n\r\n\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t\t// make request\r\n\r\n\r\n\r\n\t\t\tsearch.displayCount.request = $.ajax({\r\n\r\n\t\t\t\turl: search.displayCount.endpoint,\r\n\r\n\t\t\t\tdata: seralizedForm,\r\n\r\n\t\t\t\tsuccess: function (response) {\r\n\r\n\r\n\r\n\t\t\t\t\tclearTimeout(search.displayCount.timeout);\r\n\r\n\r\n\r\n\t\t\t\t\tif ('performance' in window !== false) {\r\n\r\n\r\n\r\n\t\t\t\t\t\tsearch.displayCount.end = performance.now();\r\n\r\n\r\n\r\n\t\t\t\t\t\tvar time_taken = parseInt((search.displayCount.end - search.displayCount.start));\r\n\r\n\t\t\t\t\t\tif (time_taken < search.displayCount.wait) { search.displayCount.wait = (search.displayCount.wait - time_taken); }\r\n\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t\tsetTimeout(function () {\r\n\r\n\r\n\r\n\t\t\t\t\t\tvar text = site.translations['settingsTranslationXJobsFoundShort'].replace('%total%', response.TotalItems);\r\n\r\n\t\t\t\t\t\t$('.js-replace-search-job-count').show().html(text);\r\n\r\n\t\t\t\t\t\t$('.js-replace-search-job-loader').hide();\r\n\r\n\r\n\r\n\t\t\t\t\t}, search.loading.wait);\r\n\r\n\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\terror: function (e) {\r\n\r\n\r\n\r\n\t\t\t\t\tconsole.log(e);\r\n\r\n\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tcomplete: function () {\r\n\r\n\t\t\t\t\t\r\n\r\n\t\t\t\t\tsearch.displayCount.request = null;\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t});\r\n\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tstate: {\r\n\r\n\r\n\r\n\t\tform: $('.js-replace-search form[data-replace-search=\"form\"]:first'),\r\n\r\n\r\n\r\n\t\tshould_restore: true,\r\n\r\n\r\n\r\n\t\tdata: false,\r\n\r\n\r\n\r\n\t\tcount: false,\r\n\r\n\r\n\r\n\t\tsave: function (form) {\r\n\r\n\r\n\r\n\t\t\tsearch.state.data = search.state.form.formstate();\r\n\r\n\t\t\tsearch.state.count = $('.js-replace-search-job-count').html();\r\n\r\n\r\n\r\n\t\t},\r\n\r\n\r\n\r\n\t\trestore: function (form) {\r\n\r\n\r\n\r\n\t\t\tif (search.state.should_restore) {\r\n\r\n\r\n\r\n\t\t\t\tsearch.state.form.formstate(search.state.data);\r\n\r\n\t\t\t\t$('.js-replace-search-job-count').html(search.state.count);\r\n\r\n\r\n\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t},\r\n\r\n\r\n\r\n\tstickyFilters: {\r\n\r\n\r\n\r\n\t\ttarget: null,\r\n\r\n\r\n\r\n\t\tinit: function () {\r\n\r\n\r\n\r\n\t\t\tvar stickyElement = document.querySelector('[data-sticky-filters]');\r\n\r\n\t\t\tsearch.stickyFilters.target = $('[data-sticky-filters]');\r\n\r\n\r\n\r\n\t\t\tif (!stickyElement || !utils.supportsSticky()) return;\r\n\r\n\r\n\r\n\t\t\tstickyElement.insertAdjacentHTML('beforebegin', '
');\r\n\r\n\t\t\tvar stickyOffElement = document.querySelector('[data-sticky-filters-off]');\r\n\r\n\r\n\r\n\t\t\tvar allowAnimation = false;\r\n\r\n\t\t\tvar visibleTimeout;\r\n\r\n\r\n\r\n\t\t\t// sticky filters\r\n\r\n\r\n\r\n\t\t\tvar lastStickyPosition;\r\n\r\n\r\n\r\n\t\t\tvar stickyObserver = new IntersectionObserver(function (entries) {\r\n\r\n\r\n\r\n\t\t\t\tvar y = entries[0].boundingClientRect.y;\r\n\r\n\t\t\t\tvar down = lastStickyPosition !== undefined ? lastStickyPosition > y : true;\r\n\r\n\t\t\t\tlastStickyPosition = y;\r\n\r\n\r\n\r\n\t\t\t\tif (down) {\r\n\r\n\r\n\r\n\t\t\t\t\tif (y < 0) { // has scrolled by\r\n\r\n\r\n\r\n\t\t\t\t\t\tstickyElement.classList.add('sticky-filters--stuck');\r\n\r\n\t\t\t\t\t\tallowAnimation = true;\r\n\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t});\r\n\r\n\r\n\r\n\t\t\tstickyObserver.observe(stickyElement);\r\n\r\n\r\n\r\n\t\t\t// sticky off anchor\r\n\r\n\r\n\r\n\t\t\tvar lastStickyOffPosition;\r\n\r\n\r\n\r\n\t\t\tvar stickyOffObserver = new IntersectionObserver(function (entries) {\r\n\r\n\r\n\r\n\t\t\t\tvar y = entries[0].boundingClientRect.y;\r\n\r\n\t\t\t\tvar down = lastStickyOffPosition !== undefined ? lastStickyOffPosition > y : true;\r\n\r\n\t\t\t\tlastStickyOffPosition = y;\r\n\r\n\r\n\r\n\t\t\t\tif (!down) {\r\n\r\n\r\n\r\n\t\t\t\t\tallowAnimation = false;\r\n\r\n\t\t\t\t\tclearTimeout(visibleTimeout);\r\n\r\n\r\n\r\n\t\t\t\t\tstickyElement.classList.remove('sticky-filters--stuck');\r\n\r\n\t\t\t\t\tstickyElement.classList.remove('sticky-filters--can-animate');\r\n\r\n\t\t\t\t\tstickyElement.classList.remove('sticky-filters--visible');\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t});\r\n\r\n\r\n\r\n\t\t\tstickyOffObserver.observe(stickyOffElement);\r\n\r\n\r\n\r\n\t\t\t// window scroll event for animations\r\n\r\n\r\n\r\n\t\t\tvar position = window.scrollY;\r\n\r\n\r\n\r\n\t\t\tdocument.addEventListener('scroll', function (e) {\r\n\r\n\r\n\r\n\t\t\t\tvar scroll = window.scrollY;\r\n\r\n\r\n\r\n\t\t\t\tif (allowAnimation) {\r\n\r\n\r\n\r\n\t\t\t\t\tif (scroll > position) {\r\n\r\n\r\n\r\n\t\t\t\t\t\tstickyElement.classList.remove('sticky-filters--visible');\r\n\r\n\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\r\n\r\n\t\t\t\t\t\tstickyElement.classList.add('sticky-filters--can-animate');\r\n\r\n\t\t\t\t\t\tvisibleTimeout = setTimeout(function () { stickyElement.classList.add('sticky-filters--visible'); }, 10);\r\n\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\r\n\t\t\t\tposition = scroll;\r\n\r\n\r\n\r\n\t\t\t});\r\n\r\n\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t}\r\n\r\n\r\n\r\n};\r\n\r\n\r\n\r\n$(function () {\r\n\r\n\tsearch.preInit();\r\n\r\n\tsite.doc.ajaxComplete(function () {\r\n\r\n\t\tsearch.init(false);\r\n\r\n\t});\r\n\r\n});"]}