Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Steemit EasyEdit
- // @namespace Steemit EasyEdit
- // @description Let's Make the Editor Great! (Again?)
- // @version 1
- // @author https://steemit.com/@bitcoiner
- // @include https://steemit.com/*
- // @grant none
- // ==/UserScript==
- var menu = document.getElementById("userscript-context-menu");
- if(!menu) {
- var menu = document.body.appendChild(document.createElement("menu"));
- menu.outerHTML = '<menu id="userscript-context-menu" type="context"><menuitem id="userscript-context-menuitem-easyedit" label="Steemit EasyEdit" icon="https://steemit.com/images/favicons/favicon-32x32.png"></menuitem></menu>';
- }
- else {
- var menuitem = menu.appendChild(document.createElement("menuitem"));
- menuitem.outerHTML = '<menuitem id="userscript-context-menuitem-easyedit" label="Steemit EasyEdit" icon="https://steemit.com/images/favicons/favicon-32x32.png"></menuitem>';
- }
- var html = document.documentElement;
- html.setAttribute("contextmenu", "userscript-context-menu");
- document.getElementById("userscript-context-menuitem-easyedit").addEventListener("click", onMenuClick, false);
- function onMenuClick() {
- setInterval(function() {
- var vframe = document.getElementsByClassName("vframe")[0];
- if(vframe) vframe.style.display = "block";
- var edit = document.getElementsByClassName("public-DraftEditor-content");
- if(edit.length) {
- if(!edit[0].hasAttribute("hasAdded")) {
- edit[0].setAttribute("hasAdded", "true");
- if(top.editorHeight) edit[0].style.height = top.editorHeight;
- else edit[0].style.height = "20em";
- edit[0].style.overflowY = "scroll";
- edit[0].style.overflowX = "auto";
- edit[0].style.resize = "vertical";
- edit[0].style.margin = "auto";
- setTimeout(function() {
- edit[0].style.margin = "";
- setTimeout(function() {
- if(top.editorScrollTop) edit[0].scrollTop = top.editorScrollTop;
- }, 20)
- }, 20);
- edit[0].onscroll = function() {
- top.editorScrollTop = this.scrollTop;
- }
- }
- top.editorHeight = edit[0].style.height;
- }
- }, 500);
- }
Advertisement
Add Comment
Please, Sign In to add comment