PageSourceSearch

https://prichardcommittee.org/wp-content/plugins/quick-timeline/assets/js/timeline.js?ver=1.0

js prichardcommittee.org collected 2026-10-01 14:33:57 UTC 8,993 bytes, 206 lines download raw bytes

1(function($) {
2    'use strict';
3
4	var timelines = [];
5
6	// Sort timelines by time
7	function sortByTimeAsc(a,b) {
8		var a_time = parseInt(a.year) * 10000 + parseInt(a.month) * 100 + parseInt(a.date);
9		var b_time = parseInt(b.year) * 10000 + parseInt(b.month) * 100 + parseInt(b.date);
10		if (a_time < b_time) {
11			return -1;
12		} else if (a_time > b_time) {
13			return 1;
14		} else {
15			return 0;
16		}
17	}
18	function sortByTimeDesc(a,b) {
19		var a_time = parseInt(a.year) * 10000 + parseInt(a.month) * 100 + parseInt(a.date);
20		var b_time = parseInt(b.year) * 10000 + parseInt(b.month) * 100 + parseInt(b.date);
21		if (a_time > b_time) {
22			return -1;
23		} else if (a_time < b_time) {
24			return 1;
25		} else {
26			return 0;
27		}
28	}
29
30	// Create timelines slider
31	function createTimelines(el) {
32		var style 		= el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-layout').html();
33		var position 	= el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-position').html();
34		var icon 		= el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-icon').html();
35		var items 		= el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-items').html();
36
37		// Responsive
38		if ((screen.width <= 767) && (position == 'both')) {
39			position = 'right';
40		}
41		
42		if (style == 1) {
43			el.html('<div class="timeline-slider style-1"><div class="slider-history owl-carousel"></div></div>');
44			for (var i = 0; i < timelines.length; i++) {
45				el.find('.slider-history').append(	'<div class="history-chart-content text-center">'
46														+ '<div class="chart-dots">'
47                            								+ '<span class="chart-year">' + timelines[i].year + '</span>'
48                            								+ '<span class="chart-circle"></span>'
49                        								+ '</div>'
50							                            + '<div class="chart-caption">'
51							                                + '<div class="caption">' + timelines[i].content + '</div>'
52							                            + '</div>'
53							                     	+ '</div>');
54																
55			}
56		} else if (style == 2) {
57			el.html('<div class="timeline-slider style-2"><div class="slider-history owl-carousel"></div></div>');
58			for (var i = 0; i < timelines.length; i++) {
59				var timeline_icon = (timelines[i].icon && (icon == 'true')) ? '<div class="icon"><i class="' + timelines[i].icon + '"></i></div>' : '<div class="no-icon"><span class="round"></span></div>';
60				el.find('.slider-history').append(	'<div class="timeline-item text-center">'
61                        								+ '<div class="timeline-time">' + timelines[i].time + '</div>'
62                        								+ timeline_icon
63                        								+ '<div class="timeline-content">'
64	                        								+ '<h3 class="title">' + timelines[i].title + '</h3>'
65								                            + '<div class="content">' + timelines[i].content + '</div>'
66								                    	+ '</div>'
67							                     	+ '</div>');
68																
69			}
70		} else if (style == 3) {
71			el.html('<div class="timeline-slider style-3"><div class="slider-history owl-carousel"></div></div>');
72			for (var i = 0; i < timelines.length; i++) {
73				var timeline_icon 	= (timelines[i].icon && (icon == 'true')) ? '<div class="icon"><i class="' + timelines[i].icon + '"></i></div>' : '<div class="no-icon"><span class="round"></span></div>';
74				var timeline_image 	= timelines[i].image ? '<div class="image"><img src="' + timelines[i].image + '" /></div>' : '';
75				el.find('.slider-history').append(	'<div class="timeline-item text-center">'
76                        								+ '<span class="timeline-time">' + timelines[i].time + '</span>'
77                        								+ timeline_icon
78                        								+ '<div class="timeline-content">'
79                        									+ '<div class="timeline-wrap">'
80	                        									+ timeline_image
81	                        									+ '<div class="timeline-title">'
82			                        								+ '<h3 class="title">' + timelines[i].title + '</h3>'
83										                            + '<div class="content">' + timelines[i].content + '</div>'
84										                    	+ '</div>'
85										                    + '</div>'
86								                    	+ '</div>'
87							                     	+ '</div>');
88																
89			}
90		} else if (style == 4) {
91			el.html('<div class="timelines style-4 position-' + position + '"><span class="timeline-spine"></span><div class="timeline-items"></div></div>');
92			timelines = timelines.slice(0, items);
93			for (var i = 0; i < timelines.length; i++) {
94				var timeline_icon = (timelines[i].icon && (icon == 'true')) ? '<div class="icon"><i class="' + timelines[i].icon + '"></i></div>' : '<div class="no-icon"><span class="round"></span></div>';
95				el.find('.timeline-items').append(	'<div class="timeline-item">'
96														+ '<div class="content">'
97															+ '<span class="time">' + timelines[i].time + '</span>'
98															+ '<h3 class="title">' + timelines[i].title + '</h3>'
99															+ '<p>' + timelines[i].content + '</p>'
100														+ '</div>'
101														+ timeline_icon
102													+ '</div>');
103			}
104		} else if (style == 5) {
105			el.html('<div class="timelines style-5 position-' + position + '"><span class="timeline-spine"></span><div class="timeline-items"></div></div>');
106			timelines = timelines.slice(0, items);
107			for (var i = 0; i < timelines.length; i++) {
108				var timeline_icon 	= (timelines[i].icon && (icon == 'true')) ? '<div class="icon"><i class="' + timelines[i].icon + '"></i></div>' : '<div class="no-icon"><span class="round"></span></div>';
109				var timeline_image 	= timelines[i].image ? '<div class="image"><img src="' + timelines[i].image + '" /></div>' : '';
110				var has_image 		= timeline_image ? 'has-image' : 'no-image';
111				el.find('.timeline-items').append(	'<div class="timeline-item">'
112                        								+ '<div class="timeline-content ' + has_image + '">'
113                        									+ '<div class="timeline-wrap">'
114                        										+ '<span class="timeline-time">' + timelines[i].time + '</span>'
115	                        									+ timeline_image
116	                        									+ '<div class="timeline-title">'
117			                        								+ '<h3 class="title">' + timelines[i].title + '</h3>'
118										                            + '<div class="content">' + timelines[i].content + '</div>'
119										                    	+ '</div>'
120										                    + '</div>'
121								                    	+ '</div>'
122								                    	+ timeline_icon
123							                     	+ '</div>');
124			}
125		}
126
127		// Carousel
128		if (el.find('.slider-history').length) {
129			var autoplay 	= (el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-autoplay').html() === 'true');
130			var loop 		= (el.parents('.quick-timeline-wrapper').find('.quick-timeline-option-loop').html() === 'true');
131			var center 		= (style == 2) ? false : true;
132
133			var $owl = el.find('.slider-history');
134
135			$owl.children().each( function( index ) {
136	  			$(this).attr('data-position', index );
137			});
138				
139			$owl.owlCarousel({
140	            margin: 0,
141	            autoplay: autoplay,
142	            center: center,
143	            loop: loop,
144	            nav: true,
145	            dots: false,
146	            navText: ["<span class='left'></span>", "<span class='right'></span>"],
147	            stopOnHover: false,
148	            pagination: false,
149	            paginationNumbers: false,
150	            responsiveClass: true,
151	            responsive: {
152	                0: {
153	                    items: 1
154	                },
155	                768: {
156	                    items: items
157	                }
158	            }
159	        });
160
161			if (center) {
162				el.find('.owl-item > div').on('click', function (e) {
163	           		var $speed = 300;  // in ms
164					$owl.trigger('to.owl.carousel', [$(this).data('position'), $speed]);
165		        });
166			}
167		}
168		
169	}
170
171	$(document).ready(function(){
172		$('.quick-timeline').each(function(index) {
173			// Set id for timetable
174			$(this).attr('id', 'timeline-' + (index + 1));
175
176			// Get variables
177			var list = $(this).parents('.quick-timeline-wrapper').find('.quick-timeline-option-list').html();
178			var time = $(this).parents('.quick-timeline-wrapper').find('.quick-timeline-option-time').html();
179			
180			var timeline_contain = $(this);
181
182			$.ajax({
183				type: 'POST',
184				url: quick_timeline_vars.ajax_url,
185				dataType: 'json',
186				data: {action: 'get_timelines', list: list},
187				success: function(data) {
188					timelines = [];
189					for (var i = 0; i < data.length; i++) {
190						timelines.push(data[i]);
191					}
192
193					// Sort timelines by time
194					if (time == 'desc') {
195						timelines.sort(sortByTimeDesc);
196					} else {
197						timelines.sort(sortByTimeAsc);
198					}
199					
200					// Create timelines slider
201					createTimelines(timeline_contain);
202				}
203			});
204		});
205	});
206})(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.