1function JCommentsEvents(){} 2function JCommentsInput(){} 3function JCommentsIndicator(){this.init();} 4function JCommentsForm(id,editor){this.init(id,editor);} 5function JCommentsEditor(textarea,resizable){this.init(textarea,resizable);} 6function JComments(oi,og,r){this.init(oi,og,r);} 7 8JCommentsEvents.prototype = { 9 add: function(o,e,f){if(o.addEventListener){o.addEventListener(e,f,false);return true;}else if(o.attachEvent){return o.attachEvent("on"+e,f);}else{return false;}}, 10 remove: function(o,e,f){if(o.removeEventListener){o.removeEventListener(e,f,false);}else if(o.detachEvent){o.detachEvent( "on"+e,o[e+f] );o[e+f]=null;o["e"+e+f]=null;}}, 11 cancel: function(e){if(e.stopPropagation){e.cancelBubble=true;e.preventDefault();e.stopPropagation();}e.returnValue=false;return false;}, 12 target: function(e){var t;if(!e)e=window.event;if(e.target)t=e.target;else if(e.srcElement)t=e.srcElement;if(t.nodeType==3)t=t.parentNode;return t;} 13}; 14 15JCommentsInput.prototype = { 16 register: function(el){if(el){var th=this,events=new JCommentsEvents();events.add(el,'focus',function(e){return th.onFocus(e);});events.add(el,'blur',function(e){return th.onBlur(e);});}}, 17 unregister: function(el){if(el){var th=this,events=new JCommentsEvents();events.remove(el,'focus',function(e){return th.onFocus(e);});events.remove(el,'blur',function(e){return th.onBlur(e);});}}, 18 onFocus: function(e){var t=JCommentsEvents.prototype.target(e);if(t!=null){t.className=t.className.replace('error','')+' selected';}}, 19 onBlur: function(e){var t=JCommentsEvents.prototype.target(e);if(t!=null){var c=t.className.replace('error','');c=c.replace('error','');c=c.replace('selected','');t.className=c.replace(/^\s+/g,"");}} 20}; 21 22JCommentsEditor.prototype = { 23 ta: null, 24 l10n: {}, 25 tags: {}, 26 smiles: {}, 27 events: null, 28 counter: null, 29 focused: false, 30 resizable: true, 31 32 init: function(textareaID, r) { 33 this.ta=JComments.prototype.$(textareaID); 34 this.l10n={counterPre:'',counterPost:' symbols left'}; 35 this.resizable=r; 36 this.events=new JCommentsEvents(); 37 this.defaultHeight=this.ta.clientHeight; 38 this.defaultRows=this.ta.rows; 39 if(this.resizable){this.addGrippie();} 40 this.isWebkit=/webkit/.test(navigator.userAgent.toLowerCase()); 41 42 var th = this; 43 this.events.add(document,!window.opera&&document.all?'keydown':'keypress',function(e){return th.onKeyPress(e);}); 44 this.events.add(this.ta,'click',function(e){th.closeSmiles();return th.storeCaret(this.ta);}); 45 this.events.add(this.ta,'select',function(e){return th.storeCaret(this.ta);}); 46 this.events.add(this.ta,'change',function(e){th.onChange(); return th.storeCaret(this.ta);}); 47 this.events.add(this.ta,'keyup',function(e){return th.onChange();}); 48 this.events.add(this.ta,'focus',function(e){th.closeSmiles(); return th.focused=true;}); 49 this.events.add(this.ta,'blur',function(e){return th.focused=false;}); 50 }, 51 onKeyPress: function(e) { 52 if (!this.focused){return;} 53 var k=String.fromCharCode(e.keyCode?e.keyCode:e.charCode),t; 54 for(var id in this.tags){ 55 t=this.tags[id]; 56 if(!t.key||k.toUpperCase()!=t.key.toUpperCase())continue; 57 if(t.ctrl&&!e[t.ctrl+"Key"])continue; 58 this.insertTag(id); 59 return this.events.cancel(e); 60 } 61 return e.returnValue; 62 }, 63 defined: function(v){return (typeof(v)!="undefined");}, 64 clear: function(){this.ta.value='';if(this.defaultHeight){this.ta.style.height=this.defaultHeight+'px';}this.updateCounter();}, 65 focus: function(){this.ta.focus();}, 66 storeCaret: function(){var ta=this.ta;if(ta.createTextRange)ta.caretPos=document.selection.createRange().duplicate();}, 67 getElementPos: function(e){var p={left:0,top:0,right:0,bottom:0};while(e!=null){p.left+=e.offsetLeft;p.top+=e.offsetTop;e=e.offsetParent;}p.right+=p.left;p.bottom+=p.top;return p;}, 68 getSelection: function(){var ta=this.ta,s='';if(document.selection&&document.selection.createRange){s=document.selection.createRange().text;}else{s=ta.value.substr(ta.selectionStart,ta.selectionEnd-ta.selectionStart);}return s;}, 69 insertText: function(text) { 70 var ta=this.ta; 71 if(this.defined(ta.caretPos)&&ta.createTextRange){ta.focus();var sel=document.selection.createRange();sel.text=sel.text+text;ta.focus();} 72 else if(this.defined(ta.selectionStart)){ 73 var ss=ta.value.substr(0, ta.selectionStart); 74 var se=ta.value.substr(ta.selectionEnd),sp=ta.scrollTop; 75 ta.value=ss+text+se; 76 if(ta.setSelectionRange){ta.focus();ta.setSelectionRange(ss.length+text.length,ss.length+text.length);} 77 ta.scrollTop=sp; 78 } else {ta.value+=text;ta.focus(ta.value.length-1);} 79 }, 80 surroundText: function(t1,t2) { 81 var ta=this.ta; 82 if (this.defined(ta.caretPos) && ta.createTextRange){ 83 var cp=ta.caretPos,tl=cp.text.length; 84 cp.text=cp.text.charAt(cp.text.length-1)==' '?t1+cp.text+t2+' ':t1+cp.text+t2; 85 if(tl==0){cp.moveStart("character",-t2.length);cp.moveEnd("character",-t2.length);cp.select();} 86 else{ta.focus(cp);} 87 }else if(this.defined(ta.selectionStart)){ 88 var ss=ta.value.substr(0,ta.selectionStart),se=ta.value.substr(ta.selectionEnd); 89 var sl=ta.value.substr(ta.selectionStart,ta.selectionEnd-ta.selectionStart); 90 var nc=ta.selectionStart,sp=ta.scrollTop; 91 ta.value=ss+t1+sl+t2+se; 92 if(ta.setSelectionRange){ 93 if(sl.length==0){ta.setSelectionRange(nc+t1.length,nc+t1.length);} 94 else{ta.setSelectionRange(nc,nc+t1.length+sl.length+t2.length);} 95 ta.focus(); 96 } 97 ta.scrollTop=sp; 98 }else{ta.value+=t1+t2;ta.focus(ta.value.length-1);} 99 }, 100 insertTag: function(id) {var tag=this.tags[id];if(!tag)return;var s=this.getSelection();if(s.length>0){this.surroundText(tag.open,tag.close);}}, 101 initTags: function(){ 102 if (this.bbc==null||this.bbc.length==0){ 103 this.bbc={}; 104 this.bbc['b']={id:'bbcode-b',open:'[b]',close:'[/b]',key:'B',ctrl:'ctrl',hint:'Bold'}; 105 this.bbc['i']={id:'bbcode-i',open:'[i]',close:'[/i]',key:'I',ctrl:'ctrl',hint:'Italic'}; 106 this.bbc['u']={id:'bbcode-u',open:'[u]',close:'[/u]',key:'U',ctrl:'ctrl',hint:'Underline'}; 107 this.bbc['s']={id:'bbcode-s',open:'[s]',close:'[/s]',key:null,ctrl:null,hint:'Strikeout'}; 108 this.bbc['img']={id:'bbcode-img',open:'[img]',close:'[/img]',key:null,ctrl:null,hint:'Image'}; 109 this.bbc['url']={id:'bbcode-url',open:'[url]',close:'[/url]',key:null,ctrl:null,hint:'Link'}; 110 this.bbc['hide']={id:'bbcode-hide',open:'[hide]',close:'[/hide]',key:null,ctrl:null,hint:'Hidden'}; 111 this.bbc['quote']={id:'bbcode-quote',open:'[quote]',close:'[/quote]',key:null,ctrl:null,hint:'Quote'}; 112 this.bbc['list']={id:'bbcode-list',open:'[list][*]',close:'[/list]',key:null,ctrl:null,hint:'List'}; 113 } 114 }, 115 116 createButton: function(i,t,c,f,img){ 117 var e;if(img==null||img==""){e=document.createElement('a');e.style.display='block';e.setAttribute('href','#');} 118 else{e=document.createElement('img');if(t){e.setAttribute('alt',t);}e.setAttribute('src',img);if(!c){c='custombbcode';}} 119 if(i){e.setAttribute('id',i);}if(t){e.setAttribute('title',t);}if(c){e.className=c;} 120 var ee=e;e.onclick=(f!=null?function(){f(ee); return false;}:function(){return false;}); 121 return e; 122 }, 123 124 addButton: function(id,h,p,ot,ct,css,img) { 125 if(this.ta){ 126 this.initTags();
127 var tag=this.bbc[id],th=this; 128 if(!tag){ 129 if(ot&&ct) { 130 this.bbc[id]={id:id,open:ot,close:ct,key:null,ctrl:null,hint:h}; 131 tag=this.bbc[id]; 132 } else { return; } 133 } 134 if(this.bbcPanel==null){ 135 this.bbcPanel=document.createElement('span'); 136 this.bbcPanel.className='bbcode'; 137 this.bbcPanel.style.display='block'; 138 this.ta.parentNode.insertBefore(this.bbcPanel,this.ta); 139 } 140 var f=function(){var s=th.getSelection();if(s.length>0){th.surroundText(tag.open,tag.close);}else{var v=prompt(p,'');if(null!=v && ''!=v){th.insertText(tag.open+v+tag.close);}}return false;}; 141 tag.e=this.createButton(tag.id,(h!=null?h:tag.hint),(css?css:tag.id),f,img); 142 this.bbcPanel.appendChild(tag.e); 143 this.tags[tag.id]=tag; 144 } 145 }, 146 147 initSmiles: function(p){this.smilesPath=p; 148 if(this.ta){ 149 this.smilesPanel=document.createElement('div'); 150 if(this.bbcPanel){ 151 document.body.appendChild(this.smilesPanel); 152 this.smilesPanel.id='comments-form-smilespanel'; 153 this.smilesPanel.setAttribute('style','display:none;top:0;left:0;position:absolute;'); 154 this.smilesPanel.onclick=function(){this.style.display='none';}; 155 var jc=this,f=function(e){ 156 var sp=jc.smilesPanel,p=jc.getElementPos(e); 157 if(sp){var sps=sp.style;sps.display=(sps.display=='none'||sps.display==''?'block':'none');sps.left=p.left+"px";sps.top=p.bottom+e.offsetHeight+"px";sps.zIndex=99;} 158 return false; 159 }; 160 this.bbcPanel.appendChild(this.createButton(null,null,'bbcode-smile',f)); 161 } else { 162 this.smilesPanel.className='smiles';this.ta.parentNode.insertBefore(this.smilesPanel, this.ta); 163 } 164 } 165 }, 166 closeSmiles: function(){if(this.smilesPanel&&this.bbcPanel){this.smilesPanel.style.display='none';}}, 167 168 addSmile: function(code,image){ 169 if(this.ta){ 170 if(!this.smilesPath||!this.smilesPanel){return;} 171 var th=this,e=document.createElement('img'); 172 e.setAttribute('src',this.smilesPath+'/'+image); 173 e.setAttribute('alt',code); 174 e.className='smile'; 175 e.onclick=function(){th.insertText(' '+code+' ');}; 176 this.smilesPanel.appendChild(e); 177 } 178 }, 179 addCounter: function(m,pre,post,className){ 180 if(this.ta){ 181 if(pre!=null){this.l10n.counterPre=pre;}if(post!=null){this.l10n.counterPost=post;} 182 var ch=document.createElement('span');ch.className=className!=null?className:''; 183 var t1=document.createTextNode(this.l10n.counterPre+' '),t2=document.createTextNode(' '+this.l10n.counterPost); 184 var c=document.createElement('span');ch.appendChild(t1);ch.appendChild(c);ch.appendChild(t2); 185 if(this.resizable){if(this.grippie!=null){this.grippie.appendChild(ch);}} 186 else{var d=document.createElement('div');d.className='counterpanel';this.ta.parentNode.insertBefore(d,this.ta.nextSibling);d.appendChild(ch);} 187 this.counter={e:c,max:m}; 188 this.updateCounter(); 189 } 190 }, 191 addGrippie: function() { 192 this.offset=null;this.dragging=false; 193 this.grippie=document.createElement('div');this.grippie.className='grippie'; 194 this.ta.parentNode.insertBefore(this.grippie,this.ta.nextSibling); 195 var th=this;this.events.add(this.grippie,'mousedown',function(e){return th.onMouseDown(e);}); 196 }, 197 updateCounter: function(){if(this.counter!=null){var ta=this.ta,e=this.counter.e;try{var n=document.createElement(e.tagName),v=this.counter.max;if(ta.value.length>0){v=v-ta.value.length;var ln=ta.value.match(/[^\r]\n/g);if(ln){v=v-ln.length;}}n.innerHTML=(v>=0)?v:0;e.parentNode.replaceChild(n,e);this.counter.e=n;}catch(ex){}}}, 198 mousePosition: function(e){var px=0,py=0;if(!e){e=window.event;}if(e.pageX||e.pageY){px=e.pageX;py=e.pageY;}else if(e.clientX||e.clientY){px=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;py=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;}return {x:px,y:py};}, 199 onChange: function(){this.updateCounter();if(this.ta&&!this.isWebkit){var l=this.ta.value.split('\n');this.ta.rows=(l.length<this.defaultRows)?this.defaultRows:l.length+1;}return false;}, 200 onMouseDown: function(e){this.offset=this.mousePosition(e).y;this.height=this.ta.clientHeight;this.dragging=true;var th=this;this.events.add(document,'mousemove',function(e){return th.onMouseMove(e);});this.events.add(document,'mouseup',function(e){return th.onMouseUp(e);});return false;}, 201 onMouseUp: function(e){this.dragging=false;}, 202 onMouseMove: function(e){if(this.dragging)this.ta.style.height=Math.max(this.defaultHeight, this.height+this.mousePosition(e).y-this.offset)+'px';return false;} 203}; 204 205JCommentsForm.prototype = { 206 id:null, 207 form: null, 208 events: null, 209 editor: null, 210 elements: {}, 211 store: new Array('name','email','homepage'), 212 fadeTimer: null, 213 214 init: function(id,editor){this.id=id;this.form=this.$(id);this.editor=editor;this.events=new JCommentsEvents();this.setElements(new Array('name','email','homepage','title','comment'));this.restoreValues();this.clear('captcha');this.setCaptcha();}, 215 setCaptcha: function(){this.captchaImage=this.$(this.id+'-captcha-image');this.register('captcha');}, 216 setEditor: function(e){this.editor=e;}, 217 setElements: function(e){for(var i=0;i<e.length; i++){try{this.register(e[i]);}catch(e){}}}, 218 $:function(e){return JComments.prototype.$(e);}, 219 register: function(n){var f=this,e=this.$(this.id+'-'+n);if(e){this.elements[n]=e;JCommentsInput.prototype.register(e);this.events.add(e,!window.opera&&document.all?'keydown':'keypress',function(e){return f.keypress(e);});}}, 220 error: function(n){var e=this.elements[n];if(e){e.focus();var c=e.className.replace('/\berror\b/g','')+' error';e.className=c.replace(/\s{2,}/g,' ');}}, 221 222 clear: function(n){ 223 if(n==null) 224 { 225 if(this.form!=null){ 226 this.form.reset(); 227 } 228 return; 229 } 230 switch(n){ 231 case 'comment':if(this.editor!=null){this.editor.clear();}break; 232 case 'captcha':var cim=this.captchaImage,cin=this.elements['captcha'];if(cim){var r=new String(Math.floor(Math.random()*100000));if(/\d+$/g.test(cim.src)){cim.src=cim.src.replace(/\d+$/g,r);}else if(/\?/g.test(cim.src)) {cim.src=cim.src+'&r='+r;}else{cim.src=cim.src+'?r='+new String(Math.floor(Math.random()*100000));}}if(cin){cin.value='';}break; 233 default:var e=this.elements[n];if(e){e.value='';}break; 234 } 235 }, 236 focus:function(n){var e;if(n==null){for(var nm in this.elements){e=this.elements[nm];if(e){e.focus();break;}}}else{e=this.elements[n];if(e){e.focus();}}}, 237 keypress: function(e){if(e.ctrlKey &&(e.keyCode==13||(e.type=='keypress'&&e.keyCode==10))){this.submit();e.returnValue=false;return this.events.cancel(e);}return this.keypressed(e);}, 238 add: function(n,i,v){if(this.form!=null){var e=document.createElement('input');e.setAttribute('type', 'hidden');e.setAttribute('name', n);e.setAttribute('id', i);e.setAttribute('value', v);this.form.appendChild(e);}}, 239 remove: function(i){var e=this.$(i);if(e){e.value=0;e.parentNode.removeChild(e);}}, 240 setText: function(n,t){if(n=='comment'){if(this.editor!=null){this.editor.clear();this.editor.insertText(t);}}else{var e=this.elements[n];if(e){e.value=t;}}}, 241 insertText: function(n,t){if(n=='comment'){if(this.editor!=null){this.editor.insertText(t);}}else{var e=this.elements[n];if(e){e.value+=t;}}}, 242 storeValues: function(){for(var i=0;i<this.store.length; i++){try{var el=JComments.prototype.$(this.id+'-'+this.store[i]);if(el){JComments.prototype.setCookie(this.store[i],encodeURIComponent(el.value),14);}}catch(e){}}}, 243 restoreValues: function(){for(var i=0;i<this.store.length; i++){try{var el=JComments.prototype.$(this.id+'-'+this.store[i]);if(el){if(el.type&&el.type=='hidden'){return;}else{el.value=decodeURIComponent(JComments.prototype.getCookie(this.store[i]));}}}catch(e){}}}, 244 submit: function(){}, 245 keypressed: function(e){} 246}; 247 248JCommentsIndicator.prototype = { 249 e: null, 250 init: function(){if(this.e==null){this.e=document.createElement('div');this.e.className='busy';}}, 251 move: function(p,b){if(p){if(this.e.parentNode){this.e.parentNode.removeChild(this.e);}if(b){p.insertBefore(this.e,b);}else{p.appendChild(this.e);}}}, 252 show: function(){this.e.style.display='block';}, 253 hide: function(){this.e.style.display='none';}, 254 start: function(p,b){this.move(p,b);this.show();}, 255 stop: function(){this.hide();} 256}; 257 258JComments.prototype = { 259 oi:null, 260 og:null, 261 requestURI: '', 262 busy: null, 263 form: null, 264 cache: {}, 265 mode:'add', 266 readyList: [], 267 isReady: false, 268 269 init: function(oi,og,r){var ua=navigator.userAgent.toLowerCase();this.browser={safari: /webkit/.test(ua),opera: /opera/.test(ua),msie: /msie/.test(ua) && !(/opera/.test(ua)),mozilla: /mozilla/.test(ua) && !(/(compatible|webkit)/.test(ua))};this.oi=oi;this.og=og;this.busy=new JCommentsIndicator();this.requestURI=r;var th=this;jtajax.startLoading=function(){th.busy.show();};jtajax.finishLoading=function(){th.busy.hide();};}, 270 reinit: function(oi,og){this.oi=oi;this.og=og;var foi=this.$('object_id');if(foi){foi.value=oi;}var fog=this.$('object_group');if(fog){fog.value=og;}this.showPage(oi,og,0);}, 271 setForm: function(f){this.form=f;this.form_id=f.id;this.setMode('add',null);var jc=this;this.form.submit=function(){jc.saveComment();};this.form.keypressed=function(e){if(e.keyCode==27&&jc.mode=='reply'){jc.restoreForm(false);}};this.formLoaded();}, 272 setList: function(l){this.list_id=l;}, 273 setMode: function(m,i){var b=this.$('comments-form-cancel'),jc=this;if(b!=null){b.style.display=(m!='add')?'':'none';b.onclick=(m=='edit'?function(){jc.cancelEdit(i);}:(m=='reply'?function(){jc.cancelReply();}:null));}this.mode=m;}, 274 $: function(id){if(!id){return null;}var e=document.getElementById(id);if(!e&&document.all){e=document.all[id];}return e;}, 275 ajax: function(f,a,fid){var r,prevURI='';try{prevURI=jtajax.options.url;jtajax.setup({url:this.requestURI});r=jtajax.call(f,a,'post',fid);jtajax.options.url=prevURI;}catch(e){jtajax.options.url=prevURI;}return r;}, 276 initOnReady : function(){if(this.isReadyInited) return;this.isReadyInited=1;var jc=this; 277 if(this.browser.mozilla||this.browser.opera){JCommentsEvents.prototype.add(document, 'DOMContentLoaded',jc.ready);} 278 else if(this.browser.msie) {(function(){try{document.documentElement.doScroll('left');}catch(e){setTimeout(arguments.callee, 50);return;}jc.ready();})();} 279 else if(this.browser.safari){(function(){if(jc.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}jc.ready();})();} 280 JCommentsEvents.prototype.add(window, 'load', function(){jc.ready(jc);}); 281 }, 282 onReady: function(f){if(this.isReady){f();}else{var jc=this;
282jc.readyList.push(f);jc.initOnReady();}}, 283 ready: function(){var jc=window.jcomments;if(jc.isReady||jc.readyList==null) return;jc.isReady=1;for(var i=0,len=jc.readyList.length;i<len;i++){try{jc.readyList[i]();}catch(e){}}jc.readyList=null;}, 284 setAntiCache: function(c,p,f){this.aca=c;this.acp=p;this.acf=f;this.onReady(this.loadComments);}, 285 loadComments: function(){var jc=window.jcomments;var l=document.location.href,lc=true,i=l.lastIndexOf('#comment-');jc.clear('captcha');if(jc.aca){if(i!=0){var c=l.substring(i+9,l.length);if(!isNaN(c)){lc=false;jc.showComment(c);}}}if(jc.acp){if(lc){jc.showPage(jc.oi,jc.og,0);}}if(jc.acf){if(l.lastIndexOf('#addcomment')!=-1){jc.showForm(jc.oi,jc.og,'comments-form-link');}}}, 286 setCookie: function(n,v,d){var e='';if(d){var dt=new Date();dt.setTime(dt.getTime()+(d*24*60*60*1000));e="; expires="+dt.toGMTString();}document.cookie = "jc_"+n+"="+v+e+"; path=/";}, 287 getCookie: function(n){var re=new RegExp( "(\;|^)[^;]*(" + "jc_"+n + ")\=([^;]*)(;|$)" );var r=re.exec(document.cookie);return r != null ? r[3] : '';}, 288 removeCookie: function(n){this.setCookie(n,"",-1);}, 289 scrollTo: function(n){if(n!=null){var e=this.$(n),t=0;if(e){t=e.offsetTop;for(var p=e.offsetParent;p;p=p.offsetParent){t+=p.offsetTop;}scrollTo(0,t);}}}, 290 scrollToList: function(){this.scrollTo(this.list_id);}, 291 scrollToForm: function(){this.scrollTo(this.form_id);}, 292 scrollToComment: function(id){this.scrollTo('comment-'+id);}, 293 moveElement: function(e,p,b){if(e){if(p){if(e.parentNode){e.parentNode.removeChild(e);}if(b){p.insertBefore(e,b);}else{p.appendChild(e);}}}}, 294 createElement: function(t,i,c){var e=document.createElement(t);if(i){e.setAttribute('id',i);}if(c){e.className=c;}return e;}, 295 fade: function(id,s,e,m){var speed=Math.round(m/100),timer=0;if(s>e){for(var i=s;i>=e;i--){setTimeout("JComments.prototype.setOpacity('"+id+"',"+i+")",(timer*speed));timer++;}var o=JComments.prototype.$(id);if(o){setTimeout(function(){o.style.display='none';},((s-e)*speed));}}else if(s<e){for(var i=s;i<=e;i++){setTimeout("JComments.prototype.setOpacity('"+id+"',"+i+")",(timer*speed));timer++;}}}, 296 setOpacity: function(id,opacity){var e=this.$(id);if(e){var s=e.style;s.opacity=(opacity/100);s.MozOpacity=(opacity/100);s.KhtmlOpacity=(opacity / 100);s.filter="alpha(opacity="+opacity+")";}}, 297 clear:function(n){if(this.form!=null){this.form.clear(n);}}, 298 insertText:function(t){if(this.form!=null){this.form.insertText('comment',t);}else{var jc=this;window.setTimeout(function(){jc.insertText(t);},500);}}, 299 busyList: function(){if(this.list_id){var l=this.$(this.list_id);if(l){this.busy.move(l.parentNode,l);}}}, 300 busyForm: function(){if(this.form_id){var f=this.$(this.form_id);if(f){this.busy.move(f.parentNode,f);}}}, 301 busyComment: function(i){this.busy.move(this.$('comment-item-'+i),null);}, 302 saveComment: function(){var f='';if(this.mode!='edit'){f='JCommentsAddComment';this.busyForm();if(this.form){this.form.storeValues();}this.busy.show();}else{f='JCommentsSaveComment';this.busy.show();}return this.ajax(f,null, this.form_id);}, 303 editComment: function(i){this.busyComment(i);var a=arguments;if(this.form==null){a=new Array(i,1);}return this.ajax('JCommentsEditComment', a);}, 304 cancelEdit: function(i){if((!this.cache[i])||(this.cache[i]=='')){this.$('comment-body-'+i).innerHTML=this.cache[i];this.cache[i]='';}if(this.form){this.form.remove('comment-id-hidden-'+i);this.restoreForm(true);}var t=this.$('comment-toolbar-'+i);if(t){t.style.display='';}return this.ajax('JCommentsCancelComment',arguments);}, 305 cancelReply: function(){if(this.form){this.form.remove('comment-parent-id-hidden');this.restoreForm(false);}}, 306 quoteComment: function(i){var a=arguments;if(this.form==null){a=new Array(i,1);}return this.ajax('JCommentsQuoteComment',a);}, 307 publishComment: function(i){if(this.form){this.restoreForm();}this.busyComment(i); return this.ajax('JCommentsPublishComment',arguments);}, 308 deleteComment: function(i){this.busyComment(i); return this.ajax('JCommentsDeleteComment',arguments);}, 309 jump2email: function(i){return this.ajax('JCommentsJump2email',arguments);}, 310 updateList: function(t,m){if(this.list_id){var l=this.$(this.list_id);if(!l){l=this.$('comments');m='a';}switch(m){case 'a':l.innerHTML=l.innerHTML+t;break;case 'p':l.innerHTML=t+l.innerHTML;break;case 'r':l.parentNode.innerHTML=t;break;}}}, 311 updateTree: function(t,r,m){var l;if(r==null){l=this.$('comments');if(l){l.innerHTML=t;}return;}l=this.$('comments-list-'+r);if(!l){var p=this.$('comment-item-'+r);if(p){this.busyComment(r);l=this.createElement('div','comments-list-'+r,'comments-list');l.innerHTML=t;p.parentNode.insertBefore(l,p.nextSibling);}}
311else{l.innerHTML=(m=='b'?t+l.innerHTML:l.innerHTML+t);}this.restoreForm(true);}, 312 updateComment: function(id,t){if(t==''){var c=this.$('comment-item-'+id);c.parentNode.removeChild(c);var l=this.$('comments-list-'+id);if(l){l.parentNode.removeChild(l);} return;}this.$('comment-item-'+id).innerHTML=t;var te=this.$('comment-toolbar-'+id);if(te){te.style.display='';}if(this.form){this.form.remove('comment-id-hidden-'+id);this.restoreForm(true);}}, 313 voteComment: function(i){var v=this.$('comment-vote-holder-'+i);if(v){v.innerHTML='';this.busy.start(v,null);}return this.ajax('JCommentsVoteComment',arguments);}, 314 updateVote: function(i,t){this.busy.stop();var c=this.$('comment-vote-holder-'+i);if(c){c.innerHTML=t;}}, 315 showComment: function(id){return this.ajax('JCommentsShowComment',arguments);}, 316 showPage: function(i,g,p){if(this.form){this.restoreForm();}var l=this.$(this.list_id);if(!l){l=this.$(this.list_id+'-0');if(l){this.list_id=this.list_id+'-0';}}this.busyList();return this.ajax('JCommentsShowPage',arguments);}, 317 showForm: function(i,g,t){if(this.form){this.moveElement(this.form.form,this.$(t));return;}this.busyForm(); return this.ajax('JCommentsShowForm',arguments);}, 318 showEdit: function(id,n,e,h,t,txt){ 319 var jc=this; 320 if(this.form==null){window.setTimeout(function(){jc.showEdit(id,n,e,h,t,txt);},500);return;} 321 if((!this.cache[id])||(this.cache[id]=='')){this.cache[id]=this.$('comment-body-'+id).innerHTML;} 322 this.busy.stop(); 323 var f=this.form,ff=this.form.form,c=this.$('comment-item-'+id); 324 if(ff!=null&&c!=null){ 325 f.add('id','comment-id-hidden-'+id,id);f.setText('name', n);f.setText('email', e);f.setText('homepage', h);f.setText('title', t);f.setText('comment', txt); 326 var d=this.$('comments-inline-edit'); 327 if(d){d.parentNode.removeChild(d);}else{d=this.createElement('div','comments-inline-edit','comments-inline-edit');}c.appendChild(d);this.moveElement(ff,d); 328 this.setMode('edit',id);var te=this.$('comment-toolbar-'+id);if(te){te.style.display='none';} 329 this.scrollTo('comments-inline-edit'); 330 this.form.focus('comment'); 331 } 332 }, 333 showReply: function(id,q){ 334 this.busyComment(id);this.cancelReport(); 335 var jc=this,c=this.$('comment-item-'+id),d=this.$('comments-inline-edit'); 336 if(d){d.parentNode.removeChild(d);}else{d=this.createElement('div','comments-inline-edit','comments-inline-edit');}c.appendChild(d); 337 if(!this.form){ 338 var t='comments-inline-edit',h=this.$('comments-form-link');if(h){t='comments-form-link';} 339 this.showForm(this.oi, this.og,t);var pid=id;this.formLoaded=function(){var f=jc.form;if(f!=null){f.add('parent','comment-parent-id-hidden',pid);}jc.setMode('reply',pid);jc.moveElement(jc.form.form,jc.$('comments-inline-edit'));jc.form.focus();if(q){jc.quoteComment(id);}}; 340 }else{ 341 var f=this.form,ff=this.form.form,p=this.$('comment-parent-id-hidden'); 342 if(ff!=null&&c!=null){if(!p){f.add('parent','comment-parent-id-hidden',id);}else{p.value=id;}this.moveElement(ff,d);this.setMode('reply',id);this.form.focus();if(q){this.quoteComment(id);}} 343 } 344 }, 345 formLoaded: function(){}, 346 restoreForm: function(c){var f=this.form;if(f!=null){var ff=this.form.form;this.busy.stop(); 347 if(ff!=null){if(c){f.clear(null);}f.restoreValues();var a=this.$('addcomments'),p=this.$('comment-parent-id-hidden');if(p){p.value=0;} 348 this.moveElement(ff,a.parentNode,a);var d=this.$('comments-inline-edit');if(d){d.parentNode.removeChild(d);}this.setMode('add',null);} 349 }}, 350 reportComment: function(id){ 351 this.busyComment(id);this.cancelReply(); 352 var c=this.$('comment-item-'+id),d=this.$('comments-inline-report'); 353 if(d){d.parentNode.removeChild(d);}else{d=this.createElement('div','comments-inline-report','comments-inline-report');}c.appendChild(d); 354 var a=new Array(id,'comments-inline-report'); 355 return this.ajax('JCommentsShowReportForm',a); 356 }, 357 saveReport: function(){this.ajax('JCommentsReportComment',null, 'comments-report-form');return true;}, 358 cancelReport: function() {var d=this.$('comments-inline-report');if(d){d.innerHTML='';}}, 359 closeReport: function(m){this.cancelReport();if(m){this.showMessage(m,'info','comments-inline-report');}}, 360 banIP: function(id){this.ajax('JCommentsBanIP',arguments)}, 361 error:function(m,t,n){if(this.form!=null){this.form.error(n);}if(!t||t==''){t=this.form_id;}this.showMessage(m,'error',t);}, 362 message:function(m,t){if(!t||t==''){t=this.form_id;}this.showMessage(m,'info',t);}, 363 showMessage: function(m,c,t){ 364 clearTimeout(this.fadeTimer);var fe=this.$('comments-form-message');var af=this.$(t); 365 if(fe){fe.parentNode.removeChild(fe);}fe=JComments.prototype.createElement('div','comments-form-message',''); 366 if(af){JComments.prototype.moveElement(fe,af,af.firstChild);}else{alert(m);return;} 367 if(!c){c='info';}fe.className='comments-form-message-'+c; 368 fe.innerHTML=m; fe.style.display='block';JComments.prototype.setOpacity(fe.id,100); 369 this.fadeTimer=setTimeout(function(){JComments.prototype.fade('comments-form-message', 100, 0, 1000);}, 6000); 370 }, 371 372 subscribe: function(o,g){return this.ajax('JCommentsSubscribe',arguments);}, 373 unsubscribe: function(o,g){return this.ajax('JCommentsUnsubscribe',arguments);}, 374 updateSubscription: function(m,t){var e=this.$('comments-subscription');if(e){var jc=this;e.innerHTML=t;e.onclick=m?function(){jc.unsubscribe(jc.oi,jc.og);return false;}:function(){jc.subscribe(jc.oi,jc.og);return false;};e.blur();}}
374, 375 go: function(l){window.open(l);return false;} 376};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.