/* * Ajax Load More * https://connekthq.com/plugins/ajax-load-more/ * Author: Darren Cooney * Twitter: @KaptonKaos, @ajaxloadmore, @connekthq * Copyright Connekt Media - https://connekthq.com */ // Polyfills require("@babel/polyfill/noConflict"); require('./helpers/polyfills.js'); // External Modules let qs = require('qs'); let imagesLoaded = require('imagesloaded'); import axios from 'axios'; import smoothscroll from 'smoothscroll-polyfill'; // Smooth scrolling polyfill smoothscroll.polyfill(); // ALM Modules import './helpers/helpers'; import commentReplyFix from './helpers/commentReplyFix'; import getParameterByName from './helpers/getParameterByName'; import almAppendChildren from './helpers/almAppendChildren'; import almTableWrap from './helpers/almTableWrap'; import almGetCacheUrl from './helpers/almGetCacheUrl'; import almDomParser from './helpers/almDomParser'; import * as queryParams from './helpers/queryParams'; import * as restAPI_Opts from './helpers/restAPI'; import * as resultsText from './modules/resultsText'; import setLocalizedVars from './modules/setLocalizedVars'; import insertScript from './modules/insertScript'; import setFocus from './modules/setFocus'; import almMasonry from './modules/masonry'; import almFadeIn from './modules/fadeIn'; import almFadeOut from './modules/fadeOut'; import almFilter from './modules/filtering'; import srcsetPolyfill from './helpers/srcsetPolyfill'; // Global filtering var let alm_is_filtering = false; // Start ALM (function() { "use strict"; /** * ajaxloadmore * Init Ajax Load More * * @param {*} el * @param {*} e */ let ajaxloadmore = function(el, e) { // Move user to top of page to prevent loading of unnessasry posts if (alm_localize && alm_localize.scrolltop === 'true') { window.scrollTo(0, 0); } //Set ALM Variables let alm = this; alm.AjaxLoadMore = {}; alm.addons = {}; alm.extensions = {}; alm.window = window; alm.page = 0; alm.posts = 0; alm.totalposts = 0; alm.proceed = false; alm.disable_ajax = false; alm.init = true; alm.loading = true; alm.finished = false; alm.timer = null; alm.ua = (window.navigator.userAgent) ? window.navigator.userAgent : ''; // User agent alm.main = el; alm.master_id = (el.dataset.id) ? `ajax-load-more-${el.dataset.id}` : el.id; // The defined or generated ID of the ALM instance el.classList.add('alm-' + e); // Add unique classname el.setAttribute('data-alm-id', e); // Add unique data id // Get localized