

<!-- html starts -->
	<script type="text/javascript">

	jQuery(function($)
	{
		var mylist = $('.hideDivList');
		var listitems = mylist.find('.eventItem');//.children('.eventItem').get();
		listitems.sort(function(a, b) {
		   return $(a).attr('id').toUpperCase().localeCompare($(b).attr('id').toUpperCase());
		})
		$.each(listitems, function(idx, itm) { mylist.find('.eventsRow').append(itm); });
		jQuery('.hideDivList').fadeIn('slow');
		
		jQuery('.filterBySite').hide();
		jQuery('.filterOuter h3').click(function(){
			if (jQuery(this).hasClass('open'))
				jQuery(this).removeClass('open');
			else 
				jQuery(this).addClass('open');
			jQuery('.filterBySite').toggle();
		});
		
		// populate the filters
		jsonObj = [];

		jQuery('.eventItem').each(function()
		{
			if (jQuery(this).find('.eventImage img').length > 0)
				jQuery(this).addClass('hasImage');
			else
				jQuery(this).addClass('NoImage');
				
			var val = jQuery(this).attr('group');
			const exists = jsonObj.includes(val);
			if (!exists)
				jsonObj.push(val);
		});

		const params = new Proxy(new URLSearchParams(window.location.search), {
  			get: (searchParams, prop) => searchParams.get(prop),
		});
		// Get the value of "some_key" in eg "https://example.com/?some_key=some_value"
		let filterVal = params.f;
		//console.log('filter val: ' + filterVal);

		let anyChecked = false;
		for (var i=0;i<jsonObj.length;i++)
		{
			var ischecked = " checked=\"checked\" ";
			if ((filterVal != null) && (filterVal != ""))
			{
				//console.log('checking ' + jsonObj[i].toLowerCase().replace(" ","-"));	
				if (jsonObj[i].toLowerCase().replaceAll(" ","-") != filterVal)
				{
					ischecked = "";
				}
				else 
				{
					anyChecked = true;	
				}
 			}
			jQuery('.filterBySite').append('<div class="filterItem"><input type="checkbox" id="cb' + i + '" value="' + jsonObj[i] + '" ' + ischecked + '/><label for="cb' + i + '">' + jsonObj[i] + '</label></div>');
		}
		
		var maybeCheck = " checked=\"checked\" ";
		if (anyChecked)
			maybeCheck = "";
		jQuery('.filterBySite').prepend('<div class="filterItem"><input type="checkbox" id="cbX" value="ALL" ' + maybeCheck + ' /><label for="cbX">Show all calendars</label></div>');
		
		
		processFilter();			
		jQuery('.filterBySite input').on('change', function(){
			if (jQuery(this).attr('id') == "cbX")
			{
				if (jQuery(this).is(':checked'))
				{
					jQuery('.filterBySite input').attr('checked','checked');
				}
				else 
				{
					jQuery('.filterBySite input').removeAttr('checked');
				}
			}
			else 
			{
				jQuery('#cbX').removeAttr('checked');
			}
			processFilter();			
		});

		function processFilter()
		{
			jQuery('.hideDivList').addClass('manfilter-active');
			jQuery('.hideDivList .eventItem').removeClass('active').addClass('inactive').hide();
			
			 jQuery('.hideDivList .eventItem').removeClass(function (index, css) {
					 return (css.match (/\activeitem\S+/g) || []).join(' '); // removes anything that starts with "activeitem"
				});
			
			if (jQuery('.filterBySite input').length > 0)
			{
				jQuery('.filterBySite input').each(function(){
					if (jQuery(this).is(':checked'))
					{
						//console.log(jQuery(this).val());
						jQuery('.hideDivList .eventItem[group="' + jQuery(this).val() + '"]').removeClass('inactive').addClass('active').fadeIn('slow');
					}
				});
			}
			else 
			{
				jQuery('.hideDivList .eventItem').removeClass('inactive').addClass('active').fadeIn('slow');
			}
			addClassesAfterManFilter();
		}
		
		function addClassesAfterManFilter()
		{
			var len = jQuery('.hideDivList.manfilter-active .eventItem.active').length;
			var i = 0;
			   
			jQuery('.hideDivList.manfilter-active .eventItem.active').each(function(index, element){
				if(i%3 == 0)
					jQuery(this).addClass('activeitemrowfirst');
					
				i++;
				jQuery(this).addClass('activeitem'+i);		
					
				if(len == i)
					jQuery(this).addClass('activeitemlast');
			});
		}
	});
	
</script>

<style>

