<commit_before><?php
$demo = false;
if (isset($_GET['demo'])){

	$demo = $_GET['demo'];

	// check if the demo is valid
	if (strpos($demo, '/') !== false || !is_dir(dirname(__FILE__) . '/demos/' . $demo)){
		$demo = false;
	} else {

		include dirname(__FILE__) . '/libs/yaml.php';

		$path = dirname(__FILE__) . '/demos/' . $_GET['demo'] . '/';
		$details = file_get_contents($path . 'demo.details');

		preg_match('/\/\*\s*^---(.*?)^\.\.\.\s*\*\/(.*)/ms', $details, $matches);

		$descriptor = array();

		if (!empty($matches)){
			$descriptor = YAML::decode($matches[1]);
			$description = $matches[2];
		}

		$html = file_get_contents($path . 'demo.html');
		$css = file_get_contents($path . 'demo.css');
		$js = file_get_contents($path . 'demo.js');

	}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>MooTools Demos<?php if (!empty($descriptor['name'])): echo ' - ' . $descriptor['name']; endif; ?></title>
	<link href="assets/css/main.css" rel="stylesheet" type="text/css" />
	<link href="assets/css/demos.css" rel="stylesheet" type="text/css" />
</head>

<body>

	<div id="header">
		<div>
			<h1>MooTools</h1>
		</div>
	</div>

	<div id="content">
		<div id="leftcolumn">
			<ul>
				<li><a href="?"><strong>Demos</strong></a></li>
		<?php
		if ($handle = opendir(dirname(__FILE__) . '/demos/')){
		    while (false !== ($folder = readdir($handle))){
		        if ($folder != "." && $folder != ".."){
					?><li><a href="?demo=<?php echo $folder; ?>"><?php echo $folder; ?></a></li><?php
				}
		    }
		    closedir($handle);
		}
		?>
			</ul>
		</div>
		<div id="rightcolumn">
			<?php if ($demo): ?>

			<form action="http://jsfiddle.net/api/post/mootools/1.3/dependencies/more,art/" method="post">

				<button type="submit" class="button">Edit with jsFiddle</button>

				<div id="description">
					<?php if (!empty($descriptor['name'])): echo '<h2>' . $descriptor['name'] . '</h2>'; endif; ?>
					<?php if (!empty($description)): echo $description; endif; ?>
				</div>

				<ul class="tabs">
					<li class="selected first">Demo</li>
					<?php if (!empty($descriptor['docs'])): ?>
					<li>Docs</li>
					<?php endif; ?>
					<li>CSS</li>
					<li>HTML</li>
					<li>JavaScript</li>
				</ul>

				<div class="tabcontent selected">
					<iframe id="demoframe" src="assets/run.php?demo=<?php echo $_GET['demo']; ?>" frameborder="0"></iframe><commit_msg>Disable scrolling of the iframe, ugly at the Drag.Chart demos for example<commit_after><?php
$demo = false;
if (isset($_GET['demo'])){

	$demo = $_GET['demo'];

	// check if the demo is valid
	if (strpos($demo, '/') !== false || !is_dir(dirname(__FILE__) . '/demos/' . $demo)){
		$demo = false;
	} else {

		include dirname(__FILE__) . '/libs/yaml.php';

		$path = dirname(__FILE__) . '/demos/' . $_GET['demo'] . '/';
		$details = file_get_contents($path . 'demo.details');

		preg_match('/\/\*\s*^---(.*?)^\.\.\.\s*\*\/(.*)/ms', $details, $matches);

		$descriptor = array();

		if (!empty($matches)){
			$descriptor = YAML::decode($matches[1]);
			$description = $matches[2];
		}

		$html = file_get_contents($path . 'demo.html');
		$css = file_get_contents($path . 'demo.css');
		$js = file_get_contents($path . 'demo.js');

	}
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>MooTools Demos<?php if (!empty($descriptor['name'])): echo ' - ' . $descriptor['name']; endif; ?></title>
	<link href="assets/css/main.css" rel="stylesheet" type="text/css" />
	<link href="assets/css/demos.css" rel="stylesheet" type="text/css" />
</head>

<body>

	<div id="header">
		<div>
			<h1>MooTools</h1>
		</div>
	</div>

	<div id="content">
		<div id="leftcolumn">
			<ul>
				<li><a href="?"><strong>Demos</strong></a></li>
		<?php
		if ($handle = opendir(dirname(__FILE__) . '/demos/')){
		    while (false !== ($folder = readdir($handle))){
		        if ($folder != "." && $folder != ".."){
					?><li><a href="?demo=<?php echo $folder; ?>"><?php echo $folder; ?></a></li><?php
				}
		    }
		    closedir($handle);
		}
		?>
			</ul>
		</div>
		<div id="rightcolumn">
			<?php if ($demo): ?>

			<form action="http://jsfiddle.net/api/post/mootools/1.3/dependencies/more,art/" method="post">

				<button type="submit" class="button">Edit with jsFiddle</button>

				<div id="description">
					<?php if (!empty($descriptor['name'])): echo '<h2>' . $descriptor['name'] . '</h2>'; endif; ?>
					<?php if (!empty($description)): echo $description; endif; ?>
				</div>

				<ul class="tabs">
					<li class="selected first">Demo</li>
					<?php if (!empty($descriptor['docs'])): ?>
					<li>Docs</li>
					<?php endif; ?>
					<li>CSS</li>
					<li>HTML</li>
					<li>JavaScript</li>
				</ul>

				<div class="tabcontent selected">
					<iframe id="demoframe" src="assets/run.php?demo=<?php echo $_GET['demo']; ?>" frameborder="0" scrolling="no"></iframe>
{'fraction_non_alphanumeric': 0.25433180641306513, 'fraction_numerical': 0.005974905397331209, 'mean_word_length': 3.557168784029038, 'pattern_counts': {'":': 0, '<': 135, '<?xml version=': 0, '>': 135, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '552487', 'n_tokens_mistral': 2103, 'n_tokens_neox': 1805, 'n_words': 349}