{"version":3,"names":["$","jQuery","window","on","elementorFrontend","hooks","addAction","$element","questions","find","numberQuestions","length","first","fadeIn","addClass","click","e","$this","this","$parent","parents","currentQuestion","data","hasClass","preventDefault","currentQuestionNumber","$nextQuestion","slice","removeClass","css","doAction","ajaxActive","firstSearch","emptyFirst","form_data","search_options","empty_search","pagination","page","page_type","page_type_id","per_page","post_type","tax_query","template","url","URL","location","params","URLSearchParams","search","getNestedValue","obj","_len","arguments","args","Array","_key","reduce","level","_do_live_search","when","action","nonce","unc_widget_vars","ajax","type","ajaxurl","success","response","console","log","error","_ajax_live_search","done","numberposts","pagination_type","_destroy","classList","append","results","attr","html","text","_build_results","_do_after_search","undefined","remove","empty","document","ready","form","forEach","value","key","fields","filter","prop","get","val","submit","serializeArray","clearTimeout","setTimeout","submitLiveSearch","trigger"],"sources":["../../source/js/main.js"],"sourcesContent":["/* global jQuery, elementorFrontend, unc_widget_vars, ScrollMagic, tingle, MicroModal */\n( function( $ ) {\n\tjQuery( window ).on( 'elementor/frontend/init', () => {\n\n\t\t/*--------------------------------------------------------------------------------\n\t\tUNC Quiz Widget\n\t\t--------------------------------------------------------------------------------*/\n\t\t/**\n\t\t* @param $element The widget wrapper element as a jQuery element\n\t\t* @param $ The jQuery alias\n\t\t*/\n\t\tconst uncQuizHandler = ( $element, $ ) => {\n\t\t\tlet questions = $element.find('.quiz__questions .question-entry');\n\t\t\tlet numberQuestions = questions.length;\n\t\t\t\n\t\t\t// Show first question\n\t\t\tquestions.first().fadeIn().addClass('question-active');\n\n\t\t\tquestions.find('.option-button').click(function(e){\n\t\t\t\tlet $this = $(this);\n\t\t\t\tlet $parent = $this.parents('.question-entry');\n\t\t\t\tlet currentQuestion = $parent.data('question');\n\t\t\t\t\n\t\t\t\tif( $this.hasClass('correct' ) ) {\n\t\t\t\t\t$parent.addClass('answered correct');\n\t\t\t\t\t$parent.find('.response__correct').fadeIn();\n\t\t\t\t} else {\n\t\t\t\t\t$parent.addClass('answered incorrect');\n\t\t\t\t\t$parent.find('.response__incorrect').fadeIn();\n\t\t\t\t}\n\n\t\t\t\tif( currentQuestion < numberQuestions ) {\n\t\t\t\t\t$element.find('.quiz__next').fadeIn();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t$element.find('.quiz__next').click(function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\tlet currentQuestionNumber = $element.find('.question-active').data('question');\n\t\t\t\tlet $nextQuestion = questions.slice(currentQuestionNumber,currentQuestionNumber+1);\n\n\t\t\t\t$element.find('.question-active').removeClass('question-active').css('display', 'none');\n\t\t\t\t$(this).css('display', 'none');\n\t\t\t\t$nextQuestion.addClass('question-active').fadeIn();\n\t\t\t});\n\t\t};\n\n\t\telementorFrontend.hooks.addAction( 'frontend/element_ready/unc-quiz.default', uncQuizHandler );\n\n\n\n\n\t\t/*--------------------------------------------------------------------------------\n\t\tManage live search functionality\n\t\t--------------------------------------------------------------------------------*/\n\n\t\t/**\n\t\t* Search setup and defaults\n\t\t**/\n\n\t\tlet doAction = false,\n\t\tajaxActive = false,\n\t\tfirstSearch = true,\n\t\temptyFirst = false;\n\n\t\tlet form_data = [];\n\t\tconst search_options = {\n\t\t\tempty_search: false,\n\t\t\tpagination: 'loadmore',\n\t\t\tpage: 1,\n\t\t\tpage_type: 'standard',\n\t\t\tpage_type_id: false,\n\t\t\tper_page: 12,\n\t\t\tpost_type: 'post',\n\t\t\ttax_query: 'AND',\n\t\t\ttemplate: 'card'\n\t\t};\n\n\t\t// Fetch current URL and any pre-search parameters\n\t\tconst url = new URL(window.location);\n\t\tconst params = new URLSearchParams(url.search);\n\n\t\t// Submit form on page ready for initial results\n\t\t$( document ).ready(function() {\n\t\t\tlet form = $('#live-search-form');\n\n\t\t\temptyFirst = form.data('emptyfirst');\n\n\t\t\tif( form.length ) {\n\t\t\t\tparams.forEach((value, key) => {\n\t\t\t\t\t// Check for general filters in URL\n\t\t\t\t\tlet fields = $(this).find('input:radio[name=' + key + ']');\n\t\t\t\t\tif( fields.length !== 0 ) {\n\t\t\t\t\t\tlet currentField = fields.filter('[value=' + value + ']');\n\t\t\t\t\t\tcurrentField.prop('checked', true);\n\n\t\t\t\t\t\t$('#live-search-viewall').addClass('active');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Check for search terms in URL\n\t\t\t\tlet search = params.get('search');\n\t\t\t\tif ( search ) {\n\t\t\t\t\t$('#live-search').val(search);\n\t\t\t\t}\n\n\t\t\t\t// Initial form submit\n\t\t\t\tform.submit();\n\t\t\t\tfirstSearch = false;\n\t\t\t}\n\t\t});\n\n\n\t\t/**\n\t\t* Utility Functions\n\t\t**/\n\n\t\tfunction getNestedValue( obj, ...args ) {\n\t\t\treturn args.reduce((obj, level) => obj && obj[level], obj)\n\t\t}\n\n\t\t\n\t\t/**\n\t\t* Handle form submission\n\t\t**/\n\n\t\t// Capture search form submissions\n\t\t$( document ).on( 'submit', '#live-search-form', function(e) {\n\t\t\te.preventDefault();\n\t\t\tlet $this = $(this);\n\n\t\t\tconsole.log('submit');\n\n\t\t\t// Disable submit button\n\t\t\tif( ! firstSearch ) $this.find('.search-submit').attr('disabled', true);\n\n\t\t\t// Start search process\n\t\t\tsubmitLiveSearch($this);\n\t\t});\n\n\t\t// Begin live search process\n\t\tfunction submitLiveSearch( $this ) {\n\t\t\t// Setup form options\n\t\t\tif( $this.data('pagination') ) search_options.pagination = $this.data('pagination');\n\t\t\tif( $this.data('perpage') ) search_options.per_page = $this.data('perpage');\n\t\t\tif( $this.data('searchtype') ) search_options.post_type = $this.data('searchtype');\n\t\t\tif( $this.data('tax_query') ) search_options.tax_query = $this.data('tax_query');\n\t\t\tif( $this.data('template') ) search_options.template = $this.data('template');\n\t\t\tif( $this.data('page_type') ) search_options.page_type = $this.data('page_type');\n\t\t\tif( $this.data('page_type_id') ) search_options.page_type_id = $this.data('page_type_id');\n\t\t\t\n\t\t\tform_data = $this.serializeArray();\n\n\t\t\t// Reset timeout for new search if necessary\n\t\t\tif( doAction ) { clearTimeout( doAction ); }\n\n\t\t\t// Execute search, prevent stacked searches with timeout\t\t\n\t\t\tif( firstSearch && emptyFirst ) {\n\t\t\t\t//\n\t\t\t} else {\n\t\t\t\tdoAction = setTimeout( function() {\n\t\t\t\t\t_do_live_search();\n\t\t\t\t}, 250 );\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Handle live search functionality\n\t\t**/\n\n\t\t// Execute search\n\t\tfunction _do_live_search() {\n\t\t\t// Exit if AJAX is currently running\n\t\t\tif ( ajaxActive ) return false;\n\n\t\t\t$('.live-search-container').addClass('processing');\n\n\t\t\t// Run AJAX search\n\t\t\tajaxActive = true;\n\n\t\t\t// Run AJAX\n\t\t\t$.when( _ajax_live_search() ).done(function( response ) {\n\t\t\t\tconsole.log( response );\n\n\t\t\t\t// Handle post-search cleanup & display\n\t\t\t\t_do_after_search( response );\n\t\t\t});\n\t\t}\n\n\t\t// Process AJAX\n\t\tfunction _ajax_live_search() {\n\t\t\tlet data = {\n\t\t\t\taction: 'ajax_search',\n\t\t\t\tform_data: form_data,\n\t\t\t\tnonce: unc_widget_vars.nonce,\n\t\t\t\tsearch_options: search_options\n\t\t\t};\n\n\t\t\treturn $.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: unc_widget_vars.ajaxurl,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\tconsole.log(response);\n\t\t\t\t\tajaxActive = false;\n\t\t\t\t},\n\t\t\t\terror: function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t\tconsole.log('error');\n\t\t\t\t\tajaxActive = false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Handle results after search\n\t\tfunction _do_after_search( response ) {\n\t\t\t$('.live-search-container').removeClass('processing');\n\n\t\t\t_build_results( response );\n\t\t\tdoAction = false;\n\t\t}\n\n\t\t// Display results\n\t\tfunction _build_results( response ) {\n\t\t\tlet template = response.template;\n\t\t\tlet post_type = response.post_type;\n\t\t\tlet numberposts = response.numberposts;\n\n\t\t\tif ( numberposts > 0 ) {\n\t\t\t\tlet page = getNestedValue(response, 'pagination', 'page');\n\t\t\t\tlet pagination_type = getNestedValue(response, 'pagination', 'type');\n\t\t\t\t_destroy( page );\n\t\t\t\t// $('#live-search-count').text('Results: ' + response.numberposts);\n\n\t\t\t\tif( pagination_type == 'loadmore' ) {\n\t\t\t\t\t// Append results\n\t\t\t\t\tlet classList = 'view-' + template + ' live-search-results';\n\t\t\t\t\t$('#live-search-results').append( response.results ).attr( 'class', classList );\n\n\t\t\t\t\t// Setup load more button\n\t\t\t\t\tlet more_pagination = getNestedValue(response, 'pagination', 'more');\n\t\t\t\t\tif( more_pagination === false ) {\n\t\t\t\t\t\t$('#live-search-loadmore').html('');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('#live-search-loadmore').html('See More');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// No results\n\t\t\telse {\n\t\t\t\t_destroy();\n\t\t\t\t$('#live-search-count').text('Results: 0');\n\t\t\t\t$('#live-search-results').append('
No results found.
');\n\t\t\t\t$('#live-search-loadmore').html('');\n\t\t\t}\n\t\t}\n\n\t\t// Destroy search results and/or button\n\t\tfunction _destroy( page = 1, style = 'standard' ) {\n\t\t\tif( page !== 1 ) {\n\t\t\t\t$('#loadmore').remove();\n\t\t\t} else {\n\t\t\t\t$('#live-search-results').empty();\n\t\t\t}\n\t\t}\n\n\n\t\t/**\n\t\t* Handle form interactivity\n\t\t**/\n\n\t\t$(document).on('click', '#live-search-viewall', function(e) {\n\t\t\te.preventDefault();\n\t\t\t$('#live-search-viewall').removeClass('active');\n\n\t\t\t$('#live-search-form').trigger('reset');\n\t\t\t$('#live-search-form').submit();\n\t\t});\n\n\t\t// Handle radio changes\n\t\t$(document).on('change', '#live-search-form input[type=\"radio\"]', function(e) {\n\t\t\te.preventDefault();\n\t\t\tsearch_options.page = 1;\n\t\t\t$('#live-search-viewall').addClass('active');\n\t\t\t$('#live-search-form').submit();\n\t\t});\n\t\t\n\n\t\t// Handle load more button\n\t\t$( document ).on( 'click', '#loadmore', function(e) {\n\t\t\te.preventDefault();\n\t\t\tlet $this = $(this);\n\n\t\t\tsearch_options.page = $this.data('page');\n\n\t\t\tif ( doAction ) { clearTimeout( doAction ); }\n\n\t\t\tdoAction = setTimeout( function() {\n\t\t\t\t_do_live_search();\n\t\t\t}, 250 );\n\t\t});\n\n\t\t// Handle pagination clicks\n\t\t$( document ).on( 'click', '.loadmore .loadmore-page', function(e) {\n\t\t\te.preventDefault();\n\t\t\tlet $this = $(this);\n\n\t\t\tif( $this.hasClass('enabled') ) {\n\t\t\t\tsearch_options.page = $this.data('page');\n\t\t\t\tif ( doAction ) { clearTimeout( doAction ); }\n\t\t\t\tdoAction = setTimeout( function() {\n\t\t\t\t\t_do_live_search();\n\t\t\t\t}, 250 );\n\t\t\t}\n\t\t});\n\n\n\n\t} );\n} )( jQuery );\n"],"mappings":"cACA,SAAYA,GACXC,OAAQC,QAASC,GAAI,2BAA2B,KA6C/CC,kBAAkBC,MAAMC,UAAW,2CApCZ,CAAEC,EAAUP,KAClC,IAAIQ,EAAYD,EAASE,KAAK,oCAC1BC,EAAkBF,EAAUG,OAGhCH,EAAUI,QAAQC,SAASC,SAAS,mBAEpCN,EAAUC,KAAK,kBAAkBM,OAAM,SAASC,GAC/C,IAAIC,EAAQjB,EAAEkB,MACVC,EAAUF,EAAMG,QAAQ,mBACxBC,EAAkBF,EAAQG,KAAK,YAE/BL,EAAMM,SAAS,YAClBJ,EAAQL,SAAS,oBACjBK,EAAQV,KAAK,sBAAsBI,WAEnCM,EAAQL,SAAS,sBACjBK,EAAQV,KAAK,wBAAwBI,UAGlCQ,EAAkBX,GACrBH,EAASE,KAAK,eAAeI,QAE/B,IAEAN,EAASE,KAAK,eAAeM,OAAM,SAASC,GAC3CA,EAAEQ,iBACF,IAAIC,EAAwBlB,EAASE,KAAK,oBAAoBa,KAAK,YAC/DI,EAAgBlB,EAAUmB,MAAMF,EAA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