mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-12 11:20:02 +01:00
Url params 🎉 (#276)
* basic implementation Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix bug Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix everything Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * add test and refactor Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update demo Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * fix comma issue Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * update test Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * now doing with native encode Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
committed by
Jeffrey Warren
parent
ac183205f0
commit
871453b857
@@ -14,12 +14,13 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
var hash = getUrlHashParameter("steps");
|
||||
|
||||
if (hash) {
|
||||
var stepsFromHash = hash.split(",");
|
||||
stepsFromHash.forEach(function eachStep(step) {
|
||||
_sequencer.addSteps(step);
|
||||
var stepsFromHash = _sequencer.importStringtoJson(hash);
|
||||
stepsFromHash.forEach(function eachStep(stepObj) {
|
||||
_sequencer.addSteps(stepObj.name,stepObj.options);
|
||||
});
|
||||
_sequencer.run();
|
||||
}
|
||||
setUrlHashParameter("steps", sequencer.toString());
|
||||
}
|
||||
|
||||
function selectNewStepUi() {
|
||||
@@ -31,23 +32,19 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
var index = $(removeStepSel).index(this) + 1;
|
||||
sequencer.removeSteps(index).run();
|
||||
// remove from URL hash too
|
||||
var urlHash = getUrlHashParameter("steps").split(",");
|
||||
urlHash.splice(index - 1, 1);
|
||||
setUrlHashParameter("steps", urlHash.join(","));
|
||||
setUrlHashParameter("steps", sequencer.toString());
|
||||
}
|
||||
|
||||
function addStepUi() {
|
||||
if ($(addStepSel + " select").val() == "none") return;
|
||||
|
||||
// add to URL hash too
|
||||
var hash = getUrlHashParameter("steps") || "";
|
||||
if (hash != "") hash += ",";
|
||||
setUrlHashParameter("steps", hash + $(addStepSel + " select").val());
|
||||
|
||||
var newStepName = $(addStepSel + " select").val();
|
||||
_sequencer
|
||||
.addSteps(newStepName, options)
|
||||
.run(null);
|
||||
.addSteps(newStepName, options)
|
||||
.run(null);
|
||||
|
||||
// add to URL hash too
|
||||
setUrlHashParameter("steps", _sequencer.toString());
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -102,10 +102,10 @@ function DefaultHtmlStepUi(_sequencer, options) {
|
||||
step.options[$(input).attr("name")] = input.value;
|
||||
});
|
||||
_sequencer.run();
|
||||
// modify the url hash
|
||||
setUrlHashParameter("steps", _sequencer.toString());
|
||||
}
|
||||
|
||||
saveOptions();
|
||||
|
||||
// on clicking Save in the details pane of the step
|
||||
$(step.ui.querySelector("div.details .btn-save")).click(saveOptions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user