');if(e=="backcolor"||e=="fontcolor"){g=this.buildColorPicker(g,e)}else{g=this.buildDropdown(g,f.dropdown)}this.dropdowns.push(g.appendTo(b(document.body)));this.hdlHideDropDown=b.proxy(function(h){this.hideDropDown(h,g,e)},this);this.hdlShowDropDown=b.proxy(function(h){this.showDropDown(h,g,e)},this);d.click(this.hdlShowDropDown)}this.$toolbar.append(b(c).append(d));if(typeof(f.separator)!="undefined"){this.$toolbar.append(b('
'))}},this));b(document).click(this.hdlHideDropDown);b(this.doc).click(this.hdlHideDropDown)},buildButton:function(d,e){var c=b('
');if(typeof(e.func)=="undefined"){c.click(b.proxy(function(){this.execCommand(e.exec,d)},this))}else{if(e.func!="show"){c.click(b.proxy(function(f){this[e.func](f)},this))}}return c},buildDropdown:function(d,c){b.each(c,b.proxy(function(e,g){if(typeof(g.style)=="undefined"){g.style=""}var f;if(g.name=="separator"){f=b('
')}else{f=b(''+g.title+"");if(typeof(g.func)=="undefined"){b(f).click(b.proxy(function(){this.execCommand(g.exec,e)},this))}else{b(f).click(b.proxy(function(h){this[g.func](h)},this))}}b(d).append(f)},this));return d},buildColorPicker:function(l,k){var f;if(k=="backcolor"){if(b.browser.msie){f="BackColor"}else{f="hilitecolor"}}else{f="forecolor"}b(l).width(210);var g=this.opts.colors.length;for(var e=0;e
').css({backgroundColor:c});b(l).append(j);var h=this;b(j).click(function(){h.execCommand(f,b(this).attr("rel"))})}var d=b('').html(RLANG.none);if(k=="backcolor"){d.click(b.proxy(this.setBackgroundNone,this))}else{d.click(b.proxy(this.setColorNone,this))}b(l).append(d);return l},setBackgroundNone:function(){b(this.getParentNode()).css("background-color","transparent");this.syncCode()},setColorNone:function(){b(this.getParentNode()).attr("color","").css("color","");this.syncCode()},showDropDown:function(g,h,c){this.hideAllDropDown();this.setBtnActive(c);this.getBtn(c).addClass("dropact");var f=this.getBtn(c).offset().left;if(this.opts.fixed&&this.fixed){b(h).css({position:"fixed",left:f+"px",top:"30px"}).show()}else{var d=this.$toolbar.offset().top+30;b(h).css({position:"absolute",left:f+"px",top:d+"px"}).show()}},hideAllDropDown:function(){this.$toolbar.find("a.dropact").removeClass("act").removeClass("dropact");b(".redactor_dropdown").hide()},hideDropDown:function(d,f,c){if(!b(d.target).parent().hasClass("dropact")){b(f).removeClass("act");this.showedDropDown=false;this.hideAllDropDown()}},getSelection:function(){if(this.$frame.get(0).contentWindow.getSelection){return this.$frame.get(0).contentWindow.getSelection()}else{if(this.$frame.get(0).contentWindow.document.selection){return this.$frame.get(0).contentWindow.document.selection.createRange()}}},getParentNode:function(){if(window.getSelection){return this.getSelection().getRangeAt(0).startContainer.parentNode}else{if(document.selection){return this.getSelection().parentElement()}}},getCurrentNode:function(){if(window.getSelection){return this.getSelection().getRangeAt(0).startContainer}else{if(document.selection){return this.getSelection()}}},setFocusNode:function(f,d){var c=this.doc.createRange();var e=this.getSelection();d=d?0:1;if(e!==null){c.selectNodeContents(f);e.addRange(c);e.collapse(f,d)}this.focus()},insertNodeAtCaret:function(g){if(typeof window.getSelection!="undefined"){var h=this.getSelection();if(h.rangeCount){var d=h.getRangeAt(0);d.collapse(false);d.insertNode(g);d=d.cloneRange();d.selectNodeContents(g);d.collapse(false);h.removeAllRanges();h.addRange(d)}}else{if(typeof document.selection!="undefined"&&document.selection.type!="Control"){var e=(g.nodeType==1)?g.outerHTML:g.data;var i="marker_"+(""+Math.random()).slice(2);e+='';var f=this.getSelection();f.collapse(false);f.pasteHTML(e);var c=document.getElementById(i);f.moveToElementText(c);f.select();c.parentNode.removeChild(c)}}},getBtn:function(c){return b(this.$toolbar.find("a.redactor_btn_"+c))},setBtnActive:function(c){this.getBtn(c).addClass("act")},setBtnInactive:function(c){this.getBtn(c).removeClass("act")},changeBtnIcon:function(c,d){this.getBtn(c).addClass("redactor_btn_"+d)},removeBtnIcon:function(c,d){this.getBtn(c).removeClass("redactor_btn_"+d)},removeBtn:function(c){this.getBtn(c).remove()},addBtn:function(c,d){this.$toolbar.append(b("").append(this.buildButton(c,d)))},fullscreen:function(){var c;if(this.opts.fullscreen===false){this.changeBtnIcon("fullscreen","normalscreen");this.setBtnActive("fullscreen");this.opts.fullscreen=true;this.height=this.$frame.css("height");this.width=(this.$box.width()-2)+"px";c=this.getCode();this.tmpspan=b("");this.$box.addClass("redactor_box_fullscreen").after(this.tmpspan);b(document.body).prepend(this.$box).css("overflow","hidden");this.$editor=this.enable(c);b(this.doc).click(b.proxy(this.hideAllDropDown,this));b(this.doc).click(b.proxy(function(d){this.$editor.focus()},this));this.observeImages();this.$box.find(".redactor_resizer").hide();this.fullScreenResize();b(window).resize(b.proxy(this.fullScreenResize,this));b(document).scrollTop(0,0);this.focus()}else{this.removeBtnIcon("fullscreen","normalscreen");this.setBtnInactive("fullscreen");this.opts.fullscreen=false;b(window).unbind("resize",b.proxy(this.fullScreenResize,this));b(document.body).css("overflow","");c=this.getCode();this.$box.removeClass("redactor_box_fullscreen").css("width","auto");this.tmpspan.after(this.$box).remove();this.$editor=this.enable(c);this.observeImages();this.observeAutoResize();this.$box.find(".redactor_resizer").show();b(this.doc).click(b.proxy(this.hideAllDropDown,this));b(this.doc).click(b.proxy(function(d){this.$editor.focus()},this));this.syncCode();this.$frame.css("height",this.height);this.$el.css("height",this.height);this.focus()}},fullScreenResize:function(){if(this.opts.fullscreen===false){return}var d=42;if(this.opts.air){d=2}var c=b(window).height()-d;this.$box.width(b(window).width()-2);this.$frame.height(c);this.$el.height(c)},buildResizer:function(){if(this.opts.resize===false){return false}this.$resizer=b('—
');this.$box.append(this.$resizer);this.$resizer.mousedown(b.proxy(this.initResize,this))},initResize:function(c){if(c.preventDefault){c.preventDefault()}this.splitter=c.target;if(this.opts.visual){this.element_resize=this.$frame;this.element_resize.get(0).style.visibility="hidden";this.element_resize_parent=this.$el}else{this.element_resize=this.$el;this.element_resize_parent=this.$frame}this.stopResizeHdl=b.proxy(this.stopResize,this);this.startResizeHdl=b.proxy(this.startResize,this);this.resizeHdl=b.proxy(this.resize,this);b(document).mousedown(this.startResizeHdl);b(document).mouseup(this.stopResizeHdl);b(this.splitter).mouseup(this.stopResizeHdl);this.null_point=false;this.h_new=false;this.h=this.element_resize.height()},startResize:function(){b(document).mousemove(this.resizeHdl)},resize:function(d){if(d.preventDefault){d.preventDefault()}var f=d.pageY;if(this.null_point===false){this.null_point=f}if(this.h_new===false){this.h_new=this.element_resize.height()}var c=(this.h_new+f-this.null_point)-10;if(c<=30){return true}if(c>=0){this.element_resize.get(0).style.height=c+"px";this.element_resize_parent.get(0).style.height=c+"px"}},stopResize:function(c){b(document).unbind("mousemove",this.resizeHdl);b(document).unbind("mousedown",this.startResizeHdl);b(document).unbind("mouseup",this.stopResizeHdl);b(this.splitter).unbind("mouseup",this.stopResizeHdl);this.element_resize.get(0).style.visibility="visible"},resizeImage:function(d){var g=false;var c=false;var l;var k;var f=b(d).width()/b(d).height();var h=1;var i=1;var j=1;var e=1;b(d).hover(function(){b(d).css("cursor","nw-resize")},function(){b(d).css("cursor","default");g=false});b(d).mousedown(function(m){if(m.preventDefault){m.preventDefault()}g=true;c=true;l=Math.round(m.pageX-b(d).eq(0).offset().left);k=Math.round(m.pageY-b(d).eq(0).offset().top)});b(d).mouseup(b.proxy(function(m){g=false;this.syncCode()},this));b(d).click(b.proxy(function(m){if(c){this.imageEdit(m)}},this));b(d).mousemove(function(q){if(g){c=false;var n=Math.round(q.pageX-b(this).eq(0).offset().left)-l;var m=Math.round(q.pageY-b(this).eq(0).offset().top)-k;var p=b(d).height();var r=parseInt(p)+m;var o=r*f;if(i==1||(typeof(i)=="number"&&oj)){b(d).width(o)}if(h==1||(typeof(h)=="number"&&re)){b(d).height(r)}l=Math.round(q.pageX-b(this).eq(0).offset().left);k=Math.round(q.pageY-b(this).eq(0).offset().top)}})},showTable:function(){this.modalInit(RLANG.table,this.opts.path+"/plugins/table.html",300,b.proxy(function(){b("#redactor_table_rows").focus();b("#redactor_insert_table_btn").click(b.proxy(this.insertTable,this))},this))},insertTable:function(){var m=b("#redactor_table_rows").val();var f=b("#redactor_table_columns").val();var c=b("");var d=Math.floor(Math.random()*99999);var k=b('');for(var g=0;g");for(var j=0;j ");b(l).append(e)}b(k).append(l)}b(c).append(k);var h=b(c).html();if(b.browser.msie){h+=""}else{h+="
"}this.execCommand("inserthtml",h);this.modalClose();this.$table=b(this.doc).find("body").find("#table"+d);this.$table.click(b.proxy(this.tableObserver,this))},tableObserver:function(c){this.$table=b(c.target).parents("table");this.$table_tr=this.$table.find("tr");this.$table_td=this.$table.find("td");this.$table_td.removeClass("current");this.$tbody=b(c.target).parents("tbody");this.$thead=b(this.$table).find("thead");this.$current_td=b(c.target);this.$current_td.addClass("current");this.$current_tr=b(c.target).parents("tr")},deleteTable:function(){b(this.$table).remove();this.$table=false;this.syncCode()},deleteRow:function(){b(this.$current_tr).remove();this.syncCode()},deleteColumn:function(){var c=b(this.$current_td).get(0).cellIndex;b(this.$table).find("tr").each(function(){b(this).find("td").eq(c).remove()});this.syncCode()},addHead:function(){if(b(this.$table).find("thead").size()!==0){this.deleteHead()}else{var c=b(this.$table).find("tr").first().clone();c.find("td").html(" ");this.$thead=b("");this.$thead.append(c);b(this.$table).prepend(this.$thead);this.syncCode()}},deleteHead:function(){b(this.$thead).remove();this.$thead=false;this.syncCode()},insertRowAbove:function(){this.insertRow("before")},insertRowBelow:function(){this.insertRow("after")},insertColumnLeft:function(){this.insertColumn("before")},insertColumnRight:function(){this.insertColumn("after")},insertRow:function(c){var d=b(this.$current_tr).clone();d.find("td").html(" ");if(c=="after"){b(this.$current_tr).after(d)}else{b(this.$current_tr).before(d)}this.syncCode()},insertColumn:function(d){var c=0;this.$current_td.addClass("current");this.$current_tr.find("td").each(function(e,f){if(b(f).hasClass("current")){c=e}});this.$table_tr.each(function(e,f){var g=b(f).find("td").eq(c);var h=g.clone();h.html(" ");if(d=="after"){b(g).after(h)}else{b(g).before(h)}});this.syncCode()},showVideo:function(){if(b.browser.msie){this.markerIE()}this.modalInit(RLANG.video,this.opts.path+"/plugins/video.html",600,b.proxy(function(){b("#redactor_insert_video_area").focus();b("#redactor_insert_video_btn").click(b.proxy(this.insertVideo,this))},this))},insertVideo:function(){var c=b("#redactor_insert_video_area").val();if(b.browser.msie){b(this.doc.getElementById("span"+this.spanid)).after(c).remove();this.syncCode()}else{this.execCommand("inserthtml",c)}this.modalClose()},imageEdit:function(g){var c=b(g.target);var f=c.parent();var d=b.proxy(function(){b("#redactor_file_alt").val(c.attr("alt"));b("#redactor_image_edit_src").attr("href",c.attr("src"));b("#redactor_form_image_align").val(c.css("float"));if(b(f).get(0).tagName=="A"){b("#redactor_file_link").val(b(f).attr("href"))}b("#redactor_image_delete_btn").click(b.proxy(function(){this.imageDelete(c)},this));b("#redactorSaveBtn").click(b.proxy(function(){this.imageSave(c)},this))},this);this.modalInit(RLANG.image,this.opts.path+"/plugins/image_edit.html",380,d)},imageDelete:function(c){b(c).remove();this.modalClose();this.syncCode()},imageSave:function(d){var c=b(d).parent();b(d).attr("alt",b("#redactor_file_alt").val());var f=b("#redactor_form_image_align").val();if(f=="left"){b(d).css({"float":"left",margin:"0 10px 10px 0"})}else{if(f=="right"){b(d).css({"float":"right",margin:"0 0 10px 10px"})}else{b(d).css({"float":"none",margin:"0"})}}var e=b.trim(b("#redactor_file_link").val());if(e!==""){if(b(c).get(0).tagName!="A"){b(d).replaceWith(''+this.outerHTML(d)+"")}else{b(c).attr("href",e)}}this.modalClose();this.observeImages();this.syncCode()},showImage:function(){if(b.browser.msie){this.markerIE()}var c=b.proxy(function(){if(this.opts.imageGetJson!==false){b.getJSON(this.opts.imageGetJson,b.proxy(function(e){b.each(e,b.proxy(function(g,h){var f=b('');b("#redactor_image_box").append(f);b(f).click(b.proxy(this.imageSetThumb,this))},this))},this))}else{b("#redactor_tabs a").eq(1).remove()}if(this.opts.imageUpload!==false){if(b("#redactor_file").size()!==0){b("#redactor_file").dragupload({url:this.opts.imageUpload,success:b.proxy(this.imageUploadCallback,this)})}this.uploadInit("redactor_file",{auto:true,url:this.opts.imageUpload,success:b.proxy(this.imageUploadCallback,this)})}else{b(".redactor_tab").hide();if(this.opts.imageGetJson===false){b("#redactor_tabs").remove();b("#redactor_tab3").show()}else{var d=b("#redactor_tabs a");d.eq(0).remove();d.eq(1).addClass("redactor_tabs_act");b("#redactor_tab2").show()}}b("#redactor_upload_btn").click(b.proxy(this.imageUploadCallbackLink,this))},this);this.modalInit(RLANG.image,this.opts.path+"/plugins/image.html",570,c,true)},imageSetThumb:function(c){this._imageSet('')},imageUploadCallbackLink:function(){if(b("#redactor_file_link").val()!==""){var c='';this._imageSet(c)}else{this.modalClose()}},imageUploadCallback:function(c){this._imageSet(c)},_imageSet:function(c){c=""+c+"
";this.focus();if(b.browser.msie){b(this.doc.getElementById("span"+this.spanid)).after(c).remove();this.syncCode()}else{this.execCommand("inserthtml",c)}this.modalClose();this.observeImages()},showLink:function(){var c=b.proxy(function(){var g=this.getSelection();if(b.browser.msie){var f=this.getParentNode();if(f.nodeName=="A"){this.insert_link_node=b(f);var h=this.insert_link_node.text();var d=this.insert_link_node.attr("href")}else{if(this.oldIE()){var h=g.text}else{var h=g.toString()}var d="";this.spanid=Math.floor(Math.random()*99999);var e=''+h+"";if(h!=""){e=''+h+""}this.execCommand("inserthtml",e)}}else{if(g&&g.anchorNode.parentNode.tagName=="A"){var d=g.anchorNode.parentNode.href;var h=g.anchorNode.parentNode.text;if(g.toString()===""){this.insert_link_node=g.anchorNode.parentNode}}else{var h=g.toString();var d=""}}b(".redactor_link_text").val(h);b("#redactor_link_url").val(d).focus();b("#redactor_insert_link_btn").click(b.proxy(this.insertLink,this));if(this.opts.linkFileUpload===false){b("#redactor_tabs a").eq(3).remove()}else{if(b("#redactor_file").size()!=0){b("#redactor_file").dragupload({url:this.opts.linkFileUpload,success:b.proxy(this.insertLinkFile,this)})}this.uploadInit("redactor_file",{auto:true,url:this.opts.linkFileUpload,success:b.proxy(this.insertLinkFile,this)})}},this);this.modalInit(RLANG.link,this.opts.path+"/plugins/link.html",460,c)},insertLink:function(){var d=b("#redactor_tab_selected").val();var c="",e="";if(d==1){c=b("#redactor_link_url").val();e=b("#redactor_link_url_text").val()}else{if(d==2){c="mailto:"+b("#redactor_link_mailto").val();e=b("#redactor_link_mailto_text").val()}else{if(d==3){c="#"+b("#redactor_link_anchor").val();e=b("#redactor_link_anchor_text").val()}}}this._insertLink(''+e+" ",b.trim(e),c)},insertLinkFile:function(c){text=b("#redactor_link_file_text").val();this._insertLink(''+text+" ",b.trim(text),c)},_insertLink:function(c,e,d){if(e!=""){if(this.insert_link_node){b(this.insert_link_node).text(e);b(this.insert_link_node).attr("href",d);this.syncCode()}else{if(b.browser.msie){b(this.doc.getElementById("span"+this.spanid)).replaceWith(c);this.syncCode()}else{this.execCommand("inserthtml",c)}}}this.modalClose()},showFile:function(){if(b.browser.msie){this.markerIE()}var c=b.proxy(function(){b("#redactor_file").dragupload({url:this.opts.fileUpload,success:b.proxy(function(d){this.fileUploadCallback(d)},this)});this.uploadInit("redactor_file",{auto:true,url:this.opts.fileUpload,success:b.proxy(function(d){this.fileUploadCallback(d)},this)})},this);this.modalInit(RLANG.file,this.opts.path+"/plugins/file.html",500,c)},fileUploadCallback:function(c){if(b.browser.webkit&&!!window.chrome){c=c+" "}if(b.browser.msie){b(this.doc.getElementById("span"+this.spanid)).after(c).remove();this.syncCode()}else{this.execCommand("inserthtml",c)}this.modalClose()},modalInit:function(g,d,f,e,c){if(b("#redactor_modal_overlay").size()==0){this.overlay=b('');b("body").prepend(this.overlay)}if(this.opts.overlay){b("#redactor_modal_overlay").show();b("#redactor_modal_overlay").click(b.proxy(this.modalClose,this))}if(b("#redactor_modal").size()==0){this.modal=b('');b("body").append(this.modal)}b("#redactor_modal_close").click(b.proxy(this.modalClose,this));this.hdlModalClose=b.proxy(function(h){if(h.keyCode==27){this.modalClose()}},this);b(document).keyup(this.hdlModalClose);b(this.doc).keyup(this.hdlModalClose);b.ajax({dataType:"html",type:"get",url:d,success:b.proxy(function(i){b.each(RLANG,function(j,l){var k=new RegExp("%RLANG."+j+"%","gi");i=i.replace(k,l)});b("#redactor_modal_inner").html(i);b("#redactor_modal_header").html(g);if(b("#redactor_tabs").size()!=0){b("#redactor_tabs a").each(function(j,k){j++;b(k).click(function(){b("#redactor_tabs a").removeClass("redactor_tabs_act");b(this).addClass("redactor_tabs_act");b(".redactor_tab").hide();b("#redactor_tab"+j).show();b("#redactor_tab_selected").val(j);var l=b("#redactor_modal").outerHeight();b("#redactor_modal").css("margin-top","-"+(l+10)/2+"px")})})}b("#redactor_btn_modal_close").click(b.proxy(this.modalClose,this));if(typeof(e)=="function"){e()}var h=b("#redactor_modal").outerHeight();b("#redactor_modal").css({width:f+"px",height:"auto",marginTop:"-"+(h+10)/2+"px",marginLeft:"-"+(f+60)/2+"px"}).fadeIn("fast");if(c===true){b("#redactor_image_box").height(300).css("overflow","auto")}},this)})},modalClose:function(){b("#redactor_modal_close").unbind("click",this.modalClose);b("#redactor_modal").fadeOut("fast",b.proxy(function(){b("#redactor_modal_inner").html("");if(this.opts.overlay){b("#redactor_modal_overlay").hide();b("#redactor_modal_overlay").unbind("click",this.modalClose)}b(document).unbind("keyup",this.hdlModalClose);b(this.doc).unbind("keyup",this.hdlModalClose)},this))},uploadInit:function(d,c){this.uploadOptions={url:false,success:false,start:false,trigger:false,auto:false,input:false};b.extend(this.uploadOptions,c);if(b("#"+d).size()!=0&&b("#"+d).get(0).tagName=="INPUT"){this.uploadOptions.input=b("#"+d);this.element=b(b("#"+d).get(0).form)}else{this.element=b("#"+d)}this.element_action=this.element.attr("action");if(this.uploadOptions.auto){b(this.uploadOptions.input).change(b.proxy(function(){this.element.submit(function(f){return false});this.uploadSubmit()},this))}else{if(this.uploadOptions.trigger){b("#"+this.uploadOptions.trigger).click(b.proxy(this.uploadSubmit,this))}}},uploadSubmit:function(){this.uploadForm(this.element,this.uploadFrame())},uploadFrame:function(){this.id="f"+Math.floor(Math.random()*99999);var e=document.createElement("div");var c='';e.innerHTML=c;document.body.appendChild(e);if(this.uploadOptions.start){this.uploadOptions.start()}b("#"+this.id).load(b.proxy(this.uploadLoaded,this));return this.id},uploadForm:function(g,e){if(this.uploadOptions.input){var h="redactorUploadForm"+this.id;var c="redactorUploadFile"+this.id;this.form=b('');var d=this.uploadOptions.input;var i=b(d).clone();b(d).attr("id",c);b(d).before(i);b(d).appendTo(this.form);b(this.form).css("position","absolute");b(this.form).css("top","-2000px");b(this.form).css("left","-2000px");b(this.form).appendTo("body");this.form.submit()}else{g.attr("target",e);g.attr("method","POST");g.attr("enctype","multipart/form-data");g.attr("action",this.uploadOptions.url);this.element.submit()}},uploadLoaded:function(){var c=b("#"+this.id);if(c.contentDocument){var e=c.contentDocument}else{if(c.contentWindow){var e=c.contentWindow.document}else{var e=window.frames[this.id].document}}if(e.location.href=="about:blank"){return true}if(this.uploadOptions.success){this.uploadOptions.success(e.body.innerHTML)}this.element.attr("action",this.element_action);this.element.attr("target","")},markerIE:function(){this.spanid=Math.floor(Math.random()*99999);this.execCommand("inserthtml",'')},oldIE:function(){if(b.browser.msie&&parseInt(b.browser.version,10)<9){return true}return false},outerHTML:function(c){return b("").append(b(c).eq(0).clone()).html()},normalize:function(c){return parseInt(c.replace("px",""))}};b.fn.getDoc=function(){return b(this.data("redactor").doc)};b.fn.getFrame=function(){return this.data("redactor").$frame};b.fn.getEditor=function(){return this.data("redactor").$editor};b.fn.getCode=function(){return this.data("redactor").getCode()};b.fn.setCode=function(c){this.data("redactor").setCode(c)};b.fn.insertHtml=function(c){this.data("redactor").insertHtml(c)};b.fn.destroyEditor=function(){this.data("redactor").destroy();this.removeData("redactor")};b.fn.setFocus=function(){this.data("redactor").focus()};b.fn.execCommand=function(c,d){this.data("redactor").execCommand(c,d)}})(jQuery);(function(b){b.fn.dragupload=function(c){return this.each(function(){var d=new a(this,c);d.init()})};function a(d,c){this.opts=b.extend({url:false,success:false,preview:false,text:RLANG.drop_file_here,atext:RLANG.or_choose},c);this.$el=b(d)}a.prototype={init:function(){if(!b.browser.opera&&!b.browser.msie){this.droparea=b('
');this.dropareabox=b(''+this.opts.text+"
");this.dropalternative=b(''+this.opts.atext+"
");this.droparea.append(this.dropareabox);this.$el.before(this.droparea);this.$el.before(this.dropalternative);this.dropareabox.bind("dragover",b.proxy(function(){return this.ondrag()},this));this.dropareabox.bind("dragleave",b.proxy(function(){return this.ondragleave()},this));this.dropareabox.get(0).ondrop=b.proxy(function(e){e.preventDefault();this.dropareabox.removeClass("hover").addClass("drop");var d=e.dataTransfer.files[0];var c=new FormData();c.append("file",d);b.ajax({dataType:"html",url:this.opts.url,data:c,cache:false,contentType:false,processData:false,type:"POST",success:b.proxy(function(f){if(this.opts.success!==false){this.opts.success(f)}if(this.opts.preview===true){this.dropareabox.html(f)}},this)})},this)}},ondrag:function(){this.dropareabox.addClass("hover");return false},ondragleave:function(){this.dropareabox.removeClass("hover");return false}}})(jQuery);(function(b){var d=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,a=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,c=function(){var g=this.childNodes,f=g.length;while(f--){var h=g[f];if(h.nodeType==3){var e=h.nodeValue;if(e){e=e.replace(/&/g,"&").replace(//g,">").replace(d,'$1
$2$3').replace(a,'$1
$2$5');b(h).after(e).remove()}}else{if(h.nodeType==1&&!/^(a|button|textarea)$/i.test(h.tagName)){c.call(h)}}}};b.fn.linkify=function(){this.each(c)}})(jQuery);