|
14 | 14 | $('#debug').append("<h4>" + str + "</h4>"); |
15 | 15 | } |
16 | 16 |
|
17 | | - var global_dir = "files/"; // for testing |
| 17 | + var global_dir = "files/"; // for local testing |
| 18 | + |
| 19 | + if (JSROOT.source_dir.indexOf("http")==0) global_dir = "../files/"; |
18 | 20 |
|
19 | | - if (JSROOT.source_dir.indexOf("root.cern.ch")>0) |
20 | | - global_dir = "https://root.cern.ch/js/files/"; |
21 | | - if (JSROOT.source_dir.indexOf("web-docs.gsi.de")>0) |
22 | | - global_dir = "http://web-docs.gsi.de/~linev/js/files/"; |
23 | | - |
24 | 21 | function draw_item(file, itemname, divid, drawopt) { |
25 | 22 | file.ReadObject(itemname, function(obj) { |
26 | 23 | if (obj==null) return file_error("In file " + file.fURL + " item " + itemname + " cannot be find"); |
27 | 24 | JSROOT.draw(divid, obj, drawopt); |
28 | 25 | }); |
29 | 26 | } |
30 | | - |
| 27 | + |
31 | 28 | function draw_item_options(file, itemname, divid, options, factor) { |
32 | 29 | var arr = options.split(";"); |
33 | 30 |
|
34 | | - var fname = (file.fURL.indexOf("http://")==0) ? file.fURL : "demo/"+ file.fURL; |
| 31 | + var fname = (JSROOT.source_dir.indexOf("http")==0) ? file.fURL : "demo/"+ file.fURL; |
35 | 32 |
|
36 | 33 | var has_equal = false; |
37 | | - |
| 34 | + |
38 | 35 | var html = 'File: <a href="../index.htm?file=' + fname + '" target="_blank">' + fname.slice(fname.lastIndexOf('/')+1) + '</a>'; |
39 | 36 | for (var i in arr) { |
40 | 37 | if (i==0) html += " Item: "; else |
41 | 38 | if (i==1) html += " Options: "; else html += ", "; |
42 | 39 | html += '<a href="../index.htm?nobrowser&file=' + fname; |
43 | 40 | html += '&item=' + itemname + '&'; |
44 | | - |
| 41 | + |
45 | 42 | if (arr[i].indexOf("=")<0) html += 'opt=' + arr[i]; |
46 | 43 | else { html += arr[i]; has_equal = true; } |
47 | | - |
| 44 | + |
48 | 45 | html += '" target="_blank">'; |
49 | 46 | if (i==0) html += itemname; else |
50 | 47 | if (arr[i] == "") html += '<default>'; else html += arr[i]; |
51 | 48 | html += '</a>'; |
52 | 49 | } |
53 | 50 | html += "<br/><br/>"; |
54 | | - |
| 51 | + |
55 | 52 | $("#" + divid).append(html); |
56 | 53 |
|
57 | 54 | if (JSROOT.GetUrlOption("minimal") || |
58 | 55 | ((JSROOT.GetUrlOption("all")==null) && (JSROOT.GetUrlOption("default")==null))) return; |
59 | 56 |
|
60 | 57 | // special case - do not draw on main page |
61 | | - if (has_equal) return; |
| 58 | + if (has_equal) { $("#" + divid).append("skip drawing on central page - use provided links"); return; } |
62 | 59 |
|
63 | 60 | var w = JSROOT.GetUrlOption("w", null, "800"); |
64 | 61 | var h = JSROOT.GetUrlOption("h", null, "600"); |
|
140 | 137 | draw_item_options(file, "zdemo;1", "can3_draw", "", 0.); |
141 | 138 | }); |
142 | 139 |
|
143 | | - if (global_dir.indexOf("root.cern.ch")<0) |
| 140 | + if (JSROOT.source_dir.indexOf("http")<0) |
144 | 141 | LoadFile("JPsi_evolution.root", function(file) { |
145 | 142 | draw_item_options(file, "CutTrees/cut1/C_cut1 < 2.85714;1", "can4_draw", "", 0.); |
146 | 143 | }); |
|
157 | 154 | draw_item_options(file, "exclusion;1", "can7_draw", "", 0.); |
158 | 155 | }); |
159 | 156 |
|
160 | | - if (global_dir.indexOf("root.cern.ch")<0) { |
| 157 | + if (JSROOT.source_dir.indexOf("http")<0) { |
161 | 158 | LoadFile("can4.root", function(file) { |
162 | 159 | draw_item_options(file, "c1;1", "can8_draw", "", 0.); |
163 | 160 | }); |
|
0 commit comments