Skip to content

Commit

Permalink
Support of fast buttons in DABC server and web browser
Browse files Browse the repository at this point in the history
git-svn-id: https://subversion.gsi.de/dabc/trunk/plugins/root/js@2700 bcbf6573-9a26-0410-9ebc-ce4ab7aade96
  • Loading branch information
linev committed Nov 7, 2014
1 parent 745b93a commit fc96672
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
7 changes: 6 additions & 1 deletion scripts/JSRootCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
return dflt;
}

JSROOT.NewHttpRequest = function(url, kind, callback) {
JSROOT.NewHttpRequest = function(url, kind, user_call_back) {
// Create asynchronous XMLHttpRequest object.
// One should call req.send() to submit request
// kind of the request can be:
Expand All @@ -164,6 +164,11 @@
// "head" - returns request itself, uses "HEAD" method
// Result will be returned to the callback functions
// If failed, request returns null

function callback(res) {
if (typeof user_call_back == 'function') user_call_back(res);
}

var xhr = new XMLHttpRequest();

// if (typeof ActiveXObject == "function") {
Expand Down
30 changes: 13 additions & 17 deletions scripts/JSRootPainter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7446,31 +7446,27 @@
}
}

JSROOT.HierarchyPainter.prototype.OpenOnline = function(server_address,
user_callback) {
if (!server_address)
server_address = "";
JSROOT.HierarchyPainter.prototype.OpenOnline = function(server_address, user_callback) {
if (!server_address) server_address = "";

var painter = this;

var req = JSROOT.NewHttpRequest(server_address + "h.json?compact=3",
'object', function(result) {
painter.h = result;
if (painter.h == null)
return;
var req = JSROOT.NewHttpRequest(server_address + "h.json?compact=3", 'object', function(result) {
painter.h = result;
if (painter.h == null) return;

// mark top hierarchy as online data and
painter.h['_online'] = server_address;
// mark top hierarchy as online data and
painter.h['_online'] = server_address;

painter.AddOnlineMethods(painter.h);
painter.AddOnlineMethods(painter.h);

if (painter.h != null)
painter.RefreshHtml(true);
if (painter.h != null)
painter.RefreshHtml(true);

if (typeof user_callback == 'function')
user_callback(painter);
if (typeof user_callback == 'function')
user_callback(painter);

});
});

req.send(null);
}
Expand Down

0 comments on commit fc96672

Please sign in to comment.