Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 150c632

Browse files
committed
Commit of code for first chapter submission
1 parent bc5780f commit 150c632

17 files changed

+613
-0
lines changed

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
task build << {
2+
println "Building..."
3+
ant.concat(destfile: "js/prowebapps.js") {
4+
filelist dir: "src/js/",
5+
files: ("load-snippet.js")
6+
}
7+
}

config/lighttpd.conf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# lighttpd configuration file
2+
3+
# define the modules to load
4+
server.modules = ()
5+
6+
# set the document root
7+
server.document-root = "/development/projects/books-code/prowebapps-code/"
8+
9+
# set the index file names
10+
index-file.names = (
11+
"index.html",
12+
"index.html"
13+
)
14+
15+
# server port to bind to
16+
server.port = 8080
17+
18+
# server name to bind to (remember use an ip of your machine so your mobile device can access via wifi)
19+
server.bind = "10.1.1.3"
20+
21+
# mimetype mapping
22+
mimetype.assign = (
23+
".pdf" => "application/pdf",
24+
".sig" => "application/pgp-signature",
25+
".gz" => "application/x-gzip",
26+
".mp3" => "audio/mpeg",
27+
".m3u" => "audio/x-mpegurl",
28+
".wma" => "audio/x-ms-wma",
29+
".wax" => "audio/x-ms-wax",
30+
".ogg" => "application/ogg",
31+
".gif" => "image/gif",
32+
".jar" => "application/x-java-archive",
33+
".jpg" => "image/jpeg",
34+
".jpeg" => "image/jpeg",
35+
".png" => "image/png",
36+
".xbm" => "image/x-xbitmap",
37+
".xpm" => "image/x-xpixmap",
38+
".xwd" => "image/x-xwindowdump",
39+
".css" => "text/css",
40+
".html" => "text/html",
41+
".htm" => "text/html",
42+
".js" => "text/javascript",
43+
".txt" => "text/plain",
44+
".dtd" => "text/xml",
45+
".xml" => "text/xml",
46+
".mpeg" => "video/mpeg",
47+
".mpg" => "video/mpeg",
48+
".mov" => "video/quicktime",
49+
".qt" => "video/quicktime",
50+
".avi" => "video/x-msvideo",
51+
".asf" => "video/x-ms-asf",
52+
".asx" => "video/x-ms-asf",
53+
".wmv" => "video/x-ms-wmv",
54+
)

css/main.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
body {
2+
margin: 0px;
3+
}
4+
5+
div {
6+
padding: 0px 8px;
7+
}
8+
9+
h1 {
10+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #555555), color-stop(0.3, #333333), color-stop(1.0, #000000));
11+
-webkit-box-shadow:0 0 4px black;
12+
color: white;
13+
margin: 0px;
14+
padding: 8px;
15+
font-size: 1.3em;
16+
}
17+
18+
ul {
19+
margin: 0;
20+
padding: 0;
21+
list-style-type: none;
22+
}

index.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
5+
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
6+
<title>Pro Android Web Apps Welcome Page</title>
7+
<link rel="stylesheet" href="css/main.css" />
8+
<script type="text/javascript" charset="utf-8" src="js/jquery-1.4.2.min.js"></script>
9+
<script type="text/javascript" charset="utf-8">
10+
$(document).ready(function() {
11+
$("#platform li").each(function() {
12+
$(this).html(navigator[this.id]);
13+
});
14+
});
15+
</script>
16+
</head>
17+
<body>
18+
<h1>Pro Android Web Apps</h1>
19+
<div id="main">
20+
<ul class="group">
21+
<li><h3>Sample Applications</h3></li>
22+
<li><a href="/to-do-list/">To Do List Application</a></li>
23+
</ul>
24+
25+
<ul class="group">
26+
<li><h3>Code Snippets</h3></li>
27+
<li><a href="#snippets">Snippets by Chapter</a></li>
28+
</ul>
29+
30+
<h3>Platform Details</h3>
31+
<ul id="platform">
32+
<li id="userAgent"></li>
33+
</ul>
34+
</div>
35+
</body>
36+
</html>

js/jquery-1.4.2.min.js

