Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 195 lines (185 sloc) 7.211 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
5 if (@$_POST['inject'] && @$_POST['html']) {
6 $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
7 $html = '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $_POST['html']) . '"';
8 } else {
9 list($code_id, $revision) = getCodeIdParams($request);
10
11 $edit_mode = false;
12
13 if ($code_id) {
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
14 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
15 } else {
16 list($html, $javascript) = defaultCode();
17 }
18 }
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
19
20 if ($revision != 1 && $revision) {
21 $code_id .= '/' . $revision;
22 }
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
23 $code_id_path = ROOT;
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
24 if ($code_id) {
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
25 $code_id_path = ROOT . $code_id . '/';
601caf4 @remy Support running jsbin from a subdirectory - change the ROOT config va…
remy authored
26 }
d03b966 @remy Changes to make local install of jsbin much easier - in particular fo…
remy authored
27
203669c @remy Supporting revisions on js bins
remy authored
28 ?>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
29 <!DOCTYPE html>
30 <html lang="en">
31 <head>
32 <meta charset=utf-8 />
33 <title>JS Bin - Collaborative JavaScript Debugging</title>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
34 <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
35 </head>
2edf8c4 @remy Mostly IE8 fixes - getting IE7 to work...
remy authored
36 <!--[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
37 <!--[if lt IE 8 ]><body class="source ie ie7"><![endif]-->
38 <!--[if gte IE 8 ]><body class="source ie"><![endif]-->
b803885 @remy Updated library support (removed some legacy crap), now supports jsbi…
remy authored
39 <!--[if !IE]><!--><body class="source"><!--<![endif]-->
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
40 <div id="control">
41 <div class="control">
6c29138 @remy Adding buttons - currently just styling
remy authored
42 <div class="buttons">
5db19ee @remy New navigation style and logic around the revert showing or not to he…
remy authored
43 <a class="tab button source group left" accesskey="1" href="#source">Code</a>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
44 <a class="tab button preview group right gap" accesskey="2" href="#preview" title="Run with alerts, prompts, etc">Render</a>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
45 <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>
fdab286 @remy Testing initial code creation
remy authored
46 <?php if ($code_id) : ?>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
47 <a id="jsbinurl" class="button group light left" href="http://<?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?>">http://<?php echo $_SERVER['HTTP_HOST'] . ROOT . $code_id?></a>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
48
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
49 <div class="button group gap right tall">
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
50 <a href="<?php echo ROOT?>save" class="save title">Save</a>
51 <a id="clone" title="Create a new copy" class="button clone group light" href="<?php echo ROOT?>clone">Clone</a>
52 <a id="save" title="Save new a new revision" class="button light save group" href="<?php echo $code_id_path?>save">Save</a>
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
53 <?php else : ?>
cabfcc6 @remy rounded edge on save button when alone
remy authored
54 <div class="button group gap left right">
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
55 <a href="<?php echo ROOT?>save" class="save title">Save</a>
56 <a id="save" title="Save new bin" class="button save group" href="<?php echo ROOT?>save">Save</a>
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
57 <?php endif ?>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
58 <a id="download" title="Save to drive" class="button download group light" href="<?php echo ROOT?>download">Download</a>
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
59 </div>
60
61 <span id="panelsvisible" class="gap">View:
62 <input type="checkbox" data-panel="javascript" id="showjavascript"><label for="showjavascript">JavaScript</label>
63 <input type="checkbox" data-panel="html" id="showhtml"><label for="showhtml">HTML</label>
64 <input type="checkbox" data-panel="live" id="showlive"><label for="showlive">Real-time preview</label>
65 </span>
5db19ee @remy New navigation style and logic around the revert showing or not to he…
remy authored
66 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
67 </div>
68 <div class="help">
69 <ul class="flat">
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
70 <li><a target="_blank" href="http://jsbin.tumblr.com">Help &amp; tutorials</a></li>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
71 </ul>
72 </div>
73 </div>
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
74 <div id="bin" class="stretch" style="opacity: 0; filter:alpha(opacity=0);">
6c29138 @remy Adding buttons - currently just styling
remy authored
75 <div id="source" class="binview stretch">
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
76 <div class="code stretch javascript">
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
77 <div class="label"><p><strong id="jslabel">JavaScript</strong><!-- <span> (<span class="hide">hide</span><span class="show">show</span> HTML)</span> --></p></div>
78 <div class="editbox">
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
79 <textarea id="javascript"></textarea>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
80 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
81 </div>
82 <div class="code stretch html">
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
83 <div class="label">
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
84 <p>HTML<!-- <span> (<span class="hide">hide</span><span class="show">show</span> JavaScript)</span> --></p>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
85 <label for="library">Include</label>
86 <select id="library">
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
87 <option value="none">None</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
88 <option value="jquery">jQuery</option>
89 <option value="jquery+jqueryui">jQuery UI</option>
90 <option value="yui">YUI</option>
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
91 <option value="prototype">Prototype</option>
0678c16 @remy Changed Prototype + Scriptaculous to just Scriptaculous for better re…
remy authored
92 <option value="prototype+scriptaculous">Scriptaculous</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
93 <option value="mootools">Mootools</option>
e862ba3 @remy Added console log inline to rendered preview, includes debug.js and m…
remy authored
94 <option value="dojo">Dojo</option>
95 <option value="ext">Ext js</option>
c8005f0 @remy Added include libraries and rendered preview mode (along with js raw …
remy authored
96 </select>
97 </div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
98 <div class="editbox">
99 <textarea id="html"></textarea>
100 </div>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
101 </div>
102 </div>
1527da4 @remy Nearly there with IE7 - just need to fix keeping the right splitter p…
remy authored
103 <div id="live" class="stretch livepreview"><!-- <span class="close"></span> --></div>
b9003be @remy Create the preview iframe whenever the preview button is clicked, thu…
remy authored
104 <div id="preview" class="binview stretch"></div>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
105 <form method="post" action="<?php echo $code_id_path?>save">
a5d4c1b @remy Working on beta features:
remy authored
106 <input type="hidden" name="method" />
107 </form>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
108 </div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
109 <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
110 <div id="keyboardHelp">
111 <h2>Keyboard Shortcuts</h2>
112 <table>
113 <thead>
114 <tr>
115 <th>Shortcut</th>
116 <th>Action</th>
117 </tr>
118 </thead>
119 <tbody>
120 <tr>
121 <td>ctrl + &rarr;</td>
122 <td>Focus HTML panel</td>
123 </tr>
124 <tr>
125 <td>ctrl + &larr;</td>
126 <td>Focus JavaScript panel</td>
127 </tr>
128 <tr>
129 <td>ctrl + 1</td>
130 <td>Source tab</td>
131 </tr>
132 <tr>
133 <td>ctrl + 2</td>
134 <td>Rendered preview tab</td>
135 </tr>
136 <tr>
137 <td>ctrl + /</td>
138 <td>Toggle comment on single line</td>
139 </tr>
140 <tr>
141 <td>ctrl + alt + .</td>
142 <td>Close current HTML element</td>
143 </tr>
144 <tr>
145 <td>esc</td>
146 <td>Code complete (JavaScript only)</td>
147 </tr>
148 <tr>
149 <td>ctrl + s</td>
150 <td>Save current Bin</td>
151 </tr>
8ba306c @remy Show that tabs can be used to indent too. Closes #50
remy authored
152 <tr>
4943ef6 @remy Created key mapping for clone: ctrl+shift+s
remy authored
153 <td>ctrl + shift + s</td>
154 <td>Clone current Bin</td>
155 </tr>
156 <tr>
8ba306c @remy Show that tabs can be used to indent too. Closes #50
remy authored
157 <td>tab</td>
158 <td>Indents selected lines</td>
159 </tr>
160 <tr>
161 <td>shift + tab</td>
162 <td>Unindents selected lines</td>
163 </tr>
c530375 @remy tips and help in place
remy authored
164 </tbody>
165 </table>
166 </div>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
167 <script>
168 <?php
ad4864e @remy Closes #66 - changed the menu towards version 3 - i.e. save dropdown,…
remy authored
169 // assumes http - if that's not okay, this need to be changed
170 $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
171 if (!$ajax) {
172 echo 'var template = ';
173 }
174 // doubles as JSON
175 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
176 ?>
1ddb2a0 @remy Mass check in of JS Bin 2.8 - lots of UI changes - in complete though…
remy authored
177 </script>
7509efe @remy <?= -> <?php echo ::sigh:: stupid php!
remy authored
178 <script>jsbin = { version: "<?php echo VERSION?>" }; tips = <?php echo file_get_contents('tips.json')?>;</script>
179 <script src="<?php echo ROOT?>js/<?php echo VERSION?>/jsbin.js"></script>
ea67980 @remy Don't use GA if offline
remy authored
180 <?php if (!OFFLINE) : ?>
e8f0258 @remy Fixing HTML & JS injection on the URL, and adding support for *any* b…
remy authored
181 <script>
a1eb8f6 @remy Creating the ability to inject entire web pages into JS Bin via a boo…
remy authored
182 var _gaq = _gaq || [];
183 _gaq.push(['_setAccount', 'UA-1656750-13']);
184 _gaq.push(['_trackPageview']);
185
186 (function() {
187 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
188 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
189 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
190 })();
e8f0258 @remy Fixing HTML & JS injection on the URL, and adding support for *any* b…
remy authored
191 </script>
ea67980 @remy Don't use GA if offline
remy authored
192 <?php endif ?>
cf2e320 @remy Early version of JS Bin 1.5 - redesign
remy authored
193 </body>
a5d4c1b @remy Working on beta features:
remy authored
194 </html>
Something went wrong with that request. Please try again.