Last active
September 2, 2020 17:17
-
-
Save stranger-danger-zamu/b2e467c34adf0f6becce42bf47d74592 to your computer and use it in GitHub Desktop.
CHYOA Story Map rendering fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.from(document.querySelectorAll('.story-map-chapter')).forEach(x=>{ | |
if (x.dataset.adjusted_indent) { | |
return | |
} | |
margin = x.style['margin-left']; | |
indent = parseInt(margin.replace('px','')) / 30 | |
margin = `${Math.min(indent, document.body.clientWidth - 300 - Math.min(indent, 200 ))}px`; | |
x.style['margin-left'] = margin; | |
x.style['min-width'] = '500px'; | |
x.dataset.adjusted_indent = true; | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment