WBBPRESET = { bodyClass: "content content-phpbb3", buttons: 'bold,italic,underline,|,quote,code,bullist,numlist,|,img,link,smilebox,fontsize,fontcolor', traceTextarea: true, allButtons: { quote: { transform: { '
{SELTEXT}
':'[quote]{SELTEXT}[/quote]', '
{AUTHOR} писал(а):{SELTEXT}
':'[quote="{AUTHOR}"]{SELTEXT}[/quote]' } }, code: { transform: { '
Код: Выделить всё
{SELTEXT}
':'[code]{SELTEXT}[/code]' } }, bullist: { transform: { '':'[list]{SELTEXT}[/list]', '
  • {SELTEXT}
  • ':'[*]{SELTEXT[^\[\]\*]}' } }, numlist: { transform: { '
      {SELTEXT}
    ':'[list=1]{SELTEXT}[/list]', '
  • {SELTEXT}
  • ':'[*]{SELTEXT[^\[\]\*]}' } }, attach: { title: CURLANG.add_attach, buttonHTML: '\uE017', hotkey: 'ctrl+shift+5', modal: { title: CURLANG.add_attach, width: "600px", tabs: [ { title: CURLANG.add_attach, html: '
    ' } ], onLoad: fileModal }, transform: { '
    {ALT} Просмотров: 0
    ':'[attachment={NUM[0-9]}]{ID[0-9]}: {ALT}[/attachment]', '
    {ALTFILE}
    Скачиваний: 0
    ':'[attachment={NUM[0-9]}]{ID[0-9]}; {ALTFILE}[/attachment]' } } }, smilefind: "#smiley-box" } //hide smilelist $(document).ready(function() { $("#format-buttons").hide(); $("#smiley-box").hide(); $("#message-box").css("width","100%"); }); (function($) { //for attachments process $.wysibb.prototype.traceTextareaEvent = function(e) { var data = this.$txtArea.val(); if (this.options.bbmode===false && data!="" && $(e.target).closest("div.wysibb").size()==0 && !this.$txtArea.attr("wbbsync")) { if (data.indexOf("[attachment=")!=-1) { var num = data.replace(/\[attachment=(\d+?)\].*/,"$1"); var idfile = $("input[name='attachment_data["+num+"][attach_id]']").val(); var ext = $("input[name='attachment_data["+num+"][real_filename]']").val().replace(/.*?\.(\w+)$/,"$1"); if (ext.match(/(jpg|gif|png|bmp)/)) { data = data.replace(/(\[attachment=\d+\])(.*?)(\[\/attachment\])/,"$1"+idfile+":$2$3"); }else{ data = data.replace(/(\[attachment=\d+\])(.*?)(\[\/attachment\])/,"$1"+";"+idfile+" $2$3"); } } this.insertAtCursor(this.getHTML(data,true)); this.$txtArea.val(""); } } $.wysibb.prototype.txtAreaInitContent = function() { var tdata = this.txtArea.value; tdata = tdata.replace(/(\[attachment=(\d+?)\])([^:;]*?)(\[\/attachment\])/g,function(m,left,num,cont,right) { var idfile = $("input[name='attachment_data["+num+"][attach_id]']").val(); var ext = $("input[name='attachment_data["+num+"][real_filename]']").val(); if (ext) { ext = ext.replace(/.*?\.(\w+)$/,"$1"); if (ext.match(/(jpg|gif|png|bmp)/)) { return (left+idfile+":"+cont+right); }else{ return (left+cont+";"+idfile+right); } }else{ return m; } }); this.$body.html(this.getHTML(tdata,true)); } $.fn.closeModal = function() { this.data("wbb").closeModal(); return this.data("wbb"); } $.fn.insertAttach = function(id,alt,isimg) { var num=0; while (num<30) { if ($("input[name='attachment_data["+num+"][attach_id]']").size()==0) { break; } num++; } this.data("wbb").$txtArea.after(''); var data = (isimg===true) ? this.data("wbb").getCodeByCommand("attach",{"id":id,"num":num,"alt":alt}):this.data("wbb").getCodeByCommand("attach",{"id":id,"num":num,"altfile":alt}); this.data("wbb").insertAtCursor(data); return this.data("wbb"); } })(jQuery); function fileModal() { $.log("fileModal"); if (this.options.imgupload===true) { this.$modal.find("#fupform").append(''); this.$modal.find("#imguploader").dragfileupload({ url: this.strf(this.options.img_uploadurl,this.options), themePrefix: this.options.themePrefix, themeName: this.options.themeName, extraParams: { upload_type:this.options.upload_type }, success: $.proxy(function(data) { $.log("Success"); if (data && data.status==1) { var num=0; while (num<30) { if ($("input[name='attachment_data["+num+"][attach_id]']").size()==0) { break; } num++; } this.$txtArea.after(''); var datastr = (data.isimg===true) ? this.getCodeByCommand("attach",{"id":data.id,"num":num,"alt":data.alt}):this.getCodeByCommand("attach",{"id":data.id,"num":num,"altfile":data.alt}); this.insertAtCursor(datastr); } this.closeModal(); this.updateUI(); },this), validation: ".*$" }); if ($.browser.msie) { //ie not posting form by security reason, show default file upload $.log("IE not posting form by security reason, show default file upload"); this.$modal.find("#nicebtn").hide(); this.$modal.find("#fileupl").css("opacity",1); } this.$modal.find("#fileupl").bind("change",function() { $("#fupform").submit(); }); this.$modal.find("#fupform").bind("submit",$.proxy(function(e) { $(e.target).parents("#imguploader").hide().after('

    '+CURLANG.loading+'
    ').parent().css("text-align","center"); },this)) }else{ this.$modal.find(".hastabs").removeClass("hastabs"); this.$modal.find("#imguploader").parents(".tab-cont").remove(); this.$modal.find(".wbbm-tablist").remove(); } }