<?xml version="1.0"?> 
<rdf:RDF 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns="http://purl.org/rss/1.0/">  
  <channel rdf:about="http://beta.twelvestone.com/forum_thread/view/12792">
    <title>RSS: JavaScript textarea selection with mozilla</title>
    <description>Last twenty posts from JavaScript textarea selection with mozilla</description>
    <link>/forum_thread/view/12792</link>
    <items>
      <rdf:Seq>	
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#202886" />
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#202672" />
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#202526" />
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#199996" />
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#199822" />
  
        <rdf:li 
	   resource="http://twelvestone.com/forum_thread/view/12792#198838" />
  
      </rdf:Seq>      
    </items>
  </channel>  
   
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#202886">
    <title>Reply by C.J. 2004.01.12, 07:53AM</title>
    <description><![CDATA[ <blockquote class="quote-block"><em>Originally posted by StinkFist </em><br /><b><a target="_blank" href="http://droppingbombsonyourmom.com/misc/selection_demo/">http://droppingbombsonyourmom.com/misc/selection_demo/</a> </b></blockquote> <br /><br />I huge improvement over how vBulletin does it. <img alt='ThumbsUp' src='/images/smilies/thumbsup.gif' /> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#202886</link>
    <dc:date>2004-01-12T07:53:34+00:00</dc:date>
  </item>
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#202672">
    <title>Reply by mosquito 2004.01.11, 03:05PM</title>
    <description><![CDATA[ i'm so stealing all of this code.  all of it i say!!!!!!<br /><br /><img alt='big grin' src='/images/smilies/biggrin.gif' /> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#202672</link>
    <dc:date>2004-01-11T15:05:18+00:00</dc:date>
  </item>
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#202526">
    <title>Reply by StinkFist 2004.01.11, 12:10AM</title>
    <description><![CDATA[ I still haven't worked on a Safari version but here's an example of the above code <br /><br /><a target="_blank" href="http://droppingbombsonyourmom.com/misc/selection_demo/">http://droppingbombsonyourmom.com/misc/selection_demo/</a> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#202526</link>
    <dc:date>2004-01-11T00:10:53+00:00</dc:date>
  </item>
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#199996">
    <title>Reply by StinkFist 2004.01.05, 07:44PM</title>
    <description><![CDATA[ :shakesfist:<br /><br /><img alt='big grin' src='/images/smilies/biggrin.gif' /><br /><br />I'll post an update when I get it to work <img alt='wink' src='/images/smilies/wink.gif' /> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#199996</link>
    <dc:date>2004-01-05T19:44:27+00:00</dc:date>
  </item>
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#199822">
    <title>Reply by arigato 2004.01.05, 03:50PM</title>
    <description><![CDATA[ All I know is that it doesn't seem to work in Safari.<br /><img alt='big grin' src='/images/smilies/biggrin.gif' /> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#199822</link>
    <dc:date>2004-01-05T15:50:45+00:00</dc:date>
  </item>
  
  <item rdf:about="http://twelvestone.com/forum_thread/view/12792#198838">
    <title>Reply by StinkFist 2004.01.02, 12:12AM</title>
    <description><![CDATA[ Ok, I'm sure you've seen the boards that allow you to select a bit of text and then wrap it in bbcode by pressing a button.<br /><br />(ours doesn't work that way <img alt='smile' src='/images/smilies/smile.gif' />). <br /><br />Well it's trivial to do it in IE but trying to make it moz compatable is a fucking pain. I finally figured out how to do this by searching the moz bugzilla list and incorporating some of the code used as an example in one of the bug fixes<br /><br />Here's the library to manipulate text selections:<br /><div class="code-block"><pre><br />//--------------------------------------------<br />// MOZILLA TEXT SELECTION LIBRARY<br />//--------------------------------------------<br />function moz_getSelectionStart(element) {<br />	var startpos = 0;<br />	startpos = element.selectionStart;<br />	return startpos;<br />}<br /><br />function moz_getSelectionEnd(element) {<br />	var endpos = 0;<br />	endpos = element.selectionEnd; <br />	return endpos;<br /><br />}<br /><br />function moz_setSelectionStart(element,newposition) {<br />	element.selectionStart = newposition; <br />}<br /><br /><br />function moz_setSelectionEnd(element,newposition) {<br />	element.selectionEnd = newposition; <br />}<br /><br />function moz_setSelection(element,newstart,newend) {<br />	setSelectionStart(element,newstart);<br />	setSelectionEnd(element,newend);<br />}<br /><br />// Inserts a string at a given position<br />function moz_stringInsert(DOMEle,newtext,newpos) {<br />	DOMEle.value = DOMEle.value.slice(0,newpos) + newtext + DOMEle.value.slice(newpos);<br />}<br /><br /></pre></div><br /><br />and here's the code for actually inserting the tag:<br /><br /><div class="code-block"><pre><br />function moz_markSelected(element,tag) {<br />	var startTag = "[" + tag + "]";<br />	var endTag	 = "[/" + tag + "]";<br />	var firstPos = moz_getSelectionStart(element);<br />	 // we're inserting one at a time<br />        var secondPos = moz_getSelectionEnd(element)+ startTag.length;<br />	moz_stringInsert(element,startTag,firstPos);<br />	moz_stringInsert(element,endTag,secondPos);<br />	<br />	// reset focus... after the first tag and before the second <br />	moz_setSelectionStart(element,firstPos + startTag.length);<br />	moz_setSelectionEnd(element,secondPos);<br />	element.focus();	<br />}<br /></pre></div><br /><br />obviously this only works for simple wrapper tags but it could be expanded for font-size, etc... tags as well.<br /><br />Just thought I'd share since it drove me fucking crazy for a while <img alt='smile' src='/images/smilies/smile.gif' /> ]]></description>
    <link>http://beta.twelvestone.com/forum_thread/view/12792#198838</link>
    <dc:date>2004-01-02T00:12:35+00:00</dc:date>
  </item>
  
  
</rdf:RDF>
