Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created November 28, 2013 21:08
Show Gist options
  • Save brianleroux/7698123 to your computer and use it in GitHub Desktop.
Save brianleroux/7698123 to your computer and use it in GitHub Desktop.
Proposal to simplify Cordova 'hello world'
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
</widget>
<html>
<head>
<meta charset=utf-8>
<meta name=format-detection content=telephone=no>
<!--
WARNING: for iOS 7
Remove the width=device-width and height=device-height attributes.
https://issues.apache.org/jira/browse/CB-4323
-->
<meta name=viewport content=user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width,height=device-height>
<style type=text/css>
* {
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
body {
-webkit-touch-callout: none;
-webkit-text-size-adjust: none;
-webkit-user-select: none;
font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
font-size:12px;
height:100%;
margin:0px;
padding:0px;
text-transform:uppercase;
width:100%;
}
/* Portrait layout (default) */
.app {
background:url(img/logo.png) no-repeat center top; /* 170px x 200px */
position:absolute;
left:50%;
top:50%;
height:50px;
width:225px;
text-align:center;
padding:180px 0px 0px 0px;
margin:-115px 0px 0px -112px;
}
/* Landscape layout (with min-width) */
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
.app {
background-position:left center;
padding:75px 0px 75px 170px;
margin:-90px 0px 0px -198px;
}
}
h1 {
font-size:24px;
font-weight:normal;
margin:0px;
overflow:visible;
padding:0px;
text-align:center;
}
#notready,
#ready {
border-radius:4px;
-webkit-border-radius:4px;
color:#FFFFFF;
font-size:12px;
margin:0px 30px;
padding:2px 0px;
}
#notready {
background-color:#333333;
display:block;
}
#ready {
background-color:#4B946A;
display:none;
}
@keyframes fade {
from { opacity: 1.0; }
50% { opacity: 0.4; }
to { opacity: 1.0; }
}
@-webkit-keyframes fade {
from { opacity: 1.0; }
50% { opacity: 0.4; }
to { opacity: 1.0; }
}
.blink {
animation:fade 3000ms infinite;
-webkit-animation:fade 3000ms infinite;
}
</style>
<title>Hello World</title>
</head>
<body>
<div class=app>
<h1>Apache Cordova</h1>
<div id=deviceready class=blink>
<p id=notready>Connecting to Device</p>
<p id=ready>Device is Ready</p>
</div>
</div>
<script src=cordova.js></script>
<script>
document.addEventListener('deviceready', function() {
var ready = document.getElementById('ready');
var notReady = document.getElementById('notready');
ready.style.display = 'block';
notReady.style.display = 'none';
});
</script>
</body>
</html>
@purplecabbage
Copy link

You can delete these 2 lines with no side effects. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment