function loadShepherd(f) { var theme = 'shepherd-theme-' + ($('body').hasClass('dark') ? 'dark' : 'default'); lichess.loadCss('vendor/' + theme + '.css'); lichess.loadScript('vendor/shepherd/dist/js/tether.js', { noVersion: true }).then(function () { lichess.loadScript('vendor/shepherd/dist/js/shepherd.min.js', { noVersion: true }).then(function () { f(theme); }); }); } lichess.studyTourChapter = function (study) { loadShepherd(function (theme) { var onTab = function (tab) { return { 'before-show': function () { study.setTab(tab); }, }; }; var tour = new Shepherd.Tour({ defaults: { classes: theme, scrollTo: false, showCancelLink: true, }, }); [ { title: "Let's create a study chapter", text: 'A study can have several chapters.
' + 'Each chapter has a distinct move tree,
' + 'and can be created in various ways.', attachTo: '#modal-wrap label[for=chapter-name] left', }, { title: 'From initial position', text: 'Just a board setup for a new game.
' + 'Suited to explore openings.', attachTo: '#modal-wrap .tabs-horiz .init top', when: onTab('init'), }, { title: 'Custom position', text: 'Setup the board your way.
' + 'Suited to explore endgames.', attachTo: '#modal-wrap .tabs-horiz .edit bottom', when: onTab('edit'), }, { title: 'Load an existing lichess game', text: 'Paste a lichess game URL
' + '(like lichess.org/7fHIU0XI)
' + 'to load the game moves in the chapter.', attachTo: '#modal-wrap .tabs-horiz .game top', when: onTab('game'), }, { title: 'From a FEN string', text: 'Paste a position in FEN format
' + '4k3/4rb2/8/7p/8/5Q2/1PP5/1K6 w
' + 'to start the chapter from a position.', attachTo: '#modal-wrap .tabs-horiz .fen top', when: onTab('fen'), }, { title: 'From a PGN game', text: 'Paste a game in PGN format.
' + 'to load moves, comments and variations in the chapter.', attachTo: '#modal-wrap .tabs-horiz .pgn top', when: onTab('pgn'), }, { title: 'Studies support variants', text: 'Yes, you can study crazyhouse,
' + 'and all lichess variants!', attachTo: '#modal-wrap label[for=chapter-variant] left', when: onTab('init'), }, { title: 'Thanks for your time', text: 'Chapters are saved forever.
' + 'Have fun organizing your chess content!', buttons: [ { text: 'Done', action: tour.next, }, ], attachTo: '#modal-wrap .help bottom', }, ].forEach(function (s) { tour.addStep(s.title, s); }); tour.start(); }); };