initial commit

This commit is contained in:
2009-12-16 14:22:56 +02:00
commit dc8249dbeb
51 changed files with 6984 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.DS_Store

1
Contents/Info.json Normal file
View File

@@ -0,0 +1 @@
[{"en": "English", "fr": "Français", "de": "Deutsch", "ja": "日本語", "es": "Español", "nl": "Nederlands", "it": "Italiano", "ru": "Русский", "zh_CN": "简体中文", "pt_BR": "Português", "da": "Dansk", "fi": "Suomi", "ko": "한글", "no": "Norsk (bokmål)", "pl": "Polski", "pt": "Português (Portugal)", "sv": "Svenska", "zn_TW": "繁體中文", "bg": "Български", "hr": "Hrvatski", "cs": "Čeština", "et": "Eestikeelne", "el": "Ελληνικά", "hu": "Magyar", "lv": "Latviski", "lt": "Lietuvių", "mk": "Македонски", "my": "Bahasa Malaysia", "me": "Crnogorski", "ro": "Română", "sk": "Slovenčina", "th": "ภาษาไทย", "tr": "Türkçe","id": "Bahasa Indonesia"}]

2092
Contents/en/content.json Normal file

File diff suppressed because one or more lines are too long

1
Contents/en/version.txt Normal file
View File

@@ -0,0 +1 @@
274226013.438797

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

BIN
mobile/assets/pixel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View File

