Untitled

 avatar
unknown
plain_text
2 years ago
5.7 kB
5
Indexable
<script>
	document.getElementById('myIframe').onload = function() {

		//console.log('ready iframe');
		var iframe = document.getElementById("myIframe");
		iframe.style.height = '0px';
		var iframenewsize = jQuery('#myIframe').contents().height();
        //console.log(iframenewsize);
		iframe.style.height = iframenewsize + 'px';
		jQuery('#myIframe').contents().find('.categoryHeader').hide();
        jQuery('#myIframe').contents().find('.GXPCategory').hide();
        jQuery('#myIframe').contents().find('.prevWeek').text('Prev Week');
        jQuery('#myIframe').contents().find('.nextWeek').text('Next Week');
        jQuery('#myIframe').contents().find('.GXPTime + div').remove();

	let head = jQuery("#myIframe").contents().find("head");
	let css = '<style>#scheduleGXP div{border: none !important;background: none !important}#scheduleGXP .GXPEntry{border-bottom: none !important;padding: 12px 10px !important}#scheduleGXP .GXPentryHeader{background: #efefef !important;border-bottom: none !important}#scheduleGXP .GXPentryHeader div{color: #000 !important;font-weight: 300 !important;font-size: 14px}#scheduleGXP .GXPTime{font-weight: 300 !important}#GXPMondayDay,#GXPTuesdayDay,#GXPWednesdayDay,#GXPThursdayDay,#GXPFridayDay,#GXPSaturdayDay,#GXPSundayDay{font-size: 20px !important;color: #4c4b4b !important;font-weight: 600 !important;text-shadow: none !important}#GXPMonday,#GXPTuesday,#GXPWednesday,#GXPThursday,#GXPFriday,#GXPSaturday,#GXPSunday{margin-bottom: 10px !important;margin-top: 10px !important}#GXPMonday .GXPEntry:nth-child(odd),#GXPTuesday .GXPEntry:nth-child(odd),#GXPWednesday .GXPEntry:nth-child(odd),#GXPThursday .GXPEntry:nth-child(odd),#GXPFriday .GXPEntry:nth-child(odd),#GXPSaturday .GXPEntry:nth-child(odd),#GXPSunday .GXPEntry:nth-child(odd){background-color: #efefef !important}#scheduleGXP .GXPDescription a{color: #0064a9 !important;font-size: 14px !important}#scheduleGXP .GXPDescription a:hover{color: #00b4f1 !important}#scheduleGXP select{padding: 5px !important;border-radius: 5px !important}#scheduleGXP #weekPicker{background: #efefef !important;padding: 15px !important;margin-bottom: 10px !important}#scheduleGXP #weekdaySelect{margin-bottom: 0 !important;padding: 5px !important;border-radius: 5px !important}#scheduleGXP #weekPicker a#printGXP{font-weight: 600 !important;color: #0064a9 !important;font-size: 14px !important;margin-left: 20px !important}#scheduleGXP #weekPicker a{font-weight: bold !important;font-weight: 300 !important;font-size: 14px !important;color: #000 !important;position: relative}#scheduleGXP #weekPicker .nextWeek::after{content: "";position: absolute;top: -3px;right: -20px;background-image: url("https://www.philaymca.org/sites/default/files/2022-08/ol-arrow-right-circle.png");background-repeat: no-repeat;width: 24px;height: 23px}#scheduleGXP #weekPicker .nextWeek{padding-right: 10px}#scheduleGXP #weekPicker .prevWeek::before{content: "";position: absolute;top: -3px;left: 3px;background-image: url("https://www.philaymca.org/sites/default/files/2022-08/ol-arrow-left-circle.png");background-repeat: no-repeat;width: 24px;height: 23px}#scheduleGXP #weekPicker .prevWeek{padding-left: 35px}#scheduleGXP .reservationInfoGXP{margin-top: 10px !important}#scheduleGXP.no-locations .GXPDescription{display: flex;align-items: center}.GXPDescription .addToCalendar img{height: 20px}#scheduleGXP.no-locations .GXPCategory{ display:none !important;}/*.descGXP {font-size: 0;visibility: hidden;text-decoration: none;color: inherit;}.descGXP:after {content: "Add to Calendar";visibility: visible; position: relative; top: -4px;}*/.addToCalendar img{content:url("https://www.philaymca.org/sites/default/files/2022-08/ol-calendar.png");} /*#scheduleGXP center {display:none;}*/#scheduleGXP a {color: #0064a9 !important;font-size: 14px !important;}#scheduleGXP a:hover {color: #00b4f1 !important;} .GXPInstructor .biographyGXP .subbed {color: #7e7e7e !important;font-weight: 300 !important;font-size: 12px !important; font-style: italic;}#scheduleGXP .GXPDescription {width: 21% !important;}#dialogGXP a {color: #0064a9 !important;font-size: 14px !important;}#dialogGXP a:hover {color: #00b4f1 !important;}#scheduleGXP #weekPicker a#printGXP:hover{color: #00b4f1 !important;}.GXPStudio:before{content: "Location: " !important;}</style>';
	jQuery(head).append(css);

    /*    jQuery('#myIframe').contents().on("mousedown, mouseup, click", function(){
        	setTimeout(function(){
				var sHeight, frame;

	           	frame = document.getElementById("myIframe");
	           	frame.style.height = '0px';
	           	sHeight = document.getElementById('myIframe').
	            contentWindow.document.body.scrollHeight + 80;
	           	frame.style.height = sHeight + 'px';
	           	//console.log(sHeight);
		    }, 2000);
        }); */
        //jQuery( '#myIframe' ).load(function(){
			var lastHeight = 0, curHeight = 0;
			var iframe = document.getElementById("myIframe");
			setInterval(function(){
			    curHeight = jQuery('#myIframe').contents().height();
			    //console.log(curHeight + ' - ' + lastHeight);
			    if ( ((curHeight - lastHeight) > 50) || ((lastHeight - curHeight) > 50) ) {
			        lastHeight = curHeight;
			        setTimeout(function(){
						var sHeight, frame;

			           	frame = document.getElementById("myIframe");
			           	frame.style.height = '0px';
			           	sHeight = document.getElementById('myIframe').
			            contentWindow.document.body.scrollHeight + 80;
			           	frame.style.height = sHeight + 'px';
			           	//console.log(sHeight);
				    }, 1000);
			    }
			},500);
		//});
	};
</script>