.eventRow {margin-bottom:20px;}
.site-outer, .mpr_content label, .mpr_start_date, .mpr_start_time, .mpr_end_time, .mpr_end_date, .dashicons-edit {display:none;}
.mpr_content .more-link {display:inline;}
.mpr_formatted_end_date {padding-left:1em;position:relative;}
.mpr_formatted_end_date:before {position:absolute;left:0.3em;content:" - ";top:0;}
.mpr_the_title {font-weight: bold;font-size: 1.1em;display:block;width:80%;}
.mpr_sitename {position: absolute;top: 0;left: 0;background: #006841;color: white;padding: 5px;}

.eventImage {position:relative;width:100%;min-height:190px;background:transparent url(/wp-content/themes/shared/images/Logo_MGCC_green.svg) no-repeat center center;background-size:contain;aspect-ratio:3 / 2;overflow:hidden;}
.eventImage img {max-width:100%;height:auto;}
.eventItem.hasImage .eventImage {background-image:none;}
/*.eventItem.NoImage .eventImage {background-image:none;min-height: 35px;}*/
.mpr_featured_image a {display:block;width:100%;height:100%;min-height:190px;}	
.eventItem.NoImage .eventImage .mpr_featured_image a {min-height: 35px;}
.filterRow {margin-bottom:30px;}
.filterRow .filterItem {float:left;width:50%;min-height:5em;}
.filterRow .filterItem * {font-size: 2.6rem; font-weight: bold;vertical-align: middle;display: inline-block;}
.filterRow .filterItem > input {margin:5px 0px 0px 0px;height: 20px;width: 20px;}
.filterRow .filterItem > label 
{
margin-left: 15px;max-width: 190px;
line-height: 120%;
vertical-align: top;
}
.filterBySite {margin-top: 10px;margin-bottom: 20px;}
.siteclassname {visibility: hidden;}

.hideDivList .row .four.columns.eventItem {
  min-height: 550px;
}
.hideDivList:not(.manfilter-active) .row .four.columns.eventItem:nth-child(3n+1) {
  margin-left: 0px;
}
.hideDivList:not(.manfilter-active) .row .four.columns.eventItem:last-child {
  float: left;
}	

.hideDivList.manfilter-active .row .four.columns.eventItem.active.activeitemrowfirst {
  margin-left: 0px;
}
.hideDivList.manfilter-active .row .four.columns.eventItem.active.activeitemlast {
 float: left !important;
}	

/*mpr_the_title*/

.row .four.columns.eventItem.mg-car-club a {
  color: #006841;
}

.row .four.columns.eventItem.motorsport a {
  color: #264089;
}

.row .four.columns.eventItem:not(.mg-car-club):not(.motorsport) a {
  color: #f28030;
}


.row .four.columns.eventItem.mg-car-club .mpr_sitename,
.row .four.columns.eventItem.mg-car-club:hover .mpr_sitename {
  border: 1px solid #006841;
  background-color: #006841;
  background: #006841;
}

.row .four.columns.eventItem.motorsport .mpr_sitename,
.row .four.columns.eventItem.motorsport:hover .mpr_sitename {
  border: 1px solid #264089;
  background-color: #264089;
  background: #264089;
}


.row .four.columns.eventItem:not(.mg-car-club):not(.motorsport) .mpr_sitename,
.row .four.columns.eventItem:not(.mg-car-club):not(.motorsport):hover .mpr_sitename {
  border: 1px solid #f28030;
  background-color: #f28030;
  background: #f28030;
}

@media only screen and (max-width: 991px) {
	.filterRow .filterItem {float:none;width:100%;display:block;margin:0px 0px 15px 0px;min-height:auto;}
	.filterRow h3 {font-size: 2.3rem;}
	.filterRow .filterItem * {font-size: 2rem;}
	.filterRow .filterItem > input {
	  height: 14px;
	  width: 14px;
	}
	
}
@media only screen and (max-width: 767px) {
	.hideDivList .row .four.columns.eventItem {
	  min-height: auto;
	}
}

.arrow {
  border: solid black;
  border-width: 0 3px 3px 0;
  display: inline-block;
  padding: 5px;
	margin-left:5px;
}
.up, h3.open .down {
  transform: rotate(-135deg);
  -webkit-transform: rotate(-135deg);
}

.down {
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}	
	.filterOuter h3 {text-decoration:underline;cursor:pointer;}	
</style>

<!-- html ends -->


{"id":35487,"date":"2023-01-30T09:53:32","date_gmt":"2023-01-30T09:53:32","guid":{"rendered":"http:\/\/mgccsite.oberginetest.co.uk\/mg100\/?page_id=35487"},"modified":"2024-06-01T15:45:22","modified_gmt":"2024-06-01T15:45:22","slug":"centenary-events","status":"publish","type":"page","link":"https:\/\/www.mgcc.co.uk\/mg100\/centenary-events\/","title":{"rendered":"Centenary Events"},"content":{"rendered":"\n<p>MG100 Events.<\/p>\n\n\n<div class='hideDivList' style='display:none'><div class='mpr_heading'>\n\t<\/div>\n<div class='row eventsRow'><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>MG100 Events.<\/p>\n","protected":false},"author":55,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"class_list":["post-35487","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/pages\/35487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/comments?post=35487"}],"version-history":[{"count":4,"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/pages\/35487\/revisions"}],"predecessor-version":[{"id":37469,"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/pages\/35487\/revisions\/37469"}],"wp:attachment":[{"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/media?parent=35487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mgcc.co.uk\/mg100\/wp-json\/wp\/v2\/categories?post=35487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}