Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

added functionality to start caching icons #167

Merged
merged 3 commits into from Jun 25, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added site/icons/16px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/icons/256px.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions site/js/jibe.js
Expand Up @@ -35,6 +35,20 @@ function getIconForSize(targetSize, app)
return DEFAULT_ICON;
}

function cacheIcons () {
if (typeof window.applicationCache.mozAdd === 'function') {
Array.prototype.slice.call(document.getElementsByClassName('icon')).forEach(
function (icon_div) {
try {
window.applicationCache.mozAdd(icon_div.firstElementChild.src);
} catch (err) {
console.log(err);
}
}
);
}
}

$(document).ready(function() {
/* IconGrid */
var appCount = 0;
Expand Down Expand Up @@ -64,6 +78,7 @@ $(document).ready(function() {
var pending = navigator.mozApps.mgmt.getAll();
pending.onsuccess = function () {
gotApps(this.result);
cacheIcons();
};
pending.onerror = function () {
$('#help').hide();
Expand Down
13 changes: 13 additions & 0 deletions site/manifest.webapp
@@ -0,0 +1,13 @@
{
"version": "0.1",
"name": "Developer Preview Apps Dashboard",
"description": "Manage Installed Open Web Apps",
"installs_allowed_from": [
"https://myapps.mozillalabs.com/"
],
"appcache_path": "/cache.manifest",
"icons": {
"16": "/icons/16px.png",
"256": "/icons/256px.png"
}
}