1var filtering_running = false; 2var wpforms_search_running = 'No'; 3 4var ajax_ctrlr = { 5 6 last_run: new Date(), 7 srch_str: '', 8 schdl_to_run_state: false, 9 schdl_to_run_delay: 250, 10 search_save_schdl_to_run_delay: 3000, 11 schdl_to_run_cntr: 0, 12 schdl_to_run_hndl: null, 13 search_save_schdl_to_run_hndl: null, 14 15 schedule_to_run: function() { 16 ajax_ctrlr.schdl_to_run_cntr++; 17 18 if(ajax_ctrlr.schdl_to_run_cntr % 5 == 0) { 19 ajax_ctrlr.schdl_to_run_delay += 250; 20 ajax_ctrlr.schdl_to_run_reset(); 21 } 22 23 if( ! ajax_ctrlr.schdl_to_run_state) { 24 return; 25 } 26 27 let crnt_run = new Date(); 28 29 if(crnt_run - ajax_ctrlr.last_run > ajax_ctrlr.schdl_to_run_delay) { 30 ajax_ctrlr.schdl_to_run_state = false; 31 ajax_ctrlr.schdl_to_run_cntr = 0; 32 ajax_ctrlr.last_run = new Date(); 33 34 ewd_ufaq_ajax_reload(); 35 36 ajax_ctrlr.save_search_schdl_to_run_reset(); 37 } 38 }, 39 schdl_to_run_reset: function () { 40 clearInterval(ajax_ctrlr.schdl_to_run_hndl); 41 ajax_ctrlr.schdl_to_run_hndl = setInterval(ajax_ctrlr.schedule_to_run, ajax_ctrlr.schdl_to_run_delay); 42 }, 43 run_search_ajax: function( elm ) { 44 ajax_ctrlr.clear_field( elm ); 45 46 let srch_str = jQuery(elm).val(); 47 48 if( ajax_ctrlr.schdl_to_run_delay > 250 ) { 49 ajax_ctrlr.schdl_to_run_delay = 250; 50 ajax_ctrlr.schdl_to_run_reset(); 51 } 52 53 if(srch_str != ajax_ctrlr.srch_str) { 54 ajax_ctrlr.srch_str = srch_str; 55 ajax_ctrlr.schdl_to_run_state = true; 56 ajax_ctrlr.last_run = new Date(); 57 } 58 }, 59 save_search_term: function() { 60 var params = {}; 61 62 params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : ''; 63 params.search_term = ajax_ctrlr.srch_str; 64 params.action = 'ewd_ufaq_record_search_term'; 65 66 var data = jQuery.param( params ); 67 jQuery.post(ajaxurl, data, function(response) {}); 68 }, 69 save_search_schdl_to_run_reset: function() { 70 71 if ( typeof ewd_ufaq_php_data == 'undefined' || ! ewd_ufaq_php_data.save_search_terms ) { return false; } 72 73 clearTimeout(ajax_ctrlr.search_save_schdl_to_run_hndl); 74 ajax_ctrlr.search_save_schdl_to_run_hndl = setTimeout(ajax_ctrlr.save_search_term, ajax_ctrlr.search_save_schdl_to_run_delay); 75 }, 76 clear_field: function ( srch_elm ) { 77 let cf = jQuery(srch_elm).parent('.search-field').find('.clear-field').eq(0); 78 if( 0 < jQuery(srch_elm).val().length ) { 79 if( 'hidden' == cf.data('state') ) { 80 cf.data('state', 'visible'); 81 cf.removeClass('slide-out').addClass('slide-in'); 82 } 83 } 84 else { 85 cf.data('state', 'hidden'); 86 cf.removeClass('slide-in').addClass('slide-out'); 87 } 88 } 89}; 90 91jQuery(function(){ //DOM Ready 92 ufaqSetClickHandlers(); 93 UFAQSetAutoCompleteClickHandlers(); 94 UFAQSetRatingHandlers(); 95 UFAQSetExpandCollapseHandlers(); 96 UFAQSetPaginationHandlers(); 97 98 UFAQWPFormsHandler(); 99}); 100 101function ewd_ufaq_run_effect( display, faq_element ) { 102 103 var selected_effect = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.reveal_effect : 'none'; 104 105 // most effect types need no options passed by default 106 var options = {}; 107 108 // some effects have required parameters 109 if ( selected_effect === 'size' ) { 110 111 options = { to: { width: 200, height: 60 } }; 112 } 113 114 // run the effect 115 if ( display == 'show' ) { faq_element.find( '.ewd-ufaq-faq-body' ).show( selected_effect, options, 500, ewd_ufaq_toggle_hidden_class( faq_element ) ); } 116 if ( display == 'hide' ) { faq_element.find( '.ewd-ufaq-faq-body' ).hide( selected_effect, options, 500, ewd_ufaq_toggle_hidden_class( faq_element ) ); } 117}; 118 119// callback function to bring a hidden box back 120function ewd_ufaq_toggle_hidden_class( faq_element ) { 121 122 setTimeout( function() { faq_element.find( '.ewd-ufaq-faq-body' ).toggleClass( 'ewd-ufaq-hidden' ); }, 500 ); 123}; 124 125function ufaqSetClickHandlers( context ) { 126 127 var interaction_scope = context ? jQuery( context ) : jQuery( document ); 128 129 interaction_scope.find( '.ewd-ufaq-faq-toggle' ).off( 'click' ).on( 'click', function( event ) { 130 131 jQuery( this ).attr( 'aria-expanded', function ( i, attr ) { 132 return attr == 'true' ? 'false' : 'true' 133 }); 134 135 event.preventDefault(); 136 137 faq = jQuery( this ).parent(); 138 139 if ( faq.find( '.ewd-ufaq-faq-body' ).hasClass( 'ewd-ufaq-hidden' ) ) { 140 141 EWD_UFAQ_Reveal_FAQ( faq ); 142 143 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.faq_scroll ) { jQuery('html, body').animate({scrollTop: jQuery(this).offset().top -80}, 100); } 144 } 145 else { 146 147 EWD_UFAQ_Hide_FAQ( faq ); 148 } 149 }); 150 151 interaction_scope.find( '.ewd-ufaq-faq-category-title-toggle' ).off( 'click' ).on( 'click', function() { 152 153 var category_title = jQuery( this ); 154 var category = category_title.parent(); 155 var category_inner = category.find( '.ewd-ufaq-faq-category-inner' ).first(); 156 var category_inner_height = category_inner.outerHeight( true ); 157 var faqs_list = category_inner.parent(); 158 var faqs_list_height = faqs_list.outerHeight( true ); 159 var total_faqs_height = category_inner_height + faqs_list_height; 160 161 jQuery( '.ewd-ufaq-category-tabs-1' ).css( 'height', total_faqs_height + 'px' ); 162 163 jQuery( this ).toggleClass( 'ewd-ufaq-category-tab-selected' ); 164 165 category_inner.toggleClass( 'ewd-ufaq-faq-category-body-hidden' ); 166 167 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.category_accordion ) { 168 169 jQuery( '.ewd-ufaq-faq-category-inner' ).each( function( index, object ) { 170 171 if ( object != category_inner.get( 0 ) ) { jQuery( this ).addClass( 'ewd-ufaq-faq-category-body-hidden' ); } 172 }); 173 174 jQuery( '.ewd-ufaq-faq-category-title-toggle' ).each (function() { 175 176 if ( jQuery( this ) != category_title ) { jQuery( this ).removeClass( 'ewd-ufaq-category-tab-selected' ); } 177 }); 178 } 179 180 jQuery( '.ewd-ufaq-faq-category-title-toggle' ).each( function() { 181 var span = jQuery( this ).find( '.ewd-ufaq-category-post-margin-symbol span' ); 182 183 if ( jQuery( this).hasClass( 'ewd-ufaq-category-tab-selected' ) ) { 184 span.html( span.html().toUpperCase() ); 185 } 186 else { 187 span.html( span.html().toLowerCase() ); 188 } 189 } ); 190 }); 191 192 interaction_scope.find( '.ewd-ufaq-back-to-top-link' ).off( 'click' ).on( 'click', function( event ) { 193 event.preventDefault(); 194 195 jQuery( 'html, body' ).animate( { scrollTop: jQuery( '#ewd-ufaq-faq-list' ).offset().top -80 }, 100 ); 196 }); 197 198 interaction_scope.find( '.ewd-ufaq-faq-header-link' ).off( 'click' ).on( 'click', function( event ) { 199 event.preventDefault(); 200 201 var faq_id = jQuery( this ).data( 'postid' ); 202 var faq = jQuery( '#ewd-ufaq-post-' + faq_id ).first(); 203 204 if ( faq.find( '.ewd-ufaq-faq-body' ).hasClass( 'ewd-ufaq-hidden' ) ) { 205 206 EWD_UFAQ_Reveal_FAQ( faq ); 207 } 208 209 jQuery( 'html, body' ).animate( { scrollTop: faq.offset().top - 20 }, 100 ); 210 }); 211} 212 213function UFAQSetAutoCompleteClickHandlers() { 214 215 jQuery( '.ewd-ufaq-text-auto-complete' ).on( 'keyup', function() { 216 217 jQuery( '.ewd-ufaq-text-auto-complete' ).autocomplete({ 218 219 source: typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.question_titles : '', 220 minLength: 3, 221 appendTo: '#ewd-ufaq-jquery-ajax-search', 222 select: function( event, ui ) { 223 jQuery( this ).val( ui.item.value ); 224 ewd_ufaq_ajax_reload(); 225 } 226 }); 227 228 jQuery( '.ewd-ufaq-text-auto-complete' ).autocomplete( 'enable' ); 229 }); 230} 231 232function EWD_UFAQ_Reveal_FAQ( faq_element ) { 233 234 var post_id = faq_element.data( 'post_id' ); 235 236 var params = {}; 237 238 params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : ''; 239 params.post_id = post_id; 240 params.action = 'ewd_ufaq_record_view'; 241 242 var data = jQuery.param( params ); 243 jQuery.post(ajaxurl, data, function(response) {}); 244 245 faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html( faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html().toUpperCase() ); 246 247 faq_element.find( '.ewd-ufaq-faq-excerpt' ).addClass( 'ewd-ufaq-hidden' ); 248 249 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.reveal_effect != 'none' ) { ewd_ufaq_run_effect( 'show', faq_element ); } 250 else { faq_element.find( '.ewd-ufaq-faq-body' ).removeClass( 'ewd-ufaq-hidden' ); } 251 252 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.faq_accordion ) { 253 254 jQuery( '.ewd-ufaq-faq-div' ).each( function() { 255 256 if ( jQuery( this ).prop( 'id' ) != faq_element.prop( 'id' ) ) { 257 258 EWD_UFAQ_Hide_FAQ( jQuery(this) ); 259 } 260 else { 261 262 jQuery( this ).addClass( 'ewd-ufaq-post-active' ); 263 } 264 }); 265 } 266 else { 267 268 faq_element.addClass( 'ewd-ufaq-post-active' ); 269 } 270} 271 272function EWD_UFAQ_Hide_FAQ( faq_element ) { 273 274 var post_id = faq_element.data( 'post_id' ); 275 276 faq_element.find( '.ewd-ufaq-faq-excerpt' ).removeClass( 'ewd-ufaq-hidden' ); 277 278 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.reveal_effect != 'none' && ! faq_element.find( '.ewd-ufaq-faq-body' ).hasClass( 'ewd-ufaq-hidden' ) ) { ewd_ufaq_run_effect( 'hide', faq_element ); } 279 else { faq_element.find( '.ewd-ufaq-faq-body' ).addClass( 'ewd-ufaq-hidden' ); } 280 281 faq_element.removeClass( 'ewd-ufaq-post-active' ); 282 faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html( faq_element.find( '.ewd-ufaq-post-margin-symbol' ).html().toLowerCase() ); 283} 284 285jQuery(document).ready(function() { 286
287 if( 0 < jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0).length ) { 288 ajax_ctrlr.schdl_to_run_hndl = setInterval(ajax_ctrlr.schedule_to_run, ajax_ctrlr.schdl_to_run_delay); 289 } 290 291 jQuery( '#ewd-ufaq-ajax-search-submit' ).click( function() { 292 jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', 1 ); 293 let elm = jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0); 294 ajax_ctrlr.run_search_ajax( elm[0] ); 295 }); 296 297 jQuery( '#ewd-ufaq-jquery-ajax-search' ).on( 'keyup', '.ewd-ufaq-text-input', function() { 298 ajax_ctrlr.run_search_ajax( this ); 299 }); 300 301 // clear search field 302 jQuery( '#ewd-ufaq-jquery-ajax-search' ).on( 'click', '.clear-field', function() { 303 let elm = jQuery( '#ewd-ufaq-jquery-ajax-search .ewd-ufaq-text-input' ).eq(0); 304 jQuery(elm).val(''); 305 ajax_ctrlr.run_search_ajax( elm[0] ); 306 }); 307 308 jQuery( '.ewd-ufaq-text-input ' ).on( 'search', function() { 309 ajax_ctrlr.run_search_ajax( this ); 310 }); 311 312 if ( typeof ewd_ufaq_php_data != 'undefined' && ewd_ufaq_php_data.display_faq > 0 ) { 313 314 var faq = jQuery( '.ewd-ufaq-faq-div[data-post_id="' + ewd_ufaq_php_data.display_faq + '"]' ); 315 316 faq.parent().removeClass( 'ewd-ufaq-hidden' ); 317 318 EWD_UFAQ_Reveal_FAQ( faq ); 319 320 jQuery('html, body').animate({scrollTop: faq.offset().top -80}, 100); 321 } 322}); 323 324var request_count = 0; 325function ewd_ufaq_ajax_reload( pagination, append_results, search_string ) { 326 327 filtering_running = true; 328 329 var search_string = search_string ? search_string : jQuery( '.ewd-ufaq-text-input' ).val(); 330 var include_cat = jQuery( '#ewd-ufaq-include-category' ).val(); 331 var exclude_cat = jQuery( '#ewd-ufaq-exclude-category' ).val(); 332 var orderby = jQuery( '#ewd-ufaq-orderby' ).val(); 333 var order = jQuery( '#ewd-ufaq-order' ).val(); 334 var post_count = jQuery( '#ewd-ufaq-post-count' ).val(); 335 var current_url = jQuery( '#ewd-ufaq-current-url' ).val(); 336 var show_on_load = jQuery( '#ewd-ufaq-show-on-load' ).val(); 337 338 if ( search_string == undefined ) { search_string = ''; } 339 340 if ( pagination == 'Yes' ) { 341 342 var faqs_only = 'Yes'; 343 var faq_page = jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ); 344 } 345 else { 346 347 var retrieving_results = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.retrieving_results : 'Retrieving Results'; 348 349 jQuery( '.ewd-ufaq-search .ewd-ufaq-faqs' ).html( '<h3>' + retrieving_results + '</h3>' ); 350 351 var faqs_only = 'No'; 352 var faq_page = 0; 353 jQuery( '.ewd-ufaq-bottom' ).remove(); 354 } 355 356 request_count = request_count + 1; 357 358 if ( jQuery( '.ewd-ufaq-text-input' ).length && 'yes' != show_on_load.toLocaleLowerCase() && search_string.length == 0 ) { 359 jQuery( '.ewd-ufaq-search .ewd-ufaq-faqs' ).html(''); 360 return; 361 } 362 363 var params = {}; 364 365 params.search_string = search_string; 366 params.include_category = include_cat; 367 params.exclude_category = exclude_cat; 368 params.orderby = orderby; 369 params.order = order; 370 params.post_count = post_count; 371 params.request_count = request_count; 372 params.current_url = current_url; 373 params.faqs_only = faqs_only; 374 params.faq_page = faq_page; 375 params.show_on_load = show_on_load; 376 params.action = 'ewd_ufaq_search'; 377 params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : ''; 378 379 var data = jQuery.param( params ); 380 381 jQuery.post( ajaxurl, data, function( response ) { 382 383 if ( ! response || ! response.success || ! response.data ) { return; } 384 if ( response.data.analytics && response.data.analytics.endpoint && response.data.analytics.token ) { 385 try { 386 var analyticsKey = 'ewdUfaqAnalytics:' + response.data.analytics.storage_key; 387 if ( ! window.sessionStorage.getItem( analyticsKey ) ) { 388 window.sessionStorage.setItem( analyticsKey, '1' ); 389 window.fetch( response.data.analytics.endpoint, { method: 'POST', credentials: 'omit', keepalive: true, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify( { event: response.data.analytics.event, token: response.data.analytics.token } ) } ).catch( function() {} ); 390 } 391 } catch ( analyticsError ) {} 392 } 393 394 if ( response.data.request_count == request_count ) { 395 396 var data_output_selector = search_string || jQuery( '.ewd-ufaq-faq-list' ).prev().is( '#ewd-ufaq-jquery-ajax-search' ) ? '#ewd-ufaq-jquery-ajax-search + .ewd-ufaq-faq-list .ewd-ufaq-faqs' : '.ewd-ufaq-faqs:not(#ewd-ufaq-jquery-ajax-search + .ewd-ufaq-faq-list .ewd-ufaq-faqs)'; 397 398 if ( ! jQuery( data_output_selector ).length ) { data_output_selector = '.ewd-ufaq-faqs'; } 399 400 if ( append_results == 'Yes' ) { 401 jQuery( data_output_selector ).append( response.data.output ); 402 } 403 else { 404 jQuery( data_output_selector ).html( response.data.output ); 405 if( '' != response.data.pagination ) { 406 jQuery('.ewd-ufaq-faq-list .ewd-ufaq-bottom').remove(); 407 jQuery('.ewd-ufaq-faq-list').append(response.data.pagination); 408 } 409 } 410 411 jQuery( '.ewd-ufaq-bottom' ).data( 'max_page', response.data.max_page ); 412 413 jQuery( '.ewd-ufaq-expand-all' ).removeClass( 'ewd-ufaq-hidden' );
414 jQuery( '.ewd-ufaq-collapse-all' ).addClass( 'ewd-ufaq-hidden' ); 415 416 ufaqSetClickHandlers(); 417 UFAQSetRatingHandlers(); 418 UFAQSetPaginationHandlers(); 419 UFAQUpdatePaginationButtons(); 420 UFAQSetExpandCollapseHandlers(); 421 422 filtering_running = false; 423 } 424 }); 425} 426 427function UFAQSetRatingHandlers() { 428 429 jQuery( '.ewd-ufaq-rating-button' ).off( 'click' ).on( 'click', function() { 430 431 var faq_id = jQuery( this ).data( 'faq_id' ); 432 jQuery( '*[data-faq_id="' + faq_id + '"]' ).off( 'click' ); 433 434 var current_count = jQuery( this ).find( 'span' ).html(); 435 current_count++; 436 jQuery( this ).find( 'span' ).html( current_count ); 437 438 if ( jQuery( this ).hasClass( 'ewd-ufaq-up-vote' ) ) { vote_type = 'up'; } 439 else { vote_type = 'down'; } 440 441 var params = {}; 442 443 params.action = 'ewd_ufaq_update_rating'; 444 params.nonce = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.nonce : ''; 445 params.faq_id = faq_id; 446 params.vote_type = vote_type; 447 448 var data = jQuery.param( params ); 449 jQuery.post( ajaxurl, data ); 450 }); 451} 452 453function UFAQSetExpandCollapseHandlers() { 454 455 jQuery('.ewd-ufaq-expand-all').off('click').on('click', function() { 456 457 var accordion_setting = typeof ewd_ufaq_php_data != 'undefined' ? ewd_ufaq_php_data.faq_accordion : false; 458 ewd_ufaq_php_data.faq_accordion = false; // turn FAQ accordion off while expanding all 459 460 jQuery( '.ewd-ufaq-faq-toggle' ).each( function() { 461 462 var faq = jQuery(this).parent(); 463 464 jQuery(this).attr('aria-expanded', 'true'); 465 466 EWD_UFAQ_Reveal_FAQ( faq ); 467 }); 468 469 if ( typeof ewd_ufaq_php_data != 'undefined' ) { ewd_ufaq_php_data.faq_accordion = accordion_setting; } //reset FAQ accordion setting 470 471 jQuery('.ewd-ufaq-faq-category-inner').removeClass('ewd-ufaq-faq-category-body-hidden'); 472 jQuery('.ewd-ufaq-collapse-all').removeClass('ewd-ufaq-hidden'); 473 jQuery('.ewd-ufaq-expand-all').addClass('ewd-ufaq-hidden'); 474 475 jQuery( '.ewd-ufaq-faq-category-title-toggle' ).addClass( 'ewd-ufaq-category-tab-selected' ); 476 jQuery( '.ewd-ufaq-category-post-margin-symbol span' ).each( function() { 477 jQuery( this ).html().toUpperCase(); 478 }); 479 }); 480 481 jQuery('.ewd-ufaq-collapse-all').off('click').on('click', function() { 482 483 jQuery('.ewd-ufaq-faq-toggle').each(function() { 484 485 var faq = jQuery(this).parent(); 486 487 jQuery(this).attr('aria-expanded', 'false'); 488 489 EWD_UFAQ_Hide_FAQ( faq ); 490 }); 491 492 jQuery( '.ewd-ufaq-faq-category-inner' ).addClass( 'ewd-ufaq-faq-category-body-hidden' ); 493 jQuery( '.ewd-ufaq-faq-category-title-toggle' ).removeClass( 'ewd-ufaq-category-tab-selected' ); 494 495 jQuery( '.ewd-ufaq-category-post-margin-symbol span' ).each( function() { 496 jQuery( this ).html().toLowerCase(); 497 }); 498 499 jQuery('.ewd-ufaq-expand-all').removeClass('ewd-ufaq-hidden'); 500 jQuery('.ewd-ufaq-collapse-all').addClass('ewd-ufaq-hidden'); 501 }); 502} 503 504function UFAQSetPaginationHandlers() { 505 506 jQuery('.ewd-ufaq-previous-faqs').off( 'click' ).on('click', function() { 507 508 var current_page = jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ); 509 510 jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', Math.max( current_page - 1, 0 ) ); 511 jQuery( '.ewd-ufaq-max-faqs-not-reached' ).remove(); 512 513 ewd_ufaq_ajax_reload( 'Yes', 'No' ); 514 }); 515 516 jQuery('.ewd-ufaq-next-faqs').off( 'click' ).on('click', function() { 517 518 var current_page = jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ); 519 520 jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', current_page + 1 ); 521 jQuery( '.ewd-ufaq-max-faqs-not-reached' ).remove(); 522 523 ewd_ufaq_ajax_reload( 'Yes', 'No' ); 524 }); 525 526 jQuery( '.ewd-ufaq-load-more' ).off( 'click' ).on( 'click', function() { 527 528 var current_page = jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ); 529 530 jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', current_page + 1 ); 531 jQuery( '.ewd-ufaq-max-faqs-not-reached' ).remove(); 532 533 ewd_ufaq_ajax_reload( 'Yes', 'Yes' ); 534 }); 535 536 if ( jQuery( '.ewd-ufaq-pagination-infinite_scroll' ).length ) { 537 538 jQuery( window ).scroll( function() { 539 540 var infinite_pos = jQuery( '.ewd-ufaq-pagination-infinite_scroll').position(); 541 542 if ( infinite_pos != undefined && jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ) != jQuery( '.ewd-ufaq-bottom' ).data( 'max_page' ) ) { 543 544 if ( ( jQuery( window ).height() + jQuery( window ).scrollTop() > infinite_pos.top ) && filtering_running == false ) { 545 546 jQuery( '.ewd-ufaq-bottom' ).data( 'current_page', jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ) + 1 ); 547 548 ewd_ufaq_ajax_reload( 'Yes', 'Yes' ); 549 } 550 } 551 }); 552 } 553} 554 555function UFAQUpdatePaginationButtons() { 556 557 jQuery('.ewd-ufaq-bottom').first().appendTo('.ewd-ufaq-faq-list'); 558 559 if ( jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ) < jQuery( '.ewd-ufaq-bottom' ).data( 'max_page' ) ) { 560 561 jQuery( '.ewd-ufaq-load-more, .ewd-ufaq-next-faqs' ).removeClass( 'ewd-ufaq-hidden' ); 562 } 563 else { jQuery( '.ewd-ufaq-load-more, .ewd-ufaq-next-faqs' ).addClass( 'ewd-ufaq-hidden' ); } 564 565 if ( jQuery( '.ewd-ufaq-bottom' ).data( 'current_page' ) <= 1 ) { 566 567 jQuery( '.ewd-ufaq-previous-faqs' ).addClass( 'ewd-ufaq-hidden' ); 568 } 569 else { jQuery( '.ewd-ufaq-previous-faqs' ).removeClass( 'ewd-ufaq-hidden' ); } 570} 571 572function UFAQWPFormsHandler() { 573 574 if ( typeof wpforms_integration === 'undefined' || wpforms_integration === null ) { return; } 575 576 if ( wpforms_integration.ufaq_enabled == 'disabled' ) { return; } 577 578 var target_field = wpforms_integration.ufaq_selected_field; 579 580 jQuery( '#wpforms-' + wpforms_integration.form_id + '-field_' + wpforms_integration.ufaq_selected_field ).on( 'keyup', function() { 581 582 var search_string = jQuery( this ).val(); 583 584 if ( search_string.length >= wpforms_integration.ufaq_minimum_characters ) { 585 586 jQuery( '.ewd-ufaq-wpforms-faq-results' ).removeClass( 'ewd-ufaq-hidden' ); 587 jQuery( '.ewd-ufaq-wpforms-label' ).removeClass( 'ewd-ufaq-hidden' ); 588 589 ewd_ufaq_ajax_reload( 'No', 'No', search_string ); 590 } 591 else if ( ! filtering_running ) { 592 593 jQuery( '.ewd-ufaq-faqs' ).html( ' ' ); 594 jQuery( '.ewd-ufaq-wpforms-faq-results' ).addClass( 'ewd-ufaq-hidden' ); 595 jQuery( '.ewd-ufaq-wpforms-label' ).addClass( 'ewd-ufaq-hidden' ); 596 } 597 598 }); 599} 600 601/*jQuery(document).ready(function() { 602jQuery('a[href*=#]:not([href=#])').click(function() { 603 var post_id = jQuery(this).attr("data-postid"); 604 var selectedIDString = 'ewd-ufaq-body-'+post_id; 605 606 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 607 var target = jQuery(this.hash); 608 target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']'); 609 if (target.length) { 610 611 jQuery('html,body').on("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", function(){ 612 jQuery('html,body').stop(); 613 }); 614 615 if (jQuery('#'+selectedIDString).hasClass("ewd-ufaq-hidden")) { 616 EWD_UFAQ_Reveal_FAQ(post_id, selectedIDString); 617 } 618 619 jQuery('html,body').animate({ 620 scrollTop: target.offset().top 621 }, 1000); 622 //return false;
623 } 624 } 625}); 626});*/ 627 628jQuery( document ).ready( function() { 629 630 jQuery( '.ewd-ufaq-compact-faq-meta .ewd-ufaq-permalink a' ).html( '<span class="dashicons dashicons-admin-links"></span>' ); 631 jQuery( '.ewd-ufaq-compact-faq-meta .rrssb-buttons li.rrssb-facebook a' ).html( '<span class="dashicons dashicons-facebook-alt"></span>' ); 632 jQuery( '.ewd-ufaq-compact-faq-meta .rrssb-buttons li.rrssb-twitter a' ).html( '<span class="dashicons dashicons-twitter-alt"></span>' ); 633 jQuery( '.ewd-ufaq-compact-faq-meta .rrssb-buttons li.rrssb-linkedin a' ).html( '<span class="dashicons dashicons-linkedin"></span>' ); 634 jQuery( '.ewd-ufaq-compact-faq-meta .rrssb-buttons li.rrssb-pinterest a' ).html( '<span class="dashicons dashicons-pinterest"></span>' ); 635 jQuery( '.ewd-ufaq-compact-faq-meta .rrssb-buttons li.rrssb-email a' ).html( '<span class="dashicons dashicons-email-alt"></span>' ); 636 jQuery( '.ewd-ufaq-compact-faq-meta .ewd-ufaq-up-vote' ).prepend( '<span class="dashicons dashicons-thumbs-up"></span>' ); 637 jQuery( '.ewd-ufaq-compact-faq-meta .ewd-ufaq-down-vote' ).prepend( '<span class="dashicons dashicons-thumbs-down"></span>' ); 638} );
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.