1 line
125 KiB
JavaScript
1 line
125 KiB
JavaScript
|
|
if(typeof window!="undefined"&&typeof window.nhn=="undefined"){window.nhn={};}if(typeof window!="undefined"){if(typeof window.jindo=="undefined"){window.jindo={};}}else{if(!jindo){jindo={};}}jindo.$Jindo=function(){var cl=arguments.callee;var cc=cl._cached;if(cc){return cc;}if(!(this instanceof cl)){return new cl();}if(!cc){cl._cached=this;}this.version="1.5.2";};jindo.$=function(sID){var ret=[],arg=arguments,nArgLeng=arg.length,lastArgument=arg[nArgLeng-1],doc=document,el=null;var reg=/^<([a-z]+|h[1-5])>$/i;var reg2=/^<([a-z]+|h[1-5])(\s+[^>]+)?>/i;if(nArgLeng>1&&typeof lastArgument!="string"&&lastArgument.body){arg=Array.prototype.slice.apply(arg,[0,nArgLeng-1]);doc=lastArgument;}for(var i=0;i<nArgLeng;i++){el=arg[i];if(typeof el=="string"){el=el.replace(/^\s+|\s+$/g,"");if(el.indexOf("<")>-1){if(reg.test(el)){el=doc.createElement(RegExp.$1);}else{if(reg2.test(el)){var p={thead:"table",tbody:"table",tr:"tbody",td:"tr",dt:"dl",dd:"dl",li:"ul",legend:"fieldset",option:"select"};var tag=RegExp.$1.toLowerCase();var ele=jindo._createEle(p[tag],el,doc);for(var i=0,leng=ele.length;i<leng;i++){ret.push(ele[i]);}el=null;}}}else{el=doc.getElementById(el);}}if(el){ret[ret.length]=el;}}return ret.length>1?ret:(ret[0]||null);};jindo._createEle=function(sParentTag,sHTML,oDoc,bWantParent){var sId="R"+new Date().getTime()+parseInt(Math.random()*100000,10);var oDummy=oDoc.createElement("div");switch(sParentTag){case"select":case"table":case"dl":case"ul":case"fieldset":oDummy.innerHTML="<"+sParentTag+' class="'+sId+'">'+sHTML+"</"+sParentTag+">";break;case"thead":case"tbody":case"col":oDummy.innerHTML="<table><"+sParentTag+' class="'+sId+'">'+sHTML+"</"+sParentTag+"></table>";break;case"tr":oDummy.innerHTML='<table><tbody><tr class="'+sId+'">'+sHTML+"</tr></tbody></table>";break;default:oDummy.innerHTML='<div class="'+sId+'">'+sHTML+"</div>";break;}var oFound;for(oFound=oDummy.firstChild;oFound;oFound=oFound.firstChild){if(oFound.className==sId){break;}}return bWantParent?oFound:oFound.childNodes;};jindo.$Class=function(oDef){function typeClass(){var t=this;var a=[];var superFunc=function(m,superClass,func){if(m!="constructor"&&func.toString().indexOf("$super")>-1){var funcArg=func.toString().replace(/function\s*\(([^\)]*)[\w\W]*/g,"$1").split(",");var funcStr=func.toString().replace(/function[^{]*{/,"").replace(/(\w|\.?)(this\.\$super|this)/g,function(m,m2,m3){if(!m2){return m3+".$super";}return m;});funcStr=funcStr.substr(0,funcStr.length-1);func=superClass[m]=eval("false||function("+funcArg.join(",")+"){"+funcStr+"}");}return function(){var f=this.$this[m];var t=this.$this;var r=(t[m]=func).apply(t,arguments);t[m]=f;return r;};};while(typeof t._$superClass!="undefined"){t.$super=new Object;t.$super.$this=this;for(var x in t._$superClass.prototype){if(t._$superClass.prototype.hasOwnProperty(x)){if(typeof this[x]=="undefined"&&x!="$init"){this[x]=t._$superClass.prototype[x];}if(x!="constructor"&&x!="_$superClass"&&typeof t._$superClass.prototype[x]=="function"){t.$super[x]=superFunc(x,t._$superClass,t._$superClass.prototype[x]);}else{t.$super[x]=t._$superClass.prototype[x];}}}if(typeof t.$super.$init=="function"){a[a.length]=t;}t=t.$super;}for(var i=a.length-1;i>-1;i--){a[i].$super.$init.apply(a[i].$super,arguments);}if(typeof this.$init=="function"){this.$init.apply(this,arguments);}}if(typeof oDef.$static!="undefined"){var i=0,x;for(x in oDef){if(oDef.hasOwnProperty(x)){x=="$static"||i++;}}for(x in oDef.$static){if(oDef.$static.hasOwnProperty(x)){typeClass[x]=oDef.$static[x];}}if(!i){return oDef.$static;}delete oDef.$static;}typeClass.prototype=oDef;typeClass.prototype.constructor=typeClass;typeClass.extend=jindo.$Class.extend;return typeClass;};jindo.$Class.extend=function(superClass){if(typeof superClass=="undefined"||superClass===null||!superClass.extend){throw new Error("extend시 슈퍼 클래스는 Class여야 합니다.");}this.prototype._$superClass=superClass;for(var x in superClass){if(superClass.hasOwnProperty(x)){if(x=="prototype"){continue;}this[x]=superClass[x];}}return this;};jindo.$$=jindo.cssquery=(function(){var sV
|