mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
#18456985 * 자동링크 애드온 리소스 과다 사용 및 중복처리 문제 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6969 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7b22e31bf5
commit
038ee6c4f2
1 changed files with 19 additions and 7 deletions
|
|
@ -31,6 +31,7 @@
|
|||
},
|
||||
API_AUTOLINK : function(oSender, params) {
|
||||
var textNode = params[0];
|
||||
if(!$(textNode).parent().length || $(textNode).parent().get(0).nodeName.toLowerCase() == 'a') return;
|
||||
var content = textNode.nodeValue;
|
||||
var dummy = $('<span>');
|
||||
|
||||
|
|
@ -44,20 +45,31 @@
|
|||
},
|
||||
extractTargets : function(obj) {
|
||||
var thisPlugin = this;
|
||||
var wrap = $('.xe_content', obj);
|
||||
if(wrap.length) {
|
||||
this.extractTargets(wrap);
|
||||
return;
|
||||
}
|
||||
|
||||
$(obj)
|
||||
.contents()
|
||||
.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?
|
||||
url_regex.exec('');
|
||||
|
||||
if (!$(this).is('a,pre,xml,code,script,style,:input')) {
|
||||
if (this.nodeType == 3 && url_regex.test(this.nodeValue)) { // text node
|
||||
thisPlugin.targets.push(this);
|
||||
} else {
|
||||
|
||||
thisPlugin.extractTargets(this);
|
||||
}
|
||||
if(this.nodeType == 3) { // 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);
|
||||
} else {
|
||||
thisPlugin.extractTargets(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue