diff options
author | Tom Glenne <tom@kyber.io> | 2016-11-10 18:38:17 +0100 |
---|---|---|
committer | Tom Glenne <tom@kyber.io> | 2016-11-10 18:38:17 +0100 |
commit | 207a7314500c230200df6ec43fb189dadfbd1f2b (patch) | |
tree | 12631354e6881744a388d14f7557a17693c83ce3 /ukulele.js | |
parent | 5627d10173276176f5c5ed0a57a4d0548852b345 (diff) | |
download | ukulele-207a7314500c230200df6ec43fb189dadfbd1f2b.tar.xz |
litt bugfixes, endring av bilde fra @ til {} og la til ~small~ i ukulele.js
Diffstat (limited to 'ukulele.js')
-rw-r--r-- | ukulele.js | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -7,8 +7,7 @@ function insert(text) { t.value = t.value.substring(0, pos) + text + t.value.substring(end, t.value.length); } t.focus(); - var cpos = t.selectionStart; - t.setSelectionRange(cpos, cpos); + t.setSelectionRange(pos + text.length, pos + text.length); } function wrap(prefix, postfix) { @@ -22,7 +21,7 @@ function wrap(prefix, postfix) { t.value = t.value.substring(0, pos) + prefix + t.value.substring(pos, end) + postfix + t.value.substring(end, t.value.length); } t.focus(); - var cpos = t.selectionEnd + prefix.length + postfix.length; + var cpos = end + prefix.length + postfix.length; t.setSelectionRange(cpos, cpos); } @@ -73,6 +72,10 @@ function marxup_italics(e) { wrap("_", "_"); } +function marxup_small(e) { + wrap("~", "~"); +} + function marxup_link(e) { wrap("[", "]"); } @@ -94,7 +97,7 @@ function button(node, html, fun) { } function orz(src) { - insert("\n@" + src.replace(".t.jpg", "") + "\n"); + insert(" {" + src.replace(".t.jpg", "") + "} "); } document.addEventListener("DOMContentLoaded", function(e) { @@ -123,6 +126,7 @@ document.addEventListener("DOMContentLoaded", function(e) { button(orz, "[lenke]", marxup_link); button(orz, "<i>_kursiv_</i>", marxup_italics); button(orz, "<b>*fet*</b>", marxup_bold); + button(orz, "<small>liten</small>", marxup_small); button(orz, "= overskrift", marxup_header); } }); |