Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8019f66a78 | ||
|
|
b5e8afb8d9 | ||
|
|
e2b585027b | ||
|
|
56ade7fa75 | ||
|
|
efbef411f9 | ||
|
|
6ef524e4ce | ||
|
|
dff7573531 | ||
|
|
881b8f014b | ||
|
|
d273c82b86 | ||
|
|
6e5ab719a4 | ||
|
|
b416dd79f5 | ||
|
|
1e4237a483 | ||
|
|
a90a53458d | ||
|
|
54fa471d26 | ||
|
|
be20e8f302 | ||
|
|
222f651d68 | ||
|
|
b70ee4553a | ||
|
|
493037a01b | ||
|
|
8233763511 | ||
|
|
2c01eeba17 | ||
|
|
82fd2a5b5d | ||
|
|
e297fd049f | ||
|
|
ef9d8ed5de | ||
|
|
07e44ecfb5 | ||
|
|
fee53144d9 | ||
|
|
e899c2f1bd | ||
|
|
579dc7d5d0 | ||
|
|
bdb7433c4a | ||
|
|
2a2a631c99 | ||
|
|
a28213983b | ||
|
|
0bcbc1a222 | ||
|
|
978e2145e6 | ||
|
|
e4e75ccbef | ||
|
|
4a804e71df | ||
|
|
c758a2ff37 | ||
|
|
77aaa16be4 | ||
|
|
215229d051 | ||
|
|
dbf7e4e834 | ||
|
|
cafd79b03d | ||
|
|
0b1073fdbe | ||
|
|
d23171b8f1 | ||
|
|
64b026ca6e | ||
|
|
422b013330 |
@@ -1,368 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CodeMirror</title>
|
||||
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
|
||||
<link rel="stylesheet" type="text/css" href="doc/docs.css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<link rel="alternate" href="http://twitter.com/statuses/user_timeline/242283288.rss" type="application/rss+xml"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
|
||||
|
||||
<pre class="grey">
|
||||
<img src="doc/baboon.png" class="logo" alt="logo"/>/* In-browser code editing
|
||||
made bearable */
|
||||
</pre>
|
||||
|
||||
<div class="clear"><div class="left blk">
|
||||
|
||||
<p style="margin-top: 0">CodeMirror is a JavaScript library that can
|
||||
be used to create a relatively pleasant editor interface for
|
||||
code-like content ― computer programs, HTML markup, and
|
||||
similar. If a mode has been written for the language you are
|
||||
editing, the code will be coloured, and the editor will optionally
|
||||
help you with indentation.</p>
|
||||
|
||||
<p>This is the project page for CodeMirror 2, the currently more
|
||||
actively developed, and recommended
|
||||
version. <a href="1/index.html">CodeMirror 1</a> is still available
|
||||
from here.</p>
|
||||
|
||||
<div class="clear"><div class="left1 blk">
|
||||
|
||||
<h2 style="margin-top: 0">Supported modes:</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="mode/clike/index.html">C, C++, Java, and similar</a></li>
|
||||
<li><a href="mode/clojure/index.html">Clojure</a></li>
|
||||
<li><a href="mode/coffeescript/index.html">CoffeeScript</a></li>
|
||||
<li><a href="mode/css/index.html">CSS</a></li>
|
||||
<li><a href="mode/diff/index.html">diff</a></li>
|
||||
<li><a href="mode/ecl/index.html">ECL</a></li>
|
||||
<li><a href="mode/go/index.html">Go</a></li>
|
||||
<li><a href="mode/groovy/index.html">Groovy</a></li>
|
||||
<li><a href="mode/haskell/index.html">Haskell</a></li>
|
||||
<li><a href="mode/htmlembedded/index.html">HTML embedded scripts</a></li>
|
||||
<li><a href="mode/htmlmixed/index.html">HTML mixed-mode</a></li>
|
||||
<li><a href="mode/javascript/index.html">JavaScript</a></li>
|
||||
<li><a href="mode/jinja2/index.html">Jinja2</a></li>
|
||||
<li><a href="mode/less/index.html">LESS</a></li>
|
||||
<li><a href="mode/lua/index.html">Lua</a></li>
|
||||
<li><a href="mode/markdown/index.html">Markdown</a> (<a href="mode/gfm/index.html">Github-flavour</a>)</li>
|
||||
<li><a href="mode/mysql/index.html">MySQL</a></li>
|
||||
<li><a href="mode/ntriples/index.html">NTriples</a></li>
|
||||
<li><a href="mode/pascal/index.html">Pascal</a></li>
|
||||
<li><a href="mode/perl/index.html">Perl</a></li>
|
||||
<li><a href="mode/php/index.html">PHP</a></li>
|
||||
<li><a href="mode/plsql/index.html">PL/SQL</a></li>
|
||||
<li><a href="mode/properties/index.html">Properties files</a></li>
|
||||
<li><a href="mode/python/index.html">Python</a></li>
|
||||
<li><a href="mode/r/index.html">R</a></li>
|
||||
<li>RPM <a href="mode/rpm/spec/index.html">spec</a> and <a href="mode/rpm/changes/index.html">changelog</a></li>
|
||||
<li><a href="mode/rst/index.html">reStructuredText</a></li>
|
||||
<li><a href="mode/ruby/index.html">Ruby</a></li>
|
||||
<li><a href="mode/rust/index.html">Rust</a></li>
|
||||
<li><a href="mode/scheme/index.html">Scheme</a></li>
|
||||
<li><a href="mode/smalltalk/index.html">Smalltalk</a></li>
|
||||
<li><a href="mode/sparql/index.html">SPARQL</a></li>
|
||||
<li><a href="mode/stex/index.html">sTeX, LaTeX</a></li>
|
||||
<li><a href="mode/tiddlywiki/index.html">Tiddlywiki</a></li>
|
||||
<li><a href="mode/velocity/index.html">Velocity</a></li>
|
||||
<li><a href="mode/verilog/index.html">Verilog</a></li>
|
||||
<li><a href="mode/xml/index.html">XML/HTML</a> (<a href="mode/xmlpure/index.html">alternative XML</a>)</li>
|
||||
<li><a href="mode/yaml/index.html">YAML</a></li>
|
||||
</ul>
|
||||
|
||||
</div><div class="left2 blk">
|
||||
|
||||
<h2 style="margin-top: 0">Usage demos:</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="demo/complete.html">Autocompletion</a></li>
|
||||
<li><a href="demo/mustache.html">Mode overlays</a></li>
|
||||
<li><a href="demo/search.html">Search/replace</a></li>
|
||||
<li><a href="demo/folding.html">Code folding</a></li>
|
||||
<li><a href="demo/preview.html">HTML editor with preview</a></li>
|
||||
<li><a href="demo/resize.html">Auto-resizing editor</a></li>
|
||||
<li><a href="demo/marker.html">Setting breakpoints</a></li>
|
||||
<li><a href="demo/activeline.html">Highlighting the current line</a></li>
|
||||
<li><a href="demo/matchhighlighter.html">Highlighting selection matches</a></li>
|
||||
<li><a href="demo/theme.html">Theming</a></li>
|
||||
<li><a href="demo/runmode.html">Stand-alone highlighting</a></li>
|
||||
<li><a href="demo/fullscreen.html">Full-screen editing</a></li>
|
||||
<li><a href="demo/changemode.html">Mode auto-changing</a></li>
|
||||
<li><a href="demo/visibletabs.html">Visible tabs</a></li>
|
||||
<li><a href="demo/formatting.html">Autoformatting of code</a></li>
|
||||
<li><a href="demo/emacs.html">Emacs keybindings</a></li>
|
||||
<li><a href="demo/vim.html">Vim keybindings</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Real-world uses:</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="http://jsbin.com">jsbin.com</a> (JS playground)</li>
|
||||
<li><a href="http://buzzard.ups.edu/">Sage demo</a> (math system)</li>
|
||||
<li><a href="http://www.sourcelair.com/">sourceLair</a> (online IDE)</li>
|
||||
<li><a href="http://eloquentjavascript.net/chapter1.html">Eloquent JavaScript</a> (book)</a></li>
|
||||
<li><a href="http://www.mergely.com/">Mergely</a> (interactive diffing)</li>
|
||||
<li><a href="http://paperjs.org/">Paper.js</a> (graphics scripting)</li>
|
||||
<li><a href="http://www.wescheme.org/">WeScheme</a> (learning tool)</li>
|
||||
<li><a href="http://webglplayground.net/">WebGL playground</a></li>
|
||||
<li><a href="http://ql.io/">ql.io</a> (http API query helper)</li>
|
||||
<li><a href="http://elm-lang.org/Examples.elm">Elm language examples</a></li>
|
||||
<li><a href="http://bluegriffon.org/">BlueGriffon</a> (HTML editor)</li>
|
||||
<li><a href="http://www.jshint.com/">JSHint</a> (JS linter)</li>
|
||||
<li><a href="http://kl1p.com/cmtest/1">kl1p</a> (paste service)</li>
|
||||
</ul>
|
||||
|
||||
</div></div>
|
||||
|
||||
<h2 id="code">Getting the code</h2>
|
||||
|
||||
<p>All of CodeMirror is released under a <a
|
||||
href="LICENSE">MIT-style</a> license. To get it, you can download
|
||||
the <a href="http://codemirror.net/codemirror.zip">latest
|
||||
release</a> or the current <a
|
||||
href="http://codemirror.net/codemirror2-latest.zip">development
|
||||
snapshot</a> as zip files. To create a custom minified script file,
|
||||
you can use the <a href="doc/compress.html">compression API</a>.</p>
|
||||
|
||||
<p>We use <a href="http://git-scm.com/">git</a> for version control.
|
||||
The main repository can be fetched in this way:</p>
|
||||
|
||||
<pre class="code">git clone http://marijnhaverbeke.nl/git/codemirror2</pre>
|
||||
|
||||
<p>CodeMirror can also be found on GitHub at <a
|
||||
href="http://github.com/marijnh/CodeMirror2">marijnh/CodeMirror2</a>.
|
||||
If you plan to hack on the code and contribute patches, the best way
|
||||
to do it is to create a GitHub fork, and send pull requests.</p>
|
||||
|
||||
<h2 id="documention">Documentation</h2>
|
||||
|
||||
<p>The <a href="doc/manual.html">manual</a> is your first stop for
|
||||
learning how to use this library. It starts with a quick explanation
|
||||
of how to use the editor, and then describes the API in detail.</p>
|
||||
|
||||
<p>For those who want to learn more about the code, there is
|
||||
an <a href="doc/internals.html">overview of the internals</a> available.
|
||||
The <a href="http://github.com/marijnh/CodeMirror2">source code</a>
|
||||
itself is, for the most part, also well commented.</p>
|
||||
|
||||
<h2 id="support">Support and bug reports</h2>
|
||||
|
||||
<p>There is
|
||||
a <a href="http://groups.google.com/group/codemirror">Google
|
||||
group</a> (a sort of mailing list/newsgroup thing) for discussion
|
||||
and news related to CodeMirror. When reporting a bug,
|
||||
<a href="doc/reporting.html">read this first</a>. If you have
|
||||
a <a href="http://github.com">github</a> account,
|
||||
simply <a href="http://github.com/marijnh/CodeMirror2/issues">open
|
||||
an issue there</a>. Otherwise, post something to
|
||||
the <a href="http://groups.google.com/group/codemirror">group</a>,
|
||||
or e-mail me directly: <a href="mailto:marijnh@gmail.com">Marijn
|
||||
Haverbeke</a>.</p>
|
||||
|
||||
<h2 id="supported">Supported browsers</h2>
|
||||
|
||||
<p>The following browsers are able to run CodeMirror:</p>
|
||||
|
||||
<ul>
|
||||
<li>Firefox 2 or higher</li>
|
||||
<li>Chrome, any version</li>
|
||||
<li>Safari 3 or higher</li>
|
||||
<li>Internet Explorer 6 or higher in standards (<strong>non-quirks</strong>) mode</li>
|
||||
<li>Opera 9 or higher (with some key-handling problems on OS X)</li>
|
||||
</ul>
|
||||
|
||||
<p>I am not actively testing against every new browser release, and
|
||||
vendors have a habit of introducing bugs all the time, so I am
|
||||
relying on the community to tell me when something breaks.
|
||||
See <a href="#support">here</a> for information on how to contact
|
||||
me.</p>
|
||||
|
||||
<h2 id="commercial">Commercial support</h2>
|
||||
|
||||
<p>CodeMirror is developed and maintained by me, Marijn Haverbeke,
|
||||
in my own time. If your company is getting value out of CodeMirror,
|
||||
please consider purchasing a support contract.</p>
|
||||
|
||||
<ul>
|
||||
<li>You'll be funding further work on CodeMirror.</li>
|
||||
<li>You ensure that you get a quick response when you have a
|
||||
problem, even when I am otherwise busy.</li>
|
||||
</ul>
|
||||
|
||||
<p>CodeMirror support contracts exist in two
|
||||
forms—<strong>basic</strong> at €100 per month,
|
||||
and <strong>premium</strong> at €500 per
|
||||
month. <a href="mailto:marijnh@gmail.com">Contact me</a> for further
|
||||
information.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="right blk">
|
||||
|
||||
<a href="http://codemirror.net/codemirror.zip" class="download">Download the latest release</a>
|
||||
|
||||
<h2>Support CodeMirror</h2>
|
||||
|
||||
<ul>
|
||||
<li>Donate
|
||||
(<span onclick="document.getElementById('paypal').submit();"
|
||||
class="quasilink">Paypal</span>
|
||||
or <span onclick="document.getElementById('bankinfo').style.display = 'block';"
|
||||
class="quasilink">bank</span>)</li>
|
||||
<li>Purchase <a href="#commercial">commercial support</a></li>
|
||||
</ul>
|
||||
|
||||
<p id="bankinfo" style="display: none;">
|
||||
Bank: <i>Rabobank</i><br/>
|
||||
Country: <i>Netherlands</i><br/>
|
||||
SWIFT: <i>RABONL2U</i><br/>
|
||||
Account: <i>147850770</i><br/>
|
||||
Name: <i>Marijn Haverbeke</i><br/>
|
||||
IBAN: <i>NL26 RABO 0147 8507 70</i>
|
||||
</p>
|
||||
|
||||
<h2>Releases:</h2>
|
||||
|
||||
<p class="rel">27-02-2012: <a href="http://codemirror.net/codemirror-2.22.zip">Version 2.22</a>:</p>
|
||||
|
||||
<ul class="rel-note">
|
||||
<li>Allow <a href="doc/manual.html#keymaps">key handlers</a> to pass up events, allow binding characters.</li>
|
||||
<li>Add <a href="doc/manual.html#option_autoClearEmptyLines"><code>autoClearEmptyLines</code></a> option.</li>
|
||||
<li>Properly use tab stops when rendering tabs.</li>
|
||||
<li>Make PHP mode more robust.</li>
|
||||
<li>Support indentation blocks in <a href="doc/manual.html#util_foldcode">code folder</a>.</li>
|
||||
<li>Add a script for <a href="doc/manual.html#util_match-highlighter">highlighting instances of the selection</a>.</li>
|
||||
<li>New <a href="mode/properties/index.html">.properties</a> mode.</li>
|
||||
<li>Fix many bugs.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">27-01-2012: <a href="http://codemirror.net/codemirror-2.21.zip">Version 2.21</a>:</p>
|
||||
|
||||
<ul class="rel-note">
|
||||
<li>Added <a href="mode/less/index.html">LESS</a>, <a href="mode/mysql/index.html">MySQL</a>,
|
||||
<a href="mode/go/index.html">Go</a>, and <a href="mode/verilog/index.html">Verilog</a> modes.</li>
|
||||
<li>Add <a href="doc/manual.html#option_smartIndent"><code>smartIndent</code></a>
|
||||
option.</li>
|
||||
<li>Support a cursor in <a href="doc/manual.html#option_readOnly"><code>readOnly</code></a>-mode.</li>
|
||||
<li>Support assigning multiple styles to a token.</li>
|
||||
<li>Use a new approach to drawing the selection.</li>
|
||||
<li>Add <a href="doc/manual.html#scrollTo"><code>scrollTo</code></a> method.</li>
|
||||
<li>Allow undo/redo events to span non-adjacent lines.</li>
|
||||
<li>Lots and lots of bugfixes.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">20-12-2011: <a href="http://codemirror.net/codemirror-2.2.zip">Version 2.2</a>:</p>
|
||||
|
||||
<ul class="rel-note">
|
||||
<li>Slightly incompatible API changes. Read <a href="doc/upgrade_v2.2.html">this</a>.</li>
|
||||
<li>New approach
|
||||
to <a href="doc/manual.html#option_extraKeys">binding</a> keys,
|
||||
support for <a href="doc/manual.html#option_keyMap">custom
|
||||
bindings</a>.</li>
|
||||
<li>Support for overwrite (insert).</li>
|
||||
<li><a href="doc/manual.html#option_tabSize">Custom-width</a>
|
||||
and <a href="demo/visibletabs.html">stylable</a> tabs.</li>
|
||||
<li>Moved more code into <a href="doc/manual.html#addons">add-on scripts</a>.</li>
|
||||
<li>Support for sane vertical cursor movement in wrapped lines.</li>
|
||||
<li>More reliable handling of
|
||||
editing <a href="doc/manual.html#markText">marked text</a>.</li>
|
||||
<li>Add minimal <a href="demo/emacs.html">emacs</a>
|
||||
and <a href="demo/vim.html">vim</a> bindings.</li>
|
||||
<li>Rename <code>coordsFromIndex</code>
|
||||
to <a href="doc/manual.html#posFromIndex"><code>posFromIndex</code></a>,
|
||||
add <a href="doc/manual.html#indexFromPos"><code>indexFromPos</code></a>
|
||||
method.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.18.zip">Version 2.18</a>:</p>
|
||||
<p class="rel-note">Fixes <code>TextMarker.clear</code>, which is broken in 2.17.</p>
|
||||
|
||||
<p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.17.zip">Version 2.17</a>:</p>
|
||||
<ul class="rel-note">
|
||||
<li>Add support for <a href="doc/manual.html#option_lineWrapping">line
|
||||
wrapping</a> and <a href="doc/manual.html#hideLine">code
|
||||
folding</a>.</li>
|
||||
<li>Add <a href="mode/gfm/index.html">Github-style Markdown</a> mode.</li>
|
||||
<li>Add <a href="theme/monokai.css">Monokai</a>
|
||||
and <a href="theme/rubyblue.css">Rubyblue</a> themes.</li>
|
||||
<li>Add <a href="doc/manual.html#setBookmark"><code>setBookmark</code></a> method.</li>
|
||||
<li>Move some of the demo code into reusable components
|
||||
under <a href="lib/util/"><code>lib/util</code></a>.</li>
|
||||
<li>Make screen-coord-finding code faster and more reliable.</li>
|
||||
<li>Fix drag-and-drop in Firefox.</li>
|
||||
<li>Improve support for IME.</li>
|
||||
<li>Speed up content rendering.</li>
|
||||
<li>Fix browser's built-in search in Webkit.</li>
|
||||
<li>Make double- and triple-click work in IE.</li>
|
||||
<li>Various fixes to modes.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">27-10-2011: <a href="http://codemirror.net/codemirror-2.16.zip">Version 2.16</a>:</p>
|
||||
<ul class="rel-note">
|
||||
<li>Add <a href="mode/perl/index.html">Perl</a>, <a href="mode/rust/index.html">Rust</a>, <a href="mode/tiddlywiki/index.html">TiddlyWiki</a>, and <a href="mode/groovy/index.html">Groovy</a> modes.</li>
|
||||
<li>Dragging text inside the editor now moves, rather than copies.</li>
|
||||
<li>Add a <a href="doc/manual.html#coordsFromIndex"><code>coordsFromIndex</code></a> method.</li>
|
||||
<li><strong>API change</strong>: <code>setValue</code> now no longer clears history. Use <a href="doc/manual.html#clearHistory"><code>clearHistory</code></a> for that.</li>
|
||||
<li><strong>API change</strong>: <a href="doc/manual.html#markText"><code>markText</code></a> now
|
||||
returns an object with <code>clear</code> and <code>find</code>
|
||||
methods. Marked text is now more robust when edited.</li>
|
||||
<li>Fix editing code with tabs in Internet Explorer.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.15.zip">Version 2.15</a>:</p>
|
||||
<p class="rel-note">Fix bug that snuck into 2.14: Clicking the
|
||||
character that currently has the cursor didn't re-focus the
|
||||
editor.</p>
|
||||
|
||||
<p class="rel">26-09-2011: <a href="http://codemirror.net/codemirror-2.14.zip">Version 2.14</a>:</p>
|
||||
<ul class="rel-note">
|
||||
<li>Add <a href="mode/clojure/index.html">Clojure</a>, <a href="mode/pascal/index.html">Pascal</a>, <a href="mode/ntriples/index.html">NTriples</a>, <a href="mode/jinja2/index.html">Jinja2</a>, and <a href="mode/markdown/index.html">Markdown</a> modes.</li>
|
||||
<li>Add <a href="theme/cobalt.css">Cobalt</a> and <a href="theme/eclipse.css">Eclipse</a> themes.</li>
|
||||
<li>Add a <a href="doc/manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
|
||||
<li>Fix bug with <code>setValue</code> breaking cursor movement.</li>
|
||||
<li>Make gutter updates much more efficient.</li>
|
||||
<li>Allow dragging of text out of the editor (on modern browsers).</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">23-08-2011: <a href="http://codemirror.net/codemirror-2.13.zip">Version 2.13</a>:</p>
|
||||
<ul class="rel-note">
|
||||
<li>Add <a href="mode/ruby/index.html">Ruby</a>, <a href="mode/r/index.html">R</a>, <a href="mode/coffeescript/index.html">CoffeeScript</a>, and <a href="mode/velocity/index.html">Velocity</a> modes.</li>
|
||||
<li>Add <a href="doc/manual.html#getGutterElement"><code>getGutterElement</code></a> to API.</li>
|
||||
<li>Several fixes to scrolling and positioning.</li>
|
||||
<li>Add <a href="doc/manual.html#option_smartHome"><code>smartHome</code></a> option.</li>
|
||||
<li>Add an experimental <a href="mode/xmlpure/index.html">pure XML</a> mode.</li>
|
||||
</ul>
|
||||
|
||||
<p class="rel">25-07-2011: <a href="http://codemirror.net/codemirror-2.12.zip">Version 2.12</a>:</p>
|
||||
<ul class="rel-note">
|
||||
<li>Add a <a href="mode/sparql/index.html">SPARQL</a> mode.</li>
|
||||
<li>Fix bug with cursor jumping around in an unfocused editor in IE.</li>
|
||||
<li>Allow key and mouse events to bubble out of the editor. Ignore widget clicks.</li>
|
||||
<li>Solve cursor flakiness after undo/redo.</li>
|
||||
<li>Fix block-reindent ignoring the last few lines.</li>
|
||||
<li>Fix parsing of multi-line attrs in XML mode.</li>
|
||||
<li>Use <code>innerHTML</code> for HTML-escaping.</li>
|
||||
<li>Some fixes to indentation in C-like mode.</li>
|
||||
<li>Shrink horiz scrollbars when long lines removed.</li>
|
||||
<li>Fix width feedback loop bug that caused the width of an inner DIV to shrink.</li>
|
||||
</ul>
|
||||
|
||||
<p><a href="doc/oldrelease.html">Older releases...</a></p>
|
||||
|
||||
</div></div>
|
||||
|
||||
<div style="height: 2em"> </div>
|
||||
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">
|
||||
<input type="hidden" name="cmd" value="_s-xclick"/>
|
||||
<input type="hidden" name="hosted_button_id" value="3FVHS5FGUY7CC"/>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
/* This is needed to prevent an IE[67] bug where the scrolled content
|
||||
is visible outside of the scrolling box. */
|
||||
position: relative;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.CodeMirror-gutter {
|
||||
@@ -27,6 +28,7 @@
|
||||
}
|
||||
.CodeMirror-lines {
|
||||
padding: .4em;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.CodeMirror pre {
|
||||
@@ -1,4 +1,4 @@
|
||||
// CodeMirror version 2.22
|
||||
// CodeMirror version 2.23
|
||||
//
|
||||
// All functions that need access to the editor's state live inside
|
||||
// the CodeMirror function. Below that, at the bottom of the file,
|
||||
@@ -15,9 +15,8 @@ var CodeMirror = (function() {
|
||||
if (defaults.hasOwnProperty(opt))
|
||||
options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt];
|
||||
|
||||
var targetDocument = options["document"];
|
||||
// The element in which the editor lives.
|
||||
var wrapper = targetDocument.createElement("div");
|
||||
var wrapper = document.createElement("div");
|
||||
wrapper.className = "CodeMirror" + (options.lineWrapping ? " CodeMirror-wrap" : "");
|
||||
// This mess creates the base DOM structure for the editor.
|
||||
wrapper.innerHTML =
|
||||
@@ -48,7 +47,10 @@ var CodeMirror = (function() {
|
||||
if (!webkit) lineSpace.draggable = true;
|
||||
lineSpace.style.outline = "none";
|
||||
if (options.tabindex != null) input.tabIndex = options.tabindex;
|
||||
if (options.autofocus) focusInput();
|
||||
if (!options.gutter && !options.lineNumbers) gutter.style.display = "none";
|
||||
// Needed to handle Tab key in KHTML
|
||||
if (khtml) inputDiv.style.height = "1px", inputDiv.style.position = "absolute";
|
||||
|
||||
// Check for problem with IE innerHTML not working when we have a
|
||||
// P (or similar) parent node.
|
||||
@@ -81,12 +83,13 @@ var CodeMirror = (function() {
|
||||
gutterDirty, callbacks;
|
||||
// Current visible range (may be bigger than the view window).
|
||||
var displayOffset = 0, showingFrom = 0, showingTo = 0, lastSizeC = 0;
|
||||
// bracketHighlighted is used to remember that a backet has been
|
||||
// bracketHighlighted is used to remember that a bracket has been
|
||||
// marked.
|
||||
var bracketHighlighted;
|
||||
// Tracks the maximum line length so that the horizontal scrollbar
|
||||
// can be kept static when scrolling.
|
||||
var maxLine = "", maxWidth;
|
||||
var tabCache = {};
|
||||
|
||||
// Initialize the content.
|
||||
operation(function(){setValue(options.value || ""); updateInput = false;})();
|
||||
@@ -124,10 +127,16 @@ var CodeMirror = (function() {
|
||||
if (!options.readOnly) replaceSelection("");
|
||||
}));
|
||||
|
||||
// Needed to handle Tab key in KHTML
|
||||
if (khtml) connect(code, "mouseup", function() {
|
||||
if (document.activeElement == input) input.blur();
|
||||
focusInput();
|
||||
});
|
||||
|
||||
// IE throws unspecified error in certain cases, when
|
||||
// trying to access activeElement before onload
|
||||
var hasFocus; try { hasFocus = (targetDocument.activeElement == input); } catch(e) { }
|
||||
if (hasFocus) setTimeout(onFocus, 20);
|
||||
var hasFocus; try { hasFocus = (document.activeElement == input); } catch(e) { }
|
||||
if (hasFocus || options.autofocus) setTimeout(onFocus, 20);
|
||||
else onBlur();
|
||||
|
||||
function isLine(l) {return l >= 0 && l < doc.size;}
|
||||
@@ -178,17 +187,23 @@ var CodeMirror = (function() {
|
||||
line = clipLine(line == null ? doc.size - 1: line);
|
||||
return getStateBefore(line + 1);
|
||||
},
|
||||
cursorCoords: function(start){
|
||||
cursorCoords: function(start, mode) {
|
||||
if (start == null) start = sel.inverted;
|
||||
return pageCoords(start ? sel.from : sel.to);
|
||||
return this.charCoords(start ? sel.from : sel.to, mode);
|
||||
},
|
||||
charCoords: function(pos, mode) {
|
||||
pos = clipPos(pos);
|
||||
if (mode == "local") return localCoords(pos, false);
|
||||
if (mode == "div") return localCoords(pos, true);
|
||||
return pageCoords(pos);
|
||||
},
|
||||
charCoords: function(pos){return pageCoords(clipPos(pos));},
|
||||
coordsChar: function(coords) {
|
||||
var off = eltOffset(lineSpace);
|
||||
return coordsChar(coords.x - off.left, coords.y - off.top);
|
||||
},
|
||||
markText: operation(markText),
|
||||
setBookmark: setBookmark,
|
||||
findMarksAt: findMarksAt,
|
||||
setMarker: operation(addGutterMarker),
|
||||
clearMarker: operation(removeGutterMarker),
|
||||
setLineClass: operation(setLineClass),
|
||||
@@ -256,6 +271,7 @@ var CodeMirror = (function() {
|
||||
replaceRange: operation(replaceRange),
|
||||
getRange: function(from, to) {return getRange(clipPos(from), clipPos(to));},
|
||||
|
||||
triggerOnKeyDown: operation(onKeyDown),
|
||||
execCommand: function(cmd) {return commands[cmd](instance);},
|
||||
// Stuff used by commands, probably not much use to outside code.
|
||||
moveH: operation(moveH),
|
||||
@@ -373,7 +389,7 @@ var CodeMirror = (function() {
|
||||
!posLess(start, sel.from) && !posLess(sel.to, start)) {
|
||||
// Let the drag handler handle this.
|
||||
if (webkit) lineSpace.draggable = true;
|
||||
var up = connect(targetDocument, "mouseup", operation(function(e2) {
|
||||
var up = connect(document, "mouseup", operation(function(e2) {
|
||||
if (webkit) lineSpace.draggable = false;
|
||||
draggingText = false;
|
||||
up();
|
||||
@@ -384,6 +400,8 @@ var CodeMirror = (function() {
|
||||
}
|
||||
}), true);
|
||||
draggingText = true;
|
||||
// IE's approach to draggable
|
||||
if (lineSpace.dragDrop) lineSpace.dragDrop();
|
||||
return;
|
||||
}
|
||||
e_preventDefault(e);
|
||||
@@ -402,12 +420,7 @@ var CodeMirror = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
var move = connect(targetDocument, "mousemove", operation(function(e) {
|
||||
clearTimeout(going);
|
||||
e_preventDefault(e);
|
||||
extend(e);
|
||||
}), true);
|
||||
var up = connect(targetDocument, "mouseup", operation(function(e) {
|
||||
function done(e) {
|
||||
clearTimeout(going);
|
||||
var cur = posFromMouse(e);
|
||||
if (cur) setSelectionUser(start, cur);
|
||||
@@ -415,7 +428,14 @@ var CodeMirror = (function() {
|
||||
focusInput();
|
||||
updateInput = true;
|
||||
move(); up();
|
||||
}
|
||||
var move = connect(document, "mousemove", operation(function(e) {
|
||||
clearTimeout(going);
|
||||
e_preventDefault(e);
|
||||
if (!ie && !e_button(e)) done(e);
|
||||
else extend(e);
|
||||
}), true);
|
||||
var up = connect(document, "mouseup", operation(done), true);
|
||||
}
|
||||
function onDoubleClick(e) {
|
||||
for (var n = e_target(e); n != wrapper; n = n.parentNode)
|
||||
@@ -464,11 +484,14 @@ var CodeMirror = (function() {
|
||||
}
|
||||
function onDragStart(e) {
|
||||
var txt = getSelection();
|
||||
// Disabled until further notice. Doesn't work on most browsers,
|
||||
// and crashes Safari (issue #332).
|
||||
//htmlEscape(txt);
|
||||
//e.dataTransfer.setDragImage(escapeElement, 0, 0);
|
||||
e.dataTransfer.setData("Text", txt);
|
||||
|
||||
// Use dummy image instead of default browsers image.
|
||||
if (gecko || chrome) {
|
||||
var img = document.createElement('img');
|
||||
img.scr = 'data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs='; //1x1 image
|
||||
e.dataTransfer.setDragImage(img, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function doHandleBinding(bound, dropShift) {
|
||||
@@ -506,13 +529,19 @@ var CodeMirror = (function() {
|
||||
if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
|
||||
if (e_prop(e, "metaKey")) name = "Cmd-" + name;
|
||||
|
||||
if (e_prop(e, "shiftKey"))
|
||||
if (e_prop(e, "shiftKey")) {
|
||||
handled = lookupKey("Shift-" + name, options.extraKeys, options.keyMap,
|
||||
function(b) {return doHandleBinding(b, true);});
|
||||
if (!handled)
|
||||
function(b) {return doHandleBinding(b, true);})
|
||||
|| lookupKey(name, options.extraKeys, options.keyMap, function(b) {
|
||||
if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(b);
|
||||
});
|
||||
} else {
|
||||
handled = lookupKey(name, options.extraKeys, options.keyMap, doHandleBinding);
|
||||
|
||||
if (handled) e_preventDefault(e);
|
||||
}
|
||||
if (handled) {
|
||||
e_preventDefault(e);
|
||||
if (ie) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
function handleCharBinding(e, ch) {
|
||||
@@ -545,7 +574,7 @@ var CodeMirror = (function() {
|
||||
if (options.onKeyEvent && options.onKeyEvent(instance, addStop(e))) return;
|
||||
var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
|
||||
if (window.opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
|
||||
if (window.opera && !e.which && handleKeyBinding(e)) return;
|
||||
if (((window.opera && !e.which) || khtml) && handleKeyBinding(e)) return;
|
||||
var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
|
||||
if (options.electricChars && mode.electricChars && options.smartIndent && !options.readOnly) {
|
||||
if (mode.electricChars.indexOf(ch) > -1)
|
||||
@@ -837,11 +866,11 @@ var CodeMirror = (function() {
|
||||
return scrollIntoView(x, cursor.y, x, cursor.yBot);
|
||||
}
|
||||
function scrollIntoView(x1, y1, x2, y2) {
|
||||
var pl = paddingLeft(), pt = paddingTop(), lh = textHeight();
|
||||
var pl = paddingLeft(), pt = paddingTop();
|
||||
y1 += pt; y2 += pt; x1 += pl; x2 += pl;
|
||||
var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
|
||||
if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
|
||||
else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
|
||||
if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1); scrolled = true;}
|
||||
else if (y2 > screentop + screen) {scroller.scrollTop = y2 - screen; scrolled = true;}
|
||||
|
||||
var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
|
||||
var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
|
||||
@@ -921,7 +950,7 @@ var CodeMirror = (function() {
|
||||
throw new Error("BAD PATCH! " + JSON.stringify(intact) + " size=" + (showingTo - showingFrom) +
|
||||
" nodes=" + lineDiv.childNodes.length);
|
||||
|
||||
if (options.lineWrapping) {
|
||||
function checkHeights() {
|
||||
maxWidth = scroller.clientWidth;
|
||||
var curNode = lineDiv.firstChild, heightChanged = false;
|
||||
doc.iter(showingFrom, showingTo, function(line) {
|
||||
@@ -936,6 +965,11 @@ var CodeMirror = (function() {
|
||||
});
|
||||
if (heightChanged)
|
||||
code.style.height = (doc.height * th + 2 * paddingTop()) + "px";
|
||||
return heightChanged;
|
||||
}
|
||||
|
||||
if (options.lineWrapping) {
|
||||
checkHeights();
|
||||
} else {
|
||||
if (maxWidth == null) maxWidth = stringWidth(maxLine);
|
||||
if (maxWidth > scroller.clientWidth) {
|
||||
@@ -947,8 +981,12 @@ var CodeMirror = (function() {
|
||||
lineSpace.style.width = code.style.width = "";
|
||||
}
|
||||
}
|
||||
|
||||
gutter.style.display = gutterDisplay;
|
||||
if (different || gutterDirty) updateGutter();
|
||||
if (different || gutterDirty) {
|
||||
// If the gutter grew in size, re-check heights. If those changed, re-draw gutter.
|
||||
updateGutter() && options.lineWrapping && checkHeights() && updateGutter();
|
||||
}
|
||||
updateSelection();
|
||||
if (!suppressCallback && options.onUpdate) options.onUpdate(instance);
|
||||
return true;
|
||||
@@ -996,16 +1034,17 @@ var CodeMirror = (function() {
|
||||
}
|
||||
// This pass fills in the lines that actually changed.
|
||||
var nextIntact = intact.shift(), curNode = lineDiv.firstChild, j = from;
|
||||
var scratch = targetDocument.createElement("div"), newElt;
|
||||
var scratch = document.createElement("div");
|
||||
doc.iter(from, to, function(line) {
|
||||
if (nextIntact && nextIntact.to == j) nextIntact = intact.shift();
|
||||
if (!nextIntact || nextIntact.from > j) {
|
||||
if (line.hidden) var html = scratch.innerHTML = "<pre></pre>";
|
||||
else {
|
||||
var html = '<pre>' + line.getHTML(makeTab) + '</pre>';
|
||||
var html = '<pre' + (line.className ? ' class="' + line.className + '"' : '') + '>'
|
||||
+ line.getHTML(makeTab) + '</pre>';
|
||||
// Kludge to make sure the styled element lies behind the selection (by z-index)
|
||||
if (line.className)
|
||||
html = '<div style="position: relative"><pre class="' + line.className +
|
||||
if (line.bgClassName)
|
||||
html = '<div style="position: relative"><pre class="' + line.bgClassName +
|
||||
'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>' + html + "</div>";
|
||||
}
|
||||
scratch.innerHTML = html;
|
||||
@@ -1021,7 +1060,7 @@ var CodeMirror = (function() {
|
||||
if (!options.gutter && !options.lineNumbers) return;
|
||||
var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
|
||||
gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
|
||||
var html = [], i = showingFrom;
|
||||
var html = [], i = showingFrom, normalNode;
|
||||
doc.iter(showingFrom, Math.max(showingTo, showingFrom + 1), function(line) {
|
||||
if (line.hidden) {
|
||||
html.push("<pre></pre>");
|
||||
@@ -1035,17 +1074,24 @@ var CodeMirror = (function() {
|
||||
html.push((marker && marker.style ? '<pre class="' + marker.style + '">' : "<pre>"), text);
|
||||
for (var j = 1; j < line.height; ++j) html.push("<br/> ");
|
||||
html.push("</pre>");
|
||||
if (!marker) normalNode = i;
|
||||
}
|
||||
++i;
|
||||
});
|
||||
gutter.style.display = "none";
|
||||
gutterText.innerHTML = html.join("");
|
||||
var minwidth = String(doc.size).length, firstNode = gutterText.firstChild, val = eltText(firstNode), pad = "";
|
||||
while (val.length + pad.length < minwidth) pad += "\u00a0";
|
||||
if (pad) firstNode.insertBefore(targetDocument.createTextNode(pad), firstNode.firstChild);
|
||||
// Make sure scrolling doesn't cause number gutter size to pop
|
||||
if (normalNode != null) {
|
||||
var node = gutterText.childNodes[normalNode - showingFrom];
|
||||
var minwidth = String(doc.size).length, val = eltText(node), pad = "";
|
||||
while (val.length + pad.length < minwidth) pad += "\u00a0";
|
||||
if (pad) node.insertBefore(document.createTextNode(pad), node.firstChild);
|
||||
}
|
||||
gutter.style.display = "";
|
||||
var resized = Math.abs((parseInt(lineSpace.style.marginLeft) || 0) - gutter.offsetWidth) > 2;
|
||||
lineSpace.style.marginLeft = gutter.offsetWidth + "px";
|
||||
gutterDirty = false;
|
||||
return resized;
|
||||
}
|
||||
function updateSelection() {
|
||||
var collapsed = posEq(sel.from, sel.to);
|
||||
@@ -1066,16 +1112,18 @@ var CodeMirror = (function() {
|
||||
html += '<div class="CodeMirror-selected" style="position: absolute; left: ' + left +
|
||||
'px; top: ' + top + 'px; right: ' + right + 'px; height: ' + height + 'px"></div>';
|
||||
}
|
||||
var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
|
||||
var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
|
||||
if (sel.from.ch && fromPos.y >= 0) {
|
||||
var right = sameLine ? lineSpace.clientWidth - toPos.x : 0;
|
||||
var right = sameLine ? clientWidth - toPos.x : 0;
|
||||
add(fromPos.x, fromPos.y, right, th);
|
||||
}
|
||||
var middleStart = Math.max(0, fromPos.y + (sel.from.ch ? th : 0));
|
||||
var middleHeight = Math.min(toPos.y, lineSpace.clientHeight) - middleStart;
|
||||
var middleHeight = Math.min(toPos.y, clientHeight) - middleStart;
|
||||
if (middleHeight > 0.2 * th)
|
||||
add(0, middleStart, 0, middleHeight);
|
||||
if ((!sameLine || !sel.from.ch) && toPos.y < lineSpace.clientHeight - .5 * th)
|
||||
add(0, toPos.y, lineSpace.clientWidth - toPos.x, th);
|
||||
if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
|
||||
add(0, toPos.y, clientWidth - toPos.x, th);
|
||||
selectionDiv.innerHTML = html;
|
||||
cursor.style.display = "none";
|
||||
selectionDiv.style.display = "";
|
||||
@@ -1105,7 +1153,12 @@ var CodeMirror = (function() {
|
||||
if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
|
||||
|
||||
// Skip over hidden lines.
|
||||
if (from.line != oldFrom) from = skipHidden(from, oldFrom, sel.from.ch);
|
||||
if (from.line != oldFrom) {
|
||||
var from1 = skipHidden(from, oldFrom, sel.from.ch);
|
||||
// If there is no non-hidden line left, force visibility on current line
|
||||
if (!from1) setLineHidden(from.line, false);
|
||||
else from = from1;
|
||||
}
|
||||
if (to.line != oldTo) to = skipHidden(to, oldTo, sel.to.ch);
|
||||
|
||||
if (posEq(from, to)) sel.inverted = false;
|
||||
@@ -1114,7 +1167,7 @@ var CodeMirror = (function() {
|
||||
|
||||
if (options.autoClearEmptyLines && posEq(sel.from, sel.to)) {
|
||||
var head = sel.inverted ? from : to;
|
||||
if (head.line != sel.from.line) {
|
||||
if (head.line != sel.from.line && sel.from.line < doc.size) {
|
||||
var oldLine = getLine(sel.from.line);
|
||||
if (/^\s+$/.test(oldLine.text))
|
||||
setTimeout(operation(function() {
|
||||
@@ -1209,6 +1262,7 @@ var CodeMirror = (function() {
|
||||
if (unit == "page") dist = Math.min(scroller.clientHeight, window.innerHeight || document.documentElement.clientHeight);
|
||||
else if (unit == "line") dist = textHeight();
|
||||
var target = coordsChar(pos.x, pos.y + dist * dir + 2);
|
||||
if (unit == "page") scroller.scrollTop += localCoords(target, true).y - pos.y;
|
||||
setCursor(target.line, target.ch, true);
|
||||
goalColumn = pos.x;
|
||||
}
|
||||
@@ -1295,9 +1349,10 @@ var CodeMirror = (function() {
|
||||
changes.push({from: 0, to: doc.size});
|
||||
}
|
||||
function makeTab(col) {
|
||||
var w = options.tabSize - col % options.tabSize;
|
||||
var w = options.tabSize - col % options.tabSize, cached = tabCache[w];
|
||||
if (cached) return cached;
|
||||
for (var str = '<span class="cm-tab">', i = 0; i < w; ++i) str += " ";
|
||||
return {html: str + "</span>", width: w};
|
||||
return (tabCache[w] = {html: str + "</span>", width: w});
|
||||
}
|
||||
function themeChanged() {
|
||||
scroller.className = scroller.className.replace(/\s*cm-s-\w+/g, "") +
|
||||
@@ -1313,7 +1368,7 @@ var CodeMirror = (function() {
|
||||
var lineN = lineNo(line);
|
||||
min = Math.min(min, lineN); max = Math.max(max, lineN);
|
||||
for (var j = 0; j < mk.length; ++j)
|
||||
if (mk[j].set == this.set) mk.splice(j--, 1);
|
||||
if (mk[j].marker == this) mk.splice(j--, 1);
|
||||
}
|
||||
if (min != Infinity)
|
||||
changes.push({from: min, to: max + 1});
|
||||
@@ -1324,7 +1379,7 @@ var CodeMirror = (function() {
|
||||
var line = this.set[i], mk = line.marked;
|
||||
for (var j = 0; j < mk.length; ++j) {
|
||||
var mark = mk[j];
|
||||
if (mark.set == this.set) {
|
||||
if (mark.marker == this) {
|
||||
if (mark.from != null || mark.to != null) {
|
||||
var found = lineNo(line);
|
||||
if (found != null) {
|
||||
@@ -1341,8 +1396,9 @@ var CodeMirror = (function() {
|
||||
function markText(from, to, className) {
|
||||
from = clipPos(from); to = clipPos(to);
|
||||
var tm = new TextMarker();
|
||||
if (!posLess(from, to)) return tm;
|
||||
function add(line, from, to, className) {
|
||||
getLine(line).addMark(new MarkedText(from, to, className, tm.set));
|
||||
getLine(line).addMark(new MarkedText(from, to, className, tm));
|
||||
}
|
||||
if (from.line == to.line) add(from.line, from.ch, to.ch, className);
|
||||
else {
|
||||
@@ -1362,6 +1418,19 @@ var CodeMirror = (function() {
|
||||
return bm;
|
||||
}
|
||||
|
||||
function findMarksAt(pos) {
|
||||
pos = clipPos(pos);
|
||||
var markers = [], marked = getLine(pos.line).marked;
|
||||
if (!marked) return markers;
|
||||
for (var i = 0, e = marked.length; i < e; ++i) {
|
||||
var m = marked[i];
|
||||
if ((m.from == null || m.from <= pos.ch) &&
|
||||
(m.to == null || m.to >= pos.ch))
|
||||
markers.push(m.marker || m);
|
||||
}
|
||||
return markers;
|
||||
}
|
||||
|
||||
function addGutterMarker(line, text, className) {
|
||||
if (typeof line == "number") line = getLine(clipLine(line));
|
||||
line.gutterMarker = {text: text, style: className};
|
||||
@@ -1383,10 +1452,11 @@ var CodeMirror = (function() {
|
||||
else return null;
|
||||
return line;
|
||||
}
|
||||
function setLineClass(handle, className) {
|
||||
function setLineClass(handle, className, bgClassName) {
|
||||
return changeLine(handle, function(line) {
|
||||
if (line.className != className) {
|
||||
if (line.className != className || line.bgClassName != bgClassName) {
|
||||
line.className = className;
|
||||
line.bgClassName = bgClassName;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -1400,6 +1470,8 @@ var CodeMirror = (function() {
|
||||
if (hidden && (fline == no || tline == no)) {
|
||||
var from = fline == no ? skipHidden({line: fline, ch: 0}, fline, 0) : sel.from;
|
||||
var to = tline == no ? skipHidden({line: tline, ch: 0}, tline, 0) : sel.to;
|
||||
// Can't hide the last visible line, we'd have no place to put the cursor
|
||||
if (!to) return;
|
||||
setSelection(from, to);
|
||||
}
|
||||
return (gutterDirty = true);
|
||||
@@ -1420,7 +1492,7 @@ var CodeMirror = (function() {
|
||||
}
|
||||
var marker = line.gutterMarker;
|
||||
return {line: n, handle: line, text: line.text, markerText: marker && marker.text,
|
||||
markerClass: marker && marker.style, lineClass: line.className};
|
||||
markerClass: marker && marker.style, lineClass: line.className, bgClass: line.bgClassName};
|
||||
}
|
||||
|
||||
function stringWidth(str) {
|
||||
@@ -1464,7 +1536,7 @@ var CodeMirror = (function() {
|
||||
var extra = "";
|
||||
// Include extra text at the end to make sure the measured line is wrapped in the right way.
|
||||
if (options.lineWrapping) {
|
||||
var end = line.text.indexOf(" ", ch + 2);
|
||||
var end = line.text.indexOf(" ", ch + 6);
|
||||
extra = htmlEscape(line.text.slice(ch + 1, end < 0 ? line.text.length : end + (ie ? 5 : 0)));
|
||||
}
|
||||
measure.innerHTML = "<pre>" + line.getHTML(makeTab, ch) +
|
||||
@@ -1823,7 +1895,7 @@ var CodeMirror = (function() {
|
||||
pollInterval: 100,
|
||||
undoDepth: 40,
|
||||
tabindex: null,
|
||||
document: window.document
|
||||
autofocus: null
|
||||
};
|
||||
|
||||
var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
||||
@@ -1831,7 +1903,7 @@ var CodeMirror = (function() {
|
||||
var win = /Win/.test(navigator.platform);
|
||||
|
||||
// Known modes, by name and by MIME
|
||||
var modes = {}, mimeModes = {};
|
||||
var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
|
||||
CodeMirror.defineMode = function(name, mode) {
|
||||
if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
|
||||
modes[name] = mode;
|
||||
@@ -1842,6 +1914,8 @@ var CodeMirror = (function() {
|
||||
CodeMirror.resolveMode = function(spec) {
|
||||
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
|
||||
spec = mimeModes[spec];
|
||||
else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
|
||||
return CodeMirror.resolveMode("application/xml");
|
||||
if (typeof spec == "string") return {name: spec};
|
||||
else return spec || {name: "null"};
|
||||
};
|
||||
@@ -1926,7 +2000,7 @@ var CodeMirror = (function() {
|
||||
keyMap.basic = {
|
||||
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
||||
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
||||
"Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "indentMore", "Shift-Tab": "indentLess",
|
||||
"Delete": "delCharRight", "Backspace": "delCharLeft", "Tab": "insertTab", "Shift-Tab": "indentAuto",
|
||||
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
|
||||
};
|
||||
// Note that the save and find-related commands aren't defined by
|
||||
@@ -1937,6 +2011,7 @@ var CodeMirror = (function() {
|
||||
"Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
||||
"Ctrl-Backspace": "delWordLeft", "Ctrl-Delete": "delWordRight", "Ctrl-S": "save", "Ctrl-F": "find",
|
||||
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
||||
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
||||
fallthrough: "basic"
|
||||
};
|
||||
keyMap.macDefault = {
|
||||
@@ -1945,6 +2020,7 @@ var CodeMirror = (function() {
|
||||
"Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordLeft",
|
||||
"Ctrl-Alt-Backspace": "delWordRight", "Alt-Delete": "delWordRight", "Cmd-S": "save", "Cmd-F": "find",
|
||||
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
||||
"Cmd-[": "indentLess", "Cmd-]": "indentMore",
|
||||
fallthrough: ["basic", "emacsy"]
|
||||
};
|
||||
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
|
||||
@@ -1987,6 +2063,8 @@ var CodeMirror = (function() {
|
||||
options.value = textarea.value;
|
||||
if (!options.tabindex && textarea.tabindex)
|
||||
options.tabindex = textarea.tabindex;
|
||||
if (options.autofocus == null && textarea.getAttribute("autofocus") != null)
|
||||
options.autofocus = true;
|
||||
|
||||
function save() {textarea.value = instance.getValue();}
|
||||
if (textarea.form) {
|
||||
@@ -2098,34 +2176,34 @@ var CodeMirror = (function() {
|
||||
};
|
||||
CodeMirror.StringStream = StringStream;
|
||||
|
||||
function MarkedText(from, to, className, set) {
|
||||
this.from = from; this.to = to; this.style = className; this.set = set;
|
||||
function MarkedText(from, to, className, marker) {
|
||||
this.from = from; this.to = to; this.style = className; this.marker = marker;
|
||||
}
|
||||
MarkedText.prototype = {
|
||||
attach: function(line) { this.set.push(line); },
|
||||
attach: function(line) { this.marker.set.push(line); },
|
||||
detach: function(line) {
|
||||
var ix = indexOf(this.set, line);
|
||||
if (ix > -1) this.set.splice(ix, 1);
|
||||
var ix = indexOf(this.marker.set, line);
|
||||
if (ix > -1) this.marker.set.splice(ix, 1);
|
||||
},
|
||||
split: function(pos, lenBefore) {
|
||||
if (this.to <= pos && this.to != null) return null;
|
||||
var from = this.from < pos || this.from == null ? null : this.from - pos + lenBefore;
|
||||
var to = this.to == null ? null : this.to - pos + lenBefore;
|
||||
return new MarkedText(from, to, this.style, this.set);
|
||||
return new MarkedText(from, to, this.style, this.marker);
|
||||
},
|
||||
dup: function() { return new MarkedText(null, null, this.style, this.set); },
|
||||
dup: function() { return new MarkedText(null, null, this.style, this.marker); },
|
||||
clipTo: function(fromOpen, from, toOpen, to, diff) {
|
||||
if (this.from != null && this.from >= from)
|
||||
this.from = Math.max(to, this.from) + diff;
|
||||
if (this.to != null && this.to > from)
|
||||
this.to = to < this.to ? this.to + diff : from;
|
||||
if (fromOpen && to > this.from && (to < this.to || this.to == null))
|
||||
this.from = null;
|
||||
else if (this.from != null && this.from >= from)
|
||||
this.from = Math.max(to, this.from) + diff;
|
||||
if (toOpen && (from < this.to || this.to == null) && (from > this.from || this.from == null))
|
||||
this.to = null;
|
||||
else if (this.to != null && this.to > from)
|
||||
this.to = to < this.to ? this.to + diff : from;
|
||||
},
|
||||
isDead: function() { return this.from != null && this.to != null && this.from >= this.to; },
|
||||
sameSet: function(x) { return this.set == x.set; }
|
||||
sameSet: function(x) { return this.marker == x.marker; }
|
||||
};
|
||||
|
||||
function Bookmark(pos) {
|
||||
@@ -2168,7 +2246,7 @@ var CodeMirror = (function() {
|
||||
this.styles = styles || [text, null];
|
||||
this.text = text;
|
||||
this.height = 1;
|
||||
this.marked = this.gutterMarker = this.className = this.handlers = null;
|
||||
this.marked = this.gutterMarker = this.className = this.bgClassName = this.handlers = null;
|
||||
this.stateAfter = this.parent = this.hidden = null;
|
||||
}
|
||||
Line.inheritMarks = function(text, orig) {
|
||||
@@ -2214,6 +2292,7 @@ var CodeMirror = (function() {
|
||||
if (newmark) {
|
||||
if (!taken.marked) taken.marked = [];
|
||||
taken.marked.push(newmark); newmark.attach(taken);
|
||||
if (newmark == mark) mk.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2637,10 +2716,10 @@ var CodeMirror = (function() {
|
||||
if (start < last.start) {
|
||||
for (var i = last.start - start - 1; i >= 0; --i)
|
||||
last.old.unshift(old[i]);
|
||||
last.added += last.start - start;
|
||||
oldoff = Math.min(0, added - old.length);
|
||||
last.added += last.start - start + oldoff;
|
||||
last.start = start;
|
||||
}
|
||||
else if (last.start < start) {
|
||||
} else if (last.start < start) {
|
||||
oldoff = start - last.start;
|
||||
added += oldoff;
|
||||
}
|
||||
@@ -2707,19 +2786,21 @@ var CodeMirror = (function() {
|
||||
|
||||
var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
|
||||
|
||||
// Detect drag-and-drop
|
||||
var dragAndDrop = function() {
|
||||
// IE8 has ondragstart and ondrop properties, but doesn't seem to
|
||||
// actually support ondragstart the way it's supposed to work.
|
||||
if (/MSIE [1-8]\b/.test(navigator.userAgent)) return false;
|
||||
var div = document.createElement('div');
|
||||
return "draggable" in div;
|
||||
}();
|
||||
|
||||
var gecko = /gecko\/\d{7}/i.test(navigator.userAgent);
|
||||
var ie = /MSIE \d/.test(navigator.userAgent);
|
||||
var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
|
||||
var webkit = /WebKit\//.test(navigator.userAgent);
|
||||
var chrome = /Chrome\//.test(navigator.userAgent);
|
||||
var khtml = /KHTML\//.test(navigator.userAgent);
|
||||
|
||||
// Detect drag-and-drop
|
||||
var dragAndDrop = function() {
|
||||
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
||||
// couldn't get it to work yet.
|
||||
if (ie_lt9) return false;
|
||||
var div = document.createElement('div');
|
||||
return "draggable" in div || "dragDrop" in div;
|
||||
}();
|
||||
|
||||
var lineSep = "\n";
|
||||
// Feature-detect whether newlines in textareas are converted to \r\n
|
||||
@@ -2873,7 +2954,7 @@ var CodeMirror = (function() {
|
||||
var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
||||
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
||||
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
||||
46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 186: ";", 187: "=", 188: ",",
|
||||
46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 127: "Delete", 186: ";", 187: "=", 188: ",",
|
||||
189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'", 63276: "PageUp",
|
||||
63277: "PageDown", 63275: "End", 63273: "Home", 63234: "Left", 63232: "Up", 63235: "Right",
|
||||
63233: "Down", 63302: "Insert", 63272: "Delete"};
|
||||
174
CodeMirror-2.23/lib/util/closetag.js
Normal file
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* Tag-closer extension for CodeMirror.
|
||||
*
|
||||
* This extension adds a "closeTag" utility function that can be used with key bindings to
|
||||
* insert a matching end tag after the ">" character of a start tag has been typed. It can
|
||||
* also complete "</" if a matching start tag is found. It will correctly ignore signal
|
||||
* characters for empty tags, comments, CDATA, etc.
|
||||
*
|
||||
* The function depends on internal parser state to identify tags. It is compatible with the
|
||||
* following CodeMirror modes and will ignore all others:
|
||||
* - htmlmixed
|
||||
* - xml
|
||||
* - xmlpure
|
||||
*
|
||||
* See demos/closetag.html for a usage example.
|
||||
*
|
||||
* @author Nathan Williams <nathan@nlwillia.net>
|
||||
* Contributed under the same license terms as CodeMirror.
|
||||
*/
|
||||
(function() {
|
||||
/** Option that allows tag closing behavior to be toggled. Default is true. */
|
||||
CodeMirror.defaults['closeTagEnabled'] = true;
|
||||
|
||||
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
|
||||
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
|
||||
|
||||
/**
|
||||
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
|
||||
* - cm: The editor instance.
|
||||
* - ch: The character being processed.
|
||||
* - indent: Optional. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
|
||||
* Pass false to disable indentation. Pass an array to override the default list of tag names.
|
||||
*/
|
||||
CodeMirror.defineExtension("closeTag", function(cm, ch, indent) {
|
||||
if (!cm.getOption('closeTagEnabled')) {
|
||||
throw CodeMirror.Pass;
|
||||
}
|
||||
|
||||
var mode = cm.getOption('mode');
|
||||
|
||||
if (mode == 'text/html') {
|
||||
|
||||
/*
|
||||
* Relevant structure of token:
|
||||
*
|
||||
* htmlmixed
|
||||
* className
|
||||
* state
|
||||
* htmlState
|
||||
* type
|
||||
* context
|
||||
* tagName
|
||||
* mode
|
||||
*
|
||||
* xml
|
||||
* className
|
||||
* state
|
||||
* tagName
|
||||
* type
|
||||
*/
|
||||
|
||||
var pos = cm.getCursor();
|
||||
var tok = cm.getTokenAt(pos);
|
||||
var state = tok.state;
|
||||
|
||||
if (state.mode && state.mode != 'html') {
|
||||
throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode.
|
||||
}
|
||||
|
||||
if (ch == '>') {
|
||||
var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
||||
|
||||
if (tok.className == 'tag' && type == 'closeTag') {
|
||||
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
|
||||
}
|
||||
|
||||
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
|
||||
pos = {line: pos.line, ch: pos.ch + 1};
|
||||
cm.setCursor(pos);
|
||||
|
||||
tok = cm.getTokenAt(cm.getCursor());
|
||||
state = tok.state;
|
||||
type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
||||
|
||||
if (tok.className == 'tag' && type != 'selfcloseTag') {
|
||||
var tagName = state.htmlState ? state.htmlState.context.tagName : state.tagName; // htmlmixed : xml
|
||||
if (tagName.length > 0) {
|
||||
insertEndTag(cm, indent, pos, tagName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Undo the '>' insert and allow cm to handle the key instead.
|
||||
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
|
||||
cm.replaceSelection("");
|
||||
|
||||
} else if (ch == '/') {
|
||||
if (tok.className == 'tag' && tok.string == '<') {
|
||||
var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : state.context.tagName; // htmlmixed : xml # extra htmlmized check is for '</' edge case
|
||||
if (tagName.length > 0) {
|
||||
completeEndTag(cm, pos, tagName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (mode == 'xmlpure') {
|
||||
|
||||
var pos = cm.getCursor();
|
||||
var tok = cm.getTokenAt(pos);
|
||||
var tagName = tok.state.context.tagName;
|
||||
|
||||
if (ch == '>') {
|
||||
// <foo> tagName=foo, string=foo
|
||||
// <foo /> tagName=foo, string=/ # ignore
|
||||
// <foo></foo> tagName=foo, string=/foo # ignore
|
||||
if (tok.string == tagName) {
|
||||
cm.replaceSelection('>'); // parity w/html modes
|
||||
pos = {line: pos.line, ch: pos.ch + 1};
|
||||
cm.setCursor(pos);
|
||||
|
||||
insertEndTag(cm, indent, pos, tagName);
|
||||
return;
|
||||
}
|
||||
|
||||
} else if (ch == '/') {
|
||||
// <foo / tagName=foo, string= # ignore
|
||||
// <foo></ tagName=foo, string=<
|
||||
if (tok.string == '<') {
|
||||
completeEndTag(cm, pos, tagName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw CodeMirror.Pass; // Bubble if not handled
|
||||
});
|
||||
|
||||
function insertEndTag(cm, indent, pos, tagName) {
|
||||
if (shouldIndent(cm, indent, tagName)) {
|
||||
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
|
||||
cm.indentLine(pos.line + 1);
|
||||
cm.indentLine(pos.line + 2);
|
||||
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
|
||||
} else {
|
||||
cm.replaceSelection('</' + tagName + '>');
|
||||
cm.setCursor(pos);
|
||||
}
|
||||
}
|
||||
|
||||
function shouldIndent(cm, indent, tagName) {
|
||||
if (typeof indent == 'undefined' || indent == null || indent == true) {
|
||||
indent = cm.getOption('closeTagIndent');
|
||||
}
|
||||
if (!indent) {
|
||||
indent = [];
|
||||
}
|
||||
return indexOf(indent, tagName.toLowerCase()) != -1;
|
||||
}
|
||||
|
||||
// C&P from codemirror.js...would be nice if this were visible to utilities.
|
||||
function indexOf(collection, elt) {
|
||||
if (collection.indexOf) return collection.indexOf(elt);
|
||||
for (var i = 0, e = collection.length; i < e; ++i)
|
||||
if (collection[i] == elt) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
function completeEndTag(cm, pos, tagName) {
|
||||
cm.replaceSelection('/' + tagName + '>');
|
||||
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -37,7 +37,7 @@ CodeMirror.tagRangeFinder = function(cm, line) {
|
||||
if (-1 != slash && slash < gt) {
|
||||
var str = lineText.substr(slash, gt - slash + 1);
|
||||
if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag
|
||||
return l+1;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
l++;
|
||||
@@ -80,7 +80,7 @@ CodeMirror.tagRangeFinder = function(cm, line) {
|
||||
}
|
||||
|
||||
if (found) {
|
||||
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\s)|(\\<" + tag + "$)";
|
||||
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
|
||||
var startTagRegExp = new RegExp(startTag, "g");
|
||||
var endTag = "</" + tag + ">";
|
||||
var depth = 1;
|
||||
@@ -96,7 +96,7 @@ CodeMirror.tagRangeFinder = function(cm, line) {
|
||||
else
|
||||
depth++;
|
||||
if (!depth)
|
||||
return l+1;
|
||||
return l;
|
||||
}
|
||||
}
|
||||
l++;
|
||||
@@ -144,7 +144,7 @@ CodeMirror.indentRangeFinder = function(cm, line) {
|
||||
return last + 1;
|
||||
};
|
||||
|
||||
CodeMirror.newFoldFunction = function(rangeFinder, markText) {
|
||||
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
|
||||
var folded = [];
|
||||
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">▼</div>%N%';
|
||||
|
||||
@@ -170,6 +170,8 @@ CodeMirror.newFoldFunction = function(rangeFinder, markText) {
|
||||
expand(cm, known.region);
|
||||
} else {
|
||||
var end = rangeFinder(cm, line);
|
||||
if (rangeFinder !== CodeMirror.indentRangeFinder && hideEnd === true) end++;
|
||||
console.log(rangeFinder !== CodeMirror.indentRangeFinder);
|
||||
if (end == null) return;
|
||||
var hidden = [];
|
||||
for (var i = line + 1; i < end; ++i) {
|
||||
@@ -1,4 +1,4 @@
|
||||
// ============== Formatting extensions ============================
|
||||
// ============== Formatting extensions ============================
|
||||
// A common storage for all mode-specific formatting features
|
||||
if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};
|
||||
|
||||
@@ -113,8 +113,10 @@
|
||||
base = 1;
|
||||
else if (obj.className == "function") {
|
||||
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
||||
(typeof jQuery == 'function')) base = jQuery();
|
||||
else if (window._ != null && (obj.string == '_') && (typeof _ == 'function')) base = _();
|
||||
(typeof window.jQuery == 'function'))
|
||||
base = window.jQuery();
|
||||
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
|
||||
base = window._();
|
||||
}
|
||||
while (base != null && context.length)
|
||||
base = base[context.pop().string];
|
||||
@@ -29,6 +29,10 @@
|
||||
complete.style.left = pos.x + "px";
|
||||
complete.style.top = pos.yBot + "px";
|
||||
document.body.appendChild(complete);
|
||||
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
||||
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
|
||||
if(winW - pos.x < sel.clientWidth)
|
||||
complete.style.left = (pos.x - sel.clientWidth) + "px";
|
||||
// Hack to hide the scrollbar.
|
||||
if (completions.length <= 10)
|
||||
complete.style.width = (sel.clientWidth - 1) + "px";
|
||||
@@ -53,6 +57,8 @@
|
||||
else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
|
||||
else if (code != 38 && code != 40) {
|
||||
close(); editor.focus();
|
||||
// Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
|
||||
editor.triggerOnKeyDown(event);
|
||||
setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
|
||||
}
|
||||
});
|
||||
@@ -96,6 +96,6 @@ void* zmq_thread_init(void* zmq_context, int signal_fd) {
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
|
||||
(C code), <code>text/x-c++src</code> (C++
|
||||
code), <code>text/x-java</code> (Java
|
||||
code).</p>
|
||||
code), <code>text/x-csharp</code> (C#).</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -92,7 +92,7 @@ CodeMirror.defineMode("css", function(config) {
|
||||
var style = state.tokenize(stream, state);
|
||||
|
||||
var context = state.stack[state.stack.length-1];
|
||||
if (type == "hash" && context == "rule") style = "atom";
|
||||
if (type == "hash" && context != "rule") style = "string-2";
|
||||
else if (style == "variable") {
|
||||
if (context == "rule") style = "number";
|
||||
else if (!context || context == "@media{") style = "tag";
|
||||
@@ -319,8 +319,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
kwAllowed: true,
|
||||
cc: [],
|
||||
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
||||
localVars: null,
|
||||
context: null,
|
||||
localVars: parserConfig.localVars,
|
||||
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
||||
indented: 0
|
||||
};
|
||||
},
|
||||
@@ -334,7 +334,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||
if (stream.eatSpace()) return null;
|
||||
var style = state.tokenize(stream, state);
|
||||
if (type == "comment") return style;
|
||||
state.reAllowed = type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/);
|
||||
state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
|
||||
state.kwAllowed = type != '.';
|
||||
return parseJS(state, style, type, content, stream);
|
||||
},
|
||||
24
CodeMirror-2.23/mode/ruby/LICENSE
Normal file
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2011, Ubalo, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Ubalo, Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
171
CodeMirror-2.23/mode/ruby/index.html
Normal file
@@ -0,0 +1,171 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CodeMirror: Ruby mode</title>
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="ruby.js"></script>
|
||||
<style>
|
||||
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||
.cm-s-default span.cm-arrow { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>CodeMirror: Ruby mode</h1>
|
||||
<form><textarea id="code" name="code">
|
||||
# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
|
||||
#
|
||||
# This program evaluates polynomials. It first asks for the coefficients
|
||||
# of a polynomial, which must be entered on one line, highest-order first.
|
||||
# It then requests values of x and will compute the value of the poly for
|
||||
# each x. It will repeatly ask for x values, unless you the user enters
|
||||
# a blank line. It that case, it will ask for another polynomial. If the
|
||||
# user types quit for either input, the program immediately exits.
|
||||
#
|
||||
|
||||
#
|
||||
# Function to evaluate a polynomial at x. The polynomial is given
|
||||
# as a list of coefficients, from the greatest to the least.
|
||||
def polyval(x, coef)
|
||||
sum = 0
|
||||
coef = coef.clone # Don't want to destroy the original
|
||||
while true
|
||||
sum += coef.shift # Add and remove the next coef
|
||||
break if coef.empty? # If no more, done entirely.
|
||||
sum *= x # This happens the right number of times.
|
||||
end
|
||||
return sum
|
||||
end
|
||||
|
||||
#
|
||||
# Function to read a line containing a list of integers and return
|
||||
# them as an array of integers. If the string conversion fails, it
|
||||
# throws TypeError. If the input line is the word 'quit', then it
|
||||
# converts it to an end-of-file exception
|
||||
def readints(prompt)
|
||||
# Read a line
|
||||
print prompt
|
||||
line = readline.chomp
|
||||
raise EOFError.new if line == 'quit' # You can also use a real EOF.
|
||||
|
||||
# Go through each item on the line, converting each one and adding it
|
||||
# to retval.
|
||||
retval = [ ]
|
||||
for str in line.split(/\s+/)
|
||||
if str =~ /^\-?\d+$/
|
||||
retval.push(str.to_i)
|
||||
else
|
||||
raise TypeError.new
|
||||
end
|
||||
end
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
#
|
||||
# Take a coeff and an exponent and return the string representation, ignoring
|
||||
# the sign of the coefficient.
|
||||
def term_to_str(coef, exp)
|
||||
ret = ""
|
||||
|
||||
# Show coeff, unless it's 1 or at the right
|
||||
coef = coef.abs
|
||||
ret = coef.to_s unless coef == 1 && exp > 0
|
||||
ret += "x" if exp > 0 # x if exponent not 0
|
||||
ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
#
|
||||
# Create a string of the polynomial in sort-of-readable form.
|
||||
def polystr(p)
|
||||
# Get the exponent of first coefficient, plus 1.
|
||||
exp = p.length
|
||||
|
||||
# Assign exponents to each term, making pairs of coeff and exponent,
|
||||
# Then get rid of the zero terms.
|
||||
p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
|
||||
|
||||
# If there's nothing left, it's a zero
|
||||
return "0" if p.empty?
|
||||
|
||||
# *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
|
||||
|
||||
# Convert the first term, preceded by a "-" if it's negative.
|
||||
result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
|
||||
|
||||
# Convert the rest of the terms, in each case adding the appropriate
|
||||
# + or - separating them.
|
||||
for term in p[1...p.length]
|
||||
# Add the separator then the rep. of the term.
|
||||
result += (if term[0] < 0 then " - " else " + " end) +
|
||||
term_to_str(*term)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
#
|
||||
# Run until some kind of endfile.
|
||||
begin
|
||||
# Repeat until an exception or quit gets us out.
|
||||
while true
|
||||
# Read a poly until it works. An EOF will except out of the
|
||||
# program.
|
||||
print "\n"
|
||||
begin
|
||||
poly = readints("Enter a polynomial coefficients: ")
|
||||
rescue TypeError
|
||||
print "Try again.\n"
|
||||
retry
|
||||
end
|
||||
break if poly.empty?
|
||||
|
||||
# Read and evaluate x values until the user types a blank line.
|
||||
# Again, an EOF will except out of the pgm.
|
||||
while true
|
||||
# Request an integer.
|
||||
print "Enter x value or blank line: "
|
||||
x = readline.chomp
|
||||
break if x == ''
|
||||
raise EOFError.new if x == 'quit'
|
||||
|
||||
# If it looks bad, let's try again.
|
||||
if x !~ /^\-?\d+$/
|
||||
print "That doesn't look like an integer. Please try again.\n"
|
||||
next
|
||||
end
|
||||
|
||||
# Convert to an integer and print the result.
|
||||
x = x.to_i
|
||||
print "p(x) = ", polystr(poly), "\n"
|
||||
print "p(", x, ") = ", polyval(x, poly), "\n"
|
||||
end
|
||||
end
|
||||
rescue EOFError
|
||||
print "\n=== EOF ===\n"
|
||||
rescue Interrupt, SignalException
|
||||
print "\n=== Interrupted ===\n"
|
||||
else
|
||||
print "--- Bye ---\n"
|
||||
end
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: "text/x-ruby",
|
||||
tabMode: "indent",
|
||||
matchBrackets: true,
|
||||
indentUnit: 4
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
|
||||
|
||||
<p>Development of the CodeMirror Ruby mode was kindly sponsored
|
||||
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
||||
the <a href="LICENSE">license</a>.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
200
CodeMirror-2.23/mode/ruby/ruby.js
Normal file
@@ -0,0 +1,200 @@
|
||||
CodeMirror.defineMode("ruby", function(config, parserConfig) {
|
||||
function wordObj(words) {
|
||||
var o = {};
|
||||
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
|
||||
return o;
|
||||
}
|
||||
var keywords = wordObj([
|
||||
"alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
|
||||
"elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
|
||||
"redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
|
||||
"until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
|
||||
"caller", "lambda", "proc", "public", "protected", "private", "require", "load",
|
||||
"require_relative", "extend", "autoload"
|
||||
]);
|
||||
var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
|
||||
"catch", "loop", "proc", "begin"]);
|
||||
var dedentWords = wordObj(["end", "until"]);
|
||||
var matching = {"[": "]", "{": "}", "(": ")"};
|
||||
var curPunc;
|
||||
|
||||
function chain(newtok, stream, state) {
|
||||
state.tokenize.push(newtok);
|
||||
return newtok(stream, state);
|
||||
}
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
curPunc = null;
|
||||
if (stream.sol() && stream.match("=begin") && stream.eol()) {
|
||||
state.tokenize.push(readBlockComment);
|
||||
return "comment";
|
||||
}
|
||||
if (stream.eatSpace()) return null;
|
||||
var ch = stream.next();
|
||||
if (ch == "`" || ch == "'" || ch == '"' ||
|
||||
(ch == "/" && !stream.eol() && stream.peek() != " ")) {
|
||||
return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
|
||||
} else if (ch == "%") {
|
||||
var style, embed = false;
|
||||
if (stream.eat("s")) style = "atom";
|
||||
else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
|
||||
else if (stream.eat(/[wxqr]/)) style = "string";
|
||||
var delim = stream.eat(/[^\w\s]/);
|
||||
if (!delim) return "operator";
|
||||
if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
|
||||
return chain(readQuoted(delim, style, embed, true), stream, state);
|
||||
} else if (ch == "#") {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
} else if (ch == "<" && stream.eat("<")) {
|
||||
stream.eat("-");
|
||||
stream.eat(/[\'\"\`]/);
|
||||
var match = stream.match(/^\w+/);
|
||||
stream.eat(/[\'\"\`]/);
|
||||
if (match) return chain(readHereDoc(match[0]), stream, state);
|
||||
return null;
|
||||
} else if (ch == "0") {
|
||||
if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
|
||||
else if (stream.eat("b")) stream.eatWhile(/[01]/);
|
||||
else stream.eatWhile(/[0-7]/);
|
||||
return "number";
|
||||
} else if (/\d/.test(ch)) {
|
||||
stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
|
||||
return "number";
|
||||
} else if (ch == "?") {
|
||||
while (stream.match(/^\\[CM]-/)) {}
|
||||
if (stream.eat("\\")) stream.eatWhile(/\w/);
|
||||
else stream.next();
|
||||
return "string";
|
||||
} else if (ch == ":") {
|
||||
if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
|
||||
if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
|
||||
stream.eatWhile(/[\w\?]/);
|
||||
return "atom";
|
||||
} else if (ch == "@") {
|
||||
stream.eat("@");
|
||||
stream.eatWhile(/[\w\?]/);
|
||||
return "variable-2";
|
||||
} else if (ch == "$") {
|
||||
stream.next();
|
||||
stream.eatWhile(/[\w\?]/);
|
||||
return "variable-3";
|
||||
} else if (/\w/.test(ch)) {
|
||||
stream.eatWhile(/[\w\?]/);
|
||||
if (stream.eat(":")) return "atom";
|
||||
return "ident";
|
||||
} else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
|
||||
curPunc = "|";
|
||||
return null;
|
||||
} else if (/[\(\)\[\]{}\\;]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return null;
|
||||
} else if (ch == "-" && stream.eat(">")) {
|
||||
return "arrow";
|
||||
} else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
|
||||
stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
|
||||
return "operator";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function tokenBaseUntilBrace() {
|
||||
var depth = 1;
|
||||
return function(stream, state) {
|
||||
if (stream.peek() == "}") {
|
||||
depth--;
|
||||
if (depth == 0) {
|
||||
state.tokenize.pop();
|
||||
return state.tokenize[state.tokenize.length-1](stream, state);
|
||||
}
|
||||
} else if (stream.peek() == "{") {
|
||||
depth++;
|
||||
}
|
||||
return tokenBase(stream, state);
|
||||
};
|
||||
}
|
||||
function readQuoted(quote, style, embed, unescaped) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (ch == quote && (unescaped || !escaped)) {
|
||||
state.tokenize.pop();
|
||||
break;
|
||||
}
|
||||
if (embed && ch == "#" && !escaped && stream.eat("{")) {
|
||||
state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && ch == "\\";
|
||||
}
|
||||
return style;
|
||||
};
|
||||
}
|
||||
function readHereDoc(phrase) {
|
||||
return function(stream, state) {
|
||||
if (stream.match(phrase)) state.tokenize.pop();
|
||||
else stream.skipToEnd();
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
function readBlockComment(stream, state) {
|
||||
if (stream.sol() && stream.match("=end") && stream.eol())
|
||||
state.tokenize.pop();
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {tokenize: [tokenBase],
|
||||
indented: 0,
|
||||
context: {type: "top", indented: -config.indentUnit},
|
||||
continuedLine: false,
|
||||
lastTok: null,
|
||||
varList: false};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
if (stream.sol()) state.indented = stream.indentation();
|
||||
var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
|
||||
if (style == "ident") {
|
||||
var word = stream.current();
|
||||
style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
|
||||
: /^[A-Z]/.test(word) ? "tag"
|
||||
: (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
|
||||
: "variable";
|
||||
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
|
||||
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
|
||||
else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
|
||||
kwtype = "indent";
|
||||
}
|
||||
if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
|
||||
if (curPunc == "|") state.varList = !state.varList;
|
||||
|
||||
if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
|
||||
state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
|
||||
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
|
||||
state.context = state.context.prev;
|
||||
|
||||
if (stream.eol())
|
||||
state.continuedLine = (curPunc == "\\" || style == "operator");
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
|
||||
var firstChar = textAfter && textAfter.charAt(0);
|
||||
var ct = state.context;
|
||||
var closing = ct.type == matching[firstChar] ||
|
||||
ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
|
||||
return ct.indented + (closing ? 0 : config.indentUnit) +
|
||||
(state.continuedLine ? config.indentUnit : 0);
|
||||
},
|
||||
electricChars: "}de" // enD and rescuE
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
||||
|
||||
@@ -264,4 +264,5 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("application/xml", "xml");
|
||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||
82
CodeMirror-2.23/theme/ambiance.css
Normal file
25
CodeMirror-2.23/theme/blackboard.css
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Port of TextMate's Blackboard theme */
|
||||
|
||||
.cm-s-blackboard { background: #0C1021; color: #F8F8F8; }
|
||||
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
|
||||
.cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; }
|
||||
.cm-s-blackboard .CodeMirror-gutter-text { color: #888; }
|
||||
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
|
||||
|
||||
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
|
||||
.cm-s-blackboard .cm-atom { color: #D8FA3C; }
|
||||
.cm-s-blackboard .cm-number { color: #D8FA3C; }
|
||||
.cm-s-blackboard .cm-def { color: #8DA6CE; }
|
||||
.cm-s-blackboard .cm-variable { color: #FF6400; }
|
||||
.cm-s-blackboard .cm-operator { color: #FBDE2D;}
|
||||
.cm-s-blackboard .cm-comment { color: #AEAEAE; }
|
||||
.cm-s-blackboard .cm-string { color: #61CE3C; }
|
||||
.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
|
||||
.cm-s-blackboard .cm-meta { color: #D8FA3C; }
|
||||
.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
|
||||
.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
|
||||
.cm-s-blackboard .cm-tag { color: #8DA6CE; }
|
||||
.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
|
||||
.cm-s-blackboard .cm-header { color: #FF6400; }
|
||||
.cm-s-blackboard .cm-hr { color: #AEAEAE; }
|
||||
.cm-s-blackboard .cm-link { color: #8DA6CE; }
|
||||
18
CodeMirror-2.23/theme/cobalt.css
Normal file
@@ -0,0 +1,18 @@
|
||||
.cm-s-cobalt { background: #002240; color: white; }
|
||||
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
|
||||
.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
|
||||
.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
|
||||
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
|
||||
.cm-s-cobalt span.cm-comment { color: #08f; }
|
||||
.cm-s-cobalt span.cm-atom { color: #845dc4; }
|
||||
.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
|
||||
.cm-s-cobalt span.cm-keyword { color: #ffee80; }
|
||||
.cm-s-cobalt span.cm-string { color: #3ad900; }
|
||||
.cm-s-cobalt span.cm-meta { color: #ff9d00; }
|
||||
.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
|
||||
.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
|
||||
.cm-s-cobalt span.cm-error { color: #9d1e15; }
|
||||
.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
|
||||
.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
|
||||
.cm-s-cobalt span.cm-link { color: #845dc4; }
|
||||
25
CodeMirror-2.23/theme/eclipse.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.cm-s-eclipse span.cm-meta {color: #FF1717;}
|
||||
.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
|
||||
.cm-s-eclipse span.cm-atom {color: #219;}
|
||||
.cm-s-eclipse span.cm-number {color: #164;}
|
||||
.cm-s-eclipse span.cm-def {color: #00f;}
|
||||
.cm-s-eclipse span.cm-variable {color: black;}
|
||||
.cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
|
||||
.cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
|
||||
.cm-s-eclipse span.cm-property {color: black;}
|
||||
.cm-s-eclipse span.cm-operator {color: black;}
|
||||
.cm-s-eclipse span.cm-comment {color: #3F7F5F;}
|
||||
.cm-s-eclipse span.cm-string {color: #2A00FF;}
|
||||
.cm-s-eclipse span.cm-string-2 {color: #f50;}
|
||||
.cm-s-eclipse span.cm-error {color: #f00;}
|
||||
.cm-s-eclipse span.cm-qualifier {color: #555;}
|
||||
.cm-s-eclipse span.cm-builtin {color: #30a;}
|
||||
.cm-s-eclipse span.cm-bracket {color: #cc7;}
|
||||
.cm-s-eclipse span.cm-tag {color: #170;}
|
||||
.cm-s-eclipse span.cm-attribute {color: #00c;}
|
||||
.cm-s-eclipse span.cm-link {color: #219;}
|
||||
|
||||
.cm-s-eclipse .CodeMirror-matchingbracket {
|
||||
border:1px solid grey;
|
||||
color:black !important;;
|
||||
}
|
||||
10
CodeMirror-2.23/theme/elegant.css
Normal file
@@ -0,0 +1,10 @@
|
||||
.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
|
||||
.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
|
||||
.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
|
||||
.cm-s-elegant span.cm-variable {color: black;}
|
||||
.cm-s-elegant span.cm-variable-2 {color: #b11;}
|
||||
.cm-s-elegant span.cm-qualifier {color: #555;}
|
||||
.cm-s-elegant span.cm-keyword {color: #730;}
|
||||
.cm-s-elegant span.cm-builtin {color: #30a;}
|
||||
.cm-s-elegant span.cm-error {background-color: #fdd;}
|
||||
.cm-s-elegant span.cm-link {color: #762;}
|
||||
45
CodeMirror-2.23/theme/lesser-dark.css
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
http://lesscss.org/ dark theme
|
||||
Ported to CodeMirror by Peter Kroon
|
||||
*/
|
||||
.CodeMirror{
|
||||
line-height: 15px;
|
||||
}
|
||||
.cm-s-lesser-dark {
|
||||
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
|
||||
font-size:12px;
|
||||
}
|
||||
|
||||
.cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
|
||||
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
|
||||
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
.cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
|
||||
|
||||
.cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; }
|
||||
.cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; }
|
||||
|
||||
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
|
||||
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
|
||||
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
|
||||
.cm-s-lesser-dark span.cm-def {color: color: white;}
|
||||
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
|
||||
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
|
||||
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
|
||||
.cm-s-lesser-dark span.cm-property {color: #92A75C;}
|
||||
.cm-s-lesser-dark span.cm-operator {color: #92A75C;}
|
||||
.cm-s-lesser-dark span.cm-comment { color: #666; }
|
||||
.cm-s-lesser-dark span.cm-string { color: #BCD279; }
|
||||
.cm-s-lesser-dark span.cm-string-2 {color: #f50;}
|
||||
.cm-s-lesser-dark span.cm-meta { color: #738C73; }
|
||||
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
|
||||
.cm-s-lesser-dark span.cm-qualifier {color: #555;}
|
||||
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
|
||||
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
|
||||
.cm-s-lesser-dark span.cm-tag { color: #669199; }
|
||||
.cm-s-lesser-dark span.cm-attribute {color: #00c;}
|
||||
.cm-s-lesser-dark span.cm-header {color: #a0a;}
|
||||
.cm-s-lesser-dark span.cm-quote {color: #090;}
|
||||
.cm-s-lesser-dark span.cm-hr {color: #999;}
|
||||
.cm-s-lesser-dark span.cm-link {color: #00c;}
|
||||
28
CodeMirror-2.23/theme/monokai.css
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Based on Sublime Text's Monokai theme */
|
||||
|
||||
.cm-s-monokai {background: #272822; color: #f8f8f2;}
|
||||
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
|
||||
.cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;}
|
||||
.cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;}
|
||||
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
|
||||
|
||||
.cm-s-monokai span.cm-comment {color: #75715e;}
|
||||
.cm-s-monokai span.cm-atom {color: #ae81ff;}
|
||||
.cm-s-monokai span.cm-number {color: #ae81ff;}
|
||||
|
||||
.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;}
|
||||
.cm-s-monokai span.cm-keyword {color: #f92672;}
|
||||
.cm-s-monokai span.cm-string {color: #e6db74;}
|
||||
|
||||
.cm-s-monokai span.cm-variable {color: #a6e22e;}
|
||||
.cm-s-monokai span.cm-variable-2 {color: #9effff;}
|
||||
.cm-s-monokai span.cm-def {color: #fd971f;}
|
||||
.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
|
||||
.cm-s-monokai span.cm-bracket {color: #f8f8f2;}
|
||||
.cm-s-monokai span.cm-tag {color: #f92672;}
|
||||
.cm-s-monokai span.cm-link {color: #ae81ff;}
|
||||
|
||||
.cm-s-monokai .CodeMirror-matchingbracket {
|
||||
text-decoration: underline;
|
||||
color: white !important;
|
||||
}
|
||||
9
CodeMirror-2.23/theme/neat.css
Normal file
@@ -0,0 +1,9 @@
|
||||
.cm-s-neat span.cm-comment { color: #a86; }
|
||||
.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
|
||||
.cm-s-neat span.cm-string { color: #a22; }
|
||||
.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
|
||||
.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
|
||||
.cm-s-neat span.cm-variable { color: black; }
|
||||
.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
|
||||
.cm-s-neat span.cm-meta {color: #555;}
|
||||
.cm-s-neat span.cm-link { color: #3a3; }
|
||||
21
CodeMirror-2.23/theme/night.css
Normal file
@@ -0,0 +1,21 @@
|
||||
/* Loosely based on the Midnight Textmate theme */
|
||||
|
||||
.cm-s-night { background: #0a001f; color: #f8f8f8; }
|
||||
.cm-s-night div.CodeMirror-selected { background: #a8f !important; }
|
||||
.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
||||
.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
|
||||
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
|
||||
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||
.cm-s-night span.cm-atom { color: #845dc4; }
|
||||
.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
|
||||
.cm-s-night span.cm-keyword { color: #599eff; }
|
||||
.cm-s-night span.cm-string { color: #37f14a; }
|
||||
.cm-s-night span.cm-meta { color: #7678e2; }
|
||||
.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
|
||||
.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
|
||||
.cm-s-night span.cm-error { color: #9d1e15; }
|
||||
.cm-s-night span.cm-bracket { color: #8da6ce; }
|
||||
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||
.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
|
||||
.cm-s-night span.cm-link { color: #845dc4; }
|
||||
21
CodeMirror-2.23/theme/rubyblue.css
Normal file
@@ -0,0 +1,21 @@
|
||||
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
||||
|
||||
.cm-s-rubyblue { background: #112435; color: white; }
|
||||
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
|
||||
.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }
|
||||
.cm-s-rubyblue .CodeMirror-gutter-text { color: white; }
|
||||
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
|
||||
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
|
||||
.cm-s-rubyblue span.cm-atom { color: #F4C20B; }
|
||||
.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
|
||||
.cm-s-rubyblue span.cm-keyword { color: #F0F; }
|
||||
.cm-s-rubyblue span.cm-string { color: #F08047; }
|
||||
.cm-s-rubyblue span.cm-meta { color: #F0F; }
|
||||
.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
|
||||
.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
|
||||
.cm-s-rubyblue span.cm-error { color: #AF2018; }
|
||||
.cm-s-rubyblue span.cm-bracket { color: #F0F; }
|
||||
.cm-s-rubyblue span.cm-link { color: #F4C20B; }
|
||||
.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
|
||||
.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
|
||||
46
CodeMirror-2.23/theme/xq-dark.css
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2011 by MarkLogic Corporation
|
||||
Author: Mike Brevoort <mike@brevoort.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }
|
||||
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
||||
.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
||||
.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }
|
||||
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
|
||||
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
||||
.cm-s-xq-dark span.cm-atom {color: #6C8CD5;}
|
||||
.cm-s-xq-dark span.cm-number {color: #164;}
|
||||
.cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;}
|
||||
.cm-s-xq-dark span.cm-variable {color: #FFF;}
|
||||
.cm-s-xq-dark span.cm-variable-2 {color: #EEE;}
|
||||
.cm-s-xq-dark span.cm-variable-3 {color: #DDD;}
|
||||
.cm-s-xq-dark span.cm-property {}
|
||||
.cm-s-xq-dark span.cm-operator {}
|
||||
.cm-s-xq-dark span.cm-comment {color: gray;}
|
||||
.cm-s-xq-dark span.cm-string {color: #9FEE00;}
|
||||
.cm-s-xq-dark span.cm-meta {color: yellow;}
|
||||
.cm-s-xq-dark span.cm-error {color: #f00;}
|
||||
.cm-s-xq-dark span.cm-qualifier {color: #FFF700;}
|
||||
.cm-s-xq-dark span.cm-builtin {color: #30a;}
|
||||
.cm-s-xq-dark span.cm-bracket {color: #cc7;}
|
||||
.cm-s-xq-dark span.cm-tag {color: #FFBD40;}
|
||||
.cm-s-xq-dark span.cm-attribute {color: #FFF700;}
|
||||
56
editor.php
@@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<html style="margin: 0px">
|
||||
<head>
|
||||
<title>CodeMirror 2: ICE Coders Editor of Choice</title>
|
||||
<?php include("lib/settings.php");?>
|
||||
@@ -11,24 +11,41 @@
|
||||
<script src="<?php echo $codeMirrorDir; ?>/mode/css/css.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/mode/clike/clike.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/mode/php/php.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/mode/ruby/ruby.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/searchcursor.js"></script>
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/match-highlighter.js"></script>
|
||||
<link rel="stylesheet" href="lib/editor.css">
|
||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/foldcode.js"></script>
|
||||
<?php
|
||||
if ($theme=="default") {
|
||||
echo '<link rel="stylesheet" href="lib/editor.css">';
|
||||
} else {
|
||||
echo '<link rel="stylesheet" href="'.$codeMirrorDir.'/theme/'.$theme.'.css">';
|
||||
}
|
||||
?>
|
||||
<style type="text/css">
|
||||
.CodeMirror {position: absolute; width: 0px; background-color: #ffffff}
|
||||
.CodeMirror-scroll {width: 100px; height: 100px;}
|
||||
.cm-s-visible {display: block; top: 0px}
|
||||
.cm-s-hidden {display: none; top: 4000px}
|
||||
.cm-s-activeLine {background: #002 !important;}
|
||||
<?php if ($visibleTabs) {?>
|
||||
.cm-tab:after {position: relative; display: inline-block; width: 0px; left: -1.4em; overflow: visible; color: #aaa; content: "\21e5";}
|
||||
<?;};?>
|
||||
span.CodeMirror-matchhighlight {background: #555555}
|
||||
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000000; background: #555555; !important}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
<body style="margin: 0px" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
|
||||
<script>
|
||||
function createNewCMInstance(num) {window['cM'+num] = CodeMirror(document.body, {
|
||||
function createNewCMInstance(num) {
|
||||
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
var codeFold = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder,'<span style=\"display: inline-block; width: 13px; height: 13px; background-color: #bb0000; color: #ffffff; text-align: center; cursor: pointer\"><span style="position: relative; top: -1px">+</span></span> %N%');
|
||||
var codeFold_JS_PHP_Ruby = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,'<span style=\"display: inline-block; width: 13px; height: 13px; background-color: #bb0000; color: #ffffff; text-align: center; cursor: pointer\"><span style="position: relative; top: -1px">+</span></span> %N%');
|
||||
|
||||
window['cM'+num] = CodeMirror(document.body, {
|
||||
mode: "application/x-httpd-php",
|
||||
theme: "icecoder",
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
indentUnit: 4,
|
||||
@@ -52,6 +69,7 @@ function createNewCMInstance(num) {window['cM'+num] = CodeMirror(document.body,
|
||||
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
|
||||
}
|
||||
top.ICEcoder.getCaretPosition();
|
||||
top.ICEcoder.dontUpdateNest = false;
|
||||
top.ICEcoder.updateCharDisplay();
|
||||
top.ICEcoder.updateNestingIndicator();
|
||||
if (top.ICEcoder.findMode) {
|
||||
@@ -74,7 +92,9 @@ function createNewCMInstance(num) {window['cM'+num] = CodeMirror(document.body,
|
||||
canDoEndTag=false;
|
||||
}
|
||||
}
|
||||
fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||
if(top.ICEcoder.tagString.slice(0,1)=="/"||top.ICEcoder.tagString.slice(0,1)=="?") {
|
||||
canDoEndTag=false;
|
||||
}
|
||||
if (!top.ICEcoder.codeAssist||fileName.indexOf(".js")>0||fileName.indexOf(".css")>0) {
|
||||
canDoEndTag=false;
|
||||
}
|
||||
@@ -86,7 +106,8 @@ function createNewCMInstance(num) {window['cM'+num] = CodeMirror(document.body,
|
||||
for (i=0;i<numTabs-1;i++) {
|
||||
tabs += "\t";
|
||||
}
|
||||
endTag = "</" + top.ICEcoder.htmlTagArray[top.ICEcoder.htmlTagArray.length-1] + ">";
|
||||
//endTag = "</" + top.ICEcoder.htmlTagArray[top.ICEcoder.htmlTagArray.length-1] + ">";
|
||||
endTag = "</" + top.ICEcoder.tagString + ">";
|
||||
if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"};
|
||||
if(top.ICEcoder.tagString=="title"||top.ICEcoder.tagString=="a"||top.ICEcoder.tagString=="li"||top.ICEcoder.tagString=="span"||(top.ICEcoder.tagString.slice(0,1)=="h"&&parseInt(top.ICEcoder.tagString.slice(1,2),10)>=1&&parseInt(top.ICEcoder.tagString.slice(1,2),10)<=7)) {
|
||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].replaceSelection(endTag);
|
||||
@@ -102,25 +123,14 @@ function createNewCMInstance(num) {window['cM'+num] = CodeMirror(document.body,
|
||||
};
|
||||
lastKeyCode = e.keyCode;
|
||||
},
|
||||
extraKeys: {"Enter": false}
|
||||
});
|
||||
onGutterClick: !fileName || (fileName && fileName.indexOf(".js") == -1 && fileName.indexOf(".php") && fileName.indexOf(".rb") == -1) ? codeFold : codeFold_JS_PHP_Ruby,
|
||||
extraKeys: {"Tab": "indentMore", "Shift-Tab": "indentLess"}
|
||||
});
|
||||
|
||||
// Now create the active line for this CodeMirror object
|
||||
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(0, "cm-s-activeLine");
|
||||
// Now create the active line for this CodeMirror object
|
||||
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(0, "cm-s-activeLine");
|
||||
};
|
||||
|
||||
<?php
|
||||
//for ($i=1;$i<=10;$i++) {
|
||||
?>
|
||||
//cM<?php echo $i;?>.getWrapperElement().getElementsByClassName("CodeMirror-lines")[0].addEventListener("click", function(){
|
||||
// if (top.ICEcoder.results && top.ICEcoder.results.length>0) {
|
||||
// top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results";
|
||||
// }
|
||||
// top.ICEcoder.findMode = false;
|
||||
//}, false);
|
||||
<?php
|
||||
//;};
|
||||
?>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -95,7 +95,7 @@ function fileManager_dir($directory, $return_link, $first_call=true) {
|
||||
$fileManager .= fileManager_dir("$directory/$this_file", $return_link , false);
|
||||
$fileManager .= "</li>";
|
||||
} else {
|
||||
$fileManager .= "<li class=\"pft-directory\" style=\"cursor: default\"><span style=\"position: relative; left:-22px; color: #888888\"> [HIDDEN] ".$fileAtts."</span></li>";
|
||||
$fileManager .= "<li class=\"pft-directory\" style=\"cursor: pointer\"><span style=\"position: relative; left:-22px; color: #888888\"> [HIDDEN] ".$fileAtts."</span></li>";
|
||||
}
|
||||
} else {
|
||||
// File
|
||||
@@ -117,7 +117,7 @@ function fileManager_dir($directory, $return_link, $first_call=true) {
|
||||
$chmodInfo = substr(sprintf('%o', fileperms($link)), -4);
|
||||
$fileAtts = '<span style="color: #888888; font-size: 8px">'.$chmodInfo.'</span>';
|
||||
}
|
||||
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\"><a nohref onMouseOver=\"top.ICEcoder.overFileFolder('file','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('file','')\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a></li>";
|
||||
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\"><a nohref onMouseOver=\"top.ICEcoder.overFileFolder('file','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('file','')\" style=\"position: relative; left:-22px; cursor: pointer\"> <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a></li>";
|
||||
} else {
|
||||
$fileAtts = "<img src=\"images/file-manager-icons/padlock.png\" style=\"cursor: pointer\" onClick=\"alert('Sorry, you need higher admin level rights to view.')\">";
|
||||
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\" style=\"cursor: default\"><span style=\"position: relative; left:-22px; color: #888888\"> [HIDDEN] ".$fileAtts."</span></li>";
|
||||
@@ -142,14 +142,15 @@ function php4_scandir($dir) {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="top.ICEcoder.getMouseXY(event);top.ICEcoder.canResizeFilesW()" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; top.ICEcoder.selectFileFolder(); return top.ICEcoder.showMenu()" onClick="top.document.getElementById('fileMenu').style.display='none'">
|
||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="top.ICEcoder.getMouseXY(event);top.ICEcoder.canResizeFilesW()" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()">
|
||||
<head>
|
||||
<title>ICE Coder File Manager</title>
|
||||
<link rel="stylesheet" type="text/css" href="lib/files.css">
|
||||
<script src="lib/coder.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body onLoad="top.ICEcoder.fileManager()" onClick="top.ICEcoder.selectFileFolder()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
<body onLoad="top.ICEcoder.fileManager()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||
<div onClick="top.ICEcoder.refreshFileManager()" class="refresh"><img src="images/file-manager-icons/refresh.png"></div>
|
||||
<?php
|
||||
echo fileManager($_SERVER['DOCUMENT_ROOT'], "[link]");
|
||||
?>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
BIN
images/delete.png
Normal file
|
After Width: | Height: | Size: 739 B |
BIN
images/file-manager-icons/refresh.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
images/new-file.png
Normal file
|
After Width: | Height: | Size: 512 B |
BIN
images/new-folder.png
Normal file
|
After Width: | Height: | Size: 377 B |
BIN
images/open.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
images/rename.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
images/save.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
images/view.png
Normal file
|
After Width: | Height: | Size: 982 B |
62
index.php
@@ -27,11 +27,29 @@ if ($testcMVersion) {
|
||||
<link rel="stylesheet" type="text/css" href="lib/coder.css">
|
||||
<script>
|
||||
shortURLStarts = "<?php echo $shortURLStarts;?>";
|
||||
theme = "<?php if ($theme=="default") {echo 'icecoder';} else {echo $theme;};?>";
|
||||
<?
|
||||
$docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
|
||||
if (strrpos($docRoot,"/")==strlen($docRoot)-1) {$docRoot = substr($docRoot,0,strlen($docRoot)-1);};
|
||||
echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
|
||||
?>
|
||||
window.onbeforeunload = function() {
|
||||
for (var i=0; i<=top.ICEcoder.changedContent.length; i++) {
|
||||
if (top.ICEcoder.changedContent[i]==1) {
|
||||
return "You have some unsaved changes.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastOpenFiles = [<?php
|
||||
if ($lastOpenedFiles!="" && $_SESSION['userLevel'] == 10) {
|
||||
$openFilesArray = explode(",",$lastOpenedFiles);
|
||||
for ($i=0;$i<count($openFilesArray);$i++) {
|
||||
echo "'".$openFilesArray[$i]."'";
|
||||
if ($i<count($openFilesArray)-1) {echo ",";};
|
||||
}
|
||||
}
|
||||
?>];
|
||||
</script>
|
||||
<script language="JavaScript" src="lib/coder.js"></script>
|
||||
</head><?php
|
||||
@@ -41,6 +59,9 @@ echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
|
||||
$onLoadExtras .= ";ICEcoder.startPluginIntervals('".$plugins[$i][3]."','".$plugins[$i][4]."','".$plugins[$i][5]."')";
|
||||
};
|
||||
};
|
||||
if ($openLastFiles) {
|
||||
$onLoadExtras .= ";ICEcoder.autoOpenFiles()";
|
||||
}
|
||||
?>
|
||||
<body onLoad="ICEcoder.init()<?php echo $onLoadExtras;?>" onResize="ICEcoder.setLayout()" onMouseMove="top.ICEcoder.getMouseXY(event);top.ICEcoder.canResizeFilesW()" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onKeyDown="return ICEcoder.interceptKeys('coder', event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
|
||||
|
||||
@@ -62,19 +83,24 @@ echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="fileMenu" class="fileMenu" onMouseOut="this.style.display='none'" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract')">
|
||||
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New File</a>
|
||||
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New Folder</a>
|
||||
<div id="fileMenu" class="fileMenu" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract')">
|
||||
<span id="folderMenuItems">
|
||||
<a href="javascript:top.ICEcoder.newFile()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New File</a>
|
||||
<a href="javascript:top.ICEcoder.newFolder()" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">New Folder</a>
|
||||
</span>
|
||||
<a href="javascript:top.ICEcoder.deleteFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Delete</a>
|
||||
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Rename</a>
|
||||
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length))" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">View Webpage</a>
|
||||
<span id="singleFileMenuItems">
|
||||
<a href="javascript:top.ICEcoder.renameFile(top.ICEcoder.rightClickedFile)" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">Rename</a>
|
||||
<a href="javascript:window.open(top.ICEcoder.rightClickedFile.substr((top.ICEcoder.rightClickedFile.indexOf(shortURLStarts)+top.shortURLStarts.length),top.ICEcoder.rightClickedFile.length))" onMouseOver="document.getElementById('fileMenu').style.display='inline-block'">View Webpage</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="header" class="header" onContextMenu="return false">
|
||||
<div class="plugins">
|
||||
<?php
|
||||
for ($i=0;$i<count($plugins);$i++) {
|
||||
echo '<a href="'.$plugins[$i][3].'" target="'.$plugins[$i][4].'"><img src="'.$plugins[$i][1].'" style="'.$plugins[$i][2].'" alt="'.$plugins[$i][0].'"></a>';
|
||||
$target = explode(":",$plugins[$i][4]);
|
||||
echo '<a href="'.$plugins[$i][3].'" target="'.$target[0].'"><img src="'.$plugins[$i][1].'" style="'.$plugins[$i][2].'" alt="'.$plugins[$i][0].'"></a>';
|
||||
};
|
||||
?>
|
||||
</div>
|
||||
@@ -84,11 +110,25 @@ echo 'fullPath = "'.$docRoot.'";'.PHP_EOL;
|
||||
|
||||
<div id="files" class="files" onMouseOver="ICEcoder.changeFilesW('expand')" onMouseOut="ICEcoder.changeFilesW('contract'); top.document.getElementById('fileMenu').style.display='none';">
|
||||
<div class="account" id="account">
|
||||
<form name="login" action="index.php" method="POST">
|
||||
<input type="password" name="loginPassword" class="accountPassword">
|
||||
<input type="submit" name="submit" value="Login" class="button">
|
||||
</form>
|
||||
<a nohref style="cursor: pointer" onClick="ICEcoder.lockUnlockNav()"><img src="images/file-manager-icons/padlock.png" id="fmLock" class="lock"></a>
|
||||
<?php if($_SESSION['userLevel']<10) {?>
|
||||
<form name="login" action="index.php" method="POST">
|
||||
<input type="password" name="loginPassword" class="accountPassword">
|
||||
<input type="submit" name="submit" value="Login" class="button">
|
||||
</form>
|
||||
<?php } else {
|
||||
$lockStyleExtra = ' style="margin-top: -22px"';
|
||||
?>
|
||||
<div class="accountOptions">
|
||||
<a nohref title="Save" onClick="ICEcoder.fMIcon('save')"><img src="images/save.png" alt="Save" id="fMSave" style="opacity: 0.3"></a>
|
||||
<a nohref title="Open" onClick="ICEcoder.fMIcon('open')"><img src="images/open.png" alt="Open" id="fMOpen" style="margin-left: 7px; opacity: 0.3"></a>
|
||||
<a nohref title="New File" onClick="ICEcoder.fMIcon('newFile')"><img src="images/new-file.png" alt="New File" id="fMNewFile" style="margin: 8px 0px 0px 10px; opacity: 0.3"></a>
|
||||
<a nohref title="New Folder" onClick="ICEcoder.fMIcon('newFolder')"><img src="images/new-folder.png" alt="New Folder" id="fMNewFolder" style="margin: 9px 0px 0px 5px; opacity: 0.3"></a>
|
||||
<a nohref title="Delete" onClick="ICEcoder.fMIcon('delete')"><img src="images/delete.png" alt="Delete" id="fMDelete" style="margin: 9px 0px 0px 5px; opacity: 0.3"></a>
|
||||
<a nohref title="Rename" onClick="ICEcoder.fMIcon('rename')"><img src="images/rename.png" alt="Rename" id="fMRename" style="margin: 9px 0px 0px 5px; opacity: 0.3"></a>
|
||||
<a nohref title="View" onClick="ICEcoder.fMIcon('view')"><img src="images/view.png" alt="View" id="fMView" style="margin: 9px 0px 0px 5px; opacity: 0.3"></a>
|
||||
</div>
|
||||
<?php ;};?>
|
||||
<a nohref style="cursor: pointer" onClick="ICEcoder.lockUnlockNav()"><img src="images/file-manager-icons/padlock.png" id="fmLock" class="lock"<?php echo $lockStyleExtra; ?>></a>
|
||||
</div>
|
||||
<iframe id="filesFrame" class="frame" name="ff" src="files.php" style="opacity: 0" onLoad="this.style.opacity='1'"></iframe>
|
||||
<div class="serverMessage" id="serverMessage"></div>
|
||||
|
||||
@@ -64,7 +64,7 @@ body {overflow: hidden;
|
||||
}
|
||||
|
||||
.header {position: absolute; display: inline-block; width: 100%; height: 40px; background-color: #ffffff; text-align: right; z-index: 2}
|
||||
.header .plugins {position: absolute; display: inline-block; left: 27px; top: 3px}
|
||||
.header .plugins {position: absolute; display: inline-block; left: 15px; top: 3px}
|
||||
.header .plugins img {position: relative; display: inline-block; margin-right: 15px}
|
||||
.header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbbbbb}
|
||||
.header .logo {position: relative; margin: 5px 10px 0px 5px}
|
||||
@@ -75,6 +75,8 @@ body {overflow: hidden;
|
||||
box-shadow: 0px 0px 10px 4px rgba(0,0,0,0.4);
|
||||
}
|
||||
.files .account {display: inline-block; height: 50px; width: 250px; margin-top: 40px; background-color: #888888}
|
||||
.files .accountOptions {position: relative; height: 31px; width: 200px; margin-left: 15px; margin-top: 8px}
|
||||
.files .accountOptions img {cursor: pointer}
|
||||
.files .accountPassword {position: relative; border: 1px solid #888888; background-color: #999999; height: 18px; width: 140px; margin-left: 14px; margin-top: 15px}
|
||||
.files .button {position: absolute; border: 0px; background: #999999; color: #555555; height:20px; margin-top: 16px; margin-left: 5px; font-size: 11px; cursor: pointer}
|
||||
.files .button:hover {background-color: #444444; color: #eeeeee}
|
||||
|
||||
614
lib/coder.js
@@ -1,6 +1,4 @@
|
||||
html, body {margin: 0px}
|
||||
|
||||
/* Based VERY loosely on the Monokai theme */
|
||||
/* ICE coder default theme: Based VERY loosely on Monokai */
|
||||
|
||||
.cm-s-icecoder {font-size: 12px; color: #666; background: #1c1c19;}
|
||||
|
||||
@@ -35,11 +33,8 @@ html, body {margin: 0px}
|
||||
.cm-s-icecoder span.cm-hr {color: #999;}
|
||||
.cm-s-icecoder span.cm-link {color: #ff0;}
|
||||
|
||||
.cm-s-icecoder .CodeMirror-selected {background: #037 !important;}
|
||||
.cm-s-icecoder .CodeMirror-gutter {background: #333; border-right: 1px solid #e8e8e8;}
|
||||
.cm-s-icecoder .CodeMirror-gutter-text {color: #999; width: 35px;}
|
||||
.cm-s-icecoder .CodeMirror-cursor {border-left: 1px solid white !important;}
|
||||
.cm-s-icecoder .CodeMirror-matchingbracket{border: 1px solid grey; color: black !important;}
|
||||
|
||||
span.CodeMirror-matchhighlight {background: #555555}
|
||||
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000000; background: #555555; !important}
|
||||
.cm-s-icecoder .CodeMirror-selected {background: #037 !important;}
|
||||
.cm-s-icecoder .CodeMirror-gutter {background: #333; border-right: 1px solid #e8e8e8}
|
||||
.cm-s-icecoder .CodeMirror-gutter-text {color: #999; width: 35px; cursor: default}
|
||||
.cm-s-icecoder .CodeMirror-matchingbracket {border: 1px solid grey; color: black !important;}
|
||||
@@ -28,7 +28,9 @@ if ($_GET['action']=="load") {
|
||||
}
|
||||
}
|
||||
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $bannedFile==false)) {
|
||||
echo '<script>fileType="text";</script>';
|
||||
echo '<script>fileType="text";top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink=\''.$file.'\';';
|
||||
echo 'shortURL = top.ICEcoder.thisFileFolderLink.replace(/\|/g,"/");';
|
||||
echo 'top.ICEcoder.shortURL = shortURL.substr((shortURL.indexOf(top.shortURLStarts)+top.shortURLStarts.length),shortURL.length);</script>';
|
||||
$loadedFile = file_get_contents($file);
|
||||
echo '<textarea name="loadedFile" id="loadedFile">'.str_replace("</textarea>","<ICEcoder:/:textarea>",$loadedFile).'</textarea>';
|
||||
} else {
|
||||
@@ -135,7 +137,7 @@ if ($_GET['action']=="save") {
|
||||
}
|
||||
$saveFile = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']).$file;
|
||||
$saveFile = str_replace("//","/",$saveFile);
|
||||
if (is_writable($saveFile)) {
|
||||
if ((file_exists($saveFile) && is_writable($saveFile)) || $_POST['newFileName']!="") {
|
||||
$fh = fopen($saveFile, 'w') or die("can't open file");
|
||||
fwrite($fh, $_POST['contents']);
|
||||
fclose($fh);
|
||||
@@ -219,10 +221,21 @@ if (action=="save") {
|
||||
} else {
|
||||
newFileName = prompt('Enter Filename','/');
|
||||
}
|
||||
if (newFileName && top.document.getElementById('filesFrame').contentWindow.document.getElementById(newFileName.replace(/\//g,"|"))) {
|
||||
overwriteOK = confirm('That file exists already, overwrite?');
|
||||
}
|
||||
document.saveFile.newFileName.value = newFileName;
|
||||
<?php ;};?>
|
||||
document.saveFile.contents.innerHTML = top.document.getElementById('saveTemp1').value;
|
||||
document.saveFile.submit();
|
||||
if ("undefined" == typeof newFileName || (newFileName && "undefined" == typeof overwriteOK) || ("undefined" != typeof overwriteOK && overwriteOK)) {
|
||||
if ("undefined" != typeof newFileName) {
|
||||
top.ICEcoder.serverMessage('<b>Saving</b><br>'+newFileName);
|
||||
}
|
||||
document.saveFile.contents.innerHTML = top.document.getElementById('saveTemp1').value;
|
||||
document.saveFile.submit();
|
||||
} else {
|
||||
top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);
|
||||
action=="nothing";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
|
||||
body {margin: 0px; overflow: auto}
|
||||
|
||||
.refresh {float: right; margin-right: 15px; cursor: pointer}
|
||||
|
||||
.fileManager {
|
||||
margin: 15px 0px 15px 22px;
|
||||
-webkit-user-select: none;
|
||||
@@ -35,7 +37,7 @@ body {margin: 0px; overflow: auto}
|
||||
.fileManager li {margin-left: 15px;}
|
||||
|
||||
/* Default file */
|
||||
.fileManager LI.pft-file { list-style-image: url(../images/file-manager-icons/file.png); cursor: pointer;}
|
||||
.fileManager LI.pft-file { list-style-image: url(../images/file-manager-icons/file.png); }
|
||||
|
||||
/* Additional file types */
|
||||
.fileManager LI.ext-3gp { list-style-image: url(../images/file-manager-icons/film.png); }
|
||||
|
||||
@@ -1,18 +1,39 @@
|
||||
<?php
|
||||
$versionNo = "v 0.5.9";
|
||||
$codeMirrorDir = "CodeMirror-2.22";
|
||||
$cMThisVer = 2.22;
|
||||
session_start();
|
||||
|
||||
$versionNo = "v 0.6.4";
|
||||
$codeMirrorDir = "CodeMirror-2.23";
|
||||
$cMThisVer = 2.23;
|
||||
$testcMVersion = false; // test if we're using the latest CodeMirror version
|
||||
$visibleTabs = true;
|
||||
$restrictedFiles = array("wp-",".php",".asp",".aspx");
|
||||
$bannedFiles = array("_coder","wp-",".exe");
|
||||
$allowedIPs = array("*"); // allowed IPs, * for any
|
||||
$plugins = array(
|
||||
array("Database Admin","images/database.png","margin-top: 3px","plugins/adminer/adminer-3.3.3-mysql-en.php","_blank",""),
|
||||
array("Batch Image Processor","images/images.png","margin-top: 5px","http://birme.net","_blank",""),
|
||||
array("Backup","images/backup-open-files.png","margin-top: 3px","plugins/backupOpenFiles/index.php","fileControl:<b>Zipping Open Files</b>","10"),
|
||||
array("Clipboard","images/clipboard.png","","javascript:alert('Doesn\'t do anything yet but will be a clipboard for copied text items, up to 100 levels')","_self","")
|
||||
array("Backup","images/backup-open-files.png","margin-top: 3px","plugins/backupOpenFiles/index.php","fileControl:<b>Zipping Open Files</b>","10")
|
||||
);
|
||||
$accountPassword = "";
|
||||
$lastOpenedFiles = "";
|
||||
$openLastFiles = true;
|
||||
$theme = "default";
|
||||
|
||||
if ($_GET['saveFiles']) {
|
||||
if ($_SESSION['userLevel'] == 10) {
|
||||
$settingsFile = 'settings.php';
|
||||
$settingsContents = file_get_contents($settingsFile);
|
||||
// Replace our lastOpenedFiles var with the the current
|
||||
$repPosStart = strpos($settingsContents,'lastOpenedFiles = "')+19;
|
||||
$repPosEnd = strpos($settingsContents,'";',$repPosStart)-$repPosStart;
|
||||
$settingsContents = substr($settingsContents,0,$repPosStart).$_GET['saveFiles'].substr($settingsContents,($repPosStart+$repPosEnd),strlen($settingsContents));
|
||||
// Now update this file
|
||||
$fh = fopen($settingsFile, 'w') or die("can't update settings file");
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
}
|
||||
echo '<script>top.ICEcoder.serverQueue("del",0);</script>';
|
||||
}
|
||||
|
||||
// ---------------
|
||||
// End of settings
|
||||
@@ -29,7 +50,6 @@ function generateHash($plainText,$salt=null) {
|
||||
return $salt.sha1($salt.$plainText);
|
||||
}
|
||||
|
||||
session_start();
|
||||
// Establish our user level
|
||||
if (!isset($_SESSION['userLevel'])) {$_SESSION['userLevel'] = 0;};
|
||||
if(isset($_POST['loginPassword']) && generateHash($_POST['loginPassword'],$accountPassword)==$accountPassword) {$_SESSION['userLevel'] = 10;};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
top.ICEcoder.serverMessage("<b>Zipping Open Files</b>");
|
||||
</script>
|
||||
<?php
|
||||
// ------------------------------------
|
||||
// backupOpenFiles by Matt Pass
|
||||
|
||||