coffeescript, awesome stuff, doesnt compile yet
Esse commit está contido em:
@@ -355,6 +355,8 @@
|
||||
8D1107290486CEB800E47090 /* Resources */,
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
8393438213FE479700EF93FB /* Copy JS to Resources */,
|
||||
8393439613FE480600EF93FB /* Compile CoffeeScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -454,6 +456,37 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
8393438213FE479700EF93FB /* Copy JS to Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Copy JS to Resources";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/usr/local/bin/coffee -c HTML/*.coffee";
|
||||
};
|
||||
8393439613FE480600EF93FB /* Compile CoffeeScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Compile CoffeeScript";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"$PROJECT_DIR/script/compile.sh\"";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="371"/>
|
||||
<integer value="29"/>
|
||||
<integer value="371"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -1323,7 +1323,7 @@
|
||||
<object class="NSWindowTemplate" id="972006081">
|
||||
<int key="NSWindowStyleMask">15</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{335, 148}, {861, 602}}</string>
|
||||
<string key="NSWindowRect">{{277, 165}, {861, 602}}</string>
|
||||
<int key="NSWTFlags">1954021376</int>
|
||||
<string key="NSWindowTitle">Atomicity</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
@@ -1388,7 +1388,7 @@
|
||||
<string key="NSFrameSize">{861, 602}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="976324537">
|
||||
@@ -3531,9 +3531,9 @@
|
||||
<integer value="1"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
<string>{{314, 202}, {861, 602}}</string>
|
||||
<string>{{336, 206}, {861, 602}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{314, 202}, {861, 602}}</string>
|
||||
<string>{{336, 206}, {861, 602}}</string>
|
||||
<integer value="1"/>
|
||||
<string>{{33, 99}, {480, 360}}</string>
|
||||
<string>{3.40282e+38, 3.40282e+38}</string>
|
||||
@@ -3719,6 +3719,20 @@
|
||||
<string key="minorKey">AtomicityAppDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">JSCocoa/JSCocoaController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">JSCocoa/JSCocoaLib.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
||||
+36
-4
@@ -3,6 +3,7 @@ console.log = OSX.NSLog
|
||||
editor = ace.edit "editor"
|
||||
editor.setTheme "ace/theme/twilight"
|
||||
JavaScriptMode = require("ace/mode/javascript").Mode
|
||||
CoffeeMode = require("ace/mode/coffee").Mode
|
||||
editor.getSession().setMode new JavaScriptMode
|
||||
editor.getSession().setUseSoftTabs true
|
||||
editor.getSession().setTabSize 2
|
||||
@@ -10,7 +11,16 @@ editor.getSession().setTabSize 2
|
||||
filename = null
|
||||
save = ->
|
||||
File.write filename, editor.getSession().getValue()
|
||||
|
||||
setMode()
|
||||
open = ->
|
||||
App.window.title = _.last filename.split('/')
|
||||
editor.getSession().setValue File.read filename
|
||||
setMode()
|
||||
setMode = ->
|
||||
if /\.js$/.test filename
|
||||
editor.getSession().setMode new JavaScriptMode
|
||||
else if /\.coffee$/.test filename
|
||||
editor.getSession().setMode new CoffeeMode
|
||||
saveAs = ->
|
||||
if file = Chrome.savePanel()
|
||||
filename = file
|
||||
@@ -20,9 +30,7 @@ saveAs = ->
|
||||
Chrome.bindKey 'open', 'Command-O', (env, args, request) ->
|
||||
if file = Chrome.openPanel()
|
||||
filename = file
|
||||
App.window.title = _.last filename.split('/')
|
||||
code = File.read file
|
||||
env.editor.getSession().setValue code
|
||||
open()
|
||||
|
||||
Chrome.bindKey 'saveAs', 'Command-Shift-S', (env, args, request) ->
|
||||
saveAs()
|
||||
@@ -37,8 +45,32 @@ Chrome.bindKey 'copy', 'Command-C', (env, args, request) ->
|
||||
Chrome.bindKey 'eval', 'Command-R', (env, args, request) ->
|
||||
eval env.editor.getSession().getValue()
|
||||
|
||||
# textmate
|
||||
|
||||
Chrome.bindKey 'togglecomment', 'Command-/', (env) ->
|
||||
env.editor.toggleCommentLines()
|
||||
|
||||
# emacs > you
|
||||
|
||||
Chrome.bindKey 'moveforward', 'Alt-F', (env) ->
|
||||
env.editor.navigateWordRight()
|
||||
|
||||
Chrome.bindKey 'moveback', 'Alt-B', (env) ->
|
||||
env.editor.navigateWordLeft()
|
||||
|
||||
Chrome.bindKey 'deleteword', 'Alt-D', (env) ->
|
||||
env.editor.removeWordRight()
|
||||
|
||||
Chrome.bindKey 'selectwordright', 'Alt-B', (env) ->
|
||||
env.editor.navigateWordLeft()
|
||||
|
||||
Chrome.bindKey 'fullscreen', 'Command-Return', (env) ->
|
||||
OSX.NSLog 'coming soon'
|
||||
|
||||
|
||||
|
||||
# HAX
|
||||
# this should go in coffee.coffee or something
|
||||
Chrome.bindKey 'consolelog', 'Ctrl-L', (env) ->
|
||||
env.editor.insert 'console.log ""'
|
||||
env.editor.navigateLeft()
|
||||
+34
-6
@@ -1,15 +1,29 @@
|
||||
(function() {
|
||||
var JavaScriptMode, editor, filename, save, saveAs;
|
||||
var CoffeeMode, JavaScriptMode, editor, filename, open, save, saveAs, setMode;
|
||||
console.log = OSX.NSLog;
|
||||
editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
CoffeeMode = require("ace/mode/coffee").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode);
|
||||
editor.getSession().setUseSoftTabs(true);
|
||||
editor.getSession().setTabSize(2);
|
||||
filename = null;
|
||||
save = function() {
|
||||
return File.write(filename, editor.getSession().getValue());
|
||||
File.write(filename, editor.getSession().getValue());
|
||||
return setMode();
|
||||
};
|
||||
open = function() {
|
||||
App.window.title = _.last(filename.split('/'));
|
||||
editor.getSession().setValue(File.read(filename));
|
||||
return setMode();
|
||||
};
|
||||
setMode = function() {
|
||||
if (/\.js$/.test(filename)) {
|
||||
return editor.getSession().setMode(new JavaScriptMode);
|
||||
} else if (/\.coffee$/.test(filename)) {
|
||||
return editor.getSession().setMode(new CoffeeMode);
|
||||
}
|
||||
};
|
||||
saveAs = function() {
|
||||
var file;
|
||||
@@ -20,12 +34,10 @@
|
||||
}
|
||||
};
|
||||
Chrome.bindKey('open', 'Command-O', function(env, args, request) {
|
||||
var code, file;
|
||||
var file;
|
||||
if (file = Chrome.openPanel()) {
|
||||
filename = file;
|
||||
App.window.title = _.last(filename.split('/'));
|
||||
code = File.read(file);
|
||||
return env.editor.getSession().setValue(code);
|
||||
return open();
|
||||
}
|
||||
});
|
||||
Chrome.bindKey('saveAs', 'Command-Shift-S', function(env, args, request) {
|
||||
@@ -49,7 +61,23 @@
|
||||
Chrome.bindKey('togglecomment', 'Command-/', function(env) {
|
||||
return env.editor.toggleCommentLines();
|
||||
});
|
||||
Chrome.bindKey('moveforward', 'Alt-F', function(env) {
|
||||
return env.editor.navigateWordRight();
|
||||
});
|
||||
Chrome.bindKey('moveback', 'Alt-B', function(env) {
|
||||
return env.editor.navigateWordLeft();
|
||||
});
|
||||
Chrome.bindKey('deleteword', 'Alt-D', function(env) {
|
||||
return env.editor.removeWordRight();
|
||||
});
|
||||
Chrome.bindKey('selectwordright', 'Alt-B', function(env) {
|
||||
return env.editor.navigateWordLeft();
|
||||
});
|
||||
Chrome.bindKey('fullscreen', 'Command-Return', function(env) {
|
||||
return OSX.NSLog('coming soon');
|
||||
});
|
||||
Chrome.bindKey('consolelog', 'Ctrl-L', function(env) {
|
||||
env.editor.insert('console.log ""');
|
||||
return env.editor.navigateLeft();
|
||||
});
|
||||
}).call(this);
|
||||
|
||||
+3
-3
@@ -7,16 +7,16 @@
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font: 18px Inconsolada, Monaco, Courier;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="editor">function say(something) {
|
||||
alert(something)
|
||||
}</div>
|
||||
<div id="editor"></div>
|
||||
|
||||
<script src="ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="mode-coffee.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="underscore.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script src="osx.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário