From 86dca0400e65192a90d45822d92a164ea7cb0e78 Mon Sep 17 00:00:00 2001 From: keshav234156 <45951376+keshav234156@users.noreply.github.com> Date: Thu, 12 Dec 2019 01:50:03 +0530 Subject: [PATCH] Allow saving onto Publiclab.org (#1353) * Allow saving onto Publiclab.org * success to primary * fixing merge conflictx --- examples/demo.js | 17 ++++++++++++++++- examples/index.html | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/demo.js b/examples/demo.js index 75c71f31..796968e8 100644 --- a/examples/demo.js +++ b/examples/demo.js @@ -118,6 +118,9 @@ window.onload = function () { } else if(dropDownValue == 'save-pdf') { savePDF(getLastImage()); } + else if (dropDownValue == 'save-to-publiclab.org' ){ + SaveToPubliclab(); + } }); let isWorkingOnGifGeneration = false; @@ -251,6 +254,18 @@ window.onload = function () { download(image, 'index.gif', 'image/gif');// downloadjs library function } + function SaveToPubliclab() { + function postToPL(imgSrc) { + var uniq = Date.now(); + $('body').append('
'); + f = $('#postToPL' + uniq)[0]; + f.datauri_main_image.value = imgSrc; + window.open('', 'postToPLWindow'); + f.submit(); + } + postToPL($('img')[sequencer.steps.length - 1].src); + } + // image selection and drag/drop handling from examples/lib/imageSelection.js sequencer.setInputStep({ dropZoneSelector: '#dropzone', @@ -289,4 +304,4 @@ window.onload = function () { } else { insertPreview.updatePreviews('images/tulips.png', '#addStep'); } -}; +}; \ No newline at end of file diff --git a/examples/index.html b/examples/index.html index 75b94570..240c19fa 100644 --- a/examples/index.html +++ b/examples/index.html @@ -196,6 +196,7 @@ + >

@@ -240,4 +241,4 @@ - + \ No newline at end of file