Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
113 lines (94 sloc) 3.3 KB
<html>
<head>
<title>Jim!!!11</title>
<style type="text/css" media="screen">
body {
overflow: hidden;
background: #E8E8E8;
}
#greeting {
font-family: Helvetica, Arial, sans-serif, Tahoma, Verdana, sans-serif;
font-size: 12px;
white-space: nowrap;
}
#greeting a {
color: #8F9D6A;
}
#editor {
margin: 0;
position: absolute;
top: 30px;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>
<p id="greeting">
This is a Vim mode for <a href="https://github.com/ajaxorg/ace">Ace</a> powered by <a href="https://github.com/misfo/jim">Jim</a>. To use Jim in Github's editor, drag this bookmarklet to your bookmarks bar: <a href="#" id="bookmarklet">Please wait...</a>
</p>
<div id="container">
<pre id="editor">
_.sortBy = function(obj, iterator, context) {
return _.pluck(_.map(obj, function(value, index, list) {
return {
value : value,
criteria : iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria, b = right.criteria;
return a < b ? -1 : a > b ? 1 : 0;
}), 'value');
};
// borrowed from:
// Underscore.js 1.1.6
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
</pre>
</div>
<script src="vendor/ace/build/src/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/ace/build/src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
<script src="vendor/ace/build/src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
<script src="build/jim-ace.development.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
var editor = ace.edit('editor');
editor.setTheme('ace/theme/twilight');
var JavaScriptMode = require("ace/mode/javascript").Mode;
var session = editor.getSession();
session.setTabSize(2);
session.setUseSoftTabs(true);
session.setMode(new JavaScriptMode());
jim = Jim.aceInit(editor);
jim.debugMode = true;
};
</script>
<script src="vendor/jquery-1.6.2.min.js"></script>
<script>
$(function() {
var insertBookmarklet = function(minifiedJs) {
// remove the comment lines
var lines = minifiedJs.split('\n'),
minifiedJs = lines[lines.length - 1],
afterJim = $('#after_jim').text().replace(/\s+/g, ' ');
$('#bookmarklet')
.attr('href', 'javascript:' + minifiedJs + ';' + afterJim)
.html('Jimmy rig');
};
$.get('build/jim-ace.min.js', null, insertBookmarklet, 'text');
});
</script>
<script type="text/dontexecute" id="after_jim">
var aceElements = document.getElementsByClassName('ace_editor'),
length = aceElements.length,
signature = '\n\nLove,\nJim\nv' + Jim.VERSION;
for (var i = 0; i < length; i++)
Jim.aceInit(aceElements[i].env ? aceElements[i].env.editor : aceElements[i].host.$editor);
alert(
length
? ('Jimmy rigged ' + length + ' editor(s)' + signature)
: ('No ace editors to Jimmy rig!' + signature)
);
</script>
</body>
</html>