Skip to content

Instantly share code, notes, and snippets.

@ianpark
Created October 4, 2017 21:59
Show Gist options
  • Save ianpark/c033e91c26048427c7c00ebb3ed16a6f to your computer and use it in GitHub Desktop.
Save ianpark/c033e91c26048427c7c00ebb3ed16a6f to your computer and use it in GitHub Desktop.
Reform the Steemit's posting UI
if (typeof window.reform_loop == 'undefined') {
window.reform_loop = setInterval(
function nice_viewer() {
var vframe, pbox, fbox, tbox;
try {
vframe = document.querySelectorAll('.vframe')[0];
pbox = vframe.querySelectorAll('.Preview')[0];
fbox = vframe.querySelectorAll('.ReplyEditor__body')[0];
tbox = fbox.getElementsByTagName('textarea')[0];
try {
document.querySelectorAll('.ReplyEditor')[0].className = "";
} catch (err) {
}
} catch(err) {
return;
}
if (!pbox.style.position) {
vframe.style.position = "relative";
tbox.style.height = "500px";
tbox.style.width = "50%";
pbox.style.position = "absolute";
pbox.style.right = "0px";
pbox.style.top = "50px";
pbox.style.overflowY = "scroll";
}
var frame_size = fbox.getBoundingClientRect();
var tbox_size = tbox.getBoundingClientRect();
var new_width = frame_size.width - tbox_size.width - 10;
var new_height = tbox_size.height - 10;
pbox.style.width = new_width + "px";
pbox.style.maxHeight = new_height + "px";
},
500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment