diff --git a/static/js/BookPage.jsx b/static/js/BookPage.jsx index d1dbc9db18..45510f6567 100644 --- a/static/js/BookPage.jsx +++ b/static/js/BookPage.jsx @@ -701,6 +701,7 @@ class JaggedArrayNode extends Component { const offset = this.props.schema?.index_offsets_by_depth?.['1'] || 0; if ("toc_zoom" in this.props.schema) { let zoom = this.props.schema.toc_zoom - 1; + const zoomedOutRef = this.props.currentlyVisibleSectionRef && Sefaria.zoomOutRef(this.props.currentlyVisibleSectionRef); return (); } diff --git a/static/js/sefaria/sefaria.js b/static/js/sefaria/sefaria.js index 851e388500..eeeef0828a 100644 --- a/static/js/sefaria/sefaria.js +++ b/static/js/sefaria/sefaria.js @@ -292,6 +292,10 @@ Sefaria = extend(Sefaria, { return oref ? oref.sectionRef : null; }, + zoomOutRef: function(ref, zoom=1) { + const humanRefForm = Sefaria.humanRef(ref); + return humanRefForm.split(":").slice(0, -zoom).join(":"); + }, splitSpanningRefNaive: function(ref){ if (ref.indexOf("-") == -1) { return ref; } return ref.split("-");