-
Notifications
You must be signed in to change notification settings - Fork 136
/
builder.php
155 lines (124 loc) · 4.83 KB
/
builder.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Δ.js Documentation</title>
<script type="text/javascript" src="dist/anything.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.6/semantic.min.css"/>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.6/semantic.min.js"></script>
<script src="http://semantic-ui.com/javascript/library/tablesort.js"></script>
</head>
<body class="pushable">
<!-- Main Menu -->
<div class="ui fixed inverted menu">
<a href="index.html" class="header item">
<img class="logo" src="assets/tb_icon.png">
</a>
<a href="index.html" class="item">Home</a>
<a href="playground.html" class="olive item">Playground</a>
<a class="active orange item">Package builder</a>
<a href="documentation.html" class="pink item">Documentation</a>
</div>
<!-- Page Contents -->
<div class="pusher">
<h1> </h1>
<h1> </h1>
<div class="ui container">
<div id="buiderFormDiv">
<form id="builderForm" method="post">
<table class="ui sortable celled table">
<thead>
<tr>
<th class="sorted ascending">Name</th>
<th>Filesize</th>
<th>
<div class="ui fitted slider checkbox">
<input checked class="fileSelectorCheckbox" type="checkbox" id="toggleAll">
<label></label>
</div>
</th>
</tr>
</thead>
<tbody>
<?php
$dir = __DIR__ . '/src/';
$files_list = array_diff(scandir($dir), array('..', '.'));
foreach ($files_list as $filekey => $file): ?>
<tr>
<td><a href="/src/<?php echo $file; ?>"><?php echo $file; ?></a></td>
<td><?php echo filesize(__DIR__ . '/src/'.$file); ?></td>
<td class="collapsing">
<div class="ui fitted slider checkbox">
<input checked class="fileSelectorCheckbox" type="checkbox"
value="<?php echo $file; ?>" name="fileselector[]">
<label></label>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot class="full-width">
<tr>
<th>
<button class="ui small orange labeled icon button">
<i class="configure icon"></i> Generate
</button>
</th>
<th></th>
</tr>
</tfoot>
</table>
</form>
</div>
<div id="resultDiv" class="ui form" style="display: none;">
<div class="field">
<label><h1>anything.js:</h1></label>
<textarea id="resultText"></textarea>
</div>
<button id="changeResult" class="ui small orange labeled icon button">
<i class="configure icon"></i> Change
</button>
</div>
<h1> </h1>
<h1> </h1>
</div>
</div>
<script>
$(function () {
$('table').tablesort();
$('#toggleAll').click (function () {
var checkedStatus = this.checked;
$('.fileSelectorCheckbox').each(function () {
$(this).prop('checked', checkedStatus);
});
});
$('#changeResult').on('click', function () {
$('#resultText').text("");
$('#buiderFormDiv').slideDown();
$('#resultDiv').fadeOut();
});
$('#builderForm').on('submit', function (event) {
event.preventDefault();
$('#buiderFormDiv').slideUp();
$.ajax({
url: 'builderReceiver.php',
data: $('#builderForm').serialize(),
method: 'post',
datatype: 'json'
}).done(function (response) {
$('#resultDiv').fadeIn();
$('#resultText').text(response.resultText);
$('#resultTextMin').text(response.resultTextMin);
}).error(function (error) {
$('#buiderFormDiv').slideDown();
});
return false;
});
});
</script>
</body>
</html>