?
Path : /home/admin/public_html/old/board/components/com_kunena/template/default/js/ |
Current File : /home/admin/public_html/old/board/components/com_kunena/template/default/js/editor-min.js |
Element.implement({getSelectedText:function(){if(Browser.Engine.trident){this.focus();return document.selection.createRange().text;}return this.get("value").substring(this.selectionStart,this.selectionEnd);},wrapSelectedText:function(b,k,a,g){g=(g==null)?true:g;var j=this.scrollTop;this.focus();if(Browser.Engine.trident){var i=document.selection.createRange();i.text=k+b+a;if(g){i.select();}}else{var c=this.selectionStart;var d=this.selectionEnd;this.value=this.get("value").substring(0,c)+k+b+a+this.get("value").substring(d);if(g==false){this.setSelectionRange(c+k.length,c+k.length+b.length);}else{var h=c+b.length+k.length+a.length;this.setSelectionRange(h,h);}}this.scrollTop=j;},replaceSelectedText:function(b,a){a=(a==null)?true:a;this.wrapSelectedText(b,"","",a);}});var _currentElement="";var _previewActive=false;function kToggleOrSwap(a){e=$(a);if(e){if(e.getStyle("display")=="none"){if(_currentElement!=""){_currentElement.setStyle("display","none");}e.setStyle("display","block");_currentElement=e;}else{e.setStyle("display","none");_currentElement="";}}}function kToggleOrSwapPreview(b){e=$("kbbcode-preview");f=$("kbbcode-message");if(e){if(e.getStyle("display")=="none"||e.getProperty("class")!=b){e.setStyle("display","block");if(b=="kbbcode-preview-right"){f.setStyle("width","47%");}else{f.setStyle("width","95%");}_previewActive=true;kPreviewHelper();}else{e.setStyle("display","none");f.setStyle("width","95%");_previewActive=false;}e.setProperty("class",b);var a=f.getStyle("height");e.setStyle("height",f.getStyle("height"));}}function kGenerateColorPalette(h,c){var j=0,i=0,a=0;var k=new Array(6);var d="";k[0]="00";k[1]="44";k[2]="88";k[3]="BB";k[4]="FF";document.writeln('<table id="kbbcode-colortable" class="kbbcode-colortable" cellspacing="1" cellpadding="0" border="0" style="width: 100%;">');for(j=0;j<5;j++){document.writeln("<tr>");for(i=0;i<5;i++){for(a=0;a<5;a++){d=String(k[j])+String(k[i])+String(k[a]);document.writeln('<td style="background-color:#'+d+"; width: "+h+"; height: "+c+';"> </td>');}}document.writeln("</tr>");}document.writeln("</table>");}var kbbcode=new Class({Implements:Options,options:{displatchChangeEvent:false,changeEventDelay:1000,interceptTabs:true},initialize:function(b,c,a){this.el=$(b);this.setOptions(a);if(this.options.dispatchChangeEvent){this.el.addEvents({focus:function(){this.timer=this.watchChange.periodical(this.options.changeEventDelay,this);}.bind(this),blur:function(){this.timer=$clear(this.timer);}.bind(this)});}if(this.options.interceptTabs){this.el.addEvent("keypress",function(d){d=new Event(d);if(d.key=="tab"){d.preventDefault();this.replaceSelection("\t");}}.bind(this));}if(!$defined(c)||c==""){c=new Element("li");c.inject(this.el,"before");this.list=c;}else{this.list=$(c);}this.oldContent=this.el.get("value");},watchChange:function(){if(this.oldContent!=this.el.get("value")){this.oldContent=this.el.get("value");this.el.fireEvent("change");}},getSelection:function(){return this.el.getSelectedText();},wrapSelection:function(c,a,b){b=(b==null)?true:b;this.el.wrapSelectedText(this.el.getSelectedText(),c,a,b);},insert:function(g,b,d){d=(d==null)?true:d;var h="";var a="";b=(b=="")?"after":b;var c=(b=="before")?h=g:a=g;this.el.wrapSelectedText(this.el.getSelectedText(),h,a,d);},replaceSelection:function(b,a){a=(a==null)?true:a;this.el.replaceSelectedText(b,a);},processEachLine:function(d,c){c=(c==null)?true:c;var a=this.el.getSelectedText().split("\n");var b=[];a.each(function(g){if(g!=""){b.push(d.attempt(g,this));}else{b.push("");}}.bind(this));this.el.replaceSelectedText(b.join("\n"),c);},getValue:function(){return this.el.get("value");},setValue:function(a){this.el.set("value",a);this.el.focus();},addFunction:function(c,g,b){var d=new Element("li");var a=new Element("a",{events:{click:function(h){new Event(h).stop();g.attempt(null,this);}.bind(this)},href:"#"});a.set("html","<span>"+c+"</span>");a.setProperties(b||{});a.inject(d,"bottom");d.injectInside(this.list);}});function kInsertCode(){var a=$("kcodetype").get("value");if(a!=""){a=" type="+a;}kbbcode.wrapSelection("[code"+a+"]","[/code]",false);kToggleOrSwap("kbbcode-code-options");}function kInsertImageLink(){var a=$("kbbcode-image_size").get("value");if(a==""){kbbcode.replaceSelection("[img]"+$("kbbcode-image_url").get("value")+"[/img]");}else{kbbcode.replaceSelection("[img size="+a+"]"+$("kbbcode-image_url").get("value")+"[/img]");}kToggleOrSwap("kbbcode-image-options");}function kGrowShrinkMessage(g){var a=$("kbbcode-message");var d=$("kbbcode-preview");var b=parseInt(a.getStyle("height"));var c=b+g;if(c>100){a.setStyle("height",c+"px");d.setStyle("height",c+"px");}else{a.setStyle("height","100px");d.setStyle("height","100px");}}function myValidate(a){if(document.formvalidator.isValid(a)){return true;}return false;}function cancelForm(){document.forms.postform.action.value="cancel";return true;}function newAttachment(){var d=$("kattachment-id");if(!d){return;}d.setStyle("display","none");d.getElement("input").setProperty("value","");var b=d.retrieve("nextid",1);d.store("nextid",b+1);var c=d.clone().inject(d,"before").set("id","kattachment"+b).setStyle("display");c.getElement("span.kattachment-id-container").set("text",b+". ");var a=c.getElement("input.kfile-input").set("name","kattachment"+b).removeProperty("onchange");a.addEvent("change",function(){this.removeEvents("change");var g=this.get("value");this.addEvent("change",function(){c.getElement("input.kfile-input-textbox").set("value",g);});c.getElement("input.kfile-input-textbox").set("value",g);c.getElement(".kattachment-insert").removeProperty("style").addEvent("click",function(){kbbcode.insert("\n[attachment:"+b+"]"+g+"[/attachment]\n","after",true);return false;});c.getElement(".kattachment-remove").removeProperty("style").addEvent("click",function(){c.dispose();return false;});newAttachment();});}function bindAttachments(){var a=$$(".kattachment-old");if(!a){return;}a.each(function(b){b.getElement(".kattachment-insert").removeProperty("style").addEvent("click",function(){kbbcode.replaceSelection("\n[attachment="+b.getElement("input").get("value")+"]"+b.getElement(".kfilename").get("text")+"[/attachment]\n","after",true);return false;});});}function IEcompatibility(){if(Browser.Engine.trident){var a=$$("#kbbcode-size-options","#kbbcode-size-options span","#kbbcode-colortable","#kbbcode-colortable td");if(a){a.setProperty("unselectable","on");}}}Selectors.Pseudo.selected=function(){return(this.selected&&this.get("tag")=="option");};function kInsertVideo1(){var d=$("kvideosize").get("value");if(d==""){d="100";}var a=$("kvideowidth").get("value");if(a==""){a="425";}var c=$("kvideoheight").get("value");if(c==""){c="344";}var g=$("kvideoprovider").get("value");if(g==""){g="";}var b=$("kvideoid").get("value");kbbcode.replaceSelection("[video size="+d+" width="+a+" height="+c+" type="+g+"]"+b+"[/video]",false);kToggleOrSwap("kbbcode-video-options");}function kInsertVideo2(){var a=$("kvideourl").get("value");kbbcode.replaceSelection("[video]"+a+"[/video]",false);kToggleOrSwap("kbbcode-video-options");}function kunenaSelectUsername(b,a){if(b.get("checked")){$("kauthorname").set("value",kunena_anonymous_name).removeProperty("disabled");$("kanynomous-check-name").removeProperty("style");}else{$("kanynomous-check-name").setStyle("display","none");$("kauthorname").set("value",a).set("disabled","disabled");}}window.addEvent("domready",function(){if(typeof(kunena_anonymous_check_url)=="undefined"){return;}if($("postcatid")!=undefined){$("postcatid").getElements("option").each(function(c){c.addEvent("click",function(h){var d=kunena_ajax_url_poll;var g=new Request.JSON({url:d,onComplete:function(i){if(i.allowed_polls!=null&&i.allowed_polls.indexOf(c.value)>=0){$("kpoll-hide-not-allowed").removeProperty("style");$("kbbcode-separator5").removeProperty("style");$("kbbcode-poll-button").removeProperty("style");$("kpoll-not-allowed").set("text"," ");}else{$("kbbcode-separator5").setStyle("display","none");$("kbbcode-poll-button").setStyle("display","none");$("kpoll-hide-not-allowed").setStyle("display","none");if(i.allowed_polls!=null){$("kpoll-not-allowed").set("text",KUNENA_POLL_CATS_NOT_ALLOWED);}else{if(i.error){$("kpoll-not-allowed").set("text",i.error);}else{$("kpoll-not-allowed").set("text","Unknown error!");}}}},onFailure:function(){$("kpoll-hide-not-allowed").setStyle("display","none");$("kpoll-not-allowed").set("text","Cannot contact server!");}}).send();});});}if(typeof(kunena_anonymous_check_url)!="undefined"&&$("kauthorname")!=undefined){var a=$("kauthorname").get("value");var b=$("kanonymous");kunenaSelectUsername(b,a);b.addEvent("click",function(c){kunenaSelectUsername(this,a);});}if(typeof(kunena_anonymous_check_url)!="undefined"&&$("postcatid")!=undefined){$("postcatid").getElements("option").each(function(c){c.addEvent("click",function(h){var d=kunena_anonymous_check_url;var g=new Request.JSON({url:d,onComplete:function(i){if(i.allowed_anonymous!=null&&i.allowed_anonymous.indexOf(c.value)>=0){$("kanynomous-check").removeProperty("style");}else{$("kanynomous-check").setStyle("display","none");b.removeProperty("checked");}kunenaSelectUsername(b,a);}}).send();});});}});