Permalink
Browse files

Merge pull request #4 from tinyhippos/next

Code Pull for ripple 0.6.0
  • Loading branch information...
gtanner committed Aug 2, 2011
2 parents 7c78160 + b614829 commit 1225bb0b2003885a93245587cad70e60a825d5d2
Showing with 531 additions and 334 deletions.
  1. +2 −2 Jakefile
  2. +0 −1 build/btest/test.html
  3. +1 −2 build/test.js
  4. BIN ext/assets/images/Torch.png
  5. BIN ext/assets/images/Torch_landscape.png
  6. +4 −3 ext/chromium/controllers/Insertion.js
  7. +0 −1 lib/ripple.js
  8. +6 −6 lib/ripple/console.js
  9. +12 −10 lib/ripple/devices/Torch/skin.css
  10. +8 −3 lib/ripple/emulatorBridge.js
  11. +1 −1 lib/ripple/fileSystem.js
  12. +3 −8 lib/ripple/platform.js
  13. +5 −5 lib/ripple/platform/opera/4.0/widget.js
  14. +1 −2 lib/ripple/platform/phonegap/0.9/navigator.js
  15. +2 −3 lib/ripple/platform/phonegap/0.9/notification.js
  16. +1 −1 lib/ripple/platform/w3c/1.0/geolocation.js
  17. +4 −7 lib/ripple/platform/wac/1.0/AudioPlayer.js
  18. +3 −4 lib/ripple/platform/wac/1.0/Camera.js
  19. +1 −2 lib/ripple/platform/wac/1.0/DataNetworkInfo.js
  20. +2 −3 lib/ripple/platform/wac/1.0/Device.js
  21. +3 −3 lib/ripple/platform/wac/1.0/DeviceStateInfo.js
  22. +1 −2 lib/ripple/platform/wac/1.0/Messaging.js
  23. +4 −5 lib/ripple/platform/wac/1.0/PowerInfo.js
  24. +1 −2 lib/ripple/platform/wac/1.0/RadioInfo.js
  25. +2 −5 lib/ripple/platform/wac/1.0/VideoPlayer.js
  26. +3 −3 lib/ripple/platform/wac/1.0/Widget.js
  27. +17 −2 lib/ripple/platform/web/default/spec.js
  28. +5 −0 lib/ripple/platform/web/default/spec/ui.js
  29. +1 −1 lib/ripple/platform/webworks/2.0.0/XMLHttpRequest.js
  30. +1 −1 lib/ripple/platform/webworks/2.0.0/client/Appointment.js
  31. +9 −9 lib/ripple/platform/webworks/2.0.0/client/AudioPlayer.js
  32. +1 −1 lib/ripple/platform/webworks/2.0.0/client/Contact.js
  33. +1 −1 lib/ripple/platform/webworks/2.0.0/client/Memo.js
  34. +1 −1 lib/ripple/platform/webworks/2.0.0/client/Message.js
  35. +3 −3 lib/ripple/platform/webworks/2.0.0/client/Phone.js
  36. +5 −5 lib/ripple/platform/webworks/2.0.0/client/PhoneLogs.js
  37. +1 −1 lib/ripple/platform/webworks/2.0.0/client/Task.js
  38. +10 −10 lib/ripple/platform/webworks/2.0.0/client/app.js
  39. +1 −1 lib/ripple/platform/webworks/2.0.0/client/blackberry.js
  40. +36 −0 lib/ripple/platform/webworks/2.0.0/client/category.js
  41. +4 −4 lib/ripple/platform/webworks/2.0.0/client/dialog.js
  42. +6 −6 lib/ripple/platform/webworks/2.0.0/client/identity.js
  43. +4 −4 lib/ripple/platform/webworks/2.0.0/client/identity/phone.js
  44. +1 −1 lib/ripple/platform/webworks/2.0.0/client/menu.js
  45. +2 −22 lib/ripple/platform/webworks/2.0.0/client/pim.js
  46. +1 −1 lib/ripple/platform/webworks/2.0.0/client/push.js
  47. +1 −1 lib/ripple/platform/webworks/2.0.0/client/sms.js
  48. +7 −7 lib/ripple/platform/webworks/2.0.0/client/system.js
  49. +24 −15 lib/ripple/platform/webworks/2.0.0/client/transport.js
  50. +33 −14 lib/ripple/platform/webworks/2.0.0/server/contact.js
  51. +0 −1 lib/ripple/platform/webworks/2.0.0/server/dialog.js
  52. +0 −1 lib/ripple/platform/webworks/2.0.0/server/menu.js
  53. +1 −2 lib/ripple/platform/webworks/2.0.0/server/sms.js
  54. +5 −1 lib/ripple/platform/webworks/2.0.0/spec.js
  55. +3 −2 lib/ripple/ui/plugins/deviceSettings.js
  56. +1 −2 lib/ripple/ui/plugins/phone.js
  57. +1 −1 lib/ripple/ui/plugins/platformEvents.js
  58. +1 −2 lib/ripple/ui/plugins/telephony.js
  59. +1 −1 lib/ripple/widgetConfig.js
  60. +1 −1 lib/ripple/xhr/base.js
  61. +50 −10 test/console.js
  62. +6 −6 test/emulatorBridge.js
  63. +0 −2 test/phonegap/navigator.js
  64. +48 −27 test/platform.js
  65. +6 −8 test/w3c/geolocation.js
  66. +31 −0 test/web/geolocation.js
  67. +1 −1 test/webworks/Message.js
  68. +2 −2 test/webworks/Task.js
  69. +1 −1 test/webworks/app.js
  70. +4 −4 test/webworks/appointment.js
  71. +1 −1 test/webworks/audioPlayer.js
  72. +1 −1 test/webworks/blackberry.js
  73. +17 −17 test/webworks/category.js
  74. +3 −3 test/webworks/contact.js
  75. +4 −4 test/webworks/dialog.js
  76. +4 −6 test/webworks/identity/Transport.js
  77. +6 −6 test/webworks/identity/identity.js
  78. +4 −4 test/webworks/identity/phone.js
  79. +1 −1 test/webworks/memo.js
  80. +8 −9 test/webworks/phone.js
  81. +4 −4 test/webworks/system.js
  82. +70 −8 test/webworks/transport.js