Lines changed: 154 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/prowebapps.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
jQuery.fn.loadSnippet = function(params) {
2+
// initialise default parameters
3+
params = jQuery.extend({
4+
5+
}, params);
6+
7+
// if the html element has an id, then that is the snippet we are to load
8+
this.each(function() {
9+
var element = this;
10+
if (element.id) {
11+
jQuery.ajax({
12+
url: "snippets/" + element.id + ".html",
13+
dataType: "html",
14+
success: function(data, textStatus, rawRequest) {
15+
jQuery(element).html(data);
16+
},
17+
18+
error: function(rawRequest, textStatus, errorThrow) {
19+
jQuery(element).html("Could not load snippet...");
20+
}
21+
});
22+
} // if
23+
}); // each
24+
}; // loadSnippet
25+
26+
jQuery(document).ready(function() {
27+
// load snippets for any objects with the class of snippet
28+
jQuery(".snippet").loadSnippet();
29+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<html>
2+
<head>
3+
<title>Simple Mobile Web Page</title>
4+
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
5+
</head>
6+
<body>
7+
<h1>Create Task</h1>
8+
<form>
9+
<div>
10+
<label for="taskname">Task Name:</label><br />
11+
<input type="text" name="task[name]" id="taskname" />
12+
</div>
13+
14+
<div>
15+
<label for="taskdesc">Task Description</label><br />
16+
<textarea name="task[description]" rows="5"></textarea>
17+
</div>
18+
19+
<div>
20+
<label for="taskdue">Task Due:</label><br />
21+
<input type="text" name="task[due]" id="taskdue" />
22+
</div>
23+
24+
<input type="submit" name="Save" />
25+
</form>
26+
</body>
27+
</html>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<html>
2+
<head>
3+
<title>Simple Mobile Web Page</title>
4+
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
5+
<link rel="stylesheet" media="screen" href="todolist.css" />
6+
<script type="text/javascript">
7+
function updateOrientation(evt) {
8+
window.orientation = 0;
9+
// return false;
10+
//document.getElementById("taskname").value = window.orientation;
11+
//document.getElementById("taskdue").value = new Date().getTime();
12+
}
13+
</script>
14+
</head>
15+
<body onload="window.scrollTo(0, 1);" onorientationchange="updateOrientation();">
16+
<h1 class="fancy">Create Task</h1>
17+
<form id="taskentry" onsubmit="return false;">
18+
<ul>
19+
<li><input type="text" name="task[name]" id="taskname" placeholder="Task Name"/></li>
20+
<li>
21+
<textarea name="task[description]" id="taskdesc" placeholder="Description" rows="5">
22+
</textarea>
23+
</li>
24+
<li><input type="text" name="task[due]" id="taskdue" placeholder="Task Due" /></li>
25+
<li class="naked"><input type="submit" name="Save" /></li>
26+
</ul>
27+
</form>
28+
</body>
29+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<head>
3+
<title>Simple Mobile Web Page</title>
4+
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
5+
<link rel="stylesheet" media="screen" href="create-task-form.css" />
6+
<script type="text/javascript" charset="utf-8" src="/js/jquery-1.4.2.js"></script>
7+
</head>
8+
<body>
9+
<h1>Create Task</h1>
10+
<form id="taskentry" onsubmit="return false;">
11+
<ul>
12+
<li><input type="text" name="task[name]" id="taskname" placeholder="Task Name" required="true" /></li>
13+
<li><textarea name="task[description]" id="taskdesc" placeholder="Description" rows="5"></textarea></li>
14+
<li><input type="datetime" name="task[due]" id="taskdue" placeholder="Task Due" /></li>
15+
<li class="naked"><input type="submit" name="Save" /></li>
16+
</ul>
17+
</form>
18+
</body>
19+
</html>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
body {
2+
margin: 0px;
3+
}
4+
5+
h1.simple {
6+
font-size: 0.9em;
7+
padding: 8px 4px 4px 8px;
8+
background: #333333;
9+
color: #AAAAAA;
10+
border-bottom: 2px solid #AAAAAA;
11+
margin: 0;
12+
}
13+
14+
ul {
15+
margin: 0;
16+
padding: 4px;
17+
list-style-type: none;
18+
}
19+
20+
ul li {
21+
margin: 0;
22+
padding: 6px;
23+
}
24+
25+
ul li.header {
26+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #666666), color-stop(1.0, #000000));
27+
color: white;
28+
font-style: bold;
29+
padding: 6px;
30+
-webkit-border-radius: 3px;
31+
margin-top: 4px;
32+
}
33+
34+
ul li label {
35+
width: 120px;
36+
float: left;
37+
clear: left;
38+
}

0 commit comments

Comments
 (0)