Skip to content

Instantly share code, notes, and snippets.

@stranger-danger-zamu
Last active September 2, 2020 17:17
Show Gist options
  • Save stranger-danger-zamu/b2e467c34adf0f6becce42bf47d74592 to your computer and use it in GitHub Desktop.
Save stranger-danger-zamu/b2e467c34adf0f6becce42bf47d74592 to your computer and use it in GitHub Desktop.
CHYOA Story Map rendering fix.
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