@@ -0,0 +1,245 @@
dataController.initDatabase = function () {
try {
if (!window.openDatabase) {
alert("not supported");
} else {
var g = window.location.toString();
var d = g.lastIndexOf("/");
if (d != -1) {
g = g.substring(0, d + 1);
}
var a = "User Guide - " + g;
var c = "1.0";
var b = "User Guide";
var h = 65536;
this.database = openDatabase(a, c, b, h);
}
} catch(f) {
alert("Unknown error " + f + ".");
return;
}
this.checkDatabaseVersion();
};
dataController.checkDatabaseVersion = function () {
this.database.transaction(function (e) {
var a = new XMLHttpRequest();
var c = dataController.dataFolder + "version.txt";
a.open("GET", c, false);
try {
a.send(null);
} catch(b) {
a = null;
}
if (!a || a.status != 200) {
console.log("Error retrieving JSON Version file.");
var d = "";
} else {
var d = a.responseText;
}
e.executeSql("SELECT * FROM " + localizationController.language + 'Config WHERE key="version"', [], function (h, f) {
var g = f.rows.item(0).value;
dataController.databaseVersion = g;
if (g == d || d == "") {
dataController.createDataStructure();
dataController.createGraphicsDataStructure();
return;
}
h.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Content;", [], null, dataController.errorHandler);
h.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Config;", [], null, dataController.errorHandler);
h.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Graphics;", [], null, dataController.errorHandler);
dataController.updateDatabaseVersion(d);
},
function (g, f) {
dataController.updateDatabaseVersion(d);
});
});
};
dataController.updateDatabaseVersion = function (a) {
this.database.transaction(function (b) {
dataController.databaseVersion = a;
b.executeSql("CREATE TABLE " + localizationController.language + "Config (key TEXT NOT NULL, value TEXT NOT NULL);", [], null, dataController.errorHandler);
b.executeSql("insert into " + localizationController.language + "Config (key, value) VALUES (?, ?);", ["version", a], null, dataController.errorHandler);
dataController.createTable();
dataController.createGraphicsTable();
});
};
dataController.createTable = function () {
this.database.transaction(function (transaction) {
console.log("Loaded new JSON data into the Database.");
var jsonRequest = new XMLHttpRequest();
var jsonURL = dataController.dataFolder + "content.json";
jsonRequest.open("GET", jsonURL, false);
try {
jsonRequest.send(null);
} catch(err) {
jsonRequest = null;
}
if (!jsonRequest || jsonRequest.status != 200) {
console.log("Error retrieving JSON file.");
return;
}
try {
var jsonObject = jsonRequest.responseText;
eval(jsonObject);
dataController.graphicCacheFromJSON = graphicCache;
} catch(err) {
if (localizationController.language != "en") {
document.location = "?lang=en";
} else {
alert("English content.json could not be parsed.");
}
return;
}
transaction.executeSql("CREATE TABLE " + localizationController.language + "Content (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, apdid TEXT NOT NULL, parentapdid TEXT NOT NULL, flatten TEXT NOT NULL, title TEXT NOT NULL, icon TEXT NOT NULL, content TEXT NOT NULL);", [], null, dataController.errorHandler);
addItemsInArrayWithParentAPDID(jsonArray, "TOP_LEVEL_ITEM");
function addItemsInArrayWithParentAPDID(array, parentAPDID) {
for (var i in array) {
var item = array[i];
var flatten = 0;
if (item.flatten && item.children && item.children.length != 0) {
flatten = 1;
}
var name = item.name;
var icon = item.icon;
var content = item.content;
if (typeof(name) == "undefined") {
name = "";
}
if (typeof(icon) == "undefined") {
icon = "";
}
if (typeof(content) == "undefined") {
content = "";
}
addEntryToContentDatabase(item.apdid, parentAPDID, flatten, name, icon, content);
if (item.children && item.children.length != 0) {
addItemsInArrayWithParentAPDID(item.children, item.apdid);
}
}
}
function addEntryToContentDatabase(apdid, parentapdid, flatten, title, icon, content) {
transaction.executeSql("insert into " + localizationController.language + "Content (apdid, parentapdid, flatten, title, icon, content) VALUES (?, ?, ?, ?, ?, ?);", [apdid, parentapdid, flatten, title, icon, content], null, dataController.errorHandler);
}
for (var key in configurationSettings) {
var value = configurationSettings[key];
transaction.executeSql("insert into " + localizationController.language + "Config (key, value) VALUES (?, ?);", [key, value], null, dataController.errorHandler);
}
dataController.createDataStructure();
});
};
dataController.createGraphicsTable = function () {
this.database.transaction(function (d) {
console.log("Loaded new Graphics data into the Database.");
d.executeSql("CREATE TABLE " + localizationController.language + "Graphics (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, artPath TEXT NOT NULL, base64 TEXT NOT NULL);", [], null, dataController.errorHandler);
var b = dataController.graphicCacheFromJSON;
if (typeof(b) != "undefined") {
for (var a in b) {
var c = b[a];
e(a, c);
}
}
function e(g, f) {
d.executeSql("insert into " + localizationController.language + "Graphics (artPath, base64) VALUES (?, ?);", [g, f], null, dataController.errorHandler);
}
dataController.createGraphicsDataStructure();
});
};
dataController.createDataStructure = function () {
this.database.transaction(function (a) {
a.executeSql("select * from " + localizationController.language + "Content;", [], function (e, b) {
for (var c = 0; c < b.rows.length; c++) {
var d = b.rows.item(c);
dataController.table.push(d);
dataController.titleTable[d.apdid] = d.title;
dataController.parentTable[d.apdid] = d.parentapdid;
if (!dataController.childrenTable[d.parentapdid]) {
dataController.childrenTable[d.parentapdid] = new Array();
}
if (d.apdid != "COPYRIGHT_PAGE_CONTENT" && d.apdid != "COPYRIGHT_TOC_STRING") {
dataController.childrenTable[d.parentapdid].push(d.apdid);
}
}
dataController.fixNestedSingularChildren();
dataController.database.transaction(function (f) {
f.executeSql("select * from " + localizationController.language + "Config;", [], function (k, g) {
for (var h = 0; h < g.rows.length; h++) {
var j = g.rows.item(h);
dataController.configurationSettings[j.key] = j.value;
if (j.key == "MenuStructure" && j.value == "Type=grouped,") {
dataController.shouldFlatten = 1;
}
if (j.key == "Search" && j.value == "disabled=true,") {
dataController.shouldHideSearchButton = 1;
}
if (j.key == "BackButtonURL" && j.value != "" && j.value != "BackButtonURL") {
dataController.mainTOCBackButtonURL = j.value;
}
if (j.key == "BackButtonTitle" && j.value != "" && j.value != "BackButtonTitle") {
dataController.mainTOCBackButtonTitle = j.value;
}
if (j.key == "BookTitle" && j.value != "") {
dataController.bookTitle = j.value;
document.title = dataController.bookTitle;
}
if (j.key == "ShowVersionNumber" && j.value == "1") {
dataController.showVersionNumber = 1;
}
}
dataController.isInitialized = 1;
},
dataController.errorHandler);
});
},
dataController.errorHandler);
});
};
dataController.createGraphicsDataStructure = function () {
this.database.transaction(function (a) {
a.executeSql("select * from " + localizationController.language + "Graphics;", [], function (d, b) {
for (var c = 0; c < b.rows.length; c++) {
dataController.graphics.push(b.rows.item(c));
}
},
dataController.errorHandler);
});
};
dataController.performSearchWithQuery = function (b, a) {
if (b == "" || b.length < 2) {
a(new Array());
return;
}
b = b.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
searchQueryArray = b.split(" ");
searchQueryContentLikeClause = '( content LIKE "%' + searchQueryArray.join('%" AND content LIKE "%') + '%" )';
searchQueryTitleLikeClause = '( title LIKE "%' + searchQueryArray.join('%" AND title LIKE "%') + '%" )';
this.database.transaction(function (d) {
var c = "SELECT * FROM " + localizationController.language + "Content WHERE " + searchQueryContentLikeClause + " OR " + searchQueryTitleLikeClause + " LIMIT 25";
d.executeSql(c, [], function (j, e) {
var h = new Array();
for (var g = 0; g < e.rows.length; g++) {
var f = e.rows.item(g).apdid;
if (0 == dataController.getChildrenAPDIDsForItemWithAPDID(f).length) {
h.push(f);
}
}
a(h);
},
dataController.errorHandler);
});
};
dataController.errorHandler = function (b, a) {
console.log("Error Handler: " + a.message + " (" + a.code + ")");
if (-1 != a.message.indexOf("no such table")) {
dataController.database.transaction(function (c) {
c.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Content;", [], null, dataController.errorHandler);
c.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Config;", [], null, dataController.errorHandler);
c.executeSql("DROP TABLE IF EXISTS " + localizationController.language + "Graphics;", [], null, dataController.errorHandler);
window.location.reload();
});
}
return true;
};
dataController.initDatabase();

