|
| 1 | +function startTour(force_start){ |
| 2 | + function autoScrollSideBar(t) { |
| 3 | + // to be called onShow, hence the currentstep + 1 below |
| 4 | + var element = t.getStep(t.getCurrentStep() + 1).element; |
| 5 | + if (!element) { |
| 6 | + console.warn("autoScrollSideBar called, but can't get element"); |
| 7 | + return; |
| 8 | + } |
| 9 | + var element_offset = $(element).offset().top; |
| 10 | + $("#sidebar-container").animate({scrollTop: element_offset}, 200); |
| 11 | + } |
| 12 | + |
| 13 | + function fixupSVGHighlighting(t) { |
| 14 | + // to be called onShown |
| 15 | + var element = t.getStep(t.getCurrentStep()).element; |
| 16 | + if (!element) { |
| 17 | + console.warn("fixupSVGHighlighting called, but can't get element"); |
| 18 | + return; |
| 19 | + } |
| 20 | + console.log('dim:'); |
| 21 | + console.log($(element).width()); |
| 22 | + console.log($(element).height()); |
| 23 | + $(".tour-step-background").width($(element).width()).height($(element).height()); |
| 24 | + } |
| 25 | + |
| 26 | + var tour = new Tour({ |
| 27 | + backdrop: true, |
| 28 | + backdropPadding: 5, |
| 29 | + // autoscroll: true, // doesn't seem to work |
| 30 | + orphan: true, |
| 31 | + debug: true, |
| 32 | + steps: [ |
| 33 | + { |
| 34 | + content: "Welcome to the result visualisation of our <a href='https://w3id.org/associations/#gp_learner'>graph pattern learner</a>.<br>As the interface is quite powerful, this tour will briefly explain its components." |
| 35 | + }, |
| 36 | + { |
| 37 | + element: '#sidebar-global-info-panel', |
| 38 | + onShow: autoScrollSideBar, |
| 39 | + placement: 'left', |
| 40 | + title: "Result step selection", |
| 41 | + content: "Let's start on the right. As you might know our evolutionary algorithm operates in several runs to cover the input source-target-pairs. Here you can select individual generations from each run, the results of each run or the overall aggregated results." |
| 42 | + }, |
| 43 | + { |
| 44 | + element: '#sidebar-select-panel', |
| 45 | + onShow: autoScrollSideBar, |
| 46 | + placement: 'left', |
| 47 | + content: "Once the selected results are loaded, you can select the individual patterns in this panel." |
| 48 | + }, |
| 49 | + { |
| 50 | + element: '#sidebar-fitness-panel', |
| 51 | + onShow: autoScrollSideBar, |
| 52 | + placement: 'left', |
| 53 | + content: "In this panel you will see the fitness of the currently selected pattern." |
| 54 | + }, |
| 55 | + { |
| 56 | + element: '#sidebar-pairs-panel', |
| 57 | + onShow: autoScrollSideBar, |
| 58 | + placement: 'left', |
| 59 | + content: "Here you can see which of the ground truth source-target-pairs are matched by the selected pattern." |
| 60 | + }, |
| 61 | + { |
| 62 | + element: '#sidebar-pairs-panel .pair-link:first', |
| 63 | + placement: 'left', |
| 64 | + content: "You can also execute the SPARQL query for the current pattern pre-filled with the individual source node." |
| 65 | + }, |
| 66 | + { |
| 67 | + element: '#graph svg>g', |
| 68 | + onShown: fixupSVGHighlighting, |
| 69 | + content: "This is a tooltip." |
| 70 | + }, |
| 71 | + { |
| 72 | + element: document.querySelectorAll('#step2')[0], |
| 73 | + content: "Ok, wasn't that fun?", |
| 74 | + position: 'right' |
| 75 | + }, |
| 76 | + { |
| 77 | + element: '#step3', |
| 78 | + content: 'More features, more fun.', |
| 79 | + position: 'left' |
| 80 | + }, |
| 81 | + { |
| 82 | + element: '#step4', |
| 83 | + content: "Another step.", |
| 84 | + position: 'bottom' |
| 85 | + }, |
| 86 | + { |
| 87 | + element: '#step5', |
| 88 | + content: 'Get it, use it.' |
| 89 | + } |
| 90 | + ] |
| 91 | + }); |
| 92 | + tour.init(); |
| 93 | + if (force_start) { |
| 94 | + tour.restart(0); |
| 95 | + } |
| 96 | + tour.start(force_start); |
| 97 | +} |
0 commit comments