Skip to content

Commit

Permalink
Making some changes to fix the scrapbook app
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKinlan committed Jan 27, 2012
1 parent 4ffa15b commit 78ee8a2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
5 changes: 5 additions & 0 deletions tools/chrome/apps/packaged/scrapbook/controller.js
Expand Up @@ -24,6 +24,11 @@ var Scrappy = new (function() {
var intent = new Intent("http://webintents.org/edit", file.type, file);
window.navigator.startActivity(intent);
};

this.startPick = function(callback) {
var intent = new Intent("http://webintents.org/pick", "*");
window.navigator.startActivity(intent, callback);
};
})();

var FileListModel = function(files) {
Expand Down
9 changes: 9 additions & 0 deletions tools/chrome/apps/packaged/scrapbook/index.html
Expand Up @@ -26,6 +26,14 @@
$("#share").click(function() {
Scrappy.startShare();
});

$("#pick").click(function() {
Scrappy.startPick(function(data) {
var filename = "";
// try and work out the file name.
Scrappy.save(data);
});
});
});
</script>
</head>
Expand All @@ -37,6 +45,7 @@
<div class="padder">
<h1>Scraps</h1>
<input type="file" class="btn" value="Add" />
<button class="btn primary">Pick</button>
<div id="files">
<ul data-bind="foreach: files">
<li>
Expand Down
13 changes: 11 additions & 2 deletions tools/chrome/apps/packaged/scrapbook/pick.html
Expand Up @@ -17,12 +17,21 @@
If window.intent.data == TypedArray then save to file-system locally
*/
var type = window.intent.type;

}
}
});
</script>
</head>
<body>
<h1>Scrappy Pick</h1>

<div id="files">
<ul data-bind="foreach: file">
<li>
<a data-bind="text: name, attr: { 'data-path': fullPath }"
</li>
</ul>
</div>


</body>
</html>
10 changes: 8 additions & 2 deletions tools/chrome/apps/packaged/scrapbook/save.html
Expand Up @@ -18,8 +18,14 @@
var data = window.intent.data;
var type = window.intent.type;
var objectType = IntentHelper.getObjectType(data);

Scrappy.save(data);

if(data instanceof Array) {
var item;
for(var i = 0; item = data[i]; i++) Scrappy.save(item);
}
else {
Scrappy.save(data);
}
}
});
</script>
Expand Down
35 changes: 7 additions & 28 deletions tools/chrome/apps/packaged/scrapbook/styles/app.css
Expand Up @@ -5,21 +5,14 @@ html {
body {
padding: 50px;
margin: 0;
background-color:#269;
background-image: -webkit-linear-gradient(white 2px, transparent 2px),
-webkit-linear-gradient(0, white 2px, transparent 2px),
background-color:#269;
background-image: -webkit-linear-gradient(white 2px, transparent 2px),
-webkit-linear-gradient(0, white 2px, transparent 2px),
-webkit-linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),
-webkit-linear-gradient(0, rgba(255,255,255,.3) 1px, transparent 1px);
background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px; background-color:#269;
background-image: -webkit-linear-gradient(white 2px, transparent 2px),
-webkit-linear-gradient(0, white 2px, transparent 2px),
-webkit-linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),
-webkit-linear-gradient(0, rgba(255,255,255,.3) 1px, transparent 1px);
background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;


-webkit-linear-gradient(0, rgba(255,255,255,.3) 1px, transparent 1px);
background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px; background-color:#269;


height: 100%;

Expand Down Expand Up @@ -86,17 +79,3 @@ header#titlebar:hover {
box-shadow: 0px 0px 5px black;
overflow: hidden;
}


input[type=file] {
display: inline-block;
}

input[type=file]::-webkit-file-upload-button {
display:none;
}

input[type=file]:before {
content: 'Select file';
-webkit-appearance: square-button;
}

0 comments on commit 78ee8a2

Please sign in to comment.