1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 function graph_zoom(divId, svgId, scale) {
6 var pg = document.getElementById(divId);
7 vcenter = (pg.scrollTop + (pg.scrollHeight - pg.scrollTopMax)/2.0) / pg.scrollHeight;
8 hcenter = (pg.scrollLeft + (pg.scrollWidth - pg.scrollLeftMax)/2.0) / pg.scrollWidth;
9 var g = document.getElementById(svgId);
10 g.setAttribute("height", parseFloat(g.getAttribute("height")) * scale);
11 g.setAttribute("width", parseFloat(g.getAttribute("width")) * scale);
12 pg.scrollTop = (vcenter * pg.scrollHeight) - (pg.scrollHeight - pg.scrollTopMax)/2.0;
13 pg.scrollLeft = (hcenter * pg.scrollWidth) - (pg.scrollWidth - pg.scrollLeftMax)/2.0;
17 function smart_scroll_fixup(s) {
19 if (s != null && s.type == 'shown.bs.tab') {
23 s = $(".smart-scroll");
26 s.each(function(i, a) {
28 var h = window.innerHeight - a.offset().top - a.attr("data-smart-scroll-padding-bottom");
29 height = String(h) + "px";
30 a.css('max-height', height);
34 $(window).on('load ready resize scroll ajax:complete', smart_scroll_fixup);
35 $(document).on('shown.bs.tab', 'ul.nav-tabs > li > a', smart_scroll_fixup);