Skip to content
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

Close-parentheses in Dynamic module input get lost when sourced from URL #459

Closed
jywarren opened this issue Nov 8, 2018 · 9 comments · Fixed by #580
Closed

Close-parentheses in Dynamic module input get lost when sourced from URL #459

jywarren opened this issue Nov 8, 2018 · 9 comments · Fixed by #580
Labels
bug has-pull-request Issues which have a PR open help wanted

Comments

@jywarren
Copy link
Member

jywarren commented Nov 8, 2018

The new ability to use a map() function in the Dynamic module (#457) works, but the URL gets messed up;

http://localhost:8000/examples/#steps=dynamic{red:map(r%2C0%2C255%2C0%2C128)|green:g|blue:b|monochrome%20(fallback):r%20%2B%20g%20%2B%20b}

This loses the closing ) from the map(...) function when you open it... not sure why!

// Converts one stringified step into JSON
function stringToJSONstep(str) {
var bracesStrings;
if (str.includes('{'))
if (str.includes('(') && str.indexOf('(') < str.indexOf('{'))
bracesStrings = ['(', ')'];
else
bracesStrings = ['{', '}'];
else
bracesStrings = ['(', ')'];
if (str.indexOf(bracesStrings[0]) === -1) { // if there are no settings specified
var moduleName = str.substr(0);
stepSettings = "";
} else {
var moduleName = str.substr(0, str.indexOf(bracesStrings[0]));
stepSettings = str.slice(str.indexOf(bracesStrings[0]) + 1, -1);
}
stepSettings = stepSettings.split('|').reduce(function formatSettings(accumulator, current, i) {
var settingName = current.substr(0, current.indexOf(':')),
settingValue = current.substr(current.indexOf(':') + 1);
settingValue = settingValue.replace(/^\(/, '').replace(/\)$/, ''); // strip () at start/end
settingValue = settingValue.replace(/^\{/, '').replace(/\}$/, ''); // strip {} at start/end
settingValue = decodeURIComponent(settingValue);
current = [
settingName,
settingValue
];
if (!!settingName) accumulator[settingName] = settingValue;
return accumulator;
}, {});
return {
name: moduleName,
options: stepSettings
}
}

@gitmate gitmate bot added the module New Module idea label Nov 8, 2018
@gitmate
Copy link

gitmate bot commented Nov 8, 2018

GitMate.io thinks possibly related issues are #209 (Module info in demo should source from info.json), #231 ("Save as module" button on Dynamic module), #434 (Rotate module), #112 (Scale module), and #201 (Allow easier access to neighboring pixels in Dynamic module).

1 similar comment
@gitmate
Copy link

gitmate bot commented Nov 8, 2018

GitMate.io thinks possibly related issues are #209 (Module info in demo should source from info.json), #231 ("Save as module" button on Dynamic module), #434 (Rotate module), #112 (Scale module), and #201 (Allow easier access to neighboring pixels in Dynamic module).

@vibhorgupta-gh
Copy link

@jywarren Is this issue up for grabs?

@jywarren
Copy link
Member Author

jywarren commented Dec 5, 2018 via email

@Divy123
Copy link
Member

Divy123 commented Dec 16, 2018

Is this issue still open? I would love to work on this.

@vibhorgupta-gh
Copy link

vibhorgupta-gh commented Dec 16, 2018

@Divy123 this is almost done! could you find another issue? thanks! :D

@Divy123
Copy link
Member

Divy123 commented Dec 16, 2018

yeah sure @VibhorCodecianGupta 😄

@Mridul97
Copy link

Hi, @VibhorCodecianGupta are you working on this issue? Can I work on this issue?

@vibhorgupta-gh
Copy link

@jywarren done #580

@harshkhandeparkar harshkhandeparkar added the has-pull-request Issues which have a PR open label Feb 22, 2019
@harshkhandeparkar harshkhandeparkar removed the module New Module idea label Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-pull-request Issues which have a PR open help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants