Skip to content

Commit 04e9345

Browse files
committed
1. Implement 'nocache' option for JSROOT scripts lodaing.
When specified in URL with JSRootCore.js script, tries to avoid scripts caching problem by adding stamp parameter to all URLs.
1 parent 93852d5 commit 04e9345

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

changes.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# JSROOT changelog
22

3+
## Changes in 5.5.1
4+
1. Implement 'nocache' option for JSROOT scripts lodaing. When specified in URL with
5+
JSRootCore.js script, tries to avoid scripts caching problem by adding stamp parameter to all URLs.
6+
7+
38
## Changes in 5.5.0
4-
1. Introduce JSROOT.StoreJSON() function. It creates JSON code for the
9+
1. Introduce JSROOT.StoreJSON() function. It creates JSON code for the
510
TCanvas with all drawn objects inside. Allows to store current canvas state
611
2. Support "item=img:file.png" parameter to insert images in existing layout (#151)
712
3. Support TTree drawing into TGraph (#153), thanks @cozzyd
813
4. Let configure "&toolbar=right" in URL to change position of tool buttons
9-
5. Let configure "&divsize=500x400" in URL of size of main div element (default - full browser)
14+
5. Let configure "&divsize=500x400" in URL of size of main div element (default - full browser)
1015
6. Implement "optstat1001" and "optfit101" draw options for histograms
1116
7. Remove "autocol" options - standard "plc" should be used instead
1217
8. Provide drawing of artificial "$legend" item - it creates TLegend for all primitives in pad

scripts/JSRootCore.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@
9696

9797
"use strict";
9898

99-
JSROOT.version = "5.5.0 6/07/2018";
99+
JSROOT.version = "5.5.1 16/07/2018";
100100

101101
JSROOT.source_dir = "";
102102
JSROOT.source_min = false;
103103
JSROOT.source_fullpath = ""; // full name of source script
104104
JSROOT.bower_dir = null; // when specified, use standard libs from bower location
105+
JSROOT.nocache = false;
105106
JSROOT.sources = ['core']; // indicates which major sources were loaded
106107

107108
JSROOT.id_counter = 0;
@@ -965,16 +966,14 @@
965966
isrootjs = true;
966967
filename = filename.slice(3);
967968
if (JSROOT.use_full_libs) filename = "libs/" + filename.slice(8, filename.length-7) + ".js";
968-
} else
969-
if (filename.indexOf("$$$")===0) {
969+
} else if (filename.indexOf("$$$")===0) {
970970
isrootjs = true;
971971
filename = filename.slice(3);
972972
if ((filename.indexOf("style/")==0) && JSROOT.source_min &&
973973
(filename.lastIndexOf('.css')==filename.length-4) &&
974974
(filename.indexOf('.min.css')<0))
975975
filename = filename.slice(0, filename.length-4) + '.min.css';
976-
} else
977-
if (filename.indexOf("###")===0) {
976+
} else if (filename.indexOf("###")===0) {
978977
isbower = true;
979978
filename = filename.slice(3);
980979
}
@@ -1020,6 +1019,9 @@
10201019
else
10211020
JSROOT.progress("loading " + filename + " ...");
10221021

1022+
if (JSROOT.nocache && isrootjs && (filename.indexOf("?")<0))
1023+
filename += "?stamp=" + JSROOT.nocache;
1024+
10231025
if (isstyle) {
10241026
element = document.createElement("link");
10251027
element.setAttribute("rel", "stylesheet");
@@ -2218,6 +2220,8 @@
22182220

22192221
var src = JSROOT.source_fullpath;
22202222

2223+
if (JSROOT.GetUrlOption('nocache', src)!=null) JSROOT.nocache = (new Date).getTime(); // use timestamp to overcome cache limitation
2224+
22212225
if (JSROOT.GetUrlOption('gui', src) !== null)
22222226
return window_on_load( function() { JSROOT.BuildSimpleGUI(); } );
22232227

0 commit comments

Comments
 (0)