Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
32
gaia/dev_apps/share-receiver/js/share-receiver.js
Executable file
32
gaia/dev_apps/share-receiver/js/share-receiver.js
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
window.onload = function() {
|
||||
navigator.mozSetMessageHandler('activity', function(activityRequest) {
|
||||
activity = activityRequest;
|
||||
if (activityRequest.source.name === 'share') {
|
||||
addImages(activityRequest.source.data);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('ok').onclick = done;
|
||||
};
|
||||
|
||||
var activity;
|
||||
|
||||
function done() {
|
||||
activity.postResult('shared');
|
||||
}
|
||||
|
||||
function addImages(data) {
|
||||
var blobs = data.blobs, filenames = data.filenames;
|
||||
console.log('share receiver: got', blobs.length, 'images');
|
||||
blobs.forEach(function(blob, index) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
var img = document.createElement('img');
|
||||
img.style.width = '100px';
|
||||
img.src = url;
|
||||
img.onload = function() { URL.revokeObjectURL(url); };
|
||||
document.body.appendChild(img);
|
||||
var label = document.createElement('span');
|
||||
label.textContent = filenames[index];
|
||||
document.body.appendChild(label);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue