forked from wikiLingo/wikiLingo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mirror.php
89 lines (81 loc) · 2.54 KB
/
mirror.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
require_once('vendor/autoload.php');
$scripts = (new WikiLingo\Utilities\Scripts())
->addCssLocation("//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css")
->addScriptLocation("//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js")
->addScriptLocation("http://code.jquery.com/ui/1.10.3/jquery-ui.js")
->addScriptLocation('~/bower_components/vkbeautify/index.js');
$parser = new WikiLingo\Parser($scripts);
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>wikiLingo mirror</title>
<?php echo $scripts->renderCss(); ?>
<style>
table td {
vertical-align: top;
}
#wLOutSource {
word-wrap: break-word ! important;
}
</style>
</head>
<body>
<br />
<div style="text-align: center; font-size:30px;"><img src="img/w.svg" style="width: 5%; margin-left: -85px; margin-top: -28px; position: absolute;"/>ikiLingo mirror</div>
<table style="width: 100%;">
<tr>
<th style="width: 50%;">in</th>
<th style="width: 50%;">out <button id="wLUpdate">Update</button> (wysiwyg output? <input type="checkbox" id="wLWYSIWYGOutput" />)</th>
</tr>
<tr>
<td style="padding: 20px;"><textarea id="wL" style="width: 100%;"></textarea></td>
<td style="padding: 20px;" id="wLOut"></td>
</tr>
<tr>
<th colspan="2">out source</th>
</tr>
<tr>
<td colspan="2">
<pre id="wLOutSource"></pre>
</td>
</tr>
</table>
</body>
<?php echo $scripts->renderScript(); ?>
<script>
$(function() {
var wL = $('#wL').height(window.innerHeight * 0.8),
wLOut = $('#wLOut'),
wLOutSource = $('#wLOutSource'),
wLWYSIWYGOutput = $('#wLWYSIWYGOutput'),
head = $('head');
$('#wLUpdate').click(function() {
var data = {
w: wL.val()
};
if (wLWYSIWYGOutput.is(':checked')) {
data.wysiwyg = true;
}
$.ajax({
type: 'POST',
dataType: 'json',
url: 'reflect.php',
data: data,
success: function(result) {
wLOut.html(result.output);
wLOutSource.text(vkbeautify.xml(result.output));
if (result.script) {
head.append(result.script);
}
if (result.css) {
head.append(result.css);
}
}
});
return false;
});
});
</script>
</html>