From 460b483616158dea2aa3022fa59fe4fe43e11f42 Mon Sep 17 00:00:00 2001 From: Baptiste JAMIN Date: Wed, 18 Nov 2015 19:50:52 +0100 Subject: [PATCH 1/2] HTTPS by default on youtube Iframe Youtube enables now HTTPS by default. This fix allows appending the iframe on HTTPS websites --- jquery.wysibb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.wysibb.js b/jquery.wysibb.js index 97cb0f3..d0ccb48 100644 --- a/jquery.wysibb.js +++ b/jquery.wysibb.js @@ -374,7 +374,7 @@ wbbdebug=true; } }, transform: { - '':'[video]{SRC}[/video]' + '':'[video]{SRC}[/video]' } }, From f3189042da6ba1ffa35d5657e1e9dbb8a4c69937 Mon Sep 17 00:00:00 2001 From: Baptiste JAMIN Date: Wed, 18 Nov 2015 19:52:17 +0100 Subject: [PATCH 2/2] Update jquery.wysibb.min.js --- jquery.wysibb.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.wysibb.min.js b/jquery.wysibb.min.js index f92b2d8..be4345f 100644 --- a/jquery.wysibb.min.js +++ b/jquery.wysibb.min.js @@ -1,5 +1,5 @@ /*! WysiBB v1.5.1 2014-03-26 Author: Vadim Dobroskok */ -"undefined"==typeof WBBLANG&&(WBBLANG={}),WBBLANG.en=CURLANG={bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strike",link:"Link",img:"Insert image",sup:"Superscript",sub:"Subscript",justifyleft:"Align left",justifycenter:"Align center",justifyright:"Align right",table:"Insert table",bullist:"• Unordered list",numlist:"1. Ordered list",quote:"Quote",offtop:"Offtop",code:"Code",spoiler:"Spoiler",fontcolor:"Font color",fontsize:"Font size",fontfamily:"Font family",fs_verysmall:"Very small",fs_small:"Small",fs_normal:"Normal",fs_big:"Big",fs_verybig:"Very big",smilebox:"Insert emoticon",video:"Insert YouTube",removeFormat:"Remove Format",modal_link_title:"Insert link",modal_link_text:"Display text",modal_link_url:"URL",modal_email_text:"Display email",modal_email_url:"Email",modal_link_tab1:"Insert URL",modal_img_title:"Insert image",modal_img_tab1:"Insert URL",modal_img_tab2:"Upload image",modal_imgsrc_text:"Enter image URL",modal_img_btn:"Choose file",add_attach:"Add Attachment",modal_video_text:"Enter the URL of the video",close:"Close",save:"Save",cancel:"Cancel",remove:"Delete",validation_err:"The entered data is invalid",error_onupload:"Error during file upload",fileupload_text1:"Drop file here",fileupload_text2:"or",loading:"Loading",auto:"Auto",views:"Views",downloads:"Downloads",sm1:"Smile",sm2:"Laughter",sm3:"Wink",sm4:"Thank you",sm5:"Scold",sm6:"Shock",sm7:"Angry",sm8:"Pain",sm9:"Sick"},wbbdebug=!0,function(a){"use strict";a.wysibb=function(b,c){a(b).data("wbb",this),c&&c.deflang&&"undefined"!=typeof WBBLANG[c.deflang]&&(CURLANG=WBBLANG[c.deflang]),c&&c.lang&&"undefined"!=typeof WBBLANG[c.lang]&&(CURLANG=WBBLANG[c.lang]),this.txtArea=b,this.$txtArea=a(b);this.$txtArea.attr("id")||this.setUID(this.txtArea);this.options={bbmode:!1,onlyBBmode:!1,themeName:"default",bodyClass:"",lang:"ru",tabInsert:!0,imgupload:!1,img_uploadurl:"/iupload.php",img_maxwidth:800,img_maxheight:800,hotkeys:!0,showHotkeys:!0,autoresize:!0,resize_maxheight:800,loadPageStyles:!0,traceTextarea:!0,smileConversion:!0,buttons:"bold,italic,underline,strike,sup,sub,|,img,video,link,|,bullist,numlist,|,fontcolor,fontsize,fontfamily,|,justifyleft,justifycenter,justifyright,|,quote,code,table,removeFormat",allButtons:{bold:{title:CURLANG.bold,buttonHTML:'',excmd:"bold",hotkey:"ctrl+b",transform:{"{SELTEXT}":"[b]{SELTEXT}[/b]","{SELTEXT}":"[b]{SELTEXT}[/b]"}},italic:{title:CURLANG.italic,buttonHTML:'',excmd:"italic",hotkey:"ctrl+i",transform:{"{SELTEXT}":"[i]{SELTEXT}[/i]","{SELTEXT}":"[i]{SELTEXT}[/i]"}},underline:{title:CURLANG.underline,buttonHTML:'',excmd:"underline",hotkey:"ctrl+u",transform:{"{SELTEXT}":"[u]{SELTEXT}[/u]"}},strike:{title:CURLANG.strike,buttonHTML:'',excmd:"strikeThrough",transform:{"{SELTEXT}":"[s]{SELTEXT}[/s]","{SELTEXT}":"[s]{SELTEXT}[/s]"}},sup:{title:CURLANG.sup,buttonHTML:'',excmd:"superscript",transform:{"{SELTEXT}":"[sup]{SELTEXT}[/sup]"}},sub:{title:CURLANG.sub,buttonHTML:'',excmd:"subscript",transform:{"{SELTEXT}":"[sub]{SELTEXT}[/sub]"}},link:{title:CURLANG.link,buttonHTML:'',hotkey:"ctrl+shift+2",modal:{title:CURLANG.modal_link_title,width:"500px",tabs:[{input:[{param:"SELTEXT",title:CURLANG.modal_link_text,type:"div"},{param:"URL",title:CURLANG.modal_link_url,validation:"^http(s)?://"}]}]},transform:{'{SELTEXT}':"[url={URL}]{SELTEXT}[/url]",'{URL}':"[url]{URL}[/url]"}},img:{title:CURLANG.img,buttonHTML:'',hotkey:"ctrl+shift+1",addWrap:!0,modal:{title:CURLANG.modal_img_title,width:"600px",tabs:[{title:CURLANG.modal_img_tab1,input:[{param:"SRC",title:CURLANG.modal_imgsrc_text,validation:"^http(s)?://.*?.(jpg|png|gif|jpeg)$"}]}],onLoad:this.imgLoadModal},transform:{'':"[img]{SRC}[/img]",'':"[img width={WIDTH},height={HEIGHT}]{SRC}[/img]"}},bullist:{title:CURLANG.bullist,buttonHTML:'',excmd:"insertUnorderedList",transform:{"":"[list]{SELTEXT}[/list]","
  • {SELTEXT}
  • ":"[*]{SELTEXT}[/*]"}},numlist:{title:CURLANG.numlist,buttonHTML:'',excmd:"insertOrderedList",transform:{"
      {SELTEXT}
    ":"[list=1]{SELTEXT}[/list]","
  • {SELTEXT}
  • ":"[*]{SELTEXT}[/*]"}},quote:{title:CURLANG.quote,buttonHTML:'',hotkey:"ctrl+shift+3",transform:{"
    {SELTEXT}
    ":"[quote]{SELTEXT}[/quote]"}},code:{title:CURLANG.code,buttonText:"[code]",hotkey:"ctrl+shift+4",onlyClearText:!0,transform:{"{SELTEXT}":"[code]{SELTEXT}[/code]"}},offtop:{title:CURLANG.offtop,buttonText:"offtop",transform:{'{SELTEXT}':"[offtop]{SELTEXT}[/offtop]"}},fontcolor:{type:"colorpicker",title:CURLANG.fontcolor,excmd:"foreColor",valueBBname:"color",subInsert:!0,colors:"#000000,#444444,#666666,#999999,#b6b6b6,#cccccc,#d8d8d8,#efefef,#f4f4f4,#ffffff,-, #ff0000,#980000,#ff7700,#ffff00,#00ff00,#00ffff,#1e84cc,#0000ff,#9900ff,#ff00ff,-, #f4cccc,#dbb0a7,#fce5cd,#fff2cc,#d9ead3,#d0e0e3,#c9daf8,#cfe2f3,#d9d2e9,#ead1dc, #ea9999,#dd7e6b,#f9cb9c,#ffe599,#b6d7a8,#a2c4c9,#a4c2f4,#9fc5e8,#b4a7d6,#d5a6bd, #e06666,#cc4125,#f6b26b,#ffd966,#93c47d,#76a5af,#6d9eeb,#6fa8dc,#8e7cc3,#c27ba0, #cc0000,#a61c00,#e69138,#f1c232,#6aa84f,#45818e,#3c78d8,#3d85c6,#674ea7,#a64d79, #900000,#85200C,#B45F06,#BF9000,#38761D,#134F5C,#1155Cc,#0B5394,#351C75,#741B47, #660000,#5B0F00,#783F04,#7F6000,#274E13,#0C343D,#1C4587,#073763,#20124D,#4C1130",transform:{'{SELTEXT}':"[color={COLOR}]{SELTEXT}[/color]"}},table:{type:"table",title:CURLANG.table,cols:10,rows:10,cellwidth:20,transform:{"{SELTEXT}":"[td]{SELTEXT}[/td]","{SELTEXT}":"[tr]{SELTEXT}[/tr]",'{SELTEXT}
    ':"[table]{SELTEXT}[/table]"},skipRules:!0},fontsize:{type:"select",title:CURLANG.fontsize,options:"fs_verysmall,fs_small,fs_normal,fs_big,fs_verybig"},fontfamily:{type:"select",title:CURLANG.fontfamily,excmd:"fontName",valueBBname:"font",options:[{title:"Arial",exvalue:"Arial"},{title:"Comic Sans MS",exvalue:"Comic Sans MS"},{title:"Courier New",exvalue:"Courier New"},{title:"Georgia",exvalue:"Georgia"},{title:"Lucida Sans Unicode",exvalue:"Lucida Sans Unicode"},{title:"Tahoma",exvalue:"Tahoma"},{title:"Times New Roman",exvalue:"Times New Roman"},{title:"Trebuchet MS",exvalue:"Trebuchet MS"},{title:"Verdana",exvalue:"Verdana"}],transform:{'{SELTEXT}':"[font={FONT}]{SELTEXT}[/font]"}},smilebox:{type:"smilebox",title:CURLANG.smilebox,buttonHTML:''},justifyleft:{title:CURLANG.justifyleft,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[left]{SELTEXT}[/left]"}},justifyright:{title:CURLANG.justifyright,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[right]{SELTEXT}[/right]"}},justifycenter:{title:CURLANG.justifycenter,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[center]{SELTEXT}[/center]"}},video:{title:CURLANG.video,buttonHTML:'',modal:{title:CURLANG.video,width:"600px",tabs:[{title:CURLANG.video,input:[{param:"SRC",title:CURLANG.modal_video_text}]}],onSubmit:function(a){var b=this.$modal.find('input[name="SRC"]').val();b&&(b=b.replace(/^\s+/,"").replace(/\s+$/,""));var c;if(c=b.match(-1!=b.indexOf("youtu.be")?/^http[s]*:\/\/youtu\.be\/([a-z0-9_-]+)/i:/^http[s]*:\/\/www\.youtube\.com\/watch\?.*?v=([a-z0-9_-]+)/i),c&&2==c.length){var d=c[1];this.insertAtCursor(this.getCodeByCommand(a,{src:d}))}return this.closeModal(),this.updateUI(),!1}},transform:{'':"[video]{SRC}[/video]"}},fs_verysmall:{title:CURLANG.fs_verysmall,buttonText:"fs1",excmd:"fontSize",exvalue:"1",transform:{'{SELTEXT}':"[size=50]{SELTEXT}[/size]"}},fs_small:{title:CURLANG.fs_small,buttonText:"fs2",excmd:"fontSize",exvalue:"2",transform:{'{SELTEXT}':"[size=85]{SELTEXT}[/size]"}},fs_normal:{title:CURLANG.fs_normal,buttonText:"fs3",excmd:"fontSize",exvalue:"3",transform:{'{SELTEXT}':"[size=100]{SELTEXT}[/size]"}},fs_big:{title:CURLANG.fs_big,buttonText:"fs4",excmd:"fontSize",exvalue:"4",transform:{'{SELTEXT}':"[size=150]{SELTEXT}[/size]"}},fs_verybig:{title:CURLANG.fs_verybig,buttonText:"fs5",excmd:"fontSize",exvalue:"6",transform:{'{SELTEXT}':"[size=200]{SELTEXT}[/size]"}},removeformat:{title:CURLANG.removeFormat,buttonHTML:'',excmd:"removeFormat"}},systr:{"
    ":"\n",'{SELTEXT}':" {SELTEXT}"},customRules:{td:[["[td]{SELTEXT}[/td]",{seltext:{rgx:!1,attr:!1,sel:!1}}]],tr:[["[tr]{SELTEXT}[/tr]",{seltext:{rgx:!1,attr:!1,sel:!1}}]],table:[["[table]{SELTEXT}[/table]",{seltext:{rgx:!1,attr:!1,sel:!1}}]]},smileList:[],attrWrap:["src","color","href"]},this.inited=this.options.onlyBBmode,this.options.themePrefix||a("link").each(a.proxy(function(b,c){var d=a(c).get(0).href.match(/(.*\/)(.*)\/wbbtheme\.css.*$/);null!==d&&(this.options.themeName=d[2],this.options.themePrefix=d[1])},this)),"undefined"!=typeof WBBPRESET&&(WBBPRESET.allButtons&&a.each(WBBPRESET.allButtons,a.proxy(function(a,b){b.transform&&this.options.allButtons[a]&&delete this.options.allButtons[a].transform},this)),a.extend(!0,this.options,WBBPRESET)),c&&c.allButtons&&a.each(c.allButtons,a.proxy(function(a,b){b.transform&&this.options.allButtons[a]&&delete this.options.allButtons[a].transform},this)),a.extend(!0,this.options,c),this.init()},a.wysibb.prototype={lastid:1,init:function(){a.log("Init",this),this.isMobile=function(a){/android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)}(navigator.userAgent||navigator.vendor||window.opera),this.options.onlyBBmode===!0&&(this.options.bbmode=!0),this.controllers=[],this.options.buttons=this.options.buttons.toLowerCase(),this.options.buttons=this.options.buttons.split(","),this.options.allButtons._systr={},this.options.allButtons._systr.transform=this.options.systr,this.smileFind(),this.initTransforms(),this.build(),this.initModal(),this.options.hotkeys!==!0||this.isMobile||this.initHotkeys(),this.options.smileList&&this.options.smileList.length>0&&this.options.smileList.sort(function(a,b){return b.bbcode.length-a.bbcode.length}),this.$txtArea.parents("form").bind("submit",a.proxy(function(){return this.sync(),!0},this)),this.$txtArea.parents("form").find("input[id*='preview'],input[id*='submit'],input[class*='preview'],input[class*='submit'],input[name*='preview'],input[name*='submit']").bind("mousedown",a.proxy(function(){this.sync(),setTimeout(a.proxy(function(){this.options.bbmode===!1&&this.$txtArea.removeAttr("wbbsync").val("")},this),1e3)},this)),this.options.initCallback&&this.options.initCallback.call(this),a.log(this)},initTransforms:function(){a.log("Create rules for transform HTML=>BB");var b=this.options;b.rules||(b.rules={}),b.groups||(b.groups={});var c=b.buttons.slice();c.push("_systr");for(var d=0;d-1||a(d).parent().contents().size()>1){var n=a("").html("{"+i+"}");this.setUID(n,"wbb");var p=f.indexOf(i)+i.length+1,q=f.substr(p,f.length-p);d.data=f.substr(0,f.indexOf(i)-1),a(d).after(this.elFromString(q,document)).after(n),m=(m?m+" ":"")+this.filterByNode(n),k=!1}o[i.toLowerCase()]={sel:m,attr:!1,rgx:k},e[e.length]=m}},this)),e=null},this));var p=k.html();p=this.unwrapAttrs(p),i!=p&&(delete e.transform[i],e.transform[p]=j,h=p)}b.rules[l].push([j,o]),e.onlyClearText===!0&&(this.cleartext||(this.cleartext={}),this.cleartext[l]=c[d]),e.groupkey&&(b.groups[e.groupkey]||(b.groups[e.groupkey]=[]),b.groups[e.groupkey].push(l))}}e.rootSelector&&this.sortArray(e.rootSelector,-1);var q=a.map(e.transform,function(a,b){return b}).sort(function(a,b){return(b[0]||"").length-(a[0]||"").length});e.bbcode=e.transform[q[0]],e.html=q[0]}}}this.options.btnlist=c,a.extend(b.rules,this.options.customRules),b.srules={},this.options.smileList&&a.each(b.smileList,a.proxy(function(c,d){var e=a(this.strf(d.img,b)),f=this.filterByNode(e);b.srules[f]=[d.bbcode,d.img]},this));for(var r in b.rules)this.options.rules[r].sort(function(a,b){return b[0].length-a[0].length});this.rsellist=[];for(var r in this.options.rules)this.rsellist.push(r);this.sortArray(this.rsellist,-1)},build:function(){if(a.log("Build editor"),this.$editor=a("
    ").addClass("wysibb"),this.isMobile&&this.$editor.addClass("wysibb-mobile"),this.options.direction&&this.$editor.css("direction",this.options.direction),this.$editor.insertAfter(this.txtArea).append(this.txtArea),this.startHeight=this.$txtArea.outerHeight(),this.$txtArea.addClass("wysibb-texarea"),this.buildToolbar(),this.$txtArea.wrap('
    '),this.options.onlyBBmode===!1){var b=this.options.minheight||this.$txtArea.outerHeight(),c=(this.options.resize_maxheight,this.options.autoresize===!0?this.options.resize_maxheight:b);if(this.$body=a(this.strf('
    ',{maxheight:c,height:b})).insertAfter(this.$txtArea),this.body=this.$body[0],this.$txtArea.hide(),b>32&&this.$toolbar.css("max-height",b),a.log("WysiBB loaded"),this.$body.addClass("wysibb-body").addClass(this.options.bodyClass),this.options.direction&&this.$body.css("direction",this.options.direction),"contentEditable"in this.body){this.body.contentEditable=!0;try{document.execCommand("StyleWithCSS",!1,!1),this.$body.append("")}catch(d){}}else this.options.onlyBBmode=this.options.bbmode=!0;this.txtArea.value.length>0&&this.txtAreaInitContent(),this.$body.bind("keydown",a.proxy(function(b){return 86==b.which&&(1==b.ctrlKey||1==b.metaKey)||45==b.which&&(1==b.shiftKey||1==b.metaKey)?(this.$pasteBlock||(this.saveRange(),this.$pasteBlock=a(this.elFromString('
    
    ')),this.$pasteBlock.appendTo(this.body),setTimeout(a.proxy(function(){this.clearPaste(this.$pasteBlock);var b=""+this.$pasteBlock.html()+"";this.$body.attr("contentEditable","true"),this.$pasteBlock.blur().remove(),this.body.focus(),this.cleartext&&(a.log("Check if paste to clearText Block"),this.isInClearTextBlock()&&(b=this.toBB(b).replace(/\n/g,"
    ").replace(/\s{3}/g,''))),b=b.replace(/\t/g,''),this.selectRange(this.lastRange),this.insertAtCursor(b,!1),this.lastRange=!1,this.$pasteBlock=!1},this),1),this.selectNode(this.$pasteBlock[0])),!0):void 0},this)),this.$body.bind("keydown",a.proxy(function(a){if(13==a.which){var b=this.isContain(this.getSelectNode(),"li");b||(a.preventDefault&&a.preventDefault(),this.checkForLastBR(this.getSelectNode()),this.insertAtCursor("
    ",!1))}},this)),this.options.tabInsert===!0&&this.$body.bind("keydown",a.proxy(this.pressTab,this)),this.$body.bind("mouseup keyup",a.proxy(this.updateUI,this)),this.$body.bind("mousedown",a.proxy(function(a){this.clearLastRange(),this.checkForLastBR(a.target)},this)),this.options.traceTextarea===!0&&(a(document).bind("mousedown",a.proxy(this.traceTextareaEvent,this)),this.$txtArea.val("")),this.options.hotkeys===!0&&this.$body.bind("keydown",a.proxy(this.presskey,this)),this.options.smileConversion===!0&&this.$body.bind("keyup",a.proxy(this.smileConversion,this)),this.inited=!0,this.options.autoresize===!0&&(this.$bresize=a(this.elFromString('
    ')).appendTo(this.$editor).wdrag({scope:this,axisY:!0,height:b})),this.imgListeners()}this.$txtArea.bind("mouseup keyup",a.proxy(function(){clearTimeout(this.uitimer),this.uitimer=setTimeout(a.proxy(this.updateUI,this),100)},this)),this.options.hotkeys===!0&&a(document).bind("keydown",a.proxy(this.presskey,this))},buildToolbar:function(){if(this.options.toolbar===!1)return!1;this.$toolbar=a("
    ").addClass("wysibb-toolbar").prependTo(this.$editor);var b;a.each(this.options.buttons,a.proxy(function(c,d){var e=this.options.allButtons[d];(0==c||"|"==d||"-"==d)&&("-"==d&&this.$toolbar.append("
    "),b=a('
    ').appendTo(this.$toolbar)),e&&("colorpicker"==e.type?this.buildColorpicker(b,d,e):"table"==e.type?this.buildTablepicker(b,d,e):"select"==e.type?this.buildSelect(b,d,e):"smilebox"==e.type?this.buildSmilebox(b,d,e):this.buildButton(b,d,e))},this)),this.$toolbar.find(".btn-tooltip").hover(function(){a(this).parent().css("overflow","hidden")},function(){a(this).parent().css("overflow","visible")});var c=a(document.createElement("div")).addClass("wysibb-toolbar-container modeSwitch").html('
    [bbcode]
    ').appendTo(this.$toolbar);1==this.options.bbmode&&c.children(".wysibb-toolbar-btn").addClass("on"),this.options.onlyBBmode===!1&&c.children(".wysibb-toolbar-btn").click(a.proxy(function(b){a(b.currentTarget).toggleClass("on"),this.modeSwitch()},this))},buildButton:function(b,c,d){"object"!=typeof b&&(b=this.$toolbar);var e=d.buttonHTML?a(this.strf(d.buttonHTML,this.options)).addClass("btn-inner"):this.strf('{text}',{text:d.buttonText.replace(/['+d.hotkey+"]":"",g=a('
    ').appendTo(b).append(e).append(this.strf('{title}{hotkey}',{title:d.title,hotkey:f}));this.controllers.push(g),g.bind("queryState",a.proxy(function(b){this.queryState(c)?a(b.currentTarget).addClass("on"):a(b.currentTarget).removeClass("on")},this)),g.mousedown(a.proxy(function(b){b.preventDefault(),this.execCommand(c,d.exvalue||!1),a(b.currentTarget).trigger("queryState")},this))},buildColorpicker:function(b,c,d){var e=a('
    ').appendTo(b).append('
    ').append(this.strf('{title}',{title:d.title})),f=e.find(".cp-line"),g=a('
    ').appendTo(e);g.append('
    '+CURLANG.auto+"
    ");for(var h=d.colors?d.colors.split(","):[],i=0;i':this.strf('
    ',{color:h[i]}));var j=a(document.body).css("color");this.controllers.push(e),e.bind("queryState",a.proxy(function(){f.css("background-color",j);var a=this.queryState(c,!0);a&&(f.css("background-color",this.options.bbmode?a.color:a),e.find(".ve-tlb-colorpick span.fonticon").css("color",this.options.bbmode?a.color:a))},this)),e.mousedown(a.proxy(function(a){a.preventDefault(),this.dropdownclick(".wbb-cp",".wbb-list",a)},this)),e.find(".sc").mousedown(a.proxy(function(b){b.preventDefault(),this.selectLastRange();var d=a(b.currentTarget).attr("title");this.execCommand(c,d),e.trigger("queryState")},this)),e.find(".nc").mousedown(a.proxy(function(a){a.preventDefault(),this.selectLastRange(),this.execCommand(c,j),e.trigger("queryState")},this)),e.mousedown(function(a){a.preventDefault&&a.preventDefault()})},buildTablepicker:function(b,c,d){var e=a('
    ').appendTo(b).append('').append(this.strf('{title}',{title:d.title})),f=a('
    ').appendTo(e),g=a("
    ").css({position:"relative","box-sizing":"border-box"}).appendTo(f),h=d.rows||10,i=d.cols||10,j=h*i;g.css("height",h*d.cellwidth+2+"px");for(var k=1;i>=k;k++)for(var l=1;h>=l;l++){var m='
    ';g.append(m)}e.find(".tbl-sel").mousedown(a.proxy(function(b){b.preventDefault();for(var c=a(b.currentTarget).attr("title"),d=c.split(","),e=this.options.bbmode?"[table]":'',f=1;f<=d[0];f++){e+=this.options.bbmode?" [tr]\n":"";for(var g=1;g<=d[1];g++)e+=this.options.bbmode?" [td][/td]\n":"";e+=this.options.bbmode?"[/tr]\n":""}e+=this.options.bbmode?"[/table]":"
    
    ",this.insertAtCursor(e)},this)),e.mousedown(a.proxy(function(a){a.preventDefault(),this.dropdownclick(".wbb-tbl",".wbb-list",a)},this))},buildSelect:function(b,c,d){for(var e=a('
    ').appendTo(b).append(this.strf('{title}',d)).append(this.strf('{title}',{title:d.title})),f=a('
    ').appendTo(e),g=e.find("span.val"),h=a.isArray(d.options)?d.options:d.options.split(","),i=this.isMobile?a("
    ',c))},this))},this)),a.isFunction(c.onLoad)&&c.onLoad.call(this,b,c,d),f.find("#wbbm-submit").click(a.proxy(function(){if(a.isFunction(c.onSubmit)){var e=c.onSubmit.call(this,b,c,d);if(e===!1)return}var f={},g=!0;this.$modal.find(".wbbm-inperr").remove(),this.$modal.find(".wbbm-brdred").removeClass("wbbm-brdred"),a.each(this.$modal.find(".tab-cont:visible .inp-text"),a.proxy(function(b,d){var e=a(d).parents(".tab-cont").attr("tid"),h=a(d).attr("name").toLowerCase(),i="";i=a(d).is("input,textrea,select")?a(d).val():a(d).html();var j=c.tabs[e].input[b].validation;"undefined"!=typeof j&&(i.match(new RegExp(j,"i"))||(g=!1,a(d).after(''+CURLANG.validation_err+"").addClass("wbbm-brdred"))),f[h]=i},this)),g&&(a.log("Last range: "+this.lastRange),this.selectLastRange(),d&&this.wbbRemoveCallback(b,!0),this.wbbInsertCallback(b,f),this.closeModal(),this.updateUI())},this)),f.find("#wbbm-remove").click(a.proxy(function(){this.selectLastRange(),this.wbbRemoveCallback(b),this.closeModal(),this.updateUI()},this)),a(document.body).css("overflow","hidden"),a("body").height()>a(window).height()&&a(document.body).css("padding-right","18px"),this.$modal.show(),this.isMobile?f.css("margin-top","10px"):f.css("margin-top",(a(window).height()-f.outerHeight())/3+"px"),setTimeout(a.proxy(function(){this.$modal.find(".inp-text:visible")[0].focus()},this),10)},escModal:function(a){27==a.which&&this.closeModal()},closeModal:function(){return a(document.body).css("overflow","auto").css("padding-right","0").unbind("keyup",this.escModal),this.$modal.find("#wbbm-submit,#wbbm-remove").unbind("click"),this.$modal.hide(),this.lastRange=!1,this},getParams:function(b,c,d){var e={};if(this.options.bbmode){var f=c.match(/\{[\s\S]+?\}/g);c=this.prepareRGX(c);var g=new RegExp(c,"g"),h=this.txtArea.value;d>0&&(h=h.substr(d,h.length-d));var i=g.exec(h);i&&a.each(f,function(a,b){e[b.replace(/\{|\}/g,"").replace(/"/g,"'").toLowerCase()]=i[a+1]})}else{var j=this.options.rules[c][0][1];a.each(j,a.proxy(function(c,d){var f="",g=d.sel!==!1?f=a(b).find(d.sel):a(b);if(f=d.attr!==!1?g.attr(d.attr):g.html()){if(d.rgx!==!1){var h=f.match(new RegExp(d.rgx));h&&2==h.length&&(f=h[1])}e[c]=f.replace(/"/g,"'")}},this))}return e},imgLoadModal:function(){a.log("imgLoadModal"),this.options.imgupload===!0?(this.$modal.find("#imguploader").dragfileupload({url:this.strf(this.options.img_uploadurl,this.options),extraParams:{maxwidth:this.options.img_maxwidth,maxheight:this.options.img_maxheight},themePrefix:this.options.themePrefix,themeName:this.options.themeName,success:a.proxy(function(a){this.$txtArea.insertImage(a.image_link,a.thumb_link),this.closeModal(),this.updateUI()},this)}),this.$modal.find("#fileupl").bind("change",function(){a("#fupform").submit()}),this.$modal.find("#fupform").bind("submit",a.proxy(function(b){a(b.target).parents("#imguploader").hide().after('

    '+CURLANG.loading+"
    ").parent().css("text-align","center")},this))):(this.$modal.find(".hastabs").removeClass("hastabs"),this.$modal.find("#imguploader").parents(".tab-cont").remove(),this.$modal.find(".wbbm-tablist").remove())},imgSubmitModal:function(){a.log("imgSubmitModal")},printObjectInIE:function(b){try{a.log(JSON.stringify(b))}catch(c){}},checkFilter:function(b,c){a.log("node: "+a(b).get(0).outerHTML+" filter: "+c+" res: "+a(b).is(c.toLowerCase()))},debug:function(b){if(this.options.debug===!0){var c=(new Date).getTime();"undefined"!=typeof console?console.log(c-this.startTime+" ms: "+b):a("#exlog").append("

    "+(c-this.startTime)+" ms: "+b+"

    "),this.startTime=c}},isChrome:function(){return window.chrome?!0:!1},fixTableTransform:function(b){return b?-1==a.inArray("table",this.options.buttons)?b.replace(/\<(\/*?(table|tr|td|tbody))[^>]*\>/gi,""):b.replace(/\<(\/*?(table|tr|td))[^>]*\>/gi,"[$1]".toLowerCase()).replace(/\<\/*tbody[^>]*\>/gi,""):""}},a.log=function(b){"undefined"!=typeof wbbdebug&&wbbdebug===!0&&("undefined"!=typeof console?console.log(b):a("#exlog").append("

    "+b+"

    "))},a.fn.wysibb=function(b){return this.each(function(){var c=a(this).data("wbb");c||new a.wysibb(this,b)})},a.fn.wdrag=function(b){b.scope||(b.scope=this);var c,d={x:0,y:0,height:0};b.scope.drag_mousedown=function(e){e.preventDefault(),d={x:e.pageX,y:e.pageY,height:b.height,sheight:b.scope.$body.height()},c=!0,a(document).bind("mousemove",a.proxy(b.scope.drag_mousemove,this)),a(this).addClass("drag")},b.scope.drag_mouseup=function(d){c===!0&&(d.preventDefault(),a(document).unbind("mousemove",b.scope.drag_mousemove),a(this).removeClass("drag"),c=!1)},b.scope.drag_mousemove=function(a){a.preventDefault();var c=0,e=0;if(b.axisX&&(c=a.pageX-d.x),b.axisY&&(e=a.pageY-d.y),0!=e){var f=d.sheight+e;f>d.height&&f<=b.scope.options.resize_maxheight&&(1==b.scope.options.bbmode?b.scope.$txtArea.css(b.scope.options.autoresize===!0?"min-height":"height",f+"px"):b.scope.$body.css(b.scope.options.autoresize===!0?"min-height":"height",f+"px"))}},a(this).bind("mousedown",b.scope.drag_mousedown),a(document).bind("mouseup",a.proxy(b.scope.drag_mouseup,this))},a.fn.getDoc=function(){return this.data("wbb").doc},a.fn.getSelectText=function(a){return this.data("wbb").getSelectText(a)},a.fn.bbcode=function(a){return"undefined"!=typeof a?(this.data("wbb").options.bbmode?this.data("wbb").$txtArea.val(a):this.data("wbb").$body.html(this.data("wbb").getHTML(a)),this):this.data("wbb").getBBCode()},a.fn.htmlcode=function(a){return this.data("wbb").options.onlyBBMode||this.data("wbb").inited!==!0?void 0:"undefined"!=typeof a?(this.data("wbb").$body.html(a),this):this.data("wbb").getHTML(this.data("wbb").$txtArea.val())},a.fn.getBBCode=function(){return this.data("wbb").getBBCode()},a.fn.getHTML=function(){var a=this.data("wbb");return a.getHTML(a.$txtArea.val())},a.fn.getHTMLByCommand=function(a,b){return this.data("wbb").getHTMLByCommand(a,b)},a.fn.getBBCodeByCommand=function(a,b){return this.data("wbb").getBBCodeByCommand(a,b)},a.fn.insertAtCursor=function(a,b){return this.data("wbb").insertAtCursor(a,b),this.data("wbb")},a.fn.execCommand=function(a,b){return this.data("wbb").execCommand(a,b),this.data("wbb")},a.fn.insertImage=function(a,b){var c=this.data("wbb"),d=b?c.getCodeByCommand("link",{url:a,seltext:c.getCodeByCommand("img",{src:b})}):c.getCodeByCommand("img",{src:a});return this.insertAtCursor(d),c},a.fn.sync=function(){return this.data("wbb").sync(),this.data("wbb")},a.fn.destroy=function(){this.data("wbb").destroy()},a.fn.queryState=function(a){return this.data("wbb").queryState(a)}}(jQuery),function(a){"use strict";function b(b,c){this.$block=a(b),this.opt=a.extend({url:!1,success:!1,extraParams:!1,fileParam:"img",validation:".(jpg|png|gif|jpeg)$",t1:CURLANG.fileupload_text1,t2:CURLANG.fileupload_text2},c)}a.fn.dragfileupload=function(a){return this.each(function(){var c=new b(this,a);c.init()})},b.prototype={init:function(){if(null!=window.FormData){this.$block.addClass("drag"),this.$block.prepend('
    '+this.opt.t2+"
    "),this.$block.prepend('
    '+this.opt.t1+"
    "),this.$block.bind("dragover",function(){return a(this).addClass("dragover"),!1}),this.$block.bind("dragleave",function(){return a(this).removeClass("dragover"),!1});var b=a.proxy(function(a){var b=parseInt(a.loaded/a.total*100,10);this.$loader.children("span").text(CURLANG.loading+": "+b+"%")},this),c=jQuery.ajaxSettings.xhr();c.upload&&c.upload.addEventListener("progress",b,!1),this.$block[0].ondrop=a.proxy(function(b){b.preventDefault(),this.$block.removeClass("dragover");var d=b.dataTransfer.files[0];if(this.opt.validation&&!d.name.match(new RegExp(this.opt.validation)))return this.error(CURLANG.validation_err),!1;var e=new FormData;e.append(this.opt.fileParam,d),this.opt.extraParams&&a.each(this.opt.extraParams,function(a,b){e.append(a,b)}),this.$loader=a('

    '+CURLANG.loading+"
    "),this.$block.html(this.$loader),a.ajax({type:"POST",url:this.opt.url,data:e,processData:!1,contentType:!1,xhr:function(){return c},dataType:"json",success:a.proxy(function(a){a&&1==a.status?this.opt.success(a):this.error(a.msg||CURLANG.error_onupload)},this),error:a.proxy(function(){this.error(CURLANG.error_onupload)},this)})},this)}},error:function(a){this.$block.find(".upl-error").remove().end().append(''+a+"").addClass("wbbm-brdred")}}}(jQuery); \ No newline at end of file +"undefined"==typeof WBBLANG&&(WBBLANG={}),WBBLANG.en=CURLANG={bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strike",link:"Link",img:"Insert image",sup:"Superscript",sub:"Subscript",justifyleft:"Align left",justifycenter:"Align center",justifyright:"Align right",table:"Insert table",bullist:"• Unordered list",numlist:"1. Ordered list",quote:"Quote",offtop:"Offtop",code:"Code",spoiler:"Spoiler",fontcolor:"Font color",fontsize:"Font size",fontfamily:"Font family",fs_verysmall:"Very small",fs_small:"Small",fs_normal:"Normal",fs_big:"Big",fs_verybig:"Very big",smilebox:"Insert emoticon",video:"Insert YouTube",removeFormat:"Remove Format",modal_link_title:"Insert link",modal_link_text:"Display text",modal_link_url:"URL",modal_email_text:"Display email",modal_email_url:"Email",modal_link_tab1:"Insert URL",modal_img_title:"Insert image",modal_img_tab1:"Insert URL",modal_img_tab2:"Upload image",modal_imgsrc_text:"Enter image URL",modal_img_btn:"Choose file",add_attach:"Add Attachment",modal_video_text:"Enter the URL of the video",close:"Close",save:"Save",cancel:"Cancel",remove:"Delete",validation_err:"The entered data is invalid",error_onupload:"Error during file upload",fileupload_text1:"Drop file here",fileupload_text2:"or",loading:"Loading",auto:"Auto",views:"Views",downloads:"Downloads",sm1:"Smile",sm2:"Laughter",sm3:"Wink",sm4:"Thank you",sm5:"Scold",sm6:"Shock",sm7:"Angry",sm8:"Pain",sm9:"Sick"},wbbdebug=!0,function(a){"use strict";a.wysibb=function(b,c){a(b).data("wbb",this),c&&c.deflang&&"undefined"!=typeof WBBLANG[c.deflang]&&(CURLANG=WBBLANG[c.deflang]),c&&c.lang&&"undefined"!=typeof WBBLANG[c.lang]&&(CURLANG=WBBLANG[c.lang]),this.txtArea=b,this.$txtArea=a(b);this.$txtArea.attr("id")||this.setUID(this.txtArea);this.options={bbmode:!1,onlyBBmode:!1,themeName:"default",bodyClass:"",lang:"ru",tabInsert:!0,imgupload:!1,img_uploadurl:"/iupload.php",img_maxwidth:800,img_maxheight:800,hotkeys:!0,showHotkeys:!0,autoresize:!0,resize_maxheight:800,loadPageStyles:!0,traceTextarea:!0,smileConversion:!0,buttons:"bold,italic,underline,strike,sup,sub,|,img,video,link,|,bullist,numlist,|,fontcolor,fontsize,fontfamily,|,justifyleft,justifycenter,justifyright,|,quote,code,table,removeFormat",allButtons:{bold:{title:CURLANG.bold,buttonHTML:'',excmd:"bold",hotkey:"ctrl+b",transform:{"{SELTEXT}":"[b]{SELTEXT}[/b]","{SELTEXT}":"[b]{SELTEXT}[/b]"}},italic:{title:CURLANG.italic,buttonHTML:'',excmd:"italic",hotkey:"ctrl+i",transform:{"{SELTEXT}":"[i]{SELTEXT}[/i]","{SELTEXT}":"[i]{SELTEXT}[/i]"}},underline:{title:CURLANG.underline,buttonHTML:'',excmd:"underline",hotkey:"ctrl+u",transform:{"{SELTEXT}":"[u]{SELTEXT}[/u]"}},strike:{title:CURLANG.strike,buttonHTML:'',excmd:"strikeThrough",transform:{"{SELTEXT}":"[s]{SELTEXT}[/s]","{SELTEXT}":"[s]{SELTEXT}[/s]"}},sup:{title:CURLANG.sup,buttonHTML:'',excmd:"superscript",transform:{"{SELTEXT}":"[sup]{SELTEXT}[/sup]"}},sub:{title:CURLANG.sub,buttonHTML:'',excmd:"subscript",transform:{"{SELTEXT}":"[sub]{SELTEXT}[/sub]"}},link:{title:CURLANG.link,buttonHTML:'',hotkey:"ctrl+shift+2",modal:{title:CURLANG.modal_link_title,width:"500px",tabs:[{input:[{param:"SELTEXT",title:CURLANG.modal_link_text,type:"div"},{param:"URL",title:CURLANG.modal_link_url,validation:"^http(s)?://"}]}]},transform:{'{SELTEXT}':"[url={URL}]{SELTEXT}[/url]",'{URL}':"[url]{URL}[/url]"}},img:{title:CURLANG.img,buttonHTML:'',hotkey:"ctrl+shift+1",addWrap:!0,modal:{title:CURLANG.modal_img_title,width:"600px",tabs:[{title:CURLANG.modal_img_tab1,input:[{param:"SRC",title:CURLANG.modal_imgsrc_text,validation:"^http(s)?://.*?.(jpg|png|gif|jpeg)$"}]}],onLoad:this.imgLoadModal},transform:{'':"[img]{SRC}[/img]",'':"[img width={WIDTH},height={HEIGHT}]{SRC}[/img]"}},bullist:{title:CURLANG.bullist,buttonHTML:'',excmd:"insertUnorderedList",transform:{"
      {SELTEXT}
    ":"[list]{SELTEXT}[/list]","
  • {SELTEXT}
  • ":"[*]{SELTEXT}[/*]"}},numlist:{title:CURLANG.numlist,buttonHTML:'',excmd:"insertOrderedList",transform:{"
      {SELTEXT}
    ":"[list=1]{SELTEXT}[/list]","
  • {SELTEXT}
  • ":"[*]{SELTEXT}[/*]"}},quote:{title:CURLANG.quote,buttonHTML:'',hotkey:"ctrl+shift+3",transform:{"
    {SELTEXT}
    ":"[quote]{SELTEXT}[/quote]"}},code:{title:CURLANG.code,buttonText:"[code]",hotkey:"ctrl+shift+4",onlyClearText:!0,transform:{"{SELTEXT}":"[code]{SELTEXT}[/code]"}},offtop:{title:CURLANG.offtop,buttonText:"offtop",transform:{'{SELTEXT}':"[offtop]{SELTEXT}[/offtop]"}},fontcolor:{type:"colorpicker",title:CURLANG.fontcolor,excmd:"foreColor",valueBBname:"color",subInsert:!0,colors:"#000000,#444444,#666666,#999999,#b6b6b6,#cccccc,#d8d8d8,#efefef,#f4f4f4,#ffffff,-, #ff0000,#980000,#ff7700,#ffff00,#00ff00,#00ffff,#1e84cc,#0000ff,#9900ff,#ff00ff,-, #f4cccc,#dbb0a7,#fce5cd,#fff2cc,#d9ead3,#d0e0e3,#c9daf8,#cfe2f3,#d9d2e9,#ead1dc, #ea9999,#dd7e6b,#f9cb9c,#ffe599,#b6d7a8,#a2c4c9,#a4c2f4,#9fc5e8,#b4a7d6,#d5a6bd, #e06666,#cc4125,#f6b26b,#ffd966,#93c47d,#76a5af,#6d9eeb,#6fa8dc,#8e7cc3,#c27ba0, #cc0000,#a61c00,#e69138,#f1c232,#6aa84f,#45818e,#3c78d8,#3d85c6,#674ea7,#a64d79, #900000,#85200C,#B45F06,#BF9000,#38761D,#134F5C,#1155Cc,#0B5394,#351C75,#741B47, #660000,#5B0F00,#783F04,#7F6000,#274E13,#0C343D,#1C4587,#073763,#20124D,#4C1130",transform:{'{SELTEXT}':"[color={COLOR}]{SELTEXT}[/color]"}},table:{type:"table",title:CURLANG.table,cols:10,rows:10,cellwidth:20,transform:{"{SELTEXT}":"[td]{SELTEXT}[/td]","{SELTEXT}":"[tr]{SELTEXT}[/tr]",'{SELTEXT}
    ':"[table]{SELTEXT}[/table]"},skipRules:!0},fontsize:{type:"select",title:CURLANG.fontsize,options:"fs_verysmall,fs_small,fs_normal,fs_big,fs_verybig"},fontfamily:{type:"select",title:CURLANG.fontfamily,excmd:"fontName",valueBBname:"font",options:[{title:"Arial",exvalue:"Arial"},{title:"Comic Sans MS",exvalue:"Comic Sans MS"},{title:"Courier New",exvalue:"Courier New"},{title:"Georgia",exvalue:"Georgia"},{title:"Lucida Sans Unicode",exvalue:"Lucida Sans Unicode"},{title:"Tahoma",exvalue:"Tahoma"},{title:"Times New Roman",exvalue:"Times New Roman"},{title:"Trebuchet MS",exvalue:"Trebuchet MS"},{title:"Verdana",exvalue:"Verdana"}],transform:{'{SELTEXT}':"[font={FONT}]{SELTEXT}[/font]"}},smilebox:{type:"smilebox",title:CURLANG.smilebox,buttonHTML:''},justifyleft:{title:CURLANG.justifyleft,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[left]{SELTEXT}[/left]"}},justifyright:{title:CURLANG.justifyright,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[right]{SELTEXT}[/right]"}},justifycenter:{title:CURLANG.justifycenter,buttonHTML:'',groupkey:"align",transform:{'

    {SELTEXT}

    ':"[center]{SELTEXT}[/center]"}},video:{title:CURLANG.video,buttonHTML:'',modal:{title:CURLANG.video,width:"600px",tabs:[{title:CURLANG.video,input:[{param:"SRC",title:CURLANG.modal_video_text}]}],onSubmit:function(a){var b=this.$modal.find('input[name="SRC"]').val();b&&(b=b.replace(/^\s+/,"").replace(/\s+$/,""));var c;if(c=b.match(-1!=b.indexOf("youtu.be")?/^http[s]*:\/\/youtu\.be\/([a-z0-9_-]+)/i:/^http[s]*:\/\/www\.youtube\.com\/watch\?.*?v=([a-z0-9_-]+)/i),c&&2==c.length){var d=c[1];this.insertAtCursor(this.getCodeByCommand(a,{src:d}))}return this.closeModal(),this.updateUI(),!1}},transform:{'':"[video]{SRC}[/video]"}},fs_verysmall:{title:CURLANG.fs_verysmall,buttonText:"fs1",excmd:"fontSize",exvalue:"1",transform:{'{SELTEXT}':"[size=50]{SELTEXT}[/size]"}},fs_small:{title:CURLANG.fs_small,buttonText:"fs2",excmd:"fontSize",exvalue:"2",transform:{'{SELTEXT}':"[size=85]{SELTEXT}[/size]"}},fs_normal:{title:CURLANG.fs_normal,buttonText:"fs3",excmd:"fontSize",exvalue:"3",transform:{'{SELTEXT}':"[size=100]{SELTEXT}[/size]"}},fs_big:{title:CURLANG.fs_big,buttonText:"fs4",excmd:"fontSize",exvalue:"4",transform:{'{SELTEXT}':"[size=150]{SELTEXT}[/size]"}},fs_verybig:{title:CURLANG.fs_verybig,buttonText:"fs5",excmd:"fontSize",exvalue:"6",transform:{'{SELTEXT}':"[size=200]{SELTEXT}[/size]"}},removeformat:{title:CURLANG.removeFormat,buttonHTML:'',excmd:"removeFormat"}},systr:{"
    ":"\n",'{SELTEXT}':" {SELTEXT}"},customRules:{td:[["[td]{SELTEXT}[/td]",{seltext:{rgx:!1,attr:!1,sel:!1}}]],tr:[["[tr]{SELTEXT}[/tr]",{seltext:{rgx:!1,attr:!1,sel:!1}}]],table:[["[table]{SELTEXT}[/table]",{seltext:{rgx:!1,attr:!1,sel:!1}}]]},smileList:[],attrWrap:["src","color","href"]},this.inited=this.options.onlyBBmode,this.options.themePrefix||a("link").each(a.proxy(function(b,c){var d=a(c).get(0).href.match(/(.*\/)(.*)\/wbbtheme\.css.*$/);null!==d&&(this.options.themeName=d[2],this.options.themePrefix=d[1])},this)),"undefined"!=typeof WBBPRESET&&(WBBPRESET.allButtons&&a.each(WBBPRESET.allButtons,a.proxy(function(a,b){b.transform&&this.options.allButtons[a]&&delete this.options.allButtons[a].transform},this)),a.extend(!0,this.options,WBBPRESET)),c&&c.allButtons&&a.each(c.allButtons,a.proxy(function(a,b){b.transform&&this.options.allButtons[a]&&delete this.options.allButtons[a].transform},this)),a.extend(!0,this.options,c),this.init()},a.wysibb.prototype={lastid:1,init:function(){a.log("Init",this),this.isMobile=function(a){/android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)}(navigator.userAgent||navigator.vendor||window.opera),this.options.onlyBBmode===!0&&(this.options.bbmode=!0),this.controllers=[],this.options.buttons=this.options.buttons.toLowerCase(),this.options.buttons=this.options.buttons.split(","),this.options.allButtons._systr={},this.options.allButtons._systr.transform=this.options.systr,this.smileFind(),this.initTransforms(),this.build(),this.initModal(),this.options.hotkeys!==!0||this.isMobile||this.initHotkeys(),this.options.smileList&&this.options.smileList.length>0&&this.options.smileList.sort(function(a,b){return b.bbcode.length-a.bbcode.length}),this.$txtArea.parents("form").bind("submit",a.proxy(function(){return this.sync(),!0},this)),this.$txtArea.parents("form").find("input[id*='preview'],input[id*='submit'],input[class*='preview'],input[class*='submit'],input[name*='preview'],input[name*='submit']").bind("mousedown",a.proxy(function(){this.sync(),setTimeout(a.proxy(function(){this.options.bbmode===!1&&this.$txtArea.removeAttr("wbbsync").val("")},this),1e3)},this)),this.options.initCallback&&this.options.initCallback.call(this),a.log(this)},initTransforms:function(){a.log("Create rules for transform HTML=>BB");var b=this.options;b.rules||(b.rules={}),b.groups||(b.groups={});var c=b.buttons.slice();c.push("_systr");for(var d=0;d-1||a(d).parent().contents().size()>1){var n=a("").html("{"+i+"}");this.setUID(n,"wbb");var p=f.indexOf(i)+i.length+1,q=f.substr(p,f.length-p);d.data=f.substr(0,f.indexOf(i)-1),a(d).after(this.elFromString(q,document)).after(n),m=(m?m+" ":"")+this.filterByNode(n),k=!1}o[i.toLowerCase()]={sel:m,attr:!1,rgx:k},e[e.length]=m}},this)),e=null},this));var p=k.html();p=this.unwrapAttrs(p),i!=p&&(delete e.transform[i],e.transform[p]=j,h=p)}b.rules[l].push([j,o]),e.onlyClearText===!0&&(this.cleartext||(this.cleartext={}),this.cleartext[l]=c[d]),e.groupkey&&(b.groups[e.groupkey]||(b.groups[e.groupkey]=[]),b.groups[e.groupkey].push(l))}}e.rootSelector&&this.sortArray(e.rootSelector,-1);var q=a.map(e.transform,function(a,b){return b}).sort(function(a,b){return(b[0]||"").length-(a[0]||"").length});e.bbcode=e.transform[q[0]],e.html=q[0]}}}this.options.btnlist=c,a.extend(b.rules,this.options.customRules),b.srules={},this.options.smileList&&a.each(b.smileList,a.proxy(function(c,d){var e=a(this.strf(d.img,b)),f=this.filterByNode(e);b.srules[f]=[d.bbcode,d.img]},this));for(var r in b.rules)this.options.rules[r].sort(function(a,b){return b[0].length-a[0].length});this.rsellist=[];for(var r in this.options.rules)this.rsellist.push(r);this.sortArray(this.rsellist,-1)},build:function(){if(a.log("Build editor"),this.$editor=a("
    ").addClass("wysibb"),this.isMobile&&this.$editor.addClass("wysibb-mobile"),this.options.direction&&this.$editor.css("direction",this.options.direction),this.$editor.insertAfter(this.txtArea).append(this.txtArea),this.startHeight=this.$txtArea.outerHeight(),this.$txtArea.addClass("wysibb-texarea"),this.buildToolbar(),this.$txtArea.wrap('
    '),this.options.onlyBBmode===!1){var b=this.options.minheight||this.$txtArea.outerHeight(),c=(this.options.resize_maxheight,this.options.autoresize===!0?this.options.resize_maxheight:b);if(this.$body=a(this.strf('
    ',{maxheight:c,height:b})).insertAfter(this.$txtArea),this.body=this.$body[0],this.$txtArea.hide(),b>32&&this.$toolbar.css("max-height",b),a.log("WysiBB loaded"),this.$body.addClass("wysibb-body").addClass(this.options.bodyClass),this.options.direction&&this.$body.css("direction",this.options.direction),"contentEditable"in this.body){this.body.contentEditable=!0;try{document.execCommand("StyleWithCSS",!1,!1),this.$body.append("")}catch(d){}}else this.options.onlyBBmode=this.options.bbmode=!0;this.txtArea.value.length>0&&this.txtAreaInitContent(),this.$body.bind("keydown",a.proxy(function(b){return 86==b.which&&(1==b.ctrlKey||1==b.metaKey)||45==b.which&&(1==b.shiftKey||1==b.metaKey)?(this.$pasteBlock||(this.saveRange(),this.$pasteBlock=a(this.elFromString('
    
    ')),this.$pasteBlock.appendTo(this.body),setTimeout(a.proxy(function(){this.clearPaste(this.$pasteBlock);var b=""+this.$pasteBlock.html()+"";this.$body.attr("contentEditable","true"),this.$pasteBlock.blur().remove(),this.body.focus(),this.cleartext&&(a.log("Check if paste to clearText Block"),this.isInClearTextBlock()&&(b=this.toBB(b).replace(/\n/g,"
    ").replace(/\s{3}/g,''))),b=b.replace(/\t/g,''),this.selectRange(this.lastRange),this.insertAtCursor(b,!1),this.lastRange=!1,this.$pasteBlock=!1},this),1),this.selectNode(this.$pasteBlock[0])),!0):void 0},this)),this.$body.bind("keydown",a.proxy(function(a){if(13==a.which){var b=this.isContain(this.getSelectNode(),"li");b||(a.preventDefault&&a.preventDefault(),this.checkForLastBR(this.getSelectNode()),this.insertAtCursor("
    ",!1))}},this)),this.options.tabInsert===!0&&this.$body.bind("keydown",a.proxy(this.pressTab,this)),this.$body.bind("mouseup keyup",a.proxy(this.updateUI,this)),this.$body.bind("mousedown",a.proxy(function(a){this.clearLastRange(),this.checkForLastBR(a.target)},this)),this.options.traceTextarea===!0&&(a(document).bind("mousedown",a.proxy(this.traceTextareaEvent,this)),this.$txtArea.val("")),this.options.hotkeys===!0&&this.$body.bind("keydown",a.proxy(this.presskey,this)),this.options.smileConversion===!0&&this.$body.bind("keyup",a.proxy(this.smileConversion,this)),this.inited=!0,this.options.autoresize===!0&&(this.$bresize=a(this.elFromString('
    ')).appendTo(this.$editor).wdrag({scope:this,axisY:!0,height:b})),this.imgListeners()}this.$txtArea.bind("mouseup keyup",a.proxy(function(){clearTimeout(this.uitimer),this.uitimer=setTimeout(a.proxy(this.updateUI,this),100)},this)),this.options.hotkeys===!0&&a(document).bind("keydown",a.proxy(this.presskey,this))},buildToolbar:function(){if(this.options.toolbar===!1)return!1;this.$toolbar=a("
    ").addClass("wysibb-toolbar").prependTo(this.$editor);var b;a.each(this.options.buttons,a.proxy(function(c,d){var e=this.options.allButtons[d];(0==c||"|"==d||"-"==d)&&("-"==d&&this.$toolbar.append("
    "),b=a('
    ').appendTo(this.$toolbar)),e&&("colorpicker"==e.type?this.buildColorpicker(b,d,e):"table"==e.type?this.buildTablepicker(b,d,e):"select"==e.type?this.buildSelect(b,d,e):"smilebox"==e.type?this.buildSmilebox(b,d,e):this.buildButton(b,d,e))},this)),this.$toolbar.find(".btn-tooltip").hover(function(){a(this).parent().css("overflow","hidden")},function(){a(this).parent().css("overflow","visible")});var c=a(document.createElement("div")).addClass("wysibb-toolbar-container modeSwitch").html('
    [bbcode]
    ').appendTo(this.$toolbar);1==this.options.bbmode&&c.children(".wysibb-toolbar-btn").addClass("on"),this.options.onlyBBmode===!1&&c.children(".wysibb-toolbar-btn").click(a.proxy(function(b){a(b.currentTarget).toggleClass("on"),this.modeSwitch()},this))},buildButton:function(b,c,d){"object"!=typeof b&&(b=this.$toolbar);var e=d.buttonHTML?a(this.strf(d.buttonHTML,this.options)).addClass("btn-inner"):this.strf('{text}',{text:d.buttonText.replace(/['+d.hotkey+"]":"",g=a('
    ').appendTo(b).append(e).append(this.strf('{title}{hotkey}',{title:d.title,hotkey:f}));this.controllers.push(g),g.bind("queryState",a.proxy(function(b){this.queryState(c)?a(b.currentTarget).addClass("on"):a(b.currentTarget).removeClass("on")},this)),g.mousedown(a.proxy(function(b){b.preventDefault(),this.execCommand(c,d.exvalue||!1),a(b.currentTarget).trigger("queryState")},this))},buildColorpicker:function(b,c,d){var e=a('
    ').appendTo(b).append('
    ').append(this.strf('{title}',{title:d.title})),f=e.find(".cp-line"),g=a('
    ').appendTo(e);g.append('
    '+CURLANG.auto+"
    ");for(var h=d.colors?d.colors.split(","):[],i=0;i':this.strf('
    ',{color:h[i]}));var j=a(document.body).css("color");this.controllers.push(e),e.bind("queryState",a.proxy(function(){f.css("background-color",j);var a=this.queryState(c,!0);a&&(f.css("background-color",this.options.bbmode?a.color:a),e.find(".ve-tlb-colorpick span.fonticon").css("color",this.options.bbmode?a.color:a))},this)),e.mousedown(a.proxy(function(a){a.preventDefault(),this.dropdownclick(".wbb-cp",".wbb-list",a)},this)),e.find(".sc").mousedown(a.proxy(function(b){b.preventDefault(),this.selectLastRange();var d=a(b.currentTarget).attr("title");this.execCommand(c,d),e.trigger("queryState")},this)),e.find(".nc").mousedown(a.proxy(function(a){a.preventDefault(),this.selectLastRange(),this.execCommand(c,j),e.trigger("queryState")},this)),e.mousedown(function(a){a.preventDefault&&a.preventDefault()})},buildTablepicker:function(b,c,d){var e=a('
    ').appendTo(b).append('').append(this.strf('{title}',{title:d.title})),f=a('
    ').appendTo(e),g=a("
    ").css({position:"relative","box-sizing":"border-box"}).appendTo(f),h=d.rows||10,i=d.cols||10,j=h*i;g.css("height",h*d.cellwidth+2+"px");for(var k=1;i>=k;k++)for(var l=1;h>=l;l++){var m='
    ';g.append(m)}e.find(".tbl-sel").mousedown(a.proxy(function(b){b.preventDefault();for(var c=a(b.currentTarget).attr("title"),d=c.split(","),e=this.options.bbmode?"[table]":'',f=1;f<=d[0];f++){e+=this.options.bbmode?" [tr]\n":"";for(var g=1;g<=d[1];g++)e+=this.options.bbmode?" [td][/td]\n":"";e+=this.options.bbmode?"[/tr]\n":""}e+=this.options.bbmode?"[/table]":"
    
    ",this.insertAtCursor(e)},this)),e.mousedown(a.proxy(function(a){a.preventDefault(),this.dropdownclick(".wbb-tbl",".wbb-list",a)},this))},buildSelect:function(b,c,d){for(var e=a('
    ').appendTo(b).append(this.strf('{title}',d)).append(this.strf('{title}',{title:d.title})),f=a('
    ').appendTo(e),g=e.find("span.val"),h=a.isArray(d.options)?d.options:d.options.split(","),i=this.isMobile?a("
    ',c))},this))},this)),a.isFunction(c.onLoad)&&c.onLoad.call(this,b,c,d),f.find("#wbbm-submit").click(a.proxy(function(){if(a.isFunction(c.onSubmit)){var e=c.onSubmit.call(this,b,c,d);if(e===!1)return}var f={},g=!0;this.$modal.find(".wbbm-inperr").remove(),this.$modal.find(".wbbm-brdred").removeClass("wbbm-brdred"),a.each(this.$modal.find(".tab-cont:visible .inp-text"),a.proxy(function(b,d){var e=a(d).parents(".tab-cont").attr("tid"),h=a(d).attr("name").toLowerCase(),i="";i=a(d).is("input,textrea,select")?a(d).val():a(d).html();var j=c.tabs[e].input[b].validation;"undefined"!=typeof j&&(i.match(new RegExp(j,"i"))||(g=!1,a(d).after(''+CURLANG.validation_err+"").addClass("wbbm-brdred"))),f[h]=i},this)),g&&(a.log("Last range: "+this.lastRange),this.selectLastRange(),d&&this.wbbRemoveCallback(b,!0),this.wbbInsertCallback(b,f),this.closeModal(),this.updateUI())},this)),f.find("#wbbm-remove").click(a.proxy(function(){this.selectLastRange(),this.wbbRemoveCallback(b),this.closeModal(),this.updateUI()},this)),a(document.body).css("overflow","hidden"),a("body").height()>a(window).height()&&a(document.body).css("padding-right","18px"),this.$modal.show(),this.isMobile?f.css("margin-top","10px"):f.css("margin-top",(a(window).height()-f.outerHeight())/3+"px"),setTimeout(a.proxy(function(){this.$modal.find(".inp-text:visible")[0].focus()},this),10)},escModal:function(a){27==a.which&&this.closeModal()},closeModal:function(){return a(document.body).css("overflow","auto").css("padding-right","0").unbind("keyup",this.escModal),this.$modal.find("#wbbm-submit,#wbbm-remove").unbind("click"),this.$modal.hide(),this.lastRange=!1,this},getParams:function(b,c,d){var e={};if(this.options.bbmode){var f=c.match(/\{[\s\S]+?\}/g);c=this.prepareRGX(c);var g=new RegExp(c,"g"),h=this.txtArea.value;d>0&&(h=h.substr(d,h.length-d));var i=g.exec(h);i&&a.each(f,function(a,b){e[b.replace(/\{|\}/g,"").replace(/"/g,"'").toLowerCase()]=i[a+1]})}else{var j=this.options.rules[c][0][1];a.each(j,a.proxy(function(c,d){var f="",g=d.sel!==!1?f=a(b).find(d.sel):a(b);if(f=d.attr!==!1?g.attr(d.attr):g.html()){if(d.rgx!==!1){var h=f.match(new RegExp(d.rgx));h&&2==h.length&&(f=h[1])}e[c]=f.replace(/"/g,"'")}},this))}return e},imgLoadModal:function(){a.log("imgLoadModal"),this.options.imgupload===!0?(this.$modal.find("#imguploader").dragfileupload({url:this.strf(this.options.img_uploadurl,this.options),extraParams:{maxwidth:this.options.img_maxwidth,maxheight:this.options.img_maxheight},themePrefix:this.options.themePrefix,themeName:this.options.themeName,success:a.proxy(function(a){this.$txtArea.insertImage(a.image_link,a.thumb_link),this.closeModal(),this.updateUI()},this)}),this.$modal.find("#fileupl").bind("change",function(){a("#fupform").submit()}),this.$modal.find("#fupform").bind("submit",a.proxy(function(b){a(b.target).parents("#imguploader").hide().after('

    '+CURLANG.loading+"
    ").parent().css("text-align","center")},this))):(this.$modal.find(".hastabs").removeClass("hastabs"),this.$modal.find("#imguploader").parents(".tab-cont").remove(),this.$modal.find(".wbbm-tablist").remove())},imgSubmitModal:function(){a.log("imgSubmitModal")},printObjectInIE:function(b){try{a.log(JSON.stringify(b))}catch(c){}},checkFilter:function(b,c){a.log("node: "+a(b).get(0).outerHTML+" filter: "+c+" res: "+a(b).is(c.toLowerCase()))},debug:function(b){if(this.options.debug===!0){var c=(new Date).getTime();"undefined"!=typeof console?console.log(c-this.startTime+" ms: "+b):a("#exlog").append("

    "+(c-this.startTime)+" ms: "+b+"

    "),this.startTime=c}},isChrome:function(){return window.chrome?!0:!1},fixTableTransform:function(b){return b?-1==a.inArray("table",this.options.buttons)?b.replace(/\<(\/*?(table|tr|td|tbody))[^>]*\>/gi,""):b.replace(/\<(\/*?(table|tr|td))[^>]*\>/gi,"[$1]".toLowerCase()).replace(/\<\/*tbody[^>]*\>/gi,""):""}},a.log=function(b){"undefined"!=typeof wbbdebug&&wbbdebug===!0&&("undefined"!=typeof console?console.log(b):a("#exlog").append("

    "+b+"

    "))},a.fn.wysibb=function(b){return this.each(function(){var c=a(this).data("wbb");c||new a.wysibb(this,b)})},a.fn.wdrag=function(b){b.scope||(b.scope=this);var c,d={x:0,y:0,height:0};b.scope.drag_mousedown=function(e){e.preventDefault(),d={x:e.pageX,y:e.pageY,height:b.height,sheight:b.scope.$body.height()},c=!0,a(document).bind("mousemove",a.proxy(b.scope.drag_mousemove,this)),a(this).addClass("drag")},b.scope.drag_mouseup=function(d){c===!0&&(d.preventDefault(),a(document).unbind("mousemove",b.scope.drag_mousemove),a(this).removeClass("drag"),c=!1)},b.scope.drag_mousemove=function(a){a.preventDefault();var c=0,e=0;if(b.axisX&&(c=a.pageX-d.x),b.axisY&&(e=a.pageY-d.y),0!=e){var f=d.sheight+e;f>d.height&&f<=b.scope.options.resize_maxheight&&(1==b.scope.options.bbmode?b.scope.$txtArea.css(b.scope.options.autoresize===!0?"min-height":"height",f+"px"):b.scope.$body.css(b.scope.options.autoresize===!0?"min-height":"height",f+"px"))}},a(this).bind("mousedown",b.scope.drag_mousedown),a(document).bind("mouseup",a.proxy(b.scope.drag_mouseup,this))},a.fn.getDoc=function(){return this.data("wbb").doc},a.fn.getSelectText=function(a){return this.data("wbb").getSelectText(a)},a.fn.bbcode=function(a){return"undefined"!=typeof a?(this.data("wbb").options.bbmode?this.data("wbb").$txtArea.val(a):this.data("wbb").$body.html(this.data("wbb").getHTML(a)),this):this.data("wbb").getBBCode()},a.fn.htmlcode=function(a){return this.data("wbb").options.onlyBBMode||this.data("wbb").inited!==!0?void 0:"undefined"!=typeof a?(this.data("wbb").$body.html(a),this):this.data("wbb").getHTML(this.data("wbb").$txtArea.val())},a.fn.getBBCode=function(){return this.data("wbb").getBBCode()},a.fn.getHTML=function(){var a=this.data("wbb");return a.getHTML(a.$txtArea.val())},a.fn.getHTMLByCommand=function(a,b){return this.data("wbb").getHTMLByCommand(a,b)},a.fn.getBBCodeByCommand=function(a,b){return this.data("wbb").getBBCodeByCommand(a,b)},a.fn.insertAtCursor=function(a,b){return this.data("wbb").insertAtCursor(a,b),this.data("wbb")},a.fn.execCommand=function(a,b){return this.data("wbb").execCommand(a,b),this.data("wbb")},a.fn.insertImage=function(a,b){var c=this.data("wbb"),d=b?c.getCodeByCommand("link",{url:a,seltext:c.getCodeByCommand("img",{src:b})}):c.getCodeByCommand("img",{src:a});return this.insertAtCursor(d),c},a.fn.sync=function(){return this.data("wbb").sync(),this.data("wbb")},a.fn.destroy=function(){this.data("wbb").destroy()},a.fn.queryState=function(a){return this.data("wbb").queryState(a)}}(jQuery),function(a){"use strict";function b(b,c){this.$block=a(b),this.opt=a.extend({url:!1,success:!1,extraParams:!1,fileParam:"img",validation:".(jpg|png|gif|jpeg)$",t1:CURLANG.fileupload_text1,t2:CURLANG.fileupload_text2},c)}a.fn.dragfileupload=function(a){return this.each(function(){var c=new b(this,a);c.init()})},b.prototype={init:function(){if(null!=window.FormData){this.$block.addClass("drag"),this.$block.prepend('
    '+this.opt.t2+"
    "),this.$block.prepend('
    '+this.opt.t1+"
    "),this.$block.bind("dragover",function(){return a(this).addClass("dragover"),!1}),this.$block.bind("dragleave",function(){return a(this).removeClass("dragover"),!1});var b=a.proxy(function(a){var b=parseInt(a.loaded/a.total*100,10);this.$loader.children("span").text(CURLANG.loading+": "+b+"%")},this),c=jQuery.ajaxSettings.xhr();c.upload&&c.upload.addEventListener("progress",b,!1),this.$block[0].ondrop=a.proxy(function(b){b.preventDefault(),this.$block.removeClass("dragover");var d=b.dataTransfer.files[0];if(this.opt.validation&&!d.name.match(new RegExp(this.opt.validation)))return this.error(CURLANG.validation_err),!1;var e=new FormData;e.append(this.opt.fileParam,d),this.opt.extraParams&&a.each(this.opt.extraParams,function(a,b){e.append(a,b)}),this.$loader=a('

    '+CURLANG.loading+"
    "),this.$block.html(this.$loader),a.ajax({type:"POST",url:this.opt.url,data:e,processData:!1,contentType:!1,xhr:function(){return c},dataType:"json",success:a.proxy(function(a){a&&1==a.status?this.opt.success(a):this.error(a.msg||CURLANG.error_onupload)},this),error:a.proxy(function(){this.error(CURLANG.error_onupload)},this)})},this)}},error:function(a){this.$block.find(".upl-error").remove().end().append(''+a+"").addClass("wbbm-brdred")}}}(jQuery);