View
@@ -23,8 +23,8 @@ desc("test and lint before building (with js compression)");
task('deploy', [], require('./build/deploy'));
desc("run all tests in node with an emulated dom - jake test [path,path2]");
-task('test', [], function (custom) {
- require('./build/test')(null, custom);
+task('test', [], function () {
+ require('./build/test')(null, process.argv.length >= 4 ? process.argv[3] : null);
});
desc("boot test server for running all tests in the browser");
View
@@ -82,7 +82,6 @@
<script src="thirdparty/browser-require/require.js" type="text/javascript" charset="utf-8"></script>
<script src="thirdparty/Math.uuid.js" type="text/javascript" charset="utf-8"></script>
<script src="thirdparty/jquery.js" type="text/javascript" charset="utf-8"></script>
- <script src="thirdparty/aop.js" type="text/javascript" charset="utf-8"></script>
<script src="thirdparty/jquery.ui.js" type="text/javascript" charset="utf-8"></script>
<script src="thirdparty/jquery.dimensions.js" type="text/javascript" charset="utf-8"></script>
<script src="thirdparty/jquery.tooltip.js" type="text/javascript" charset="utf-8"></script>
View
@@ -46,8 +46,7 @@ function _setupEnv(ready) {
layout = fs.readFileSync(__dirname + "/../ext/assets/index.html", "utf-8"),
thirdparty = [
__dirname + "/../thirdparty/jquery.js",
- __dirname + "/../thirdparty/jquery.ui.js",
- __dirname + "/../thirdparty/aop.js"
+ __dirname + "/../thirdparty/jquery.ui.js"
];
jsdom.env(layout, thirdparty, function (error, window) {
View
Binary file not shown.
Binary file not shown.
@@ -16,20 +16,21 @@
(function () {
function _subscribeToEnableDisable() {
chrome.extension.onRequest.addListener(function (request, sender, sendResponse) {
- switch (request.action)
- {
+ var uri = location.href;
+ switch (request.action) {
case "enable":
break;
case "disable":
localStorage.removeItem("tinyhippos-enabled-uri");
+ uri = uri.toLowerCase().replace("?enableripple=true", "").replace("&enableripple=true", "");
break;
default:
throw {name: "MethodNotImplemented", message: "Requested action is not supported!"};
}
sendResponse({});
- location.assign(location.href);
+ location.assign(uri);
});
}
View
@@ -36,7 +36,6 @@ var omgwtf = require('ripple/omgwtf'),
.andThen(devices.initialize, devices)
.andThen(platform.initialize, platform)
.andThen(widgetConfig.initialize, widgetConfig)
- .andThen(platform.inject, platform)
.andThen(deviceSettings.initialize, deviceSettings)
.andThen(ui.initialize, ui)
.start(booted);
View
@@ -13,15 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+var _self;
+
function _log(msg, method) {
try {
- console[method](msg);
+ console[method](_self.prefix ? _self.prefix + " :: " + msg : msg);
} catch (e) {
// silent
}
}
-module.exports = {
+_self = {
log: function (msg) {
_log(msg, "log");
},
@@ -32,9 +34,7 @@ module.exports = {
error: function (msg) {
_log(msg, "error");
- },
-
- clear: function () {
- console.clear();
}
};
+
+module.exports = _self;
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/* ------------------------------>
- Torch Skin (446x782) offset (41x144)*/
+ Torch Skin (444x779) offset (40x142)*/
.viewport-wrapper-Torch {
width:360px;
height:480px;
@@ -23,9 +24,9 @@
.device-wrapper-Torch {
position: relative;
- padding: 144px 0 0 41px;
- width:405px;
- height:638px;
+ padding: 142px 0 0 40px;
+ width:404px;
+ height:637px;
margin: 0 auto;
border: none;
-webkit-box-shadow: none;
@@ -35,7 +36,7 @@
.menu-button-wrapper-Torch {
position: relative;
display: inline-block;
- margin: 30px 0 0 75px;
+ margin: 32px 0 0 75px;
width: 55px;
height: 65px;
cursor: pointer;
@@ -44,14 +45,14 @@
.back-button-wrapper-Torch {
position: relative;
display: inline-block;
- margin: 0 0 0 95px;
+ margin: 0 0 0 92px;
width: 55px;
height: 65px;
cursor: pointer;
}
.viewport-wrapper-landscape-Torch {
- margin: -99px 0 0 104px;
+ margin: -99px 0 0 103px;
width:480px;
height:360px;
border: none;
@@ -60,9 +61,9 @@
.device-wrapper-landscape-Torch {
position: relative;
- padding: 144px 0 0 41px;
- width:740px;
- height:300px;
+ padding: 142px 0 0 40px;
+ width:739px;
+ height:302px;
margin: 0 auto;
border: none;
-webkit-box-shadow: none;
@@ -86,3 +87,4 @@
height: 65px;
cursor: pointer;
}
+
@@ -15,6 +15,7 @@
*/
var _isMouseDown = false,
platform = require('ripple/platform'),
+ builder = require('ripple/platform/builder'),
constants = require('ripple/constants'),
utils = require('ripple/utils'),
exception = require('ripple/exception'),
@@ -72,12 +73,16 @@ module.exports = {
_frame = frame;
var marshal = function (obj, key) {
- window[key] = _frame.contentWindow[key] = obj;
- };
+ window[key] = _frame.contentWindow[key] = obj;
+ },
+ sandbox = {};
marshal(window.tinyHippos, "tinyHippos");
marshal(window.XMLHttpRequest, "XMLHttpRequest");
- utils.forEach(platform.sandbox, marshal);
+
+ builder.build(platform.current().objects).into(sandbox);
+
+ utils.forEach(sandbox, marshal);
_marshalScreen(_frame.contentWindow);
_marshalScreen(window);
View
@@ -77,7 +77,7 @@ module.exports = {
}
catch (e) {
exception.handle(e);
- _console.log("Emulator :: failed to check if [" + path + "] exists");
+ _console.log("failed to check if [" + path + "] exists");
return false;
}
},
View
@@ -20,8 +20,7 @@ var _current,
constants = require('ripple/constants'),
app = require('ripple/app'),
event = require('ripple/event'),
- builder = require('ripple/platform/builder'),
- spec,
+ spec = require('ripple/platform/spec'),
_self;
function _checkForDeprecatedPlatforms(replacement) {
@@ -39,10 +38,7 @@ function _getPlatform() {
}
_self = {
- sandbox: {},
-
initialize: function () {
- spec = require('ripple/platform/spec');
var firstAvailablePlatform = utils.map(this.getList(), function (platform) {
return utils.map(platform, function (details, version) {
return {name: details.id, version: version};
@@ -56,10 +52,8 @@ _self = {
} else {
_current = firstAvailablePlatform;
}
- },
- inject: function () {
- builder.build(_getPlatform().objects).into(_self.sandbox);
+ _console.prefix = _getPlatform().name;
},
getList: function () {
@@ -101,6 +95,7 @@ _self = {
db.save(constants.ENCAPSULATOR.LAYOUT, null, null, baton.pass);
}).andThen(function () {
event.trigger("PlatformChangedEvent", true);
+ _console.prefix = null;
_console.log("Emulator :: loading platform " + platform.name);
});
@@ -25,7 +25,7 @@ var event = require('ripple/event'),
event.on("ScreenChangeDimensions", function (width, height) {
var eventToFire = document.createEvent("Event");
- _console.log(platform.current().name + " :: Firing resolution changed event for width: " + width + " and height: " + height);
+ _console.log("Firing resolution changed event for width: " + width + " and height: " + height);
eventToFire.height = height;
eventToFire.width = width;
eventToFire.initEvent("resolution", false, false);
@@ -61,7 +61,7 @@ _self = {
utils.validateNumberOfArguments(1, 2, arguments.length);
utils.validateArgumentType(key, "string");
- var msg = platform.current().name + " :: ",
+ var msg = "",
prefix = platform.getPersistencePrefix();
if (app.isPreferenceReadOnly(key)) {
@@ -90,7 +90,7 @@ _self = {
var prefix = platform.getPersistencePrefix(),
value = db.retrieve(key, prefix) || undefined;
- _console.log(platform.current().name + " :: retrieving preference " + key + " == " + value);
+ _console.log("retrieving preference " + key + " == " + value);
return value;
},
@@ -116,13 +116,13 @@ _self = {
},
addEventListener: function (type, expression, bubbling) {
- _console.log(platform.current().name + " :: Adding Widget Event Listener for type == " + type);
+ _console.log("Adding Widget Event Listener for type == " + type);
bubbling = bubbling || false;
window.addEventListener(type, expression, bubbling);
},
removeEventListener: function (type, listener, useCapture) {
- _console.log(platform.current().name + " :: Removing a Widget Event Listener for type == " + type);
+ _console.log("Removing a Widget Event Listener for type == " + type);
window.removeEventListener(type, listener, useCapture);
}
};
@@ -18,15 +18,14 @@ var nav = require('ripple/platform/w3c/1.0/navigator'),
_console = require('ripple/console'),
utils = require('ripple/utils'),
emulatorBridge = require('ripple/emulatorBridge'),
- platform = require('ripple/platform'),
_self = {};
event.on("TinyHipposLoaded", function () {
var doc = emulatorBridge.getWidgetDocument(),
evt = doc.createEvent("Events");
evt.initEvent("deviceready", true, true);
doc.dispatchEvent(evt);
- _console.log(platform.current().name + " :: fired deviceready event!");
+ _console.log("fired deviceready event!");
});
utils.mixin(nav, _self);
@@ -17,8 +17,7 @@ var notifications = require('ripple/notifications'),
constants = require('ripple/constants'),
_console = require('ripple/console'),
ui = require('ripple/ui'),
- goodVibrations = require('ripple/ui/plugins/goodVibrations'),
- platform = require('ripple/platform');
+ goodVibrations = require('ripple/ui/plugins/goodVibrations');
module.exports = {
alert: function (message, title, buttonName) {
@@ -27,7 +26,7 @@ module.exports = {
beep: function (times) {
for (var i = times; i > 0; i--) {
- _console.log(platform.current().name + " :: beep!");
+ _console.log("beep!");
}
notifications.openNotification(constants.NOTIFICATIONS.TYPES.NORMAL, "BEEP x " + times);
},
@@ -28,6 +28,7 @@ event.on("PositionInfoUpdatedEvent", function (positionInfo) {
_positionInfo.coords.longitude = positionInfo.longitude;
_positionInfo.coords.altitude = positionInfo.altitude;
_positionInfo.coords.altitudeAccuracy = positionInfo.altitudeAccuracy;
+ _positionInfo.coords.accuracy = positionInfo.accuracy;
_positionInfo.coords.heading = positionInfo.heading;
_positionInfo.coords.speed = positionInfo.speed;
_positionInfo.timestamp = positionInfo.timeStamp.getTime();
@@ -59,7 +60,6 @@ _self = {
var watchId = (new Date()).getTime().toString(),
watchObj = {};
-
if (geolocationOptions &&
geolocationOptions.frequency && typeof
geolocationOptions.frequency === "number" &&
@@ -15,7 +15,6 @@
*/
var constants = require('ripple/constants'),
event = require('ripple/event'),
- platform = require('ripple/platform'),
exception = require('ripple/exception'),
utils = require('ripple/utils'),
fileSystem = require('ripple/fileSystem'),
@@ -40,9 +39,9 @@ _audio = utils.createElement("audio", {
});
_audio.addEventListener('error', function () {
- _console.warn(platform.current().name + " :: AudioPlayer encountered an error: " + _audio.error.code);
+ _console.warn("AudioPlayer encountered an error: " + _audio.error.code);
if (_audio.error.code === 4) {
- _console.warn(platform.current().name + " :: AudioPlayer error 4 could be caused by missing codecs");
+ _console.warn("AudioPlayer error 4 could be caused by missing codecs");
}
_state = null;
event.trigger("MultimediaAudioStateChanged", [null], true);
@@ -68,8 +67,7 @@ function _validateAndSet(state, validStates, callbackBeforeSuccess) {
}
if (!valid) {
- _console.warn(platform.current().name +
- " :: Attempted to initiate AudioPlayer." + state +
+ _console.warn("Attempted to initiate AudioPlayer." + state +
" in invalid state. current state: " + _state);
} else {
if (typeof(callbackBeforeSuccess) === "function") {
@@ -86,8 +84,7 @@ function _validateAudioType(fileUrl) {
type = matched ? matched[1] : "";
if (_audio && _audio.canPlayType("audio/" + type) === "") {
- _console.warn(platform.current().name +
- " :: Attempting to load an audio that might not work in the current browser [" + fileUrl + "]");
+ _console.warn("Attempting to load an audio that might not work in the current browser [" + fileUrl + "]");
}
}
Oops, something went wrong.

0 comments on commit 1225bb0

Please sign in to comment.