Changeset View
Changeset View
Standalone View
Standalone View
assets/src/bundles/guided_tour/index.js
Show All 11 Lines | |||||
import {disableScrolling, enableScrolling} from 'utils/scrolling'; | import {disableScrolling, enableScrolling} from 'utils/scrolling'; | ||||
let guidedTour = []; | let guidedTour = []; | ||||
let tour = null; | let tour = null; | ||||
let previousElement = null; | let previousElement = null; | ||||
// we use a origin available both in production and swh-web tests | // we use a origin available both in production and swh-web tests | ||||
// environment to ease tour testing | // environment to ease tour testing | ||||
const originUrl = 'https://github.com/memononen/libtess2'; | const originUrl = 'https://github.com/memononen/libtess2'; | ||||
// sha1 for the content used | |||||
const contentSha1 = 'sha1_git:2d4e23bf1d3f64c1e8b94622178e18d89c653de0'; | |||||
function openSWHIDsTabBeforeNextStep() { | function openSWHIDsTabBeforeNextStep() { | ||||
window.scrollTo(0, 0); | window.scrollTo(0, 0); | ||||
if (!$('#swh-identifiers').tabSlideOut('isOpen')) { | if (!$('#swh-identifiers').tabSlideOut('isOpen')) { | ||||
$('.introjs-helperLayer, .introjs-tooltipReferenceLayer').hide(); | $('.introjs-helperLayer, .introjs-tooltipReferenceLayer').hide(); | ||||
$('#swh-identifiers').tabSlideOut('open'); | $('#swh-identifiers').tabSlideOut('open'); | ||||
setTimeout(() => { | setTimeout(() => { | ||||
$('.introjs-helperLayer, .introjs-tooltipReferenceLayer').show(); | $('.introjs-helperLayer, .introjs-tooltipReferenceLayer').show(); | ||||
Show All 31 Lines | guidedTour = [ | ||||
// open SWHIDs tab before its tour step | // open SWHIDs tab before its tour step | ||||
if (targetElement && targetElement.id === 'swh-identifiers') { | if (targetElement && targetElement.id === 'swh-identifiers') { | ||||
return openSWHIDsTabBeforeNextStep(); | return openSWHIDsTabBeforeNextStep(); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
}, | }, | ||||
{ | { | ||||
url: `${Urls.browse_origin_content()}?origin_url=${originUrl}&path=Example/example.c`, | url: `${Urls.browse_content(contentSha1)}?origin_url=${originUrl}`, | ||||
anlambert: Why did you not use `${Urls.browse_content()}?origin_url=${originUrl}&path=Example/example.c`… | |||||
Done Inline ActionsThis is going to an infinite redirect loop without the contentSha1. It is because the js wrapper function that controls the guided tour page is not designed to work with server redirects. It will restart the js script each time it reloads and continue the loop. jayeshv: This is going to an infinite redirect loop without the contentSha1. It is because the js… | |||||
Not Done Inline ActionsJust figured that out too, let's keep it that way then. anlambert: Just figured that out too, let's keep it that way then. | |||||
introJsOptions: { | introJsOptions: { | ||||
steps: guidedTourSteps.browseContent | steps: guidedTourSteps.browseContent | ||||
}, | }, | ||||
onBeforeChange: function(targetElement) { | onBeforeChange: function(targetElement) { | ||||
const lineNumberStart = 11; | const lineNumberStart = 11; | ||||
const lineNumberEnd = 17; | const lineNumberEnd = 17; | ||||
if (targetElement && $(targetElement).hasClass('swhid')) { | if (targetElement && $(targetElement).hasClass('swhid')) { | ||||
return openSWHIDsTabBeforeNextStep(); | return openSWHIDsTabBeforeNextStep(); | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |
Why did you not use ${Urls.browse_content()}?origin_url=${originUrl}&path=Example/example.c here ?