Skip to content

Commit 0dba50d

Browse files
author
Kevin Nadro
committed
fixed reloading of the algorithm
- changed the save/load of the algorithm for it correctly returns to the example after closing the generate overlay
1 parent 0ff9d86 commit 0dba50d

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

js/create/index.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,39 @@
33
const modules = require('../module');
44
const array2d = require('./array2d');
55
const util = require('./util');
6+
const Server = require('../server');
7+
const DOM = require('../dom');
68

7-
const closeCreate = (modules) => {
9+
const {
10+
getPath
11+
} = require('../server/helpers');
12+
13+
const closeCreate = () => {
814
const $btnClose = $('#btn_close');
915

1016
$btnClose.click(() => {
1117
$('.sandbox_container').remove();
1218
util.clearModules();
13-
restoreModules(modules);
19+
reloadAlgorithm();
1420
});
1521
};
1622

17-
const restoreModules = (modules) => {
18-
for (var i = 0; i < modules.length; i++) {
19-
$('.module_container').append(modules[i]);
20-
}
21-
};
23+
const reloadAlgorithm = () => {
24+
const {
25+
category,
26+
algorithm,
27+
file
28+
} = getPath();
2229

23-
const saveModules = () => {
24-
return $('.module_wrapper')
30+
Server.loadAlgorithm(category, algorithm).then((data) => {
31+
DOM.showAlgorithm(category, algorithm, data);
32+
});
2533
};
2634

35+
36+
2737
const init = () => {
28-
var moduleWrappers = saveModules();
38+
2939
var check = $('.sandbox_container');
3040
if(!check.length){
3141
util.clearModules();

js/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ RSVP.on('error', function (reason) {
3232
});
3333

3434
$(() => {
35-
3635
// initialize the application and attach in to the instance module
3736
const appConstructor = new AppConstructor();
3837
extend(true, app, appConstructor);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy