Filepicker client plugin
authorDarren <darren@Darrens-MacBook-Pro.local>
Wed, 3 Apr 2013 20:04:20 +0000 (21:04 +0100)
committerDarren <darren@Darrens-MacBook-Pro.local>
Wed, 3 Apr 2013 20:04:20 +0000 (21:04 +0100)
client/assets/plugins/filepicker.html [new file with mode: 0644]

diff --git a/client/assets/plugins/filepicker.html b/client/assets/plugins/filepicker.html
new file mode 100644 (file)
index 0000000..000fbb2
--- /dev/null
@@ -0,0 +1,26 @@
+<script type="text/javascript">
+    // File picker plugin
+    // Author: https://github.com/pepijndevos/
+    
+    $script("//api.filepicker.io/v1/filepicker.js", function () {
+        var network = kiwi.components.Network();
+        var control = kiwi.components.ControlInput();
+
+        filepicker.setKey("YOUR_API_KEY");
+
+        function uploaded(files) {
+            var area = $("#kiwi #controlbox textarea");
+
+            for (var i = 0; files.length>i; i++) {
+                area.val(area.val() + " " + files[i].url);
+            }
+        }
+
+        filepicker.makeDropPane($("#kiwi #panels")[0], { onSuccess: uploaded });
+
+        var $icon = $("<a class=\"upload\" title=\"Send File\"><i class=\"icon-upload-alt\"></i></a>");
+        $icon.click(function () { filepicker.pickMultiple(uploaded); });
+
+        control.addPluginIcon($icon);
+    });
+</script>
\ No newline at end of file