summaryrefslogtreecommitdiffstats
path: root/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee')
-rw-r--r--vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee20
1 files changed, 20 insertions, 0 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee
new file mode 100644
index 00000000..fdd8455e
--- /dev/null
+++ b/vnfmarket/src/main/webapp/vnfmarket/node_modules/phantomjs/lib/phantom/examples/imagebin.coffee
@@ -0,0 +1,20 @@
+# Upload an image to imagebin.org
+
+page = require('webpage').create()
+system = require 'system'
+
+if system.args.length isnt 2
+ console.log 'Usage: imagebin.coffee filename'
+ phantom.exit 1
+else
+ fname = system.args[1]
+ page.open 'http://imagebin.org/index.php?page=add', ->
+ page.uploadFile 'input[name=image]', fname
+ page.evaluate ->
+ document.querySelector('input[name=nickname]').value = 'phantom'
+ document.querySelector('input[name=disclaimer_agree]').click()
+ document.querySelector('form').submit()
+
+ window.setTimeout ->
+ phantom.exit()
+ , 3000