#18456985 * 자동링크 애드온 리소스 과다 사용 및 중복처리 문제 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6969 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
bnu 2009-11-25 01:48:22 +00:00
parent 7b22e31bf5
commit 038ee6c4f2

View file

@ -31,6 +31,7 @@
}, },
API_AUTOLINK : function(oSender, params) { API_AUTOLINK : function(oSender, params) {
var textNode = params[0]; var textNode = params[0];
if(!$(textNode).parent().length || $(textNode).parent().get(0).nodeName.toLowerCase() == 'a') return;
var content = textNode.nodeValue; var content = textNode.nodeValue;
var dummy = $('<span>'); var dummy = $('<span>');
@ -44,21 +45,32 @@
}, },
extractTargets : function(obj) { extractTargets : function(obj) {
var thisPlugin = this; var thisPlugin = this;
var wrap = $('.xe_content', obj);
if(wrap.length) {
this.extractTargets(wrap);
return;
}
$(obj) $(obj)
.contents() .contents()
.each(function(){ .each(function(){
var node_name = this.nodeName.toLowerCase();
if($.inArray(node_name, ['a', 'pre', 'xml', 'textarea', 'input', 'select', 'option', 'code', 'script', 'style', 'iframe', 'button', 'img', 'embed', 'object', 'ins']) != -1) return;
// FIX ME : When this meanless code wasn't executed, url_regex do not run correctly. why? // FIX ME : When this meanless code wasn't executed, url_regex do not run correctly. why?
url_regex.exec(''); url_regex.exec('');
if (!$(this).is('a,pre,xml,code,script,style,:input')) { if(this.nodeType == 3) { // text node
if (this.nodeType == 3 && url_regex.test(this.nodeValue)) { // text node var content = this.nodeValue;
if(content.length < 5) return;
if(!/(http|https|ftp|news|telnet|irc):\/\//i.test(content)) return;
thisPlugin.targets.push(this); thisPlugin.targets.push(this);
} else { } else {
thisPlugin.extractTargets(this); thisPlugin.extractTargets(this);
} }
}
}); });
} }
}); });