Permalink
Browse files

Merge branch 'develop' of git://github.com/mozilla/openwebapps into d…

…evelop
  • Loading branch information...
2 parents 4333598 + 0f0310c commit 7c42242a558012fca7c9bcc2ae8b401d495189ed David Clarke committed Mar 23, 2012
View
@@ -24,7 +24,8 @@
<div id="dashboard">
<p class="msg">Click to launch:</p>
<div id="apps" class="dashboardclipper well" style="width:800px; height:500px;">
- <div id="help">You have no apps installed. Apps are available <a href="https://apps-preview.mozilla.org/en-US/apps/" target="_blank">here</a>.
+ <div id="help">You have no apps installed. Apps are available
+ <a href="https://marketplace.mozilla.org/" target="_blank">in the Marketplace</a>.
</div>
</div>
</div>
View
@@ -137,9 +137,9 @@ $(document).ready(function() {
function eventUninstall(ev) {
doUpdate("uninstall", [ev.application]);
}
- if (navigator.mozApps.mgmt.addEventListener) {
- navigator.mozApps.mgmt.addEventListener('install', eventInstall);
- navigator.mozApps.mgmt.addEventListener('uninstall', eventUninstall);
+ if (navigator.mozApps.getInstalled) {
+ navigator.mozApps.mgmt.oninstall = eventInstall;
+ navigator.mozApps.mgmt.onuninstall = eventUninstall;
eventListenerBound = true;
}
@@ -149,17 +149,9 @@ $(document).ready(function() {
navigator.mozApps.mgmt.clearWatch(watcherID);
}
if (eventListenerBound) {
- navigator.mozApps.mgmt.removeEventListener('install', eventInstall);
- navigator.mozApps.mgmt.removeEventListener('uninstall', eventUninstall);
+ navigator.mozApps.mgmt.oninstall = null;
+ navigator.mozApps.mgmt.onuninstall = null;
}
});
- if (navigator.mozApps.mgmt.syncButton) {
- var syncButton = navigator.mozApps.mgmt.syncButton();
- syncButton.appendTo('login');
- $(document).click(function () {
- syncButton.makeCompact();
- });
- }
-
});
View
@@ -290,8 +290,6 @@
<script src="repo.js"></script>
<script src="trusted.js"></script>
-<script src="sync/sync.js"></script>
-<script src="syncbuttonbridge.js"></script>
</body>
</html>
View
@@ -703,7 +703,7 @@ if (!navigator.mozApps.install || navigator.mozApps.html5Implementation) {
if (this.manifest.launch_path) {
url += this.manifest.launch_path;
}
- var name = ("openwebapp_" + id).replace(/[.:]/g, "_").replace(/[^a-zA-Z0-9_]/g, "");
+ var name = ("openwebapp_" + url).replace(/[.:]/g, "_").replace(/[^a-zA-Z0-9_]/g, "");
window.open(url, name);
};
@@ -1016,80 +1016,6 @@ if (!navigator.mozApps.install || navigator.mozApps.html5Implementation) {
function callRegisterHandler(activity, message, func) {
}
- function callSyncButton(options) {
- return new SyncButton(options);
- }
-
- function SyncButton(options) {
- options = options || {};
- setupWindow();
- var iframe = document.createElement('iframe');
- iframe.style.height = '22px';
- iframe.style.width = '150px';
- iframe.scrolling = "no";
- iframe.setAttribute('frameborder', '0');
- iframe.setAttribute('marginwidth', '0');
- iframe.setAttribute('marginheight', '0');
- iframe.setAttribute('id', 'syncbutton-frame');
- var url = AppRepositoryOrigin + "/jsapi/syncbutton.html";
- var params = [];
- if (options.buttonColor) {
- params.push('buttonColor=' + encodeURIComponent(options.buttonColor));
- }
- if (options.backgroundColor) {
- params.push('backgroundColor=' + encodeURIComponent(options.backgroundColor));
- }
- if (options.foregroundColor) {
- params.push('foregroundColor=' + encodeURIComponent(options.foregroundColor));
- }
- if (params.length) {
- url += '#';
- for (var i=0; i<params.length; i++) {
- if (i) {
- url += '&';
- }
- url += params[i];
- }
- }
- iframe.src = url;
- this.iframe = iframe;
- iframe.addEventListener('load', function () {
- window.addEventListener("message", function (event) {
- if (event.origin != AppRepositoryOrigin) {
- // FIXME: signal an error?
- return;
- }
- var message = JSON.parse(event.data);
- if (message.size == 'expanded') {
- iframe.style.height = '150px';
- } else if (message.size == 'compact') {
- iframe.style.height = '22px';
- }
- }, false);
- iframe.contentWindow.postMessage('hello', AppRepositoryOrigin);
- }, false);
- };
-
- SyncButton.prototype.makeCompact = function () {
- if (this.iframe.style.height == '22px') {
- return;
- }
- this.iframe.contentWindow.postMessage(JSON.stringify({size: "compact"}), AppRepositoryOrigin);
- this.iframe.style.height = '22px';
- };
-
- SyncButton.prototype.appendTo = function (elOrId) {
- if (typeof elOrId == 'string') {
- var el = document.getElementById(elOrId);
- } else {
- var el = elOrId;
- }
- if (! el) {
- throw 'No element found ' + elOrId;
- }
- el.appendChild(this.iframe);
- };
-
// Return AppClient object with exposed API calls
var api = {
install: callInstall,
@@ -1109,8 +1035,7 @@ if (!navigator.mozApps.install || navigator.mozApps.html5Implementation) {
addEventListener: callAddEventListener,
removeEventListener: callRemoveEventListener,
oninstall: null,
- onuninstall: null,
- syncButton: callSyncButton
+ onuninstall: null
};
}
View
View
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Sync Button</title>
-<style type="text/css" media="screen">
-body {
- font-family: Helvetica, sans-serif;
- margin: 0;
- padding: 0;
-}
-/* The .with-status class is set on the sync button (syncbutton-expanded/compact) when
- there is some status from the sync service (typically an error) */
-.with-status a {
- color: #f00;
-}
-a:link, a:visited {
- text-decoration: none;
- color: #00f;
-}
-a:hover {
- text-decoration: underline;
-}
-#syncbutton-compacter, #syncbutton-expander {
- color: #000;
- text-decoration: none;
-}
-
-</style>
-</head>
-<body>
-
-<div id="syncbutton-login"><a id="login" href="#"><img id="login-image" src="https://browserid.org/i/sign_in_blue.png"></a></div>
-
-<div id="syncbutton-compact" style="display: none"><a id="syncbutton-expander" href="#" title="" style="width: 140px">sync &#9656;<!-- FIXME: should be image --></a></div>
-
-<div id="syncbutton-expanded" style="display: none">
- <a id="syncbutton-compacter" href="#" title="" style="width: 140px">sync &#9662;<!-- FIXME: should be image or header --></a><br>
- <span id="username"></span><br>
- <a href="#" id="sync-now">sync now</a><br>
- <a href="#" id="logout">logout</a><br>
- <span id="status-updated"></span>
- <span id="status"></span><br>
-</div>
-
-<script src="syncbutton.js"></script>
-<script src="https://browserid.org/include.js"></script>
-
-</body>
-</html>
Oops, something went wrong.

0 comments on commit 7c42242

Please sign in to comment.