PageSourceSearch

https://hareodymall.com/cdn/shop/t/44/assets/ajaxinate.min.js?v=184280457900856627781706579200

js hareodymall.com collected 2026-09-24 10:57:24 UTC 5,528 bytes, 145 lines download raw bytes

1'use strict';
2
3/* ===================================================================================== @preserve =
4 ___  _   _    _
5/   || | | |  | |
6\__  | | | |  | |  __
7/    |/  |/_) |/  /  \_/\/
8\___/|__/| \_/|__/\__/  /\_/
9              |\
10              |/
11Ajaxinate
12version v2.0.11
13https://github.com/Elkfox/Ajaxinate
14Copyright (c) 2017 Elkfox Co Pty Ltd
15https://elkfox.com
16MIT License
17================================================================================================= */
18
19var Ajaxinate = function ajaxinateConstructor(config) {
20  var settings = config || {};
21  /*
22    pagination: Selector of pagination container
23    method: [options are 'scroll', 'click']
24    container: Selector of repeating content
25    offset: 0, offset the number of pixels before the bottom to start loading more on scroll
26    loadingText: 'Loading', The text changed during loading
27    callback: null, function to callback after a new page is loaded
28  */
29  var defaultSettings = {
30    pagination: '#AjaxinatePagination',
31    method: 'scroll',
32    container: '#AjaxinateLoop',
33    offset: 0,
34    loadingText: 'Loading',
35    callback: null
36  };
37  // Merge configs
38  this.settings = Object.assign(defaultSettings, settings);
39
40  // Bind 'this' to applicable prototype functions
41  this.addScrollListeners = this.addScrollListeners.bind(this);
42  this.addClickListener = this.addClickListener.bind(this);
43  this.checkIfPaginationInView = this.checkIfPaginationInView.bind(this);
44  this.stopMultipleClicks = this.stopMultipleClicks.bind(this);
45  this.destroy = this.destroy.bind(this);
46
47  // Set up our element selectors
48  this.containerElement = document.querySelector(this.settings.container);
49  this.paginationElement = document.querySelector(this.settings.pagination);
50
51  this.initialize();
52};
53
54Ajaxinate.prototype.initialize = function initializeTheCorrectFunctionsBasedOnTheMethod() {
55  // Find and initialise the correct function based on the method set in the config
56  if (this.containerElement) {
57    var initializers = {
58      click: this.addClickListener,
59      scroll: this.addScrollListeners
60    };
61    initializers[this.settings.method]();
62  }
63};
64
65Ajaxinate.prototype.addScrollListeners = function addEventListenersForScrolling() {
66  if (this.paginationElement) {
67    document.addEventListener('scroll', this.checkIfPaginationInView);
68    window.addEventListener('resize', this.checkIfPaginationInView);
69    window.addEventListener('orientationchange', this.checkIfPaginationInView);
70  }
71};
72
73Ajaxinate.prototype.addClickListener = function addEventListenerForClicking() {
74  if (this.paginationElement) {
75    this.nextPageLinkElement = this.paginationElement.querySelector('a');
76    this.clickActive = true;
77    if (this.nextPageLinkElement !== null) {
78      this.nextPageLinkElement.addEventListener('click', this.stopMultipleClicks);
79    }
80  }
81};
82
83Ajaxinate.prototype.stopMultipleClicks = function handleClickEvent(event) {
84  event.preventDefault();
85  if (this.clickActive) {
86    this.nextPageLinkElement.innerHTML = this.settings.loadingText;
87    this.nextPageUrl = this.nextPageLinkElement.href;
88    this.clickActive = false;
89    this.loadMore();
90  }
91};
92
93Ajaxinate.prototype.checkIfPaginationInView = function handleScrollEvent() {
94  var top = this.paginationElement.getBoundingClientRect().top - this.settings.offset;
95  var bottom = this.paginationElement.getBoundingClientRect().bottom + this.settings.offset;
96  if (top <= window.innerHeight && bottom >= 0) {
97    this.nextPageLinkElement = this.paginationElement.querySelector('a');
98    this.removeScrollListener();
99    if (this.nextPageLinkElement) {
100      this.nextPageLinkElement.innerHTML = this.settings.loadingText;
101      this.nextPageUrl = this.nextPageLinkElement.href;
102      this.loadMore();
103    }
104  }
105};
106
107Ajaxinate.prototype.loadMore = function getTheHtmlOfTheNextPageWithAnAjaxRequest() {
108  this.request = new XMLHttpRequest();
109  this.request.onreadystatechange = function success() {
110    if (this.request.readyState === 4 && this.request.status === 200) {
111      var newContainer = this.request.responseXML.querySelectorAll(this.settings.container)[0];
112      var newPagination = this.request.responseXML.querySelectorAll(this.settings.pagination)[0];
113      this.containerElement.insertAdjacentHTML('beforeend', newContainer.innerHTML);
114      this.paginationElement.innerHTML = newPagination.innerHTML;
115      if (this.settings.callback && typeof this.settings.callback === 'function') {
116        this.settings.callback(this.request.responseXML);
117      }
118      this.initialize();
119    }
120  }.bind(this);
121  this.request.open('GET', this.nextPageUrl);
122  this.request.responseType = 'document';
123  this.request.send();
124};
125
126Ajaxinate.prototype.removeClickListener = function removeClickEventListener() {
127  this.nextPageLinkElement.addEventListener('click', this.stopMultipleClicks);
128};
129
130Ajaxinate.prototype.removeScrollListener = function removeScrollEventListener() {
131  document.removeEventListener('scroll', this.checkIfPaginationInView);
132  window.removeEventListener('resize', this.checkIfPaginationInView);
133  window.removeEventListener('orientationchange', this.checkIfPaginationInView);
134};
135
136Ajaxinate.prototype.destroy = function removeEventListenersAndReturnThis() {
137  // This method is used to unbind event listeners from the DOM
138  // This function is called manually to destroy "this" Ajaxinate instance
139  var destroyers = {
140    click: this.removeClickListener,
141    scroll: this.removeScrollListener
142  };
143  destroyers[this.settings.method]();
144  return this;
145};

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.