PageSourceSearch

https://psddaddy.com/wp-content/themes/pressgrid/js/app.js?ver=6.8.10

js psddaddy.com collected 2026-10-04 05:20:16 UTC 20,899 bytes, 660 lines download raw bytes

1'use strict';
2
3var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
5var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
6
7function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
9function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
10
11function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
12
13(function ($) {
14	"use strict";
15
16	var posts = [];
17	var img_4x3 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEg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
21	var PressgridItem = function (_React$Component) {
22		_inherits(PressgridItem, _React$Component);
23
24		function PressgridItem(props) {
25			_classCallCheck(this, PressgridItem);
26
27			var _this2 = _possibleConstructorReturn(this, (PressgridItem.__proto__ || Object.getPrototypeOf(PressgridItem)).call(this, props));
28
29			var post = _this2.props.post;
30
31			_this2.state = {
32				the_post: post
33			};
34			return _this2;
35		}
36
37		_createClass(PressgridItem, [{
38			key: 'render',
39			value: function render() {
40				var post = this.state.the_post;
41
42				var format = post.format,
43				    media = post.media,
44				    author = post.author;
45				var type = media.type,
46				    src = media.src,
47				    lazyload = media.lazyload;
48
49
50				var item_class = ['pressgrid-item'];
51
52				for (var k = 0; k < post.post_classes.length; k++) {
53					item_class.push(post.post_classes[k]);
54				}
55
56				item_class.push(themeton_content_col);
57
58				// Author and date
59				var el_author_date = React.createElement(
60					'div',
61					{ className: 'entry-author' },
62					React.createElement('img', { src: author.avatar, alt: 'avatar' }),
63					React.createElement(
64						'a',
65						{ href: author.link },
66						author.name
67					),
68					React.createElement(
69						'span',
70						null,
71						'|'
72					),
73					React.createElement(
74						'a',
75						{ href: post.link },
76						post.date
77					),
78					this.renderEditLink(post)
79				);
80
81				if (post.emotions.length < 1) {
82					el_author_date = React.createElement(
83						'div',
84						{ className: 'entry-author' },
85						React.createElement('img', { src: author.avatar, alt: 'avatar' }),
86						React.createElement(
87							'a',
88							{ href: author.link },
89							author.name
90						),
91						this.renderEditLink(post)
92					);
93				}
94
95				// Post Categories
96				var el_categories = React.createElement(
97					'div',
98					{ className: 'entry-cats' },
99					post.categories.map(function (cat) {
100						return React.createElement(
101							'a',
102							{ href: cat.link, style: { "background-color": cat.color } },
103							cat.name
104						);
105					})
106				);
107
108				// Post Format Media
109				var el_media = false;
110				if (type == 'image') {
111					el_media = React.createElement(
112						'div',
113						{ className: 'entry-image' },
114						React.createElement(
115							'a',
116							{ href: post.link },
117							React.createElement('img', { src: lazyload, 'data-src': src, alt: 'post image' })
118						),
119						el_categories
120					);
121					el_categories = false;
122					item_class.push('layout-image');
123				} else if (type == 'gallery') {
124					el_media = React.createElement(
125						'div',
126						{ className: 'entry-image' },
127						React.createElement(
128							'div',
129							{ className: 'swiper-container' },
130							React.createElement(
131								'div',
132								{ className: 'swiper-wrapper' },
133								src.map(function (img_item) {
134									return React.createElement(
135										'div',
136										{ className: 'swiper-slide' },
137										React.createElement(
138											'div',
139											{ className: 'entry-gallery-item', style: { "background-image": 'url(' + img_item + ')' } },
140											React.createElement(
141												'a',
142												{ href: post.link },
143												React.createElement('img', { src: img_4x3, alt: 'dimensions' })
144											)
145										)
146									);
147								})
148							),
149							React.createElement('div', { className: 'swiper-pagination' })
150						),
151						el_categories
152					);
153					el_categories = false;
154					item_class.push('layout-image');
155					item_class.push('layout-gallery');
156				} else if (type == 'audio') {
157					el_media = React.createElement(
158						'div',
159						{ className: 'entry-audio' },
160						React.createElement('div', { className: 'entry-audio-player' }),
161						el_categories
162					);
163					el_categories = false;
164					item_class.push('layout-audio');
165				}
166
167				// Post Title
168				var _post_title = $('<div></div>').html(post.title).text();
169				var el_title = React.createElement(
170					'h3',
171					{ className: 'entry-title' },
172					React.createElement(
173						'a',
174						{ href: post.link },
175						_post_title
176					)
177				);
178
179				// Post Excerpt
180				var el_excerpt_text = $('<span></span>').html(post.excerpt).text();
181				var el_excerpt = el_excerpt_text == '' ? '' : React.createElement(
182					'div',
183					{ className: 'entry-excerpt' },
184					el_excerpt_text
185				);
186
187				// Meta Section
188				var el_bottom = React.createElement(
189					'div',
190					{ className: 'entry-meta' },
191					React.createElement(
192						'div',
193						{ className: 'left-content' },
194						this.renderReactions(post)
195					),
196					React.createElement(
197						'div',
198						{ className: 'right-content' },
199						React.createElement(
200							'span',
201							null,
202							React.createElement('i', { className: 'icon-eye' }),
203							post.post_views
204						),
205						React.createElement(
206							'span',
207							null,
208							React.createElement('i', { className: 'icon-bubbles' }),
209							post.comments
210						)
211					),
212					React.createElement('div', { className: 'clearfix' })
213				);
214
215				if (format == 'banner') {
216					var _ads = $('<div></div>').html(post.excerpt);
217					_ads.find('script').each(function (indx) {
218						if (typeof $(this).attr('src') !== 'undefined') {
219							if ($('script[src="' + $(this).attr('src') + '"]').length < 1) {
220								$('body').append(this);
221							}
222						} else {
223							if ($('script[data-length="' + $(this).text().length + '"]').length < 1) {
224								$(this).attr('data-length', $(this).text().length);
225								$('body').append(this);
226							}
227						}
228					});
229					_ads.find('script').remove();
230					var _ads_html = _ads.html();
231
232					el_author_date = false;
233					el_categories = false;
234					el_title = false;
235					el_excerpt = false;
236					el_bottom = false;
237					el_media = React.createElement(
238						'div',
239						{ className: 'entry-image with-banner' },
240						React.createElement('div', { className: 'entry-banner', dangerouslySetInnerHTML: { __html: _ads_html } })
241					);
242					item_class.push('layout-image');
243				}
244
245				return React.createElement(
246					'div',
247					{ className: item_class.join(' ') },
248					React.createElement(
249						'div',
250						{ className: 'pg-item' },
251						el_media,
252						el_author_date,
253						el_categories,
254						el_title,
255						el_excerpt,
256						el_bottom
257					)
258				);
259			}
260		}, {
261			key: 'renderEditLink',
262			value: function renderEditLink(post) {
263				if (post.edit_url == '') {
264					return '';
265				}
266
267				return React.createElement(
268					'a',
269					{ href: post.edit_url, className: 'post-edit-url' },
270					'Edit'
271				);
272			}
273		}, {
274			key: 'renderGallery',
275			value: function renderGallery() {
276				return React.createElement(
277					'div',
278					null,
279					'gallery'
280				);
281			}
282		}, {
283			key: 'renderAudio',
284			value: function renderAudio() {
285				return React.createElement(
286					'div',
287					null,
288					'audio'
289				);
290			}
291		}, {
292			key: 'renderReactions',
293			value: function renderReactions(post) {
294				var _this3 = this;
295
296				var emotions = post.emotions;
297
298
299				if (emotions.length < 1) {
300					return React.createElement(
301						'div',
302						{ className: 'post-reactions not-reaction' },
303						React.createElement(
304							'em',
305							null,
306							post.date
307						)
308					);
309				}
310
311				var total_reactions = 0;
312				$.each(emotions, function (i, item) {
313					if (parseInt(item.count, 10) > 0) {
314						total_reactions += item.count;
315					} else {
316						total_reactions = item.count;
317					}
318				});
319
320				return React.createElement(
321					'div',
322					{ className: 'post-reactions' },
323					emotions.map(function (item) {
324						return React.createElement(
325							'span',
326							null,
327							_this3.renderReactionItem(item.emoji)
328						);
329					}),
330					React.createElement(
331						'em',
332						null,
333						total_reactions
334					),
335					this.renderActionReact(post)
336				);
337			}
338		}, {
339			key: 'renderReactionItem',
340			value: function renderReactionItem(reaction) {
341				return React.createElement(
342					'svg',
343					{ className: 'emotion-icon emoji-icon-' + reaction, 'aria-hidden': 'true' },
344					React.createElement('use', { xlinkHref: '#emoji-icon-' + reaction })
345				);
346			}
347		}, {
348			key: 'renderActionReact',
349			value: function renderActionReact(post) {
350				var _this4 = this;
351
352				if (themeton_reaction_of_posts.indexOf(post.id) > -1) {
353					return '';
354				}
355				return React.createElement(
356					'div',
357					{ className: 'post-action-react' },
358					pressgrid_reactions.map(function (item) {
359						return React.createElement(
360							'a',
361							{ href: 'javascript:;', onClick: _this4.onReactionPost.bind(_this4, item.emoji) },
362							_this4.renderReactionItem(item.emoji),
363							React.createElement(
364								'span',
365								null,
366								item.label
367							)
368						);
369					})
370				);
371			}
372		}, {
373			key: 'onReactionPost',
374			value: function onReactionPost(reaction) {
375				var post = this.state.the_post;
376				var _this = this;
377				var el_this = ReactDOM.findDOMNode(_this);
378				$(el_this).find('.post-action-react').hide();
379
380				$.post(theme_options.ajax_url, { action: 'themeton_post_reaction', post_id: post.id, reaction: reaction }, function (data) {
381					if (data != '') {
382						var _response = false;
383						try {
384							_response = $.parseJSON(data);
385						} catch (e) {}
386
387						if (_response) {
388							post.emotions = _response;
389							_this.setState({ the_post: post });
390						}
391					}
392				});
393			}
394		}, {
395			key: 'componentDidUpdate',
396			value: function componentDidUpdate() {}
397		}, {
398			key: 'componentDidMount',
399			value: function componentDidMount() {
400				var post = this.state.the_post;
401				var format = post.format,
402				    media = post.media,
403				    author = post.author;
404				var type = media.type,
405				    src = media.src,
406				    lazyload = media.lazyload;
407
408				var _this = this;
409				var el_this = ReactDOM.findDOMNode(_this);
410
411				if (type == 'image') {
412					$('<img src="' + src + '">').on('load', function () {
413						post.media.lazyload = src;
414						_this.setState({ the_post: post });
415					});
416				} else if (type == 'gallery') {
417					(function () {
418						var current_gallery = $(el_this).find('.swiper-container').swiper({
419							slidesPerView: 1,
420							spaceBetween: 0,
421							pagination: $(el_this).find('.swiper-pagination'),
422							paginationClickable: true
423						});
424
425						$(window).resize(function () {
426							setTimeout(function () {
427								current_gallery.update();
428							}, 600);
429						});
430					})();
431				} else if (type == 'audio') {
432					$(el_this).find('.entry-audio-player').html(src);
433					$(el_this).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer({ autosizeProgress: true });
434					$(el_this).find('.wp-playlist').each(function () {
435						return new WPPlaylistView({ el: this });
436					});
437				}
438
439				_this.props.onItemdAddedBind(el_this, _this.props.index);
440			}
441		}]);
442
443		return PressgridItem;
444	}(React.Component);
445
446	// Press Grid Object
447
448
449	var Pressgrid = function (_React$Component2) {
450		_inherits(Pressgrid, _React$Component2);
451
452		_createClass(Pressgrid, [{
453			key: 'getInitialState',
454			value: function getInitialState() {
455				return {
456					masonry: false
457				};
458			}
459		}]);
460
461		function Pressgrid(props) {
462			_classCallCheck(this, Pressgrid);
463
464			var _this5 = _possibleConstructorReturn(this, (Pressgrid.__proto__ || Object.getPrototypeOf(Pressgrid)).call(this, props));
465
466			var data = props.data;
467			var _data$count = data.count,
468			    count = _data$count === undefined ? 0 : _data$count,
469			    _data$current = data.current,
470			    current = _data$current === undefined ? 1 : _data$current,
471			    _data$pagination = data.pagination,
472			    pagination = _data$pagination === undefined ? [] : _data$pagination,
473			    _data$items = data.items,
474			    items = _data$items === undefined ? [] : _data$items,
475			    _data$pager_label = data.pager_label,
476			    pager_label = _data$pager_label === undefined ? 'Load more' : _data$pager_label,
477			    _data$pager_label_emp = data.pager_label_empty,
478			    pager_label_empty = _data$pager_label_emp === undefined ? 'No more posts' : _data$pager_label_emp;
479
480			_this5.state = {
481				posts: items,
482				current: current,
483				pagination: pagination,
484				pager_label: pager_label,
485				pager_label_empty: pager_label_empty,
486				posts_length: items.length,
487				postsElements: []
488			};
489			return _this5;
490		}
491
492		_createClass(Pressgrid, [{
493			key: 'render',
494			value: function render() {
495				var _this6 = this;
496
497				return React.createElement(
498					'div',
499					{ className: 'items-container' },
500					this.state.posts.map(function (post, index) {
501						return React.createElement(PressgridItem, { post: post, index: index, onItemdAddedBind: _this6.onItemdAddedBind.bind(_this6) });
502					})
503				);
504			}
505		}, {
506			key: 'renderPagination',
507			value: function renderPagination() {
508				if (this.state.current == -1 && this.state.pagination.length) {
509					if ($('#pressgrid_pager_standard').length < 1) {
510						$('#pressgrid_content').after('<div id="pressgrid_pager_standard"></div>');
511					}
512					$('#pressgrid_pager_standard').html($(this.state.pagination[0]));
513					return;
514				}
515				if ($('#pressgrid_pagination').length) {
516					ReactDOM.render(React.createElement(
517						'div',
518						{ className: 'pressgrid-pager' },
519						React.createElement(
520							'a',
521							{ href: 'javascript:;', onClick: this.onPaginationBind.bind(this) },
522							React.createElement(
523								'svg',
524								{ className: 'pagination-loader', 'aria-hidden': 'true' },
525								React.createElement('use', { xmlnsXlink: 'http://www.w3.org/1999/xlink', xlinkHref: '#svg-icon-loader' })
526							),
527							React.createElement(
528								'span',
529								null,
530								this.state.pager_label
531							)
532						)
533					), document.getElementById('pressgrid_pagination'));
534				}
535			}
536		}, {
537			key: 'onPaginationBind',
538			value: function onPaginationBind(event) {
539				var _this7 = this;
540
541				if (!$('#pressgrid_pagination').hasClass('onloading')) {
542					if (this.state.pagination.length > 1 && this.state.current < this.state.pagination.length) {
543						var _ret2 = function () {
544							var pager = _this7.state.current + 1;
545							var _this = _this7;
546							var _pagination = _this7.state.pagination;
547							if (_pagination[_this7.state.current] != '') {
548								$('#pressgrid_pagination').addClass('onloading');
549								$.post(_pagination[_this7.state.current], { paged: pager }, function (response) {
550									if (response != '') {
551										var _json = $.parseJSON(response);
552										if (typeof _json.items !== 'undefined' && _json.items && _json.items.length > 0) {
553											var _state_posts = _this.state.posts;
554											var _the_posts = _state_posts.concat(_json.items);
555											_this.setState({ current: pager });
556											_this.setState({ postsElements: [] });
557											_this.setState({ posts_length: _this.state.posts_length + _json.items.length });
558											_this.setState({ posts: _the_posts });
559										}
560
561										$('#pressgrid_pagination').removeClass('onloading');
562									}
563								});
564								return {
565									v: void 0
566								};
567							}
568						}();
569
570						if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === "object") return _ret2.v;
571					}
572					$('#pressgrid_pagination').find('a span').text(this.state.pager_label_empty);
573				}
574			}
575		}, {
576			key: 'onItemdAddedBind',
577			value: function onItemdAddedBind(newElement, index) {
578				var _this = this;
579				var _elements = this.state.postsElements;
580				var _ne = $(newElement).clone();
581				_elements.push(_ne);
582				this.setState({ postsElements: _elements });
583
584				if (index + 1 >= _this.state.posts_length) {
585					(function () {
586
587						var _elements_container = $('<div></div>');
588						$.each(_this.state.postsElements, function (index, item) {
589							_elements_container.append(item);
590						});
591
592						_elements_container.imagesLoaded(function () {
593							if (!_this.state.masonry) {
594								// initial options
595								$('#pressgrid_content').find('.items-container').isotope({
596									itemSelector: '.pressgrid-item',
597									layoutMode: 'masonry',
598									initLayout: false,
599									transitionDuration: 0
600								});
601								// bind event
602								$('#pressgrid_content').find('.items-container').isotope('on', 'layoutComplete', function (_event) {
603
604									$('#pressgrid_content').find('.items-container').find('.pressgrid-item:not(.elm-animate)').each(function (_index) {
605										var _el = $(this);
606										_el.css({
607											'-webkit-transition-delay': _index * 0.1 + "s",
608											'-moz-transition-delay': _index * 0.1 + "s",
609											'-ms-transition-delay': _index * 0.1 + "s",
610											'-o-transition-delay': _index * 0.1 + "s",
611											'transition-delay': _index * 0.1 + "s"
612										});
613										_el.addClass('elm-animate');
614									});
615								});
616								// initialize
617								$('#pressgrid_content').find('.items-container').isotope();
618
619								$(window).resize(function () {
620									setTimeout(function () {
621										$('#pressgrid_content').find('.items-container').isotope('reloadItems').isotope({ sortBy: '*' });
622									}, 800);
623								});
624
625								_this.setState({ masonry: true });
626							} else {
627								// $('#pressgrid_content').find('.items-container').isotope({ sortBy: '*' });
628								$('#pressgrid_content').find('.items-container').isotope('reloadItems').isotope({ sortBy: '*' });
629							}
630						});
631					})();
632				}
633			}
634		}, {
635			key: 'componentDidUpdate',
636			value: function componentDidUpdate() {}
637		}, {
638			key: 'componentDidMount',
639			value: function componentDidMount() {
640				var _this = this;
641				this.renderPagination();
642			}
643		}]);
644
645		return Pressgrid;
646	}(React.Component);
647
648	// Build Press Grid
649
650
651	if ($('#pressgrid_json').length) {
652		var json_data = $('#pressgrid_json').html();
653		if (json_data != '') {
654			var _json = $.parseJSON(json_data);
655			if (typeof _json.items !== 'undefined' && _json.items) {
656				ReactDOM.render(React.createElement(Pressgrid, { data: _json }), document.getElementById('pressgrid_content'));
657			}
658		}
659	}
660})(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.