rem: Xinha.prototype._createLink = function(link) { var editor = this; var outparam = null; if ( typeof link == "undefined" ) { link = this.getParentElement(); if ( link ) { while (link && !/^a$/i.test(link.tagName)) { link = link.parentNode; } } } if ( !link ) { var sel = editor.getSelection(); var range = editor.createRange(sel); var compare = 0; if ( Xinha.is_ie ) { if ( sel.type == "Control" ) { compare = range.length; } else { compare = range.compareEndPoints("StartToEnd", range); } } else { compare = range.compareBoundaryPoints(range.START_TO_END, range); } if ( compare === 0 ) { alert(Xinha._lc("You need to select some text before creating a link")); return; } outparam = { f_href : '', f_title : '', f_target : '', f_usetarget : editor.config.makeLinkShowsTarget }; } else { outparam = { f_href   : Xinha.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), f_title  : link.title, f_target : link.target, f_usetarget : editor.config.makeLinkShowsTarget }; } Dialog( editor.config.URIs.link, function(param) { if ( !param ) { return false; } var a = link; if ( !a ) { try { var tmp = Xinha.uniq('http: editor._doc.execCommand('createlink', false, tmp);   var anchors = editor._doc.getElementsByTagName('a'); for(var i = 0; i < anchors.length; i++) { var anchor = anchors[i]; if(anchor.href == tmp) {  if (!a) a = anchor; anchor.href =  param.f_href; if (param.f_target) anchor.target =  param.f_target; if (param.f_title)  anchor.title =  param.f_title; } } } catch(ex) {} } else { var href = param.f_href.trim(); editor.selectNodeContents(a); if ( href === '' ) { editor._doc.execCommand("unlink", false, null); editor.updateToolbar(); return false; } else { a.href = href; } } if ( ! ( a && a.tagName.toLowerCase() == 'a' ) ) { return false; } a.target = param.f_target.trim(); a.title = param.f_title.trim(); editor.selectNodeContents(a); editor.updateToolbar(); }, outparam); 
add: Xinha.prototype._createLink=function(_2){ var _3=this; var _4=null; if(typeof _2=="undefined"){ _2=this.getParentElement(); if(_2){ while(_2&&!/^a$/i.test(_2.tagName)){ _2=_2.parentNode; } } } if(!_2){ var _5=_3.getSelection(); var _6=_3.createRange(_5); var _7=0; if(Xinha.is_ie){ if(_5.type=="Control"){ _7=_6.length; }else{ _7=_6.compareEndPoints("StartToEnd",_6); } }else{ _7=_6.compareBoundaryPoints(_6.START_TO_END,_6); } if(_7===0){ alert(Xinha._lc("You need to select some text before creating a link")); return; } _4={f_href:"",f_title:"",f_target:"",f_usetarget:_3.config.makeLinkShowsTarget}; }else{ _4={f_href:Xinha.is_ie?_3.stripBaseURL(_2.href):_2.getAttribute("href"),f_title:_2.title,f_target:_2.target,f_usetarget:_3.config.makeLinkShowsTarget}; } Dialog(_3.config.URIs.link,function(_8){ if(!_8){ return false; } var a=_2; if(!a){ try{ var _a=Xinha.uniq("http: _3._doc.execCommand("createlink",false,_a); var _b=_3._doc.getElementsByTagName("a"); for(var i=0;i<_b.length;i++){ var _d=_b[i]; if(_d.href==_a){ if(!a){ a=_d; } _d.href=_8.f_href; if(_8.f_target){ _d.target=_8.f_target; } if(_8.f_title){ _d.title=_8.f_title; } } } } catch(ex){ } }else{ var _e=_8.f_href.trim(); _3.selectNodeContents(a); if(_e===""){ _3._doc.execCommand("unlink",false,null); _3.updateToolbar(); return false; }else{ a.href=_e; } } if(!(a&&a.tagName.toLowerCase()=="a")){ return false; } a.target=_8.f_target.trim(); a.title=_8.f_title.trim(); _3.selectNodeContents(a); _3.updateToolbar(); },_4); 
context: Xinha.prototype._createLink = function(link){  var editor = this;  var outparam = null;  if ( typeof link == "undefined" )  {    link = this.getParentElement();    if ( link )    {      while (link && !/^a$/i.test(link.tagName))      {        link = link.parentNode;      }    }  }  if ( !link )  {    var sel = editor.getSelection();    var range = editor.createRange(sel);    var compare = 0;    if ( Xinha.is_ie )    {      if ( sel.type == "Control" )      {        compare = range.length;      }      else      {        compare = range.compareEndPoints("StartToEnd", range);      }    }    else    {      compare = range.compareBoundaryPoints(range.START_TO_END, range);    }    if ( compare === 0 )    {      alert(Xinha._lc("You need to select some text before creating a link"));      return;    }    outparam =    {      f_href : '',      f_title : '',      f_target : '',      f_usetarget : editor.config.makeLinkShowsTarget    };  }  else  {    outparam =    {      f_href   : Xinha.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),      f_title  : link.title,      f_target : link.target,      f_usetarget : editor.config.makeLinkShowsTarget    };  }  Dialog(    editor.config.URIs.link,    function(param)    {      if ( !param )      {        return false;      }      var a = link;      if ( !a )      {        try        {          var tmp = Xinha.uniq('http://www.example.com/Link');          editor._doc.execCommand('createlink', false, tmp);          // Fix them up          var anchors = editor._doc.getElementsByTagName('a');          for(var i = 0; i < anchors.length; i++)          {            var anchor = anchors[i];            if(anchor.href == tmp)            {              // Found one.              if (!a) a = anchor;              anchor.href =  param.f_href;              if (param.f_target) anchor.target =  param.f_target;              if (param.f_title)  anchor.title =  param.f_title;            }          }        } catch(ex) {}      }      else      {        var href = param.f_href.trim();        editor.selectNodeContents(a);        if ( href === '' )        {          editor._doc.execCommand("unlink", false, null);          editor.updateToolbar();          return false;        }        else        {          a.href = href;        }      }      if ( ! ( a && a.tagName.toLowerCase() == 'a' ) )      {        return false;      }      a.target = param.f_target.trim();      a.title = param.f_title.trim();      editor.selectNodeContents(a);      editor.updateToolbar();    },    outparam);};
meta: 6015	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6015/d8776708e0e10dfa0ab6ee1d0fa9e512d8d16348/link.js/clean/packages/acs-templating/www/resources/xinha-nightly/modules/CreateLink/link.js