PageSourceSearch

https://www.viola-group.com/wp-content/themes/viola/assets/blog/js/Blog2.js?a1a

js viola-group.com collected 2026-09-24 19:38:09 UTC 18,358 bytes, 669 lines download raw bytes

1var ajax = null;
2var Portfolio = {
3
4	popup_timer : null,
5
6	shuffle_instance : null,
7
8	init: function () {
9
10		var t = this;
11
12		$(".fake-select").FakeSelect();
13		$(".portfolio-popup-content").mCustomScrollbar();
14		$("#filter_by_industry .fake-select-options").mCustomScrollbar();
15
16		t.initShuffleJs();
17		t.eventsListeners();
18
19	},
20
21	eventsListeners: function () {
22
23		var t = this;
24
25		$(".plus-img").click(function () {
26			t.openPortfolioPopup();
27		});
28
29		$(".portfolio-arrows-wrapper .close-btn").click(function () {
30			t.closePortfolioPopup();
31		});
32
33
34		// $(".fake-select").on('fs-changed', function (e, data) {
35		// 	t.shuffleResults();
36		// });
37
38		// $(".option").on('click', function (e, data) {
39		// 	t.shuffleResults();
40		// });
41
42		$("#all-btn").on('click', function (e, data) {
43			t.shuffle_instance.filter(Shuffle.ALL_ITEMS);
44		});
45
46		$(".open-filtering-box").click(function (){
47			t.openMobileFilters();
48		});
49
50		$(".filtering-box .close-img").click(function (){
51			t.closeMobileFilters();
52		});
53
54		$(".filtering-box .fake-option").click(function () {
55			t.closeMobileFilters();
56		});
57
58	},
59
60
61	isMobile: function () {
62
63		if($(window).width() <= 640 || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
64			return true;
65		}
66		return false;
67
68	},
69
70
71	openMobileFilters: function () {
72
73		$(".filtering-box").removeClass("hidden-m").addClass("animated slideInLeft");
74		setTimeout(function() {
75			$(".filtering-box").removeClass("animated slideInLeft");
76		}, 300);
77		
78
79	},
80
81	closeMobileFilters: function () {
82
83		$(".filtering-box").removeClass("slideInLeft animated").addClass("animated slideOutLeft");
84		setTimeout(function() {
85			$(".filtering-box").removeClass("animated slideOutLeft").addClass('hidden-m');
86		}, 300);
87
88	},
89
90
91	scrollToContent: function () {
92		$("body, html").animate({
93			scrollTop: $(".portfolio .content-wrapper").offset().top
94		}, 1000);
95	},
96
97
98
99	openPortfolioPopup: function () {
100
101		var t = this;
102		$("body").addClass('no-scrolling');
103		t.clearPopupTimeout();
104		$("#portfolio_popup").removeClass("hidden-elem").addClass('animated fadeInRight');
105
106	},
107
108
109
110	closePortfolioPopup: function () {
111
112		var t = this;
113
114		$("body").removeClass('no-scrolling');
115		t.clearPopupTimeout();
116		$("#portfolio_popup").removeClass("fadeInRight").removeClass('animated').addClass('animated fadeOutLeft');
117		t.popup_timer = setTimeout(function () {
118			$("#portfolio_popup").addClass('hidden-elem');
119			$("#portfolio_popup").removeClass("fadeOutLeft").removeClass('animated')
120		}, 1000);
121
122	},
123
124
125
126	clearPopupTimeout: function () {
127
128		var t = this;
129		if(t.popup_timer){
130			clearTimeout(t.popup_timer);
131		}
132
133	},
134
135
136
137	initShuffleJs: function () {
138
139		var t = this;
140
141		Shuffle.ShuffleItem.Scale.HIDDEN = 0;
142		t.shuffle_instance = new Shuffle($(".portfolio-items-container"), {
143			speed : 500,
144			itemSelector: '.portfolio-item',
145			staggerAmount: 50,
146			sizer: $('#sizer'),
147			useTransforms: false,
148			staggerAmountMax: 100
149		});
150
151	},
152
153
154
155	shuffleResults: function () {
156
157		var t = this;
158
159		var selected_elements = $(".fake-select .fake-option.selected");
160		var selected_values = [];
161
162		if(selected_elements) {
163			$.each(selected_elements, function (){
164				selected_values.push($(this).text().trim());
165			});
166
167			t.shuffle_instance.filter(selected_values);
168
169		}else{
170
171			t.shuffle_instance.filter();
172
173		}
174
175		if(t.isMobile()) {
176			t.closeMobileFilters();
177			t.scrollToContent();
178		}
179
180		// if($('#all-pop')) {
181
182		//     t.shuffle_instance.filter(Shuffle.ALL_ITEMS);
183
184		// }
185
186		// if($('.fake-select-inner .option.guests')) {
187
188		//     t.shuffle_instance.filter('Guests');
189
190		// }
191
192
193	}
194
195
196};
197
198var updateBlog;
199
200$(document).ready(function () {
201
202console.log("blog2");
203
204	$.ajaxSetup({
205		beforeSend: function() {
206			$('.the-loader').fadeIn();
207		},
208		complete: function() {
209			$('.the-loader').fadeOut();
210		}
211	});
212
213	var vw = $(window).width(),
214		direction;
215
216	$('.all-contr').on('click', function(){
217		console.log($(this).attr('href'));
218		window.location = $('.all-contr a').attr('href');
219	});
220
221	Portfolio.init();
222
223	$('.option').on('click', function(e){
224		e.stopPropagation();
225		if($(this).hasClass('contr')) {
226			$(this).addClass('active');
227			$('.option.guests').removeClass('active');
228			$('.fake-select-inner.guests').removeClass('active');
229			$('.fake-select-inner.contr').addClass('active');
230		}
231
232		if($(this).hasClass('guests')) {
233			$(this).addClass('active');
234			$('.option.contr').removeClass('active');
235			$('.fake-select-inner.guests').addClass('active');
236			$('.fake-select-inner.contr').removeClass('active');
237		}
238	});
239
240	$('.all').on('click', function() {
241		$('.all a').trigger('click');
242	});
243
244	// Menu Transition
245	if ($('body').hasClass('home-page') == false && vw > 480) {
246		$(window).scroll(function(){
247
248			var menu = $('.sticky-menu')
249				menuBtn = $('.sticky-menu .btn')
250				wScroll = $(window).scrollTop();
251
252			if (wScroll >= 170) {
253				menu.addClass('white');
254				menuBtn.removeClass('white-outline-btn').addClass('blue-btn');
255			} else {
256				menu.removeClass('white');
257				menuBtn.removeClass('blue-btn').addClass('white-outline-btn');
258			}
259
260		});
261	}
262
263	//Mailing List Popup
264	$('.hero-btn').on('click', function(){
265		$('.mailing-list-popup').fadeIn('300');
266		$('.popup-overlay').fadeIn('300');
267	});
268
269	$('.mailing-list-popup .close-btn').on('click', function(){
270		$('.mailing-list-popup').fadeOut('300');
271		$('.popup-overlay').fadeOut('300');
272	});
273
274	$('.popup-overlay').on('click', function(){
275		$('.mailing-list-popup').fadeOut('300');
276		$('.popup-overlay').fadeOut('300');
277	});
278
279	// Check Scroll Direction
280	$(window).bind('mousewheel', function(event) {
281		if (event.originalEvent.wheelDelta >= 0) {
282			direction = 'up';
283		}
284		else {
285			direction = 'down';
286		}
287
288	});
289
290	if($('body').hasClass('contributor-page') == false && vw > 480) {
291		// Sticky Filters
292		$(window).scroll(function(){
293			var wScroll = $(this).scrollTop(),
294				$filters = $('.filtering-box');
295
296			if(wScroll > $($filters).position().top + $($filters).height() && direction == 'down') {
297				$($filters).addClass('top');
298			}
299
300			if(wScroll < $($filters).position().top + $('.hero').height() && direction == 'up') {
301				$('.page-content.portfolio .filtering-box.top').addClass('back')
302					.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
303						$($filters).removeClass('top back');
304					});
305			}
306
307		});
308	}
309
310
311	// Desktop Only JS
312	if(vw > 480) {
313
314
315		// Parrallax
316		$(window).scroll(function(){
317
318			var wScroll = $(this).scrollTop();
319
320			// Hero Image
321			$('.hero').css({
322				'background-position' : 'center ' + wScroll / 2 + 'px'
323			});			
324
325		});
326
327		$('.sticky-menu').removeClass('white');
328		$('.sticky-menu .btn').removeClass('white-btn').addClass('white-outline-btn');
329
330		// Post Opacity Transition
331		$(document).on('mouseover', '.post-outer', function(){
332			$('.post-outer').css('opacity', '0.5');
333			$(this).css('opacity', '1');
334		})
335		.on('mouseleave', '.post-outer', function(){
336			$('.post-outer').css('opacity', '1');
337		});
338
339		$('.search-btn').on('click', function(){
340			$('.select-wrap').toggleClass('outLeft');
341			$('.search-box').toggleClass('open');
342		});
343
344	}
345
346	// Mobile Only JS
347	if(vw < 480) {
348
349		$('.sticky-menu').addClass('white');
350		$('.sticky-menu .btn').removeClass('white-outline-btn').addClass('blue-btn');
351
352
353
354		// $('.search-box').appendTo('.box-title');
355
356	}
357
358	
359
360
361
362
363
364		var scrollProtect = false;
365		$("#pop-btn").on("click", function(e){
366			popular_data = true;
367			updateBlog();
368			// console.log("pop-btn");
369		});
370		$("#all-btn").on("click", function(e){
371			popular_data = false;
372			contributors_data = "";
373			category_data = "";
374			search_data = "";
375			one_promoted = false;
376			updateBlog();
377			// console.log("all-btn");
378		});
379		$("#filter_by_industry").on("fs-changed", function(e){
380			category_data = $.trim($(this).find(".fake-option.selected").text());
381			// page_data=1;
382			updateBlog()
383			// console.log("filter_by_industry");
384		});		
385		$("#filter_by_contributor").on("fs-changed", function(e){
386			contributors_data = $.trim($(this).find(".fake-option.selected").text());
387			var lastIndex = contributors_data.lastIndexOf(" ");
388			contributors_data = contributors_data.substring(0, lastIndex);
389			lastIndex = contributors_data.lastIndexOf(" ");
390			contributors_data = contributors_data.substring(0, lastIndex);
391			updateBlog()
392
393			// console.log(contributors_data);
394			// page_data=1;
395			// console.log("filter_by_contributor");
396		});				
397
398var searchTimeout;
399$(".input-wrap .search-input").on("keyup", function(){
400	var that = this;
401	clearTimeout(searchTimeout);
402	searchTimeout = setTimeout(function(){
403		search_data = $.trim($(that).val());
404		updateBlog();
405	}, 500);
406})
407
408
409		$(".mobileonly .search-input").on("keyup", function(e){
410			var that = this;
411			if (e.which == 13) {
412				search_data = $.trim($(that).val());
413				page_data=1;
414				$(".filtering-box .close-img").click();
415				updateBlog()
416			}
417		})
418		$(".mobileonly .search-input-clickzone").on("click", function(){
419			var e = jQuery.Event("keyup", { which: 13 });
420			// e.which = 13;
421			$(".mobileonly .search-input").trigger(e);
422		});
423
424
425		// $(document).on("click",".portfolio-item", function(e){
426		// 	var href = $(this).find(".plus-img a").attr("href");
427		// 	window.location = href;
428		// })
429
430		updateBlog = function(perPage = 12, thePage = 1, shouldRemove = true) {
431			updateUrl();
432			if ($.active) {
433				ajax.abort();
434			}
435			if ( ! one_promoted ) {
436				var theurl = "https://www.viola-group.com/api/blog-filter-once.php";
437			} else {
438				var theurl = "https://www.viola-group.com/api/blog-filter2.php";
439			}
440			popu = (popular_data)?"popular":"";
441			ajax = $.ajax({
442				url: theurl,
443				method: "get",
444				data: {
445					category: category_data,
446					author: contributors_data,
447					search: search_data,
448					order: popu,
449					per_page: perPage,
450					page: thePage
451				},
452				beforeSend: function() {
453					$('.the-loader').fadeIn();
454				},
455				complete: function() {
456					$('.the-loader').fadeOut();
457				},
458				success: function(datas){
459
460					$(".load-more-wrap").show();
461					if (shouldRemove) {
462						$(".portfolio-items-container .portfolio-item:not(.blog-big-hidden):not(.blog-small-hidden)").remove();
463						$(".results-for").remove();
464					}
465					if (search_data != "") {
466						$(".content-wrapper .container.row ").prepend("<div class='results-for'>Displaying results for: \""+search_data+"\" | <span class='clear-results'>Clear results</span></div>");
467
468						if (!datas.length) {
469							$(".results-for").text("No results for\""+search_data+"\"");
470							$(".load-more-wrap ").hide();
471						}
472					}
473					if (shouldRemove) {
474						datas.forEach(function(data, i, datas){
475							console.log('sss', data);
476								if(data.id != 13821 && data.id != 13817 && data.id != 13813 && data.id != 13541 && data.id != 13941 && data.id != 13944){
477    							if ( ! one_promoted ) {
478    								if ( data.promoted_post == "Yes" ) {
479    									var p = datas.splice(i, 1)[0];
480    									one_promoted = true;
481    
482    									var newElement = $(".portfolio-item.blog-big-hidden").clone().removeClass("blog-big-hidden");
483    
484    									// if (p.show_image == "No") {
485    										newElement.find(".img-col img").attr("src",p.featured_image_big);
486    										newElement.find(".img-col").addClass(p.choose_image_filter);
487    									// } else {
488    									// 	newElement.find(".img-filter").remove();
489    									// }
490    									// choose_image_filter
491    
492    
493    
494    									// update the author and image
495    									if ( data.authors[0].role == "guest-editor") {
496    										newElement.find(".post-author a").addClass("guest-popup-link").attr("data-url",data.authors[0].nicename).text(data.authors[0].name).attr("href","https://www.viola-group.com/violanotes/author/"+data.authors[0].nicename);
497    									} else {
498    										newElement.find(".post-author a").text(data.authors[0].name).attr("href","https://www.viola-group.com/violanotes/author/"+data.authors[0].nicename);
499    									}
500    									newElement.find(".post-author img").attr("src", data.authors[0].image);
501    
502    
503    									newElement.find(".post-title a").html(data.title).attr("href", data.url);
504    									newElement.find("a.read-more.mobileonly").attr("href", data.url);
505    									if(data.authors[1]){
506    										secoautho = '<p class="post-author"> <img class="img-responsive blog-author-image" src="' + data.authors[1].image + '"> <a href="https://www.viola-group.com/violanotes/author/' + data.authors[1].nicename + '">' + data.authors[1].name + '</a></p>';
507    										newElement.find(".post-author").after(secoautho);
508    									}
509    									newElement.find(".post-content").html(data.content);
510    									newElement.find(".post-date").html(data.post_date);
511    
512    
513    
514    									// if (data.authors.length == 2) {
515    									// 	secondAuthor = newElement.find(".post-author").clone().appendTo(".post-authors-outer");
516    									// 	secondAuthor.find("span").text(data.authors[1].name);
517    									// 	secondAuthor.find("img").attr("src", data.authors[1].image);
518    									// 	$(".post-outer").removeClass("single-author").addClass("double-author");
519    									// }
520    									$(".portfolio-items-container").append(newElement);
521    
522    								}
523    							}
524							}
525						});
526						Portfolio.initShuffleJs();
527					}
528
529					datas.forEach(function(data){
530					console.log('www', data.id);
531					if(data.id != 13821 && data.id != 13817 && data.id != 13813 && data.id != 13541 && data.id != 13941 && data.id != 13944){
532    						// add new box
533    						var newElement = $(".portfolio-item.blog-small-hidden").clone().removeClass("blog-small-hidden");
534    
535    
536    						// update the image
537    						if (data.show_image != "Yes") {
538    							newElement.find(".post-img img").attr("src",data.featured_image);
539    							newElement.find(".post-img").addClass(data.choose_image_filter);
540    							// console.log(data.choose_image_filter);
541    						} else {
542    							newElement.find(".post-img").remove();
543    							newElement.find(".post-outer").addClass("no-image");
544    							// 
545    						}
546    
547    						// update the author and image
548    						newElement.find(".post-author a").text(data.authors[0].name).attr("href","https://www.viola-group.com/violanotes/author/"+data.authors[0].nicename);
549    						if (data.authors[0].image)
550    							newElement.find(".post-author img").attr("src", data.authors[0].image);
551    						jQuery('.post-author img').each(function(){
552    						    if(jQuery(this).attr('src') == 'false'){
553    						        jQuery(this).attr("src","https://www.viola-group.com/w
553p-content/uploads/2023/03/user-1.png").hide();
554    						        jQuery(this).parent().find('a').hide();
555    						        jQuery(this).parent().append('<p style="margin: 0px;">' + jQuery(this).parent().find('a').text() + '</p>');
556    						    }
557    						});
558    						// console.log(data.authors.length);
559    						if (data.authors.length == 2) {
560    							secondAuthor = newElement.find(".post-author").clone().appendTo(newElement.find(".post-authors-outer"));
561    							secondAuthor.find("a").text(data.authors[1].name).attr("href","https://www.viola-group.com/author/"+data.authors[1].nicename);;
562    							secondAuthor.find("img").attr("src", data.authors[1].image);
563    							newElement.find(".single-author").removeClass("single-author").addClass("double-author");
564    
565    							// console.log(data.title);
566    						}
567    						if ( data.authors[0].role == "guest-editor") {
568    							newElement.find(".post-author a").addClass("guest-popup-link").attr("data-url",data.authors[0].nicename).text(data.authors[0].name).attr("href","#");
569    						} 
570    						if (data.authors.length == 2) {
571    							if ( data.authors[1].role == "guest-editor") {
572    								secondAuthor.find(".post-author a").addClass("guest-popup-link").attr("data-url",data.authors[0].nicename).text(data.authors[0].name).attr("href","https://www.viola-group.com/violanotes/author/"+data.authors[0].nicename);
573    							} 							
574    						}
575    						//
576    						newElement.find(".post-header h3 a").html(data.title).attr("href", data.url);
577    						newElement.find(".post-reveal p").html(data.content);
578    						newElement.find(".post-date").html(data.post_date);
579    
580    						newElement.find(".plus-wrap a").attr("href", data.url);
581    
582    						$(".portfolio-items-container").append(newElement);
583					}
584
585					});
586
587
588					$(".no-results").remove();
589					if (datas.length == 0) {
590						$(".container.row").append("<div class='no-results' style='margin: 0 auto;'>No results</div>");
591					}
592
593
594						Portfolio.initShuffleJs();
595					// refresh shufflejs
596					setTimeout(function(){
597						Portfolio.shuffle_instance.layout();
598						// console.log("PortfolioPortfolioPortfolio");
599					},1000);
600
601
602					console.log("datas.length", datas.length)
603
604
605
606					// Portfolio.shuffleResults();
607					if (datas.length >= perPage)
608						scrollProtect = false;
609					if (datas.length+1 < perPage)
610						$(".load-more").hide();
611				}	
612			});
613		}
614
615
616		// $(window).on("scroll", function(){
617		// 	if($("#sizer").position().top <  $(this).scrollTop() + $(this).height() ) {
618		// 		// console.log("more");
619		// 		if (!scrollProtect) {
620		// 			scrollProtect = true;
621		// 			updateBlog(8, ++page_data, false);
622		// 		}
623		// 	}
624		// });
625
626	$(".load-more").on("click", function(){
627		// if($("#sizer").position().top <  $(this).scrollTop() + $(this).height() ) {
628			// console.log("more");
629			if (!scrollProtect) {
630				scrollProtect = true;
631				updateBlog(12, ++page_data, false);
632			}
633		// }
634	});
635	$(document).on("click", ".clear-results", function(){
636		one_promoted = false;
637		$(".search-input").val("");
638		$(".search-box.desktoponly.open .search-btn").click();
639		$("#all-btn").click();
640	});
641		function updateUrl() {
642			var url =[];
643			if (popular_data ==true) {
644				url.push("order=popular");
645			}
646			if (category_data != "") {
647				url.push("category="+category_data);
648			}
649			if (contributors_data != "") {
650				url.push("author="+contributors_data);
651			}
652			if (search_data != "") {
653				url.push("search="+search_data);
654			}					
655			if (page_data != "1") {
656				url.push("thePage="+page_data);
657			}									
658			// var url = "category="+category_data+"&fund="+fund_data+"&activeexit="+activeexit_data+"&thePage="+page_data;
659			window.history.pushState({ }, "", "?"+url.join("&"));
660		}
661
662
663
664updateUrl();
665
666
667	
668
669});

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.