PageSourceSearch

https://www.ellafitzgerald.com/wp-content/plugins/umg-grand-royal-…/js/libs/loadMoreResults.js?ver=3.5.8

js ellafitzgerald.com collected 2026-09-24 08:43:31 UTC 2,338 bytes, 89 lines download raw bytes

1/**
2	*	Load More Results v1.0.0
3	* Author: Cenk Çalgan
4	* 
5	* Options:
6	* - tag (object):
7	*		- name (string)
8	*		- class (string)
9	* - displayedItems (int)
10	* - showItems (int)
11	* - button (object):
12	*		- class (string)
13	*		- text (string)
14*/
15
16(function ($) {
17	'use strict';
18
19	$.fn.loadMoreResults = function (options) {
20
21		var defaults = {
22			tag: {
23				name: 'div',
24				'class': 'item'
25			},
26			displayedItems: 5,
27			showItems: 5,
28			button: {
29				'class': 'btn-load-more',
30				text: 'Load More'
31			}
32		};
33
34		var opts = $.extend(true, {}, defaults, options);
35
36		var alphaNumRE = /^[A-Za-z][-_A-Za-z0-9]+$/;
37		var numRE = /^[0-9]+$/;
38
39		$.each(opts, function validateOptions(key, val) {
40			if (key === 'tag') {
41				formatCheck(key, val, 'name', 'string');
42				formatCheck(key, val, 'class', 'string');
43			}
44			if (key === 'displayedItems') {
45				formatCheck(key, val, null, 'number');
46			}
47			if (key === 'showItems') {
48				formatCheck(key, val, null, 'number');
49			}
50			if (key === 'button') {
51				formatCheck(key, val, 'class', 'string');
52			}
53		});
54
55		function formatCheck(key, val, prop, typ) {
56			if (prop !== null && typeof prop !== 'object') {
57				if (typeof val[prop] !== typ || String(val[prop]).match(typ == 'string' ? alphaNumRE : numRE) === null) {
58					opts[key][prop] = defaults[key][prop];
59				}
60			} else {
61				if (typeof val !== typ || String(val).match(typ == 'string' ? alphaNumRE : numRE) === null) {
62					opts[key] = defaults[key];
63				}
64			}
65		};
66
67		return this.each(function (index, element) {
68			var $list = $(element),
69					lc = $list.find(' > ' + opts.tag.name + '.' + opts.tag.class).length,
70					dc = parseInt(opts.displayedItems),
71					sc = parseInt(opts.showItems);
72			
73			$list.find(' > ' + opts.tag.name + '.' + opts.tag.class + ':lt(' + dc + ')').css("display", "inline-block");
74			$list.find(' > ' + opts.tag.name + '.' + opts.tag.class + ':gt(' + (dc - 1) + ')').css("display", "none");
75
76			$list.parent().append('<button class="btn-view ' + opts.button.class + '">' + opts.button.text + '</button>');
77			$list.parent().on("click", ".btn-view", function (e) {
78				e.preventDefault();
79				dc = (dc + sc <= lc) ? dc + sc : lc;
80				
81				$list.find(' > ' + opts.tag.name + '.' + opts.tag.class + ':lt(' + dc + ')').fadeIn();
82				if (dc == lc) {
83					$(this).hide();
84				}
85			});
86		});
87
88	};
89})(jQuery);

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.