Browse files

adding commands

  • Loading branch information...
1 parent 48deeb8 commit 872c8aca3e433f8f6ed87f9674f0bd34a2d1bf96 @imhotep committed Nov 22, 2010
View
26 Commands/accelerometer_clearWatch.tmCommand
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string># just to remind you of some useful environment variables
+# see Help / Environment Variables for the full list
+echo "var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
+
+// ... later on ...
+
+echo "navigator.accelerometer.clearWatch(watchID);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>accelerometer.clearWatch</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>accel.cw</string>
+ <key>uuid</key>
+ <string>0E0785A1-4E13-4AE1-9932-34CA2CEB0F99</string>
+</dict>
+</plist>
View
33 Commands/accelerometer_getCurrentAcceleration.tmCommand
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string># just to remind you of some useful environment variables
+# see Help / Environment Variables for the full list
+echo "function onSuccess(acceleration) {
+ alert('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp + '\n');
+};
+
+function onError() {
+ alert('onError!');
+};
+
+navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>accelerometer.getCurrentAcceleration</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>accel.gca</string>
+ <key>uuid</key>
+ <string>22811697-8BF0-4809-8CDA-92D6840726B8</string>
+</dict>
+</plist>
View
38 Commands/accelerometer_watchAcceleration.tmCommand
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string># just to remind you of some useful environment variables
+# see Help / Environment Variables for the full list
+# echo File: "$TM_FILEPATH"
+# echo Word: "$TM_CURRENT_WORD"
+# echo Selection: "$TM_SELECTED_TEXT"
+echo "function onSuccess(acceleration) {
+ alert('Acceleration X: ' + acceleration.x + '\n' +
+ 'Acceleration Y: ' + acceleration.y + '\n' +
+ 'Acceleration Z: ' + acceleration.z + '\n' +
+ 'Timestamp: ' + acceleration.timestamp + '\n');
+};
+
+function onError() {
+ alert('onError!');
+};
+
+var options = { frequency: 3000 }; // Update every 3 seconds
+
+var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>accelerometer.watchAcceleration</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>accel.wa</string>
+ <key>uuid</key>
+ <string>D64D729B-A6C6-46ED-AE45-509E346F5171</string>
+</dict>
+</plist>
View
29 Commands/camera_getPicture.tmCommand
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "navigator.camera.getPicture(onSuccess, onFail, { quality: 50 });
+
+function onSuccess(imageData) {
+ var image = document.getElementById('myImage');
+ image.src = "data:image/jpeg;base64," + imageData;
+}
+
+function onFail(message) {
+ alert('Failed because: ' + message);
+}"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>camera.getPicture</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>cam.getpic</string>
+ <key>uuid</key>
+ <string>803F88B6-6EC6-4AF6-95AA-2FE896DF88C1</string>
+</dict>
+</plist>
View
21 Commands/contacts_create.tmCommand
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "var myContact = navigator.service.contacts.create({'displayName': 'Test User'});
+"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>contacts.create</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>contacts.create</string>
+ <key>uuid</key>
+ <string>3FEE24DA-7DDA-4C0E-8B3C-26A2CCAA3508</string>
+</dict>
+</plist>
View
33 Commands/contacts_find.tmCommand
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "function onSuccess(contacts) {
+ alert('Found ' + contacts.length + ' contacts.');
+};
+
+function onError() {
+ alert('onError!');
+};
+
+// find all contacts with 'Bob' in any name field
+var options = new ContactFindOptions();
+options.filter='Bob';
+var fields = ['displayName', 'names'];
+navigator.service.contacts.find(fields, onSuccess, onError, options);
+"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>contacts.find</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>contacts.find</string>
+ <key>uuid</key>
+ <string>A132012A-07D6-4218-AB4F-DC7A16E3B640</string>
+</dict>
+</plist>
View
20 Commands/geolocation_clearWatch.tmCommand
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "navigator.geolocation.clearWatch(watchID);" </string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>geolocation.clearWatch</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>geo.clearwatch</string>
+ <key>uuid</key>
+ <string>CBAA96F2-3D08-4510-9014-2E52043B5790</string>
+</dict>
+</plist>
View
42 Commands/geolocation_getCurrentPosition.tmCommand
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "// onSuccess Callback
+// This method accepts a `Position` object, which contains
+// the current GPS coordinates
+//
+var onSuccess = function(position) {
+ alert('Latitude: ' + position.coords.latitude + '\n' +
+ 'Longitude: ' + position.coords.longitude + '\n' +
+ 'Altitude: ' + position.coords.altitude + '\n' +
+ 'Accuracy: ' + position.coords.accuracy + '\n' +
+ 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
+ 'Heading: ' + position.coords.heading + '\n' +
+ 'Speed: ' + position.coords.speed + '\n' +
+ 'Timestamp: ' + new Date(position.timestamp) + '\n');
+};
+
+// onError Callback receives a PositionError object
+//
+function onError(error) {
+ alert('code: ' + error.code + '\n' +
+ 'message: ' + error.message + '\n');
+}
+
+navigator.geolocation.getCurrentPosition(onSuccess, onError);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>geolocation.getCurrentPosition</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>geo.getpos</string>
+ <key>uuid</key>
+ <string>EAB1350D-84D1-4387-BD76-59488F73FB16</string>
+</dict>
+</plist>
View
41 Commands/geolocation_watchPosition.tmCommand
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "// onSuccess Callback
+// This method accepts a `Position` object, which contains
+// the current GPS coordinates
+//
+function onSuccess(position) {
+ var element = document.getElementById('geolocation');
+ element.innerHTML = 'Latitude: ' + position.coords.latitude + '&lt;br /&gt;' +
+ 'Longitude: ' + position.coords.longitude + '&lt;br /&gt;' +
+ '&lt;hr /&gt;' + element.innerHTML;
+}
+
+// onError Callback receives a PositionError object
+//
+function onError(error) {
+ alert('code: ' + error.code + '\n' +
+ 'message: ' + error.message + '\n');
+}
+
+// Options: retrieve the location every 3 seconds
+//
+var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { frequency: 3000 });
+"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>geolocation.watchPosition</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>geo.watchpos</string>
+ <key>uuid</key>
+ <string>2385C6B8-6011-4D41-9884-E64963FBE9E1</string>
+</dict>
+</plist>
View
33 Commands/network_isReachable.tmCommand
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "function reachableCallback(reachability) {
+ // There is no consistency on the format of reachability
+ var networkState = reachability.code || reachability;
+
+ var states = {};
+ states[NetworkStatus.NOT_REACHABLE] = 'No network connection';
+ states[NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK] = 'Carrier data connection';
+ states[NetworkStatus.REACHABLE_VIA_WIFI_NETWORK] = 'WiFi connection';
+
+ alert('Connection type: ' + states[networkState]);
+}
+
+navigator.network.isReachable('phonegap.com', reachableCallback);
+"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>network.isReachable</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>network.isreach</string>
+ <key>uuid</key>
+ <string>1560F586-D55B-40C2-9A69-0796EE465E63</string>
+</dict>
+</plist>
View
38 Commands/notification_alert.tmCommand
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "// Android / BlackBerry Widgets (OS 5.0 and higher) / iPhone
+//
+function alertDismissed() {
+ // do something
+}
+
+navigator.notification.alert(
+ 'You are the winner!', // message
+ alertDismissed, // callback
+ 'Game Over', // title
+ 'Done' // buttonName
+);
+
+// BlackBerry (OS 4.6) / webOS
+//
+navigator.notification.alert('You are the winner!');
+"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>keyEquivalent</key>
+ <string></string>
+ <key>name</key>
+ <string>notification.alert</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>notif.alert</string>
+ <key>uuid</key>
+ <string>5E5A2B54-3EB8-4593-B59E-B89D7A04AD92</string>
+</dict>
+</plist>
View
20 Commands/notification_beep.tmCommand
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "// Beep twice! navigator.notification.beep(2);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>notification.beep</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>notif.beep</string>
+ <key>uuid</key>
+ <string>5C95E5F5-ED2B-4EF1-95FE-62B5D0E4A823</string>
+</dict>
+</plist>
View
34 Commands/notification_confirm.tmCommand
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "// process the confirmation dialog result
+function onConfirm(button) {
+ alert('You selected button ' + button);
+}
+
+// Show a custom confirmation dialog
+//
+function showConfirm() {
+ navigator.notification.confirm(
+ 'You are the winner!', // message
+ onConfirm, // callback to invoke with index of button pressed
+ 'Game Over', // title
+ 'Restart,Exit' // buttonLabels
+ );
+}"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>notification.confirm</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>notif.confirm</string>
+ <key>uuid</key>
+ <string>FB689158-EC3D-4BE8-8825-788F245D572B</string>
+</dict>
+</plist>
View
20 Commands/notification_vibrate.tmCommand
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>echo "navigator.notification.vibrate(2500);"</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>name</key>
+ <string>notification.vibrate</string>
+ <key>output</key>
+ <string>insertAsSnippet</string>
+ <key>tabTrigger</key>
+ <string>notif.vibrate</string>
+ <key>uuid</key>
+ <string>B056F4F4-5CE0-410A-B806-215B0D28A8B8</string>
+</dict>
+</plist>
View
27 info.plist
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>name</key>
+ <string>PhoneGap</string>
+ <key>ordering</key>
+ <array>
+ <string>D64D729B-A6C6-46ED-AE45-509E346F5171</string>
+ <string>22811697-8BF0-4809-8CDA-92D6840726B8</string>
+ <string>0E0785A1-4E13-4AE1-9932-34CA2CEB0F99</string>
+ <string>803F88B6-6EC6-4AF6-95AA-2FE896DF88C1</string>
+ <string>3FEE24DA-7DDA-4C0E-8B3C-26A2CCAA3508</string>
+ <string>A132012A-07D6-4218-AB4F-DC7A16E3B640</string>
+ <string>EAB1350D-84D1-4387-BD76-59488F73FB16</string>
+ <string>2385C6B8-6011-4D41-9884-E64963FBE9E1</string>
+ <string>CBAA96F2-3D08-4510-9014-2E52043B5790</string>
+ <string>1560F586-D55B-40C2-9A69-0796EE465E63</string>
+ <string>5E5A2B54-3EB8-4593-B59E-B89D7A04AD92</string>
+ <string>FB689158-EC3D-4BE8-8825-788F245D572B</string>
+ <string>5C95E5F5-ED2B-4EF1-95FE-62B5D0E4A823</string>
+ <string>B056F4F4-5CE0-410A-B806-215B0D28A8B8</string>
+ </array>
+ <key>uuid</key>
+ <string>E10112FC-6BB4-4098-9AEC-17EC6F4B8421</string>
+</dict>
+</plist>

0 comments on commit 872c8ac

Please sign in to comment.