Files
cappuccino/Tools/Editors/TextMate/JavaScript Objective-J.tmbundle/Commands/Run.tmCommand
T

61 lines
2.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>
[[ ! -z $TM_OBJJ_MASTER_FILE ]] &amp;&amp; INDEXFILE="$TM_OBJJ_MASTER_FILE"
[[ ! -z $TM_PROJECT_DIRECTORY ]] &amp;&amp; INDEXFILE="$TM_PROJECT_DIRECTORY/index.html"
[[ ! -z $TM_DIRECTORY ]] &amp;&amp; INDEXFILE="$TM_DIRECTORY/index.html"
if [ -z "$INDEXFILE" ]; then
D=`dirname "$TM_FILEPATH"`
while [ -z `find "$D" -name index.html` ]; do
D=`dirname "$D"`
done
INDEXFILE="${D}/index.html"
fi
[[ -z $INDEXFILE ]] &amp;&amp; echo "No start file found. Please set the shell variable 'OBJJ_MASTER_FILE'" &amp;&amp; exit 206
cat &lt;&lt;-HTML
&lt;script type="text/javascript" charset="utf-8"&gt;
try {
if (TextMate.system("", function (task) { })) {
var __TM_confirm_Status;
alert = function(s){TextMate.system("\"$DIALOG\" -e -p '{messageTitle=\"JavaScript\";informativeText=\""+s.toString().replace(/\x27/g,"").replace(/\"/g,'\\\"')+"\";}'",null);};
confirm = function(s){TextMate.system("\"$DIALOG\" -e -p '{messageTitle=\"JavaScript\";informativeText=\""+s.toString().replace(/\x27/g,"").replace(/\"/g,'\\\"')+"\";buttonTitles=(\"OK\",\"Cancel\");}'",null).onreadoutput=function(s){__TM_confirm_Status = s != 1;};return(__TM_confirm_Status)};
}
} catch(e) {}
&lt;/script&gt;
&lt;base href="file://${INDEXFILE// /%20}"&gt;
HTML
cat "$INDEXFILE"
[[ ! -z $(grep 'objj_exception_setOutputStream' "$INDEXFILE") ]] &amp;&amp; exit 205
cat &lt;&lt;-JS
&lt;script type="text/javascript" charset="utf-8"&gt;
objj_exception_setOutputStream(function(aString) { console.log(aString);alert(aString) });
&lt;/script&gt;
JS
exit 205
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>@r</string>
<key>name</key>
<string>Run</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.js.objj</string>
<key>uuid</key>
<string>0C55A19B-3B2D-418F-B7FD-7E64B736F379</string>
</dict>
</plist>