Skip to content

Commit

Permalink
added possiblity to install cron as mozilla app
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackScorp committed Mar 19, 2012
1 parent b01ae2e commit 30c3461
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
AddType application/x-web-app-manifest+json webapp
AddType application/x-web-app-manifest+json webapp
AddType text/cache-manifest appcache
3 changes: 2 additions & 1 deletion assets/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* This is the Main JS File
*/
$(function(){

//Init Crafty
Crafty.init(600,500);
//Add Canvas Element
Crafty.canvas.init();
//Set canvas under interface
//Set canvas under interface
Crafty.canvas._canvas.style.zIndex = '1';

//play the loading scene
Expand Down
21 changes: 21 additions & 0 deletions cron.appcache
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CACHE MANIFEST
# v1 - 2011-08-13
# This is a comment.
index.html
media/music/spaceship.ogg
media/music/through-space.ogg
media/sounds/explode.ogg
media/sounds/explodemini.ogg
media/sounds/laser1.ogg
media/sounds/laser2.ogg
media/sounds/laser3.ogg
media/sounds/laser4.ogg
assets/img/bg.png
assets/img/loading.jpg
assets/img/dmg.png
assets/img/bars.png
assets/img/ships.png
assets/img/weapon1_small.png
assets/img/explosion.png
assets/img/asteroid32.png
assets/img/asteroid64.png
2 changes: 1 addition & 1 deletion cron.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://twitter.com/#!/xBlackScorpx"
},
"installs_allowed_from": [
"https://appstore.mozillalabs.com"
"http://cron.cruel-online.de" ,"http://blackscorp.github.com/cron/","https://marketplace.mozilla.org/"
],
"locales": {
"de": {
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<p>Use Arrow Keys to move, Space to shoot</p>
<p>Get the <a href="https://github.com/BlackScorp/cron">Code</a></p>
<p>Get the <a href="http://opengameart.org">Images and Sounds</a></p>
<p><a href="mozilla-app.html">Install</a> the App in <a href="https://myapps.mozillalabs.com/">Mozilla Appstore</a></p>
</div>
<div id="cr-stage">
<div id="interface">
Expand Down
47 changes: 47 additions & 0 deletions mozilla-app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html manifest="cron.appcache">
<head>
<title>Install Cron</title>
</head>
<body>
<script type="text/javascript">

//expands on the previous example code

function installCallback(result) {
document.write('See your <a href="https://myapps.mozillalabs.com/">Apps</a>');
// window.location.href="https://myapps.mozillalabs.com/";
// great - display a message, or redirect to a launch page

}

function errorCallback(result) {
alert(result.message);
// whoops - result.code and result.message have details
}

function installCheck(data) {
if (data) {
// yes, we're installed
// data.manifest has the manifest
// data.install_time is when it was installed
// data.install_origin is the domain that called install
// data.install_data has the optional data from install

window.location.href="https://myapps.mozillalabs.com/";
} else {
// not installed!
navigator.mozApps.install(
"http://cron.cruel-online.de/cron.webapp",
{},
installCallback,
errorCallback
);
}
}


navigator.mozApps.amInstalled(installCheck);
</script>
</body>
</html>

0 comments on commit 30c3461

Please sign in to comment.