mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Use JS shortcut for interactive tutorial breadcrumbs
This commit is contained in:
19
assets/js/interactive-tutorial.js
Normal file
19
assets/js/interactive-tutorial.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// Helper functions for interactive tutorials
|
||||
|
||||
function slugify(s) {
|
||||
const unacceptable_chars = /[^A-Za-z0-9._ ]+/
|
||||
const whitespace_regex = /\s+/
|
||||
s = s.replace(unacceptable_chars, "")
|
||||
s = s.replace(whitespace_regex, "_")
|
||||
s = s.toLowerCase()
|
||||
if (!s) {
|
||||
s = "_"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
function complete_step(step_name) {
|
||||
const step_id = slugify(step_name)
|
||||
$(".bc-"+step_id).removeClass("active").addClass("done")
|
||||
$(".bc-"+step_id).next().removeClass("disabled").addClass("active")
|
||||
}
|
||||
Reference in New Issue
Block a user