-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Url params 🎉 #276
Url params 🎉 #276
Conversation
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
@jywarren One issue I am facing right now is that importimage takes a function which also has commas and |
Oh I found one more logical error, now reworking .toJson() |
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
@jywarren everything is working now!!! |
Oh wow! Did you figure out the comma issue? I had thought of that and
wasn't sure what to do about it.
…On Sat, Jun 2, 2018, 7:23 AM Varun Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> everything is working now!!!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#276 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJztY6gikGA9uYvf4fUHpZXwk0RlSks5t4pGngaJpZM4UXrUD>
.
|
@jyywarren yes i did😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice. How did the function-with-commas question get resolved -- what happens?
Awesome work, Varun!
_sequencer.addSteps(step); | ||
var stepsFromHash = _sequencer.toJson(hash); | ||
stepsFromHash.forEach(function eachStep(stepObj) { | ||
_sequencer.addSteps(stepObj.name,stepObj.options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great, this would eventually be replaced by importString
or what were we going to call it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren yeah We can call it importString()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren actually I split on '),' !!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if this could still be triggered by incorrect parsing with a specifically crafted function.
Maybe we should forbid functions unless it's a full json string? Or could we url-encode the function like with %20
-like encoding? But that would be quite unreadable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren this won't fail until the function is incorrect!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case even if we encode it won't make sense since it would not be valid
}); | ||
_sequencer.run(); | ||
} | ||
setUrlHashParameter("steps", sequencer.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome :-)
.run(null); | ||
|
||
// add to URL hash too | ||
setUrlHashParameter("steps", _sequencer.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we're sure this'll overwrite the previous one? Great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah!!
src/ImageSequencer.js
Outdated
return steps.map(stepToJson); | ||
} | ||
// Converts one stringified step into JSON | ||
function stepToJson(str){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe stepStringToJson()
? for extra clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And can we write a test for this function? Thank you!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jywarren yeah I'l add the tests now!!
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
@jywarren I think this is ready!! |
Oh yeah sure!! |
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
Oh my bad!! I'm sorry @jywarren I forgot to push the commit that fixed the comma problem😅 |
@jywarren now this is done with the updated test, please have a look!! I tried it in the browser, looking very cool!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost there -- very exciting! Just made a suggestion with these encode/decode functions that'll make things simpler.
Thanks Varun!!!
src/ImageSequencer.js
Outdated
for(let input in inputs) inputs[input] = step.options[input] || inputs[input].default; | ||
for(let input in inputs) { | ||
inputs[input] = step.options[input] || inputs[input].default; | ||
inputs[input] = inputs[input].toString().replace(',',',%20'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try this -- encodeURIComponent()
-- this is available in node too. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
src/ImageSequencer.js
Outdated
@@ -232,9 +235,12 @@ ImageSequencer = function ImageSequencer(options) { | |||
str.substr(0,str.indexOf('(')), | |||
str.substr(str.indexOf('(')+1) | |||
] | |||
|
|||
str[1] = str[1].split('%20').join(' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this then be decodeURIComponent()
to reconstruct it? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent
I had mistakenly put %20
which is the code for a space, not a comma. I think commas are %2C
but these converter functions should deal with it.
src/ImageSequencer.js
Outdated
@@ -232,9 +235,12 @@ ImageSequencer = function ImageSequencer(options) { | |||
str.substr(0,str.indexOf('(')), | |||
str.substr(str.indexOf('(')+1) | |||
] | |||
|
|||
str[1] = str[1].split('%20').join(' '); | |||
str[1] = str[1].split(', ').join('|'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are you replacing commas with |
pipes? I think the encode/decode should make that unnecessary, right?
@jywarren Actually yeah I think this can simplify things a little, I'll try this out |
oops i was writing a long response while you were reading!
…On Sun, Jun 3, 2018 at 8:35 AM, Varun Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> Actually yeah I think this can
simplify things a little, I'll try this out
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#276 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ31i7tvpB10a-VGvH-ScexC5L9PDks5t4_QYgaJpZM4UXrUD>
.
|
@jywarren this is somewhat messing with the functionality |
I would have to figure this out from scratch i guess |
Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
@jywarren Done!! |
AMAZING!!!!!!!! |
fixes #250 and #127