* Lordeagle When I first read this thread I was too busy to participate, infact I could not even relax to read the code. After going through it last night I felt like contributing, though it's such a wonderful job credits to the author. While trying the code I found out that once you select any of the text formating or any the similes and the tag function executes the input field loses focus, which means that the user has to scroll down and click the text area again in other to continue typing. I don't know if someone else noticed this cus I tested it from mobile using firefox(android). I think adding location.hash and target.focus will make more sense...just thinking o.
2017-01-18 05:36 · (0)
* Graham * Lordeagle I have fixed the focus issue by adding
at the end of both functions
I will test with the location.hash but it can cause undesired effects on larger screens (xt chat function has this issue)
Various mobile browsers have one issue or another with this script
in my opera emulator the 'wrap selection' part does not work due to operas text editor
function tag(text1, text2) {
    if ((document.selection)) {
      document.post.document.selection.createRange().text = text1+document.post.document.selection.createRange().text+text2;
    else if(document.forms['post'].elements['__xtblog_msg'].selectionStart!=undefined) {
      var element = document.forms['post'].elements['__xtblog_msg'];
      var str = element.value;
      var start = element.selectionStart;
      var length = element.selectionEnd - element.selectionStart;
      element.value = str.substr(0, start) + text1 + str.substr(start, length) + text2 + str.substr(start + length);
    else {
      document.post.__xtblog_msg.value += text1+text2;
 document.forms['post'].elements['__xtblog_msg'].focus(); }
  function show_sml(elem) {
    obj = document.getElementById(elem);
    if( obj.style.display == "none" ) {
      obj.style.display = "block";
    else {
      obj.style.display = "none";
 document.forms['post'].elements['__xtblog_msg'].focus(); }

Copy code
2017-01-24 11:25 (edited 2017-01-24 12:10 by Graham ) · (0)
* Lordeagle * Graham Nice one, I hope that helps.
2017-01-24 16:26 · (0)

Online: Guests: 1