Skip to content
Newer
Older
100644 223 lines (213 sloc) 7.86 KB
5dc412a @remy Some Menlo love and moved the version number in to index.php
remy authored
1 <?php
2
3 include('app.php');
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
4
09d4a41 @remy removed secondary post reading
remy authored
5 if (false && (@$_POST['html'] || @$_POST['javascript'])) {
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
6 $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
5e1c90f @remy add support for preview JS as well as HTML
remy authored
7 if (@$_POST['html']) {
cd8a67a @remy removed random quoting
remy authored
8 $html = str_replace($jsonReplaces[0], $jsonReplaces[1], $_POST['html']);
5e1c90f @remy add support for preview JS as well as HTML
remy authored
9 } else {
10 $html = '';
11 }
12 if (@$_POST['javascript']) {
cd8a67a @remy removed random quoting
remy authored
13 $javascript = str_replace($jsonReplaces[0], $jsonReplaces[1], $_POST['javascript']);
5e1c90f @remy add support for preview JS as well as HTML
remy authored
14 } else {
15 $javascript = '';
16 }
17
18 if ($html == '') {
19 // if there's no HTML, let's pop some simple HTML in place to give the JavaScript
20 // some context to run inside of
21 list($latest_revision, $defhtml, $defjavascript) = getCode($code_id, $revision, true);
22 $html = $defhtml;
23 }
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
24 } else {
25 list($code_id, $revision) = getCodeIdParams($request);
26
27 $edit_mode = false;
28
29 if ($code_id) {
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
30 list($latest_revision, $html, $javascript) = getCode($code_id, $revision, true);
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
31 } else {
b13873e @remy Accidentally broke default code - now fixed.
remy authored
32 list($latest_revision, $html, $javascript) = defaultCode();
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
33 }
34 }
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
35
36 if ($revision != 1 && $revision) {
37 $code_id .= '/' . $revision;
38 }
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
39 $code_id_path = ROOT;
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
40 if ($code_id) {
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
41 $code_id_path = ROOT . $code_id . '/';
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
42 }
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
43
203669c @remy Supporting revisions on js bins
remy authored
44 ?>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
45 <!DOCTYPE html>
96795ad @remy Splitter state save and restore
remy authored
46 <html id="jsbin" lang="en">
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
47 <head>
48 <meta charset=utf-8 />
49 <title>JS Bin - Collaborative JavaScript Debugging</title>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
50 <link rel="stylesheet" href="<?php echo ROOT?>css/pictos.css" type="text/css" charset="utf-8">
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
51 <link rel="stylesheet" href="<?php echo ROOT?>css/style.css?<?php echo VERSION?>" type="text/css" />
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
52 </head>
2edf8c4 @remy Mostly IE8 fixes - getting IE7 to work...
remy authored
53 <!--[if lt IE 7 ]><body class="source ie ie6"><![endif]-->
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
54 <!--[if lt IE 8 ]><body class="source ie ie7"><![endif]-->
55 <!--[if gte IE 8 ]><body class="source ie"><![endif]-->
906b5c0 @remy Partial checkin - tweaking menus - don't look right yet.
remy authored
56 <!--[if !IE]><!--><body class="source"><!--<![endif]-->
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
57 <div id="control">
58 <div class="control">
6c29138 @remy Adding buttons - currently just styling
remy authored
59 <div class="buttons">
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
60 <div class="button group menu">
61 <a href="<?php echo ROOT?>save" class="save title button icon icon-chevron-down">Save</a>
906b5c0 @remy Partial checkin - tweaking menus - don't look right yet.
remy authored
62 <?php if ($code_id) : ?>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
63 <a id="clone" title="Create a new copy" class="button clone group light" href="<?php echo ROOT?>clone">Clone</a>
64 <a id="save" title="Save new a new revision" class="button light save group" href="<?php echo $code_id_path?>save">Save</a>
906b5c0 @remy Partial checkin - tweaking menus - don't look right yet.
remy authored
65 <?php else : ?>
66 <a id="save" title="Save new bin" class="button save group" href="<?php echo ROOT?>save">Save</a>
67 <?php endif ?>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
68 <a id="download" title="Save to drive" class="button download group light icon icon-download-alt" href="<?php echo ROOT?>download">Download</a>
69 <a id="startingpoint" title="Set as starting code" class="button group" href="<?php echo ROOT?>save">As template</a>
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
70 </div>
71
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
72 <div id="panels"></div>
5db19ee @remy New navigation style and logic around the revert showing or not to he…
remy authored
73 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
74 </div>
75 <div class="help">
906b5c0 @remy Partial checkin - tweaking menus - don't look right yet.
remy authored
76 <?php if ($code_id) : ?>
77 <span class="meta">
78 <a title="Revert" class="button light group left" id="revert" href="#"><img class="enabled" src="<?php echo ROOT?>images/revert.png" /><img class="disabled" src="<?php echo ROOT?>images/revert-disabled.png" /></a>
79 <a id="jsbinurl" class="button group light left right gap" href="http://<?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?>"><?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?></a>
80 </span>
81 <?php endif ?>
ce1efc0 @remy Working dynamic splitters - incomplete
remy authored
82 <a href="#" class="button">History</a>
83 <a href="http://jsbin.tumblr.com" class="button group">Tips</a>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
84 </div>
85 </div>
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
86 <div id="bin" class="stretch" style="opacity: 0; filter:alpha(opacity=0);">
6c29138 @remy Adding buttons - currently just styling
remy authored
87 <div id="source" class="binview stretch">
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
88 <div class="code stretch javascript panel">
8a7788e @remy Button closes panel, not entire text label
remy authored
89 <div class="label"><strong>JavaScript</strong></div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
90 <div class="editbox">
8c9038d @remy Disable spellcheck, autocomplete and all that rubbish for iOS view. F…
remy authored
91 <textarea spellcheck="false" autocapitalize="off" autocorrect="off" id="javascript"></textarea>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
92 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
93 </div>
fbea703 @remy Splitter alignment working
remy authored
94 <div class="code stretch css panel">
8a7788e @remy Button closes panel, not entire text label
remy authored
95 <div class="label"><strong id="csslabel">CSS</strong></div>
fbea703 @remy Splitter alignment working
remy authored
96 <div class="editbox">
97 <textarea spellcheck="false" autocapitalize="off" autocorrect="off" id="css"></textarea>
98 </div>
99 </div>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
100 <div class="code stretch html panel">
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
101 <div class="label">
8a7788e @remy Button closes panel, not entire text label
remy authored
102 <strong>HTML</strong>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
103 <label for="library">Include</label>
8e7e5ca @remy Plodding along - totally broken for now.
remy authored
104 <select id="library" class="chosen">
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
105 <option value="none">None</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
106 <option value="jquery">jQuery</option>
107 <option value="jquery+jqueryui">jQuery UI</option>
108 <option value="yui">YUI</option>
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
109 <option value="prototype">Prototype</option>
0678c16 @remy Changed Prototype + Scriptaculous to just Scriptaculous for better re…
remy authored
110 <option value="prototype+scriptaculous">Scriptaculous</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
111 <option value="mootools">Mootools</option>
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
112 <option value="dojo">Dojo</option>
113 <option value="ext">Ext js</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
114 </select>
115 </div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
116 <div class="editbox">
8c9038d @remy Disable spellcheck, autocomplete and all that rubbish for iOS view. F…
remy authored
117 <textarea spellcheck="false" autocapitalize="off" autocorrect="off" id="html"></textarea>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
118 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
119 </div>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
120 <div class="stretch console panel">
8a7788e @remy Button closes panel, not entire text label
remy authored
121 <div class="label"><strong>Console</strong></div>
8e7e5ca @remy Plodding along - totally broken for now.
remy authored
122 <div id="console"></div>
123 </div>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
124 <div id="live" class="stretch live panel">
8a7788e @remy Button closes panel, not entire text label
remy authored
125 <div class="label"><strong>Live Preview</strong></div>
8b31d9f @remy More panel work - closer to @yandle's designs
remy authored
126 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
127 </div>
282934a @remy Merge master
remy authored
128 <div id="live" class="stretch livepreview"><a href="<?php echo ROOT ?>live" target="_new" id="popout" class="popout button light left right">Pop out</a></div>
b9003be @remy Create the preview iframe whenever the preview button is clicked, thu…
remy authored
129 <div id="preview" class="binview stretch"></div>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
130 <form method="post" action="<?php echo $code_id_path?>save">
a5d4c1b @remy Working on beta features:
remy authored
131 <input type="hidden" name="method" />
132 </form>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
133 </div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
134 <div id="tip"><p>You can jump to the latest bin by adding <code>/latest</code> to your URL</p><a class="dismiss" href="#">Dismiss x</a></div>
c530375 @remy tips and help in place
remy authored
135 <div id="keyboardHelp">
c9de02c @remy General tidying of code - need to add better support for back and his…
remy authored
136 <div>
137 <h2>Keyboard Shortcuts</h2>
138 <table>
139 <thead>
140 <tr>
141 <th>Shortcut</th>
142 <th>Action</th>
143 </tr>
144 </thead>
145 <tbody>
146 <tr>
147 <td>ctrl + &rarr;</td>
148 <td>Focus HTML panel</td>
149 </tr>
150 <tr>
151 <td>ctrl + &larr;</td>
152 <td>Focus JavaScript panel</td>
153 </tr>
154 <tr>
155 <td>ctrl + 1</td>
156 <td>Source tab</td>
157 </tr>
158 <tr>
159 <td>ctrl + 2</td>
160 <td>Rendered preview tab</td>
161 </tr>
162 <tr>
163 <td>ctrl + /</td>
164 <td>Toggle comment on single line</td>
165 </tr>
166 <tr>
167 <td>ctrl + alt + .</td>
168 <td>Close current HTML element</td>
169 </tr>
170 <tr>
171 <td>esc</td>
172 <td>Code complete (JavaScript only)</td>
173 </tr>
174 <tr>
175 <td>ctrl + s</td>
176 <td>Save current Bin</td>
177 </tr>
178 <tr>
179 <td>ctrl + shift + s</td>
180 <td>Clone current Bin</td>
181 </tr>
182 <tr>
183 <td>tab</td>
184 <td>Indents selected lines</td>
185 </tr>
186 <tr>
187 <td>shift + tab</td>
188 <td>Unindents selected lines</td>
189 </tr>
190 </tbody>
191 </table>
192 </div>
c530375 @remy tips and help in place
remy authored
193 </div>
c9de02c @remy General tidying of code - need to add better support for back and his…
remy authored
194 <div class="prefsOverlay"></div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
195 <script>
196 <?php
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
197 // assumes http - if that's not okay, this need to be changed
198 $url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $code_id . ($revision == 1 ? '' : '/' . $revision);
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
199 if (!$ajax) {
200 echo 'var template = ';
201 }
202 // doubles as JSON
203 echo '{"url":"' . $url . '","html" : ' . encode($html) . ',"javascript":' . encode($javascript) . '}';
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
204 ?>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
205 </script>
87b491e @remy adding root to jsbin object to help with API
remy authored
206 <script>jsbin = { root: "<?php echo HOST ?>", version: "<?php echo VERSION?>" }; tips = <?php echo file_get_contents('tips.json')?>;</script>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
207 <script src="<?php echo ROOT?>js/<?php echo VERSION?>/jsbin.js"></script>
ea67980 @remy Don't use GA if offline
remy authored
208 <?php if (!OFFLINE) : ?>
e8f0258 @remy Fixing HTML & JS injection on the URL, and adding support for *any* b…
remy authored
209 <script>
a1eb8f6 @remy Creating the ability to inject entire web pages into JS Bin via a boo…
remy authored
210 var _gaq = _gaq || [];
211 _gaq.push(['_setAccount', 'UA-1656750-13']);
212 _gaq.push(['_trackPageview']);
213
214 (function() {
215 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
216 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
217 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
218 })();
e8f0258 @remy Fixing HTML & JS injection on the URL, and adding support for *any* b…
remy authored
219 </script>
ea67980 @remy Don't use GA if offline
remy authored
220 <?php endif ?>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
221 </body>
a5d4c1b @remy Working on beta features:
remy authored
222 </html>
Something went wrong with that request. Please try again.