1
mobile/dist/PastryKit.css vendored Normal file

File diff suppressed because one or more lines are too long

3438
mobile/dist/PastryKit.js vendored Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

BIN
mobile/images/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
mobile/images/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

27
mobile/index.html Normal file
View File

@@ -0,0 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html manifest="cache.manifest">
<head>
<title>PastryKit Demo (iPhone User Guide)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="apple-touch-icon" href="images/icon.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-startup-image" href="images/startupimage.png">
<!-- PastryKit -->
<link rel="stylesheet" href="dist/PastryKit-compressed.css">
<script type="text/javascript" src="dist/PastryKit.js" charset="utf-8"></script>
<!-- Our logic and style -->
<link rel="stylesheet" href="style/stylesheet.css">
<script type="text/javascript" src="javascript.js" charset="utf-8"></script>
</head>
<body>
</body>
</html>

1175
mobile/javascript.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
<html><head><title>iPhone User Guide</title><meta name="viewport" content="width=device-width"><style type="text/css">body { font-size:16px; font-family:Helvetica, sans-serif; } .TableAsList > p.TableDisplay:after {content:": "; padding-right: .25em;} .TableAsList > p.TableDisplay {display: run-in; font-weight: bold;} ul.ListDescriptor > li {list-style-type: none;} .voiceoverListLink { line-height:1.5em; } </style><script>var controller = {}; controller.navigateToElement = function(apdid) { window.location = apdid + ".html"; }</script></head><body><a href="iphdada543f.html" alt="Getting Started" class="voiceoverListLink">Getting Started</a><br /><a href="iphdb2d5b46.html" alt="Basics" class="voiceoverListLink">Basics</a><br /><a href="iphdb57e037.html" alt="Phone" class="voiceoverListLink">Phone</a><br /><a href="iphdb6b967d.html" alt="Mail" class="voiceoverListLink">Mail</a><br /><a href="iphdb7fbce4.html" alt="Safari" class="voiceoverListLink">Safari</a><br /><a href="iphdba63fab.html" alt="iPod" class="voiceoverListLink">iPod</a><br /><a href="iphdbbcac19.html" alt="Messages" class="voiceoverListLink">Messages</a><br /><a href="iphdbc7d8f1.html" alt="Calendar" class="voiceoverListLink">Calendar</a><br /><a href="iphdc98bd55.html" alt="Photos" class="voiceoverListLink">Photos</a><br /><a href="iphdca327ee.html" alt="Camera" class="voiceoverListLink">Camera</a><br /><a href="iphdcb55c31.html" alt="YouTube" class="voiceoverListLink">YouTube</a><br /><a href="iphdd085cab.html" alt="Stocks" class="voiceoverListLink">Stocks</a><br /><a href="iphdd1cdc98.html" alt="Maps" class="voiceoverListLink">Maps</a><br /><a href="iphdd239086.html" alt="Weather" class="voiceoverListLink">Weather</a><br /><a href="iphdd2ef9db.html" alt="Voice Memos" class="voiceoverListLink">Voice Memos</a><br /><a href="iphdd3a93c0.html" alt="Notes" class="voiceoverListLink">Notes</a><br /><a href="iphdd410a46.html" alt="Clock" class="voiceoverListLink">Clock</a><br /><a href="iphdd4962e1.html" alt="Calculator" class="voiceoverListLink">Calculator</a><br /><a href="iphdd83b7a6.html" alt="Settings" class="voiceoverListLink">Settings</a><br /><a href="iphdd9a172b.html" alt="iTunes Store" class="voiceoverListLink">iTunes Store</a><br /><a href="iphdda54270.html" alt="App Store" class="voiceoverListLink">App Store</a><br /><a href="iphddab3ca3.html" alt="Compass" class="voiceoverListLink">Compass</a><br /><a href="iphddb4e011.html" alt="Contacts" class="voiceoverListLink">Contacts</a><br /><a href="iphddbc9eaa.html" alt="Nike + iPod" class="voiceoverListLink">Nike + iPod</a><br /><a href="iphddd0e033.html" alt="Accessibility" class="voiceoverListLink">Accessibility</a><br /><a href="iphddf3e47a.html" alt="Troubleshooting" class="voiceoverListLink">Troubleshooting</a><br /><a href="iphde046855.html" alt="Other Resources" class="voiceoverListLink">Other Resources</a><br /></body></html>