Commit c48f6f0d authored by Marc Duez's avatar Marc Duez

conf.js : spli demo file path and filename in two

parent 0a55b6a8
...@@ -9,17 +9,22 @@ var config = { ...@@ -9,17 +9,22 @@ var config = {
/*database */ /*database */
"use_database" : true, "use_database" : true,
"db_address" : "http://134.206.11.64:8000/Vidjil/", "db_address" : "http://134.206.11.64:8000/Vidjil/",
"login" : "", // un jour peut-etre ... "login" : "",
"password" : "", "password" : "",
/* you can use relative path if Vidjil browser is online on the same server /* you can use relative path if Vidjil browser is online on the same server
* or complete path to a CORS active server only if browser is offline or on another server * or complete path to a CORS active server only if browser is offline or on another server
* use an empty array [] if you don't want demo_file menu * use an empty array [] if you don't want demo_file menu
*/ */
"demo_file" : [
"/browser/demo_file/A_BCD.data", "demo" : {
"/browser/demo_file/L2-LIL-2.data" "path" : "/browser/demo_file/",
], "file" : [
"A_BCD.data",
"L2-LIL-2.data"
]
},
"debug_mode" : false //en phase de recherche "debug_mode" : false //en phase de recherche
} }
\ No newline at end of file
...@@ -37,29 +37,28 @@ if (typeof config != 'undefined') { ...@@ -37,29 +37,28 @@ if (typeof config != 'undefined') {
$('#database_menu').css("display", "") $('#database_menu').css("display", "")
} }
if (config.demo_file && config.demo_file.length != 0){ if (config.demo && config.demo.file.length != 0){
//detect if files are available //detect if files are available
$.ajax({ $.ajax({
type: "POST", type: "POST",
timeout: 5000, timeout: 5000,
crossDomain: true, crossDomain: true,
url: config.demo_file[0], url: config.demo.path+config.demo.file[0],
success: function (result) { success: function (result) {
$('#demo_file_menu').css("display", "") $('#demo_file_menu').css("display", "")
var demo_file = document.getElementById("demoSelector").firstChild var demo_file = document.getElementById("demoSelector").firstChild
for (var i = 0; i < config.demo_file.length; i++) { for (var i = 0; i < config.demo.file.length; i++) {
(function (i) { (function (i) {
var path = config.demo_file[i].split("/")
var a = document.createElement('a'); var a = document.createElement('a');
a.className = "buttonSelector" a.className = "buttonSelector"
a.onclick = function () { a.onclick = function () {
m.loadDataUrl(config.demo_file[i]) m.loadDataUrl(config.demo.path+config.demo.file[i])
} }
a.appendChild(document.createTextNode(path[path.length-1])) a.appendChild(document.createTextNode(config.demo.file[i]))
demo_file.appendChild(a); demo_file.appendChild(a);
})(i) })(i)
......
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