diff --git a/elements/pick.html b/elements/pick.html new file mode 100644 index 0000000..cd56999 --- /dev/null +++ b/elements/pick.html @@ -0,0 +1,67 @@ + + + + + + + File Picker + + + + + + + + + + + + + + + + + + +
+
+
+ + +

Pick a file

+
+
+
+
+
+
+
+ + + + + + + + diff --git a/js/pick.js b/js/pick.js new file mode 100644 index 0000000..4896a06 --- /dev/null +++ b/js/pick.js @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2013-2015 Jhon Klever, http://github.com/elfoxero +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish and distribute, subject to the +* following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +*/ + +;+function (window, document, undefined) { + var activity; + var _ = window.document.webL10n.get; + + window.navigator.mozSetMessageHandler('activity', function(request) { + activity = request; + + var option = activity.source; + + if (option.name === 'pick') { + var data = option.data; + + document.querySelector('.content').textContent = JSON.stringify(data); + + document.querySelector('#close').onclick = document.querySelector('#done').onclick = function (e) { + window.close(); + }; + } else { + console.error('Not allowed'); + } + + }); +} (window, document, undefined); diff --git a/manifest.webapp b/manifest.webapp index 07621ef..3796a67 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -42,7 +42,7 @@ "pick": { "disposition": "inline", "returnValue": true, - "href": "/pick.html" + "href": "/elements/pick.html" } }, "locales": {