-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigscripts.js
More file actions
54 lines (37 loc) · 1.37 KB
/
configscripts.js
File metadata and controls
54 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// JavaScript source code
//this must be declared first to ensure that the setconfig is run before the
//code in script1 tries to use the variables
//will need to get the instance divs from the array of all modules + their identity
var modules = [];
var modulepositions = [];
var configpositions = [];
function setconfig(config) {
//find all the modules in the config
var configmodules = config.modules;
configmodules.forEach(module =>
modules.push(module.module)
);
configmodules.forEach(module =>
configpositions.push(module.position)
);
configmodules.forEach(module =>
modulepositions[module.module] = {}
);
}
//button handler
function saveFunction() {
console.log("saving config");
//we want to save a revised config with the new modpos values
//as opposed to using CSS ??
//it is more flexible (if modpos exists, use them to setup the position of the class/module name)
//though CSS might be a good way to do it initially
//so
//can we read the custom.css to merge the new details as a module css entry
//or overwrite an existing one
//here we will need to write the file out useing the nodehelper
// custom.css.timestamp
// config.js.timestamp
}
//config handler
// need to get access to the full config so we load it as a script which might break something
setconfig(config);