--- /dev/null
+
+(function(){tinymce.create('tinymce.plugins.LinkAutoDetect',{init:function(ed,url){var t=this;t.RE_email=/^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i;t.RE_url=/^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?$/i;ed.onKeyPress.add(t.onKeyPress,t);ed.onKeyUp.add(t.onKeyUp,t);},getInfo:function(){return{longname:'Link Auto Detect',author:'Ubernote/Shane Tomlinson',authorurl:'http://www.ubernote.com',infourl:'http://www.ubernote.com',version:'0.2'};},onKeyPress:function(ed,ev,o){if(tinymce.isIE){return;}
+var s=ed.selection.getSel();var textNode=s.anchorNode;var createLink=function(searchfor,hlink,midStart){var leftText=textNode;var rightText=leftText.splitText(s.anchorOffset);var midText=leftText.splitText(midStart);var midEnd=midText.data.search(searchfor);if(midEnd!=-1){rightText=midText.splitText(midEnd);}
+var tag=ed.dom.create('a',{href:hlink},midText.data);var a=midText.parentNode.insertBefore(tag,rightText);s.collapse(rightText,0);ed.dom.remove(midText);};if((ev.which==13||ev.which==32)&&textNode.nodeType==3&&textNode.data.length>3&&textNode.data.indexOf('.')>=0&&!ed.dom.getParent(textNode,'a')){var midStart=textNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);if(midStart!=-1){var matchData=textNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,'$1');var matchURL=matchData.match(this.RE_url);var matchEmail=matchData.match(this.RE_email);if(matchEmail){createLink(/[^a-zA-Z0-9\.@_\-]/,'mailto:'+matchEmail[0],midStart);}
+else if(matchURL){createLink(/[^a-zA-Z0-9\._\-\/\&\?#=:@]/,(matchURL[1]?'':'http://')+matchURL[0],midStart);}}}},onKeyUp:function(ed,ev,o){if(tinymce.isIE){return;}
+var s=ed.selection.getSel();var textNode=s.anchorNode;var a=ed.dom.getParent(textNode,'a');if(!(ev.which&&(ev.which==13||ev.which==32))&&(ev.which||ev.keyCode==8||ev.keyCode==46)&&(textNode.nodeType==3)&&(a)){var matchEmail=s.anchorNode.data.match(this.RE_email);var matchURL=textNode.data.match(this.RE_url);if(matchEmail){ed.dom.setAttrib(a,'href','mailto:'+textNode.data);}
+if(matchURL){ed.dom.setAttrib(a,'href',(matchURL[1]?'':'http://')+matchURL[0]);}}}});tinymce.PluginManager.add('linkautodetect',tinymce.plugins.LinkAutoDetect);})();
\ No newline at end of file
--- /dev/null
+/**\r
+ * $Id: editor_plugin_src.js 2009-05-10\r
+ *\r
+ * @author Ubernote/Shane Tomlinson\r
+ * http://www.ubernote.com\r
+ * set117@gmail.com\r
+ *\r
+ * Detect emails and urls as they are typed in Mozilla/Safari/Chrome and Opera\r
+ * Borrowed from both Typo3 http://typo3.org/ and Xinha http://xinha.gogo.co.nz/\r
+ * Heavily modified and cleaned up.\r
+ * \r
+ * Original license info from Xinha at the bottom.\r
+ */\r
+\r
+(function() {\r
+ tinymce.create('tinymce.plugins.LinkAutoDetect', {\r
+ init : function(ed, url) {\r
+ var t = this;\r
+ t.RE_email = /^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$/i;\r
+ t.RE_url = /^((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-z][a-z0-9_]*)?$/i;\r
+ ed.onKeyPress.add( t.onKeyPress, t );\r
+ ed.onKeyUp.add( t.onKeyUp, t );\r
+ },\r
+ \r
+ getInfo : function() {\r
+ return {\r
+ longname : 'Link Auto Detect',\r
+ author : 'Ubernote/Shane Tomlinson',\r
+ authorurl : 'http://www.ubernote.com',\r
+ infourl : 'http://www.ubernote.com',\r
+ version : '0.2'\r
+ };\r
+ },\r
+ \r
+ onKeyPress : function(ed, ev, o) {\r
+ if(tinymce.isIE) { \r
+ // IE already does auto-detect, so no worries.\r
+ return;\r
+ } // end if\r
+ \r
+ var s = ed.selection.getSel();\r
+ var textNode = s.anchorNode;\r
+ \r
+ var createLink = function (searchfor, hlink, midStart) {\r
+ var leftText = textNode;\r
+ var rightText = leftText.splitText(s.anchorOffset);\r
+ var midText = leftText.splitText(midStart);\r
+ var midEnd = midText.data.search(searchfor);\r
+ if (midEnd != -1) {\r
+ rightText = midText.splitText(midEnd);\r
+ } // end if\r
+ var tag = ed.dom.create('a', { href: hlink }, midText.data);\r
+ var a = midText.parentNode.insertBefore(tag, rightText);\r
+ \r
+ // We are going to put the cursor into the first position after\r
+ // the anchor and let the browser take care of inserting the space/enter.\r
+ s.collapse(rightText, 0);\r
+ ed.dom.remove(midText);\r
+ };\r
+ \r
+ // Space or Enter, see if the text just typed looks like a URL, or email address and link it accordingly\r
+ if((ev.which == 13 || ev.which == 32) \r
+ && textNode.nodeType == 3 && textNode.data.length > 3 \r
+ && textNode.data.indexOf('.') >= 0 && !ed.dom.getParent(textNode, 'a')) {\r
+ var midStart = textNode.data.substring(0,s.anchorOffset).search(/\S{4,}$/);\r
+ if(midStart != -1) {\r
+ var matchData = textNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/, '$1');\r
+ var matchURL = matchData.match(this.RE_url);\r
+ var matchEmail = matchData.match(this.RE_email);\r
+ if(matchEmail) {\r
+ createLink(/[^a-zA-Z0-9\.@_\-]/, 'mailto:' + matchEmail[0], midStart);\r
+ }\r
+ else if(matchURL) {\r
+ createLink( /[^a-zA-Z0-9\._\-\/\&\?#=:@]/, (matchURL[1] ? '' : 'http://') + matchURL[0], midStart);\r
+ }\r
+ } // end if\r
+ }\r
+ },\r
+ \r
+ onKeyUp : function(ed, ev, o) {\r
+ if(tinymce.isIE) { \r
+ // IE already does auto-detect, so no worries.\r
+ return;\r
+ } // end if\r
+ \r
+ var s = ed.selection.getSel();\r
+ var textNode = s.anchorNode;\r
+ var a = ed.dom.getParent(textNode, 'a');\r
+ \r
+ if( ! (ev.which && ( ev.which == 13 || ev.which == 32)) \r
+ && (ev.which || ev.keyCode == 8 || ev.keyCode == 46)\r
+ && (textNode.nodeType == 3) && (a)) {\r
+ // See if we might be changing a link\r
+ var matchEmail = s.anchorNode.data.match(this.RE_email);\r
+ var matchURL = textNode.data.match(this.RE_url);\r
+ if(matchEmail) {\r
+ ed.dom.setAttrib(a, 'href', 'mailto:' + textNode.data);\r
+ } // end if\r
+ if(matchURL) {\r
+ ed.dom.setAttrib(a, 'href', (matchURL[1] ? '' : 'http://') + matchURL[0]);\r
+ } // end if\r
+ } // end if\r
+ }\r
+ });\r
+\r
+ // Register plugin\r
+ tinymce.PluginManager.add('linkautodetect', tinymce.plugins.LinkAutoDetect);\r
+})();\r
+\r
+/*\r
+htmlArea License (based on BSD license)\r
+Copyright (c) 2002-2004, interactivetools.com, inc.\r
+Copyright (c) 2003-2004 dynarch.com\r
+All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+\r
+1) Redistributions of source code must retain the above copyright notice,\r
+ this list of conditions and the following disclaimer.\r
+\r
+2) Redistributions in binary form must reproduce the above copyright notice,\r
+ this list of conditions and the following disclaimer in the documentation\r
+ and/or other materials provided with the distribution.\r
+\r
+3) Neither the name of interactivetools.com, inc. nor the names of its\r
+ contributors may be used to endorse or promote products derived from this\r
+ software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGE.\r
+*/
\ No newline at end of file