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
54
gaia/apps/bookmark/js/activity_handler.js
Executable file
54
gaia/apps/bookmark/js/activity_handler.js
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
|
||||
/* global utils, BookmarkEditor, BookmarkRemover */
|
||||
var ActivityHandler = {
|
||||
'save-bookmark': function ah_save(activity) {
|
||||
BookmarkEditor.init({
|
||||
data: activity.source.data,
|
||||
onsaved: function onsaved(saved) {
|
||||
window.addEventListener('status-hidden', function hidden() {
|
||||
window.removeEventListener('status-hidden', hidden);
|
||||
activity.postResult(saved ? 'saved' : 'updated');
|
||||
});
|
||||
|
||||
var msg = saved ?
|
||||
'added-to-home-screen-message' : 'updated-pinned-site';
|
||||
navigator.mozL10n.formatValue(msg)
|
||||
.then(msg => utils.status.show(msg));
|
||||
},
|
||||
oncancelled: function oncancelled() {
|
||||
activity.postError('cancelled');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'remove-bookmark': function ah_remove(activity) {
|
||||
BookmarkRemover.init({
|
||||
id: activity.source.data.url,
|
||||
onremoved: function onremoved() {
|
||||
activity.postResult('removed');
|
||||
},
|
||||
oncancelled: function oncancelled(e) {
|
||||
activity.postError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
navigator.mozSetMessageHandler('activity', function onActivity(activity) {
|
||||
var name = activity.source.name;
|
||||
switch (name) {
|
||||
case 'save-bookmark':
|
||||
case 'remove-bookmark':
|
||||
if (activity.source.data.type === 'url') {
|
||||
ActivityHandler[name](activity);
|
||||
} else {
|
||||
activity.postError('type not supported');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
activity.postError('name not supported');
|
||||
}
|
||||
});
|
||||
Loading…
Reference in a new issue