Commit 16d3000a authored by Romain Loth's avatar Romain Loth

add samuel's flags by div as module loading config feature

parent 1d6a7be1
...@@ -482,6 +482,30 @@ function trackMouse() { ...@@ -482,6 +482,30 @@ function trackMouse() {
} }
// This is for adding/removing features from TinawebJS
// each key is simultaneously 3 things:
// - the key of a bool config value in DivsFlags (settings_explorerjs)
// - the dir of the submodule's files (and its init.js)
// - the css class of all html elements added by the submodule
function ProcessDivsFlags() {
for(var key in TW.DivsFlags) {
if(TW.DivsFlags[key]===false) {
// $("#"+key).remove() ; // previous logic by id
$("."+key).remove() ; // new logic by class
}
else {
console.log("extras:ProcessDivsFlags: key is true: "+key)
// load JS+CSS items corresponding to the flagname
// ex: flag = crowdsourcingTerms
// ==> JS = crowdsourcingTerms/init.js
// ==> CSS = crowdsourcingTerms/submodule.css
my_src_dir = key
loadJS(my_src_dir+"/init.js") ;
}
}
}
//both obsolete //both obsolete
function closeDialog () { function closeDialog () {
$('#windowTitleDialog').modal('hide'); $('#windowTitleDialog').modal('hide');
......
...@@ -36,6 +36,14 @@ var TW = {} ...@@ -36,6 +36,14 @@ var TW = {}
// field["data/20141215_GPs_04.gexf"] = "ISItermsfirstindexing"; // field["data/20141215_GPs_04.gexf"] = "ISItermsfirstindexing";
TW.Relations = {} TW.Relations = {}
// module_names to load
// ----------------------
TW.DivsFlags = {} ;
// flag name is div class to be removed if false
// *and* subdirectory to import if true
// see also ProcessDivsFlags()
//ex: TW.DivsFlags["crowdsourcingTerms"] = true ;
TW.SystemStates = {} TW.SystemStates = {}
TW.SystemStates.level = true; TW.SystemStates.level = true;
TW.SystemStates.type = [ true ] //[ true , false ]; //social activated! TW.SystemStates.type = [ true ] //[ true , false ]; //social activated!
......
...@@ -361,6 +361,9 @@ if(RES["OK"]) { ...@@ -361,6 +361,9 @@ if(RES["OK"]) {
} else alert("error: "+RES["data"]) } else alert("error: "+RES["data"])
// load optional modules
ProcessDivsFlags() ;
console.log("finish") console.log("finish")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment