<commit_before>/**
 *
 * Inline Style (JS)
 *
 * @author <NAME> @ Space-Time Inc.
 * @version 2019-10-29
 *
 */


window.ST = window['ST'] || {};


(function (NS) {

	const SEL_TARGET = '.stile';


	NS.addInit(1, () => {
		const spans = document.querySelectorAll(SEL_TARGET + ' span');
		modifySpanStyle(spans);
		const fs = document.querySelectorAll(SEL_TARGET + ' iframe');
		modifyIframeStyle(fs);
	});


	// Span Styles -------------------------------------------------------------


	function modifySpanStyle(spans) {
		for (let i = 0; i < spans.length; i += 1) {
			const target = spans[i];
			let type = target.style.textDecorationLine;
			if (type === undefined) {  // for IE11, Edge
				type = target.style.textDecoration;
				if (type === 'underline') {
					target.style.textDecoration = '';
					NS.addStile(target, 'inline-' + type);
				}
			} else {
				if (type === 'underline') {
					target.style.textDecorationLine = '';
					NS.addStile(target, 'inline-' + type);
				}
			}
		}
	}


	// Iframe Styles -----------------------------------------------------------


	function modifyIframeStyle(fs) {
		for (let i = 0; i < fs.length; i += 1) {
			const f = fs[i];
			let w = f.width, h = f.height;
			if (!w || !h) {
				w = parseInt(f.style.width);
				h = parseInt(f.style.height);
				if (!w || !h) continue;
			}
			const wrap = document.createElement('SPAN');
			NS.addStile(wrap, 'iframe-wrapper');
			const spacer = document.createElement('DIV');
			spacer.style.paddingTop = (100 * h / w) + '%';
			wrap.appendChild(spacer);
			wrap.style.maxWidth = w + 'px';
			f.parentElement.insertBefore(wrap, f);
			wrap.appendChild(f);
			wrap.dataset['aspect'] = Math.round(w / h * 1000) / 1000;
		}
	}

})(window.ST);<commit_msg>Improve size acquisition of iframe wrapper<commit_after>/**
 *
 * Inline Style (JS)
 *
 * @author <NAME> @ Space-Time Inc.
 * @version 2019-12-16
 *
 */


window.ST = window['ST'] || {};


(function (NS) {

	const SEL_TARGET = '.stile';


	NS.addInit(1, () => {
		const spans = document.querySelectorAll(SEL_TARGET + ' span');
		modifySpanStyle(spans);
		const fs = document.querySelectorAll(SEL_TARGET + ' iframe');
		modifyIframeStyle(fs);
	});


	// Span Styles -------------------------------------------------------------


	function modifySpanStyle(spans) {
		for (let i = 0; i < spans.length; i += 1) {
			const target = spans[i];
			let type = target.style.textDecorationLine;
			if (type === undefined) {  // for IE11, Edge
				type = target.style.textDecoration;
				if (type === 'underline') {
					target.style.textDecoration = '';
					NS.addStile(target, 'inline-' + type);
				}
			} else {
				if (type === 'underline') {
					target.style.textDecorationLine = '';
					NS.addStile(target, 'inline-' + type);
				}
			}
		}
	}


	// Iframe Styles -----------------------------------------------------------


	function modifyIframeStyle(fs) {
		for (let i = 0; i < fs.length; i += 1) {
			const f = fs[i];
			let w = f.width, h = f.height;
			if (!w || !h) {
				const sW = f.style.width;
				const sH = f.style.height;
				if (sW.indexOf('px') !== sW.length - 2) continue;
				if (sH.indexOf('px') !== sH.length - 2) continue;
				w = parseInt(sW);
				h = parseInt(sH);
				if (!w || !h) continue;
			}
			const wrap = document.createElement('SPAN');
			NS.addStile(wrap, 'iframe-wrapper');
			const spacer = document.createElement('DIV');
			spacer.style.paddingTop = (100 * h / w) + '%';
			wrap.appendChild(spacer);
			wrap.style.maxWidth = w + 'px';
			f.parentElement.insertBefore(wrap, f);
			wrap.appendChild(f);
			wrap.dataset['aspect'] = Math.round(w / h * 1000) / 1000;
		}
	}

})(window.ST);
{'fraction_non_alphanumeric': 0.23452413416962095, 'fraction_numerical': 0.014725934005999454, 'mean_word_length': 2.257548845470693, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6310980', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1243, 'n_words': 270}