The code above had a bug which I somehow didn't notice since now. It forgot to insert the paragraph tag to put the toolbar in a separate page, so sometimes (in wide pages) the toolbar shows to the left of the textarea, which is ugly. The fix would be trivial: change

t.parentNode.insertBefore(l,t);
to
t.parentNode.insertBefore(p,t);
However, this is a bit ugly, because the paragraph tag adds some vertical space between the toolbar and the image, so I'll soon fix the code to add a br tag instead of a p tag.

The original node will contain the fixed code (it does now), so here's a backup copy of the old code.

<script type="text/javascript" defer><!-- function edittoolbar_help(){window.alert('Separate paragraphs with "<p +>", put "<c>".."<\x2fc>" around code or data (linebreaks inside it ar +e taken literally) and you\x27ll be okay. Don\x27t forget to check i +f the preview looks right.');} (function(){ var d=document,c="createElement",i="appendChild"; var t=d.getElementsByTagName("textarea")[0]; if(t){ var p=d[c]("p"),l=d[c]("a"),m=d[c]("img"); m.src="http://www.math.bme.hu/~ambrus/pu/edittoolbar"; m.border=0; l.href="javascript:edittoolbar_help()"; l[i](m);p[i](l); t.parentNode.insertBefore(l,t); } })(); //--></script>

In reply to Re: Javascript formatting toolbar for perlmonks by ambrus
in thread Javascript formatting toolbar for perlmonks by ambrus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.