1(function(c){function h(a,b){return new h.prototype.init(a,b)}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a)}});var l=0,m=/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,p=/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/;c.fn.redactor=function(a){var b=[],d=Array.prototype.slice.call(arguments,1);"string"===typeof a?this.each(function(){var e= 2c.data(this,"redactor"),f;"-1"!=a.search(/\./)?(f=a.split("."),"undefined"!=typeof e[f[0]]&&(f=e[f[0]][f[1]])):f=e[a];"undefined"!==typeof e&&c.isFunction(f)?(f=f.apply(e,d),void 0!==f&&f!==e&&b.push(f)):c.error('No such method "'+a+'" for Redactor')}):this.each(function(){c.data(this,"redactor",{});c.data(this,"redactor",h(this,a))});return 0===b.length?this:1===b.length?b[0]:b};c.Redactor=h;c.Redactor.VERSION="10.0.3";c.Redactor.modules="core build lang toolbar button dropdown code clean tidy paragraphize tabifier focus placeholder autosave buffer indent alignment paste keydown keyup shortcuts line list block inline insert caret selection observe link image file modal progress upload utils".split(" "); 3c.Redactor.opts={lang:"en",direction:"ltr",plugins:!1,focus:!1,focusEnd:!1,placeholder:!1,visual:!0,tabindex:!1,minHeight:!1,maxHeight:!1,linebreaks:!1,replaceDivs:!0,paragraphize:!0,cleanStyleOnEnter:!1,enterKey:!0,cleanOnPaste:!0,cleanSpaces:!0,pastePlainText:!1,autosave:!1,autosaveName:!1,autosaveInterval:60,autosaveOnChange:!1,linkTooltip:!0,linkProtocol:"http",linkNofollow:!1,linkSize:50,imageEditable:!0,imageLink:!0,imagePosition:!0,imageFloatMargin:"10px",imageResizable:!0,imageUpload:!1,imageUploadParam:"file", 4uploadImageField:!1,dragImageUpload:!0,fileUpload:!1,fileUploadParam:"file",dragFileUpload:!0,s3:!1,convertLinks:!0,convertUrlLinks:!0,convertImageLinks:!0,convertVideoLinks:!0,preSpaces:4,tabAsSpaces:!1,tabFocus:!0,scrollTarget:!1,toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,toolbarOverflow:!1,buttonSource:!1,buttons:"html formatting bold italic deleted unorderedlist orderedlist outdent indent image file link alignment horizontalrule".split(" "), 5buttonsHide:[],buttonsHideOnMobile:[],formatting:"p blockquote pre h1 h2 h3 h4 h5 h6".split(" "),formattingAdd:!1,tabifier:!0,deniedTags:"html head link body meta script style applet".split(" "),allowedTags:!1,removeComments:!1,replaceTags:[["strike","del"]],replaceStyles:[["font-weight:\\s?bold","strong"],["font-style:\\s?italic","em"],["text-decoration:\\s?underline","u"],["text-decoration:\\s?line-through","del"]],removeDataAttr:!1,removeAttr:!1,allowedAttr:!1,removeWithoutAttr:["span"],removeEmpty:["p"], 6activeButtons:"deleted italic bold underline unorderedlist orderedlist alignleft aligncenter alignright justify".split(" "),activeButtonsStates:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted",ul:"unorderedlist",ol:"orderedlist",u:"underline"},shortcuts:{"ctrl+shift+m, meta+shift+m":{func:"inline.removeFormat"},"ctrl+b, meta+b":{func:"inline.format",params:["bold"]},"ctrl+i, meta+i":{func:"inline.format",params:["italic"]},"ctrl+h, meta+h":{func:"inline.format",params:["superscript"]}, 7"ctrl+l, meta+l":{func:"inline.format",params:["subscript"]},"ctrl+k, meta+k":{func:"link.show"},"ctrl+shift+7":{func:"list.toggle",params:["orderedlist"]},"ctrl+shift+8":{func:"list.toggle",params:["unorderedlist"]}},shortcutsAdd:!1,buffer:[],rebuffer:[],emptyHtml:"<p>​</p>",invisibleSpace:"​",imageTypes:["image/png","image/jpeg","image/gif"],indentValue:20,verifiedTags:"a img b strong sub sup i em u small strike del cite ul ol li".split(" "),inlineTags:"strong b u em i code del ins samp kbd sup sub mark var cite small".split(" "), 8alignmentTags:"P H1 H2 H3 H4 H5 H6 DL DT DD DIV TD BLOCKQUOTE OUTPUT FIGCAPTION ADDRESS SECTION HEADER FOOTER ASIDE ARTICLE".split(" "),blockLevelElements:["PRE","UL","OL","LI"],langs:{en:{html:"HTML",video:"Insert Video",image:"Insert Image",table:"Table",link:"Link",link_insert:"Insert link",link_edit:"Edit link",unlink:"Unlink",formatting:"Formatting",paragraph:"Normal text",quote:"Quote",code:"Code",header1:"Header 1",header2:"Header 2",header3:"Header 3",header4:"Header 4",header5:"Header 5", 9bold:"Bold",italic:"Italic",fontcolor:"Font Color",backcolor:"Back Color",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",cancel:"Cancel",insert:"Insert",save:"Save",_delete:"Delete",insert_table:"Insert Table",insert_row_above:"Add Row Above",insert_row_below:"Add Row Below",insert_column_left:"Add Column Left",insert_column_right:"Add Column Right",delete_column:"Delete Column",delete_row:"Delete Row",delete_table:"Delete Table",rows:"Rows",columns:"Columns", 10add_head:"Add Head",delete_head:"Delete Head",title:"Title",image_position:"Position",none:"None",left:"Left",right:"Right",center:"Center",image_web_link:"Image Web Link",text:"Text",mailto:"Email",web:"URL",video_html_code:"Video Embed Code or Youtube/Vimeo Link",file:"Insert File",upload:"Upload",download:"Download",choose:"Choose",or_choose:"Or choose",drop_file_here:"Drop file here",align_left:"Align text to the left",align_center:"Center text",align_right:"Align text to the right",align_justify:"Justify text", 11horizontalrule:"Insert Horizontal Rule",deleted:"Deleted",anchor:"Anchor",link_new_tab:"Open link in new tab",underline:"Underline",alignment:"Alignment",filename:"Name (optional)",edit:"Edit"}}};h.fn=c.Redactor.prototype={keyCode:{BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,SPACE:32,ESC:27,TAB:9,CTRL:17,META:91,SHIFT:16,ALT:18,LEFT:37,LEFT_WIN:91},init:function(a,b){this.$element=c(a);this.uuid=l++;this.$pasteBox=this.rtePaste=!1;this.loadOptions(b);this.loadModules();this.formatting={};c.merge(this.opts.blockLevelElements, 12this.opts.alignmentTags);this.reIsBlock=new RegExp("^("+this.opts.blockLevelElements.join("|")+")$","i");this.tidy.setupAllowed();this.lang.load();c.extend(this.opts.shortcuts,this.opts.shortcutsAdd);this.core.setCallback("start");this.start=!0;this.build.run()},loadOptions:function(a){this.opts=c.extend({},c.extend(!0,{},c.Redactor.opts),this.$element.data(),a)},getModuleMethods:function(a){return Object.getOwnPropertyNames(a).filter(function(b){return"function"==typeof a[b]})}
12,loadModules:function(){for(var a= 13c.Redactor.modules.length,b=0;b<a;b++)this.bindModuleMethods(c.Redactor.modules[b])},bindModuleMethods:function(a){if("undefined"!=typeof this[a]){this[a]=this[a]();for(var b=this.getModuleMethods(this[a]),c=b.length,e=0;e<c;e++)this[a][b[e]]=this[a][b[e]].bind(this)}},core:function(){return{getObject:function(){return c.extend({},this)},getEditor:function(){return this.$editor},getBox:function(){return this.$box},getElement:function(){return this.$element},getTextarea:function(){return this.$textarea}, 14getToolbar:function(){return this.$toolbar?this.$toolbar:!1},addEvent:function(a){this.core.event=a},getEvent:function(){return this.core.event},setCallback:function(a,b,d){a=this.opts[a+"Callback"];return c.isFunction(a)?"undefined"==typeof d?a.call(this,b):a.call(this,b,d):"undefined"==typeof d?b:d},destroy:function(){this.core.setCallback("destroy");this.$element.off(".redactor").removeData("redactor");this.$editor.off(".redactor");this.$editor.removeClass("redactor-editor redactor-linebreaks redactor-placeholder"); 15this.$editor.removeAttr("contenteditable");var a=this.code.get();this.build.isTextarea()?(this.$box.after(this.$element),this.$box.remove(),this.$element.val(a).show()):(this.$box.after(this.$editor),this.$box.remove(),this.$element.html(a).show());this.$pasteBox&&this.$pasteBox.remove();this.$modalBox&&this.$modalBox.remove();this.$modalOverlay&&this.$modalOverlay.remove();c(".redactor-toolbar-tooltip").remove();clearInterval(this.autosaveInterval)}}},build:function(){return{run:function(){this.build.createContainerBox(); 16this.build.loadContent();this.build.loadEditor();this.build.enableEditor();this.build.setCodeAndCall()},isTextarea:function(){return"TEXTAREA"===this.$element[0].tagName},createContainerBox:function(){this.$box=c('<div class="redactor-box" />')},createTextarea:function(){this.$textarea=c("<textarea />").attr("name",this.build.getTextareaName())},getTextareaName:function(){var a=this.$element.attr("id");"undefined"==typeof a&&(a="content-"+this.uuid);return a},loadContent:function(){var a=this.build.isTextarea()? 17"val":"html";this.content=c.trim(this.$element[a]())},enableEditor:function(){this.$editor.attr({contenteditable:!0,dir:this.opts.direction})},loadEditor:function(){var a=this.build.isTextarea()?"fromTextarea":"fromElement";this.build[a]()},fromTextarea:function(){this.$editor=c("<div />");this.$textarea=this.$element;this.$box.insertAfter(this.$element).append(this.$editor).append(this.$element);this.$editor.addClass("redactor-editor");this.$element.hide()},fromElement:function(){this.$editor=this.$element; 18this.build.createTextarea();this.$box.insertAfter(this.$editor).append(this.$editor).append(this.$textarea);this.$editor.addClass("redactor-editor");this.$textarea.hide()},setCodeAndCall:function(){this.code.set(this.content);this.build.setOptions();this.build.callEditor();this.opts.visual||setTimeout(c.proxy(this.code.showCode,this),200)},callEditor:function(){this.build.disableMozillaEditing();this.build.setEvents();this.build.setHelpers();this.opts.toolbar&&(this.opts.toolbar=this.toolbar.init(), 19this.toolbar.build());this.modal.loadTemplates();this.build.plugins();setTimeout(c.proxy(this.observe.load,this),4);this.core.setCallback("init")},setOptions:function(){c(this.$textarea).attr("dir",this.opts.direction);this.opts.linebreaks&&this.$editor.addClass("redactor-linebreaks");this.opts.tabindex&&this.$editor.attr("tabindex",this.opts.tabindex);this.opts.minHeight&&this.$editor.css("minHeight",this.opts.minHeight);this.opts.maxHeight&&this.$editor.css("maxHeight",this.opts.maxHeight)},setEvents:function(){this.$editor.on("drop.redactor", 20c.proxy(function(a){a=a.originalEvent||a;if(void 0!==window.FormData&&a.dataTransfer&&0!==a.dataTransfer.files.length)a.preventDefault(),(this.opts.dragImageUpload||this.opts.dragFileUpload)&&this.upload.directUpload(a.dataTransfer.files[0],a);else return!0;setTimeout(c.proxy(this.clean.clearUnverified,this),1);this.core.setCallback("drop",a)},this));this.$editor.on("click.redactor",c.proxy(function(a){var c="click";if("click"==this.core.getEvent()||"arrow"==this.core.getEvent())c=!1;this.core.addEvent(c); 21this.utils.disableSelectAll();this.core.setCallback("click",a)},this));this.$editor.on("paste.redactor",c.proxy(this.paste.init,this));
21this.$editor.on("keydown.redactor",c.proxy(this.keydown.init,this));this.$editor.on("keyup.redactor",c.proxy(this.keyup.init,this));if(c.isFunction(this.opts.codeKeydownCallback))this.$textarea.on("keydown.redactor-textarea",c.proxy(this.opts.codeKeydownCallback,this));if(c.isFunction(this.opts.codeKeyupCallback))this.$textarea.on("keyup.redactor-textarea",c.proxy(this.opts.codeKeyupCallback, 22this));if(c.isFunction(this.opts.focusCallback))this.$editor.on("focus.redactor",c.proxy(this.opts.focusCallback,this));var a;c(document).on("mousedown",function(b){a=c(b.target)});this.$editor.on("blur.redactor",c.proxy(function(b){if(!this.rtePaste){var d=c(a);d.hasClass("redactor-toolbar, redactor-dropdown")||d.is("#redactor-modal")||0!==d.parents(".redactor-toolbar, .redactor-dropdown, #redactor-modal").size()||(this.utils.disableSelectAll(),c.isFunction(this.opts.blurCallback)&&this.core.setCallback("blur", 23b))}},this))},setHelpers:function(){this.autosave.enable();this.placeholder.enable();this.opts.focus&&setTimeout(c.proxy(this.focus.setStart,this),100);this.opts.focusEnd&&setTimeout(c.proxy(this.focus.setEnd,this),100)},plugins:function(){this.opts.plugins&&RedactorPlugins&&c.each(this.opts.plugins,c.proxy(function(a,b){if("undefined"!==typeof RedactorPlugins[b])if(-1!==c.inArray(b,c.Redactor.modules))c.error('Plugin name "'+b+"\" matches the name of the Redactor's module.");else if(c.isFunction(RedactorPlugins[b])){this[b]= 24RedactorPlugins[b]();for(var d=this.getModuleMethods(this[b]),e=d.length,f=0;f<e;f++)this[b][d[f]]=this[b][d[f]].bind(this);c.isFunction(this[b].init)&&this[b].init()}},this))},disableMozillaEditing:function(){if(this.utils.browser("mozilla"))try{document.execCommand("enableObjectResizing",!1,!1),document.execCommand("enableInlineTableEditing",!1,!1)}catch(a){}}}},lang:function(){return{load:function(){this.opts.curLang=this.opts.langs[this.opts.lang]},get:function(a){return"undefined"!=typeof this.opts.curLang[a]? 25this.opts.curLang[a]:""}}},toolbar:function(){return{init:function(){return{html:{title:this.lang.get("html"),func:"code.toggle"},formatting:{title:this.lang.get("formatting"),dropdown:{p:{title:this.lang.get("paragraph"),func:"block.format"},blockquote:{title:this.lang.get("quote"),func:"block.format"},pre:{title:this.lang.get("code"),func:"block.format"},h1:{title:this.lang.get("header1"),func:"block.format"},h2:{title:this.lang.get("header2"),func:"block.format"},h3:{title:this.lang.get("header3"), 26func:"block.format"},h4:{title:this.lang.get("header4"),func:"block.format"},h5:{title:this.lang.get("header5"),func:"block.format"}}},bold:{title:this.lang.get("bold"),func:"inline.format"},italic:{title:this.lang.get("italic"),func:"inline.format"},deleted:{title:this.lang.get("deleted"),func:"inline.format"},underline:{title:this.lang.get("underline"),func:"inline.format"},unorderedlist:{title:"• "+this.lang.get("unorderedlist"),func:"list.toggle"},orderedlist:{title:"1. "+this.lang.get("orderedlist"), 27func:"list.toggle"},outdent:{title:"< "+this.lang.get("outdent"),func:"indent.decrease"},indent:{title:"> "+this.lang.get("indent"),func:"indent.increase"},image:{title:this.lang.get("image"),func:"image.show"},file:{title:this.lang.get("file"),func:"file.show"},link:{title:this.lang.get("link"),dropdown:{link:{title:this.lang.get("link_insert"),func:"link.show"},unlink:{title:this.lang.get("unlink"),func:"link.unlink"}}},alignment:{title:this.lang.get("alignment"),dropdown:{left:{title:this.lang.get("align_left"), 28func:"alignment.left"},center:{title:this.lang.get("align_center"),func:"alignment.center"},right:{title:this.lang.get("align_right"),func:"alignment.right"},justify:{title:this.lang.get("align_justify"),func:"alignment.justify"}}},horizontalrule:{title:this.lang.get("horizontalrule"),func:"line.insert"}}},build:function(){this.toolbar.hideButtons();this.toolbar.hideButtonsOnMobile();this.toolbar.isButtonSourceNeeded();if(0!==this.opts.buttons.length&&(this.$toolbar=this.toolbar.createContainer(), 29this.toolbar.setOverflow(),this.toolbar.append(),this.toolbar.setFormattingTags(),this.toolbar.loadButtons(),this.toolbar.setTabindex(),this.toolbar.setFixed(),this.opts.activeButtons))this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",c.proxy(this.observe.buttons,this))},createContainer:function(){return c("<ul>").addClass("redactor-toolbar").attr("id","redactor-toolbar-"+this.uuid)},setFormattingTags:function(){c.each(this.opts.toolbar.formatting.dropdown,c.proxy(function(a,b){-1== 30c.inArray(a,this.opts.formatting)&&delete this.opts.toolbar.formatting.dropdown[a]},this))},loadButtons:function(){c.each(this.opts.buttons,c.proxy(function(a,b){if(this.opts.toolbar[b]){if(!1===this.opts.fileUpload&&"file"===b||!1===this.opts.imageUpload&&!1===this.opts.s3&&"image"===b)return!0;var d=this.opts.toolbar[b];this.$toolbar.append(c("<li>").append(this.button.build(b,d)))}},this))},append:function(){this.opts.toolbarExternal?(this.$toolbar.addClass("redactor-toolbar-external"),c(this.opts.toolbarExternal).html(this.$toolbar)): 31this.$box.prepend(this.$toolbar)},setFixed:function(){this.utils.isMobile()||this.opts.toolbarExternal||!this.opts.toolbarFixed||(this.toolbar.observeScroll(),c(this.opts.toolbarFixedTarget).on("scroll.redactor",c.proxy(this.toolbar.observeScroll,this)))},setTabindex:function(){this.$toolbar.find("a").attr("tabindex","-1")},setOverflow:function(){this.utils.isMobile()&&this.opts.toolbarOverflow&&this.$toolbar.addClass("redactor-toolbar-overflow")},isButtonSourceNeeded:function(){if(!this.opts.buttonSource){var a= 32this.opts.buttons.indexOf("html");-1!==a&&this.opts.buttons.splice(a,1)}},hideButtons:function(){0!==this.opts.buttonsHide.length&&c.each(this.opts.buttonsHide,c.proxy(function(a,b){var c=this.opts.buttons.indexOf(b);this.opts.buttons.splice(c,1)},this))},hideButtonsOnMobile:function(){this.utils.isMobile()&&0!==this.opts.buttonsHideOnMobile.length&&c.each(this.opts.buttonsHideOnMobile,c.proxy(function(a,b){var c=this.opts.buttons.indexOf(b);this.opts.buttons.splice(c,1)},this))},observeScroll:function(){var a= 33c(this.opts.toolbarFixedTarget).scrollTop(),b=1;this.opts.toolbarFixedTarget===document&&(b=this.$box.offset().top);a>b?this.toolbar.observeScrollEnable(a,b):this.toolbar.observeScrollDisable()},observeScrollEnable:function(a,b){var c=this.opts.toolbarFixedTo
33pOffset+a-b,e=b+this.$box.height()+30,f=this.$box.innerWidth();this.$toolbar.addClass("toolbar-fixed-box");this.$toolbar.css({position:"absolute",width:f,top:c+"px",left:0});this.toolbar.setDropdownsFixed();this.$toolbar.css("visibility",a<e? 34"visible":"hidden")},observeScrollDisable:function(){this.$toolbar.css({position:"relative",width:"auto",top:0,left:0,visibility:"visible"});this.toolbar.unsetDropdownsFixed();this.$toolbar.removeClass("toolbar-fixed-box")},setDropdownsFixed:function(){var a=this.$toolbar.innerHeight()+this.opts.toolbarFixedTopOffset,b="fixed";this.opts.toolbarFixedTarget!==document&&(a=this.$toolbar.innerHeight()+this.$toolbar.offset().top+this.opts.toolbarFixedTopOffset,b="absolute");c(".redactor-dropdown").each(function(){c(this).css({position:b, 35top:a+"px"})})},unsetDropdownsFixed:function(){var a=this.$toolbar.innerHeight()+this.$toolbar.offset().top;c(".redactor-dropdown").each(function(){c(this).css({position:"absolute",top:a+"px"})})}}},button:function(){return{build:function(a,b){var d=c('<a href="#" class="re-icon re-'+a+'" rel="'+a+'" />');if(b.func||b.command||b.dropdown)d.on("touchstart click",c.proxy(function(c){if(d.hasClass("redactor-button-disabled"))return!1;var e="func",k=b.func;b.command?(e="command",k=b.command):b.dropdown&& 36(e="dropdown",k=!1);this.button.onClick(c,a,e,k)},this));if(b.dropdown){var e=c('<div class="redactor-dropdown redactor-dropdown-box-'+a+'" style="display: none;">');d.data("dropdown",e);this.dropdown.build(a,e,b.dropdown)}this.utils.isDesktop()&&this.button.createTooltip(d,a,b.title);return d},createTooltip:function(a,b,d){var e=c("<span>").addClass("redactor-toolbar-tooltip redactor-toolbar-tooltip-"+b).hide().html(d);e.appendTo("body");a.on("mouseover",function(){if(!c(this).hasClass("redactor-button-disabled")){var b= 37a.offset(),d=a.innerHeight(),k=a.innerWidth();e.show();e.css({top:b.top+d+"px",left:b.left+k/2-e.innerWidth()/2+"px"})}});a.on("mouseout",function(){e.hide()})},onClick:function(a,b,d,e){a.preventDefault();this.utils.browser("msie")&&(a.returnValue=!1);"command"==d?this.inline.format(e):"dropdown"==d?this.dropdown.show(a,b):c.isFunction(e)?(e.call(this,b),this.observe.buttons(a,b)):"-1"!=e.search(/\./)?(d=e.split("."),"undefined"!=typeof this[d[0]]&&(this[d[0]][d[1]](b),this.observe.buttons(a,b))): 38(this[e](b),this.observe.buttons(a,b))},get:function(a){return this.$toolbar.find("a.re-"+a)},setActive:function(a){this.button.get(a).addClass("redactor-act")},setInactive:function(a){this.button.get(a).removeClass("redactor-act")},setInactiveAll:function(a){"undefined"==typeof a?this.$toolbar.find("a.re-icon").removeClass("redactor-act"):this.$toolbar.find("a.re-icon").not(".re-"+a).removeClass("redactor-act")},setActiveInVisual:function(){this.$toolbar.find("a.re-icon").not("a.re-html").removeClass("redactor-button-disabled")}, 39setInactiveInCode:function(){this.$toolbar.find("a.re-icon").not("a.re-html").addClass("redactor-button-disabled")},changeIcon:function(a,b){this.button.get(a).addClass("re-"+b)},removeIcon:function(a,b){this.button.get(a).removeClass("re-"+b)},setAwesome:function(a,b){var c=this.button.get(a);c.removeClass("redactor-btn-image").addClass("fa-redactor-btn");c.html('<i class="fa '+b+'"></i>')},addCallback:function(a,b){var d="dropdown"==b?"dropdown":"func",e=a.attr("rel");a.on("touchstart click",c.proxy(function(c){if(a.hasClass("redactor-button-disabled"))return!1; 40this.button.onClick(c,e,d,b)},this))},addDropdown:function(a,b){var d=a.attr("rel");this.button.addCallback(a,"dropdown");var e=c('<div class="redactor-dropdown redactor-dropdown-box-'+d+'" style="display: none;">');a.data("dropdown",e);b&&this.dropdown.build(d,e,b);return e},add:function(a,b){if(this.opts.toolbar){var d=this.button.build(a,{title:b});d.addClass("redactor-btn-image");this.$toolbar.append(c("<li>").append(d));return d}},addFirst:function(a,b){if(this.opts.toolbar){var d=this.button.build(a, 41{title:b});this.$toolbar.prepend(c("<li>").append(d));return d}},addAfter:function(a,b,d){if(this.opts.toolbar)return b=this.button.build(b,{title:d}),a=this.button.get(a),0!==a.size()?a.parent().after(c("<li>").append(b)):this.$toolbar.append(c("<li>").append(b)),b},addBefore:function(a,b,d){if(this.opts.toolbar)return b=this.button.build(b,{title:d}),a=this.button.get(a),0!==a.size()?a.parent().before(c("<li>").append(b)):this.$toolbar.append(c("<li>").append(b)),b},remove:function(a){this.button.get(a).remove()}}}, 42dropdown:function(){return{build:function(a,b,d){"formatting"==a&&this.opts.formattingAdd&&c.each(this.opts.formattingAdd,c.proxy(function(a,b){var c=b.tag;"undefined"!=typeof b["class"]&&(c=c+"-"+b["class"]);
42b.type=this.utils.isBlockTag(b.tag)?"block":"inline";var k="inline"==b.type?"inline.formatting":"block.formatting";this.opts.linebreaks&&"block"==b.type&&"p"==b.tag||(this.formatting[c]={tag:b.tag,style:b.style,"class":b["class"],attr:b.attr,data:b.data},d[c]={func:k,title:b.title})},this)); 43c.each(d,c.proxy(function(d,f){var g=c('<a href="#" class="redactor-dropdown-'+d+'">'+f.title+"</a>");"formatting"==a&&g.addClass("redactor-formatting-"+d);g.on("click",c.proxy(function(a){var b="func",c=f.func;f.command?(b="command",c=f.command):f.dropdown&&(b="dropdown",c=f.dropdown);this.button.onClick(a,d,b,c)},this));b.append(g)},this))},show:function(a,b){if(!this.opts.visual)return a.preventDefault(),!1;var d=this.button.get(b),e=d.data("dropdown").appendTo(document.body);document.activeElement.blur(); 44if(d.hasClass("dropact"))this.dropdown.hideAll();else{this.dropdown.hideAll();this.core.setCallback("dropdownShow",{dropdown:e,key:b,button:d});this.button.setActive(b);d.addClass("dropact");var f=d.offset(),g=e.width();f.left+g>c(document).width()&&(f.left-=g);g=f.left+"px";if(this.$toolbar.hasClass("toolbar-fixed-box")){var f=this.$toolbar.innerHeight()+this.opts.toolbarFixedTopOffset,k="fixed";this.opts.toolbarFixedTarget!==document&&(f=this.$toolbar.innerHeight()+this.$toolbar.offset().top+this.opts.toolbarFixedTopOffset, 45k="absolute");e.css({position:k,left:g,top:f+"px"}).show()}else f=d.innerHeight()+f.top+"px",e.css({position:"absolute",left:g,top:f}).show();this.core.setCallback("dropdownShown",{dropdown:e,key:b,button:d})}c(document).one("click",c.proxy(this.dropdown.hide,this));this.$editor.one("click",c.proxy(this.dropdown.hide,this));var h=c(document.body),l=h.width();e.on("mouseover",function(){h.addClass("body-hidden");h.css("margin-right",h.width()-l+"px")});e.on("mouseout",function(){h.removeClass("body-hidden").css("margin-right", 460)});a.stopPropagation()},hideAll:function(){this.$toolbar.find("a.dropact").removeClass("redactor-act").removeClass("dropact");c(".redactor-dropdown").hide();this.core.setCallback("dropdownHide")},hide:function(a){a=c(a.target);a.hasClass("dropact")||(a.removeClass("dropact"),this.dropdown.hideAll())}}},code:function(){return{set:function(a){a=c.trim(a.toString());a=this.clean.onSet(a);this.$editor.html(a);this.code.sync();setTimeout(c.proxy(this.buffer.add,this),15);!1===this.start&&this.observe.load()}, 47get:function(){var a=this.$textarea.val();return a=this.tabifier.get(a)},sync:function(){setTimeout(c.proxy(this.code.startSync,this),10)},startSync:function(){var a=this.$editor.html();this.code.syncCode&&this.code.syncCode==a||(this.code.syncCode=a,a=this.core.setCallback("syncBefore",a),a=this.clean.onSync(a),this.$textarea.val(a),this.core.setCallback("sync",a),!1===this.start&&this.core.setCallback("change",a),this.start=!1,this.autosave.onChange())},toggle:function(){this.opts.visual?this.code.showCode(): 48this.code.showVisual()},showCode:function(){this.code.offset=this.caret.getOffset();var a=c(window).scrollTop(),b=this.$editor.innerHeight();this.$editor.hide();var d=this.$textarea.val();this.modified=this.clean.removeSpaces(d);d=this.tabifier.get(d);this.$textarea.val(d).height(b).show().focus();this.$textarea.on("keydown.redactor-textarea-indenting",this.code.textareaIndenting);c(window).scrollTop(a);this.$textarea[0].setSelectionRange&&this.$textarea[0].setSelectionRange(0,0);this.$textarea[0].scrollTop= 490;this.opts.visual=!1;this.button.setInactiveInCode();this.button.setActive("html");this.core.setCallback("source",d)},showVisual:function(){if(!this.opts.visual){var a=this.$textarea.hide().val();this.modified!==this.clean.removeSpaces(a)&&this.code.set(a);this.$editor.show();this.utils.isEmpty(a)||this.placeholder.remove();this.caret.setOffset(this.code.offset);this.$textarea.off("keydown.redactor-textarea-indenting");this.button.setActiveInVisual();this.button.setInactive("html");this.observe.load(); 50this.opts.visual=!0}},textareaIndenting:function(a){if(9!==a.keyCode)return!0;a=this.$textarea;var b=a.get(0).selectionStart;a.val(a.val().substring(0,b)+"\t"+a.val().substring(a.get(0).selectionEnd));a.get(0).selectionStart=a.get(0).selectionEnd=b+1;return!1}}},clean:function(){return{onSet:function(a){a=this.clean.savePreCode(a);a=a.replace(/\$/g,"$");a=a.replace(/\u201d/g,'"');a=a.replace(/\u2018/g,"'");a=a.replace(/\u2019/g,"'");this.opts.replaceDivs&&(a=this.clean.replaceDivs(a));this.opts.linebreaks&& 51(a=this.clean.replaceParagraphsToBr(a));a=this.clean.saveFormTags(a);var b=c("<div>");b.html(a);var d=b.find("font[style]");0!==d.length&&(d.replaceWith(function(){var a=c(this);c("<span>").attr("style",a.attr("style"));return $span.append(a.contents())}),a=b.html());b.remove();a=a.replace(/<font(.*?[^<])>/gi,"");a=a.replace(/<\/font>/gi,"");a=this.tidy.load(a);this.opts.paragraphize&&(a=this.paragraphize.load(a));a=this.clean.setVerified(a);return a=this.clean.convertInline(a)},onSync:function(a){a= 52a.replace(/[\u200B-\u200D\uFEFF]/g,"");a=a.replace(/​/gi,"");if(-1!=a.search(/^<p>(||\s|| )<\/p>$/i))return"";a=this.clean.restoreFormTags(a);c.each({"\u2122":"™","\u00a9":"©","\u2026":"…","\u2014":"—","\u2010":"‐"},function(b,c){a=a.replace(new RegExp(b,"g"),c)});a=a.replace(RegExp("<br\\s?/?></li>","gi"),"</li>");a=a.replace(RegExp("</li><br\\s?/?>","gi"),"</li>");a=a.replace(RegExp('<div(.*?) data-tagblock="redactor"(.*?[^>])>',"gi"),"<div$1$2>");a=a.replace(RegExp('<(.*?) data-verified="redactor"(.*?[^>])>', 53"gi"),"<$1$2>");a=a.replace(RegExp('<span(.*?) rel="(.*?)"(.*?[^>])>',"gi"),"<span$1$3>");a=a.replace(RegExp('<img(.*?) rel="(.*?)"(.*?[^>])>',"gi"),"<img$1$3>");a=a.replace(RegExp('<img(.*?) style="" (.*?[^>])>',"gi"),"<img$1 $2>");a=a.replace(RegExp("<img(.*?) style (.*?[^>])>","gi"),"<img$1 $2>");a=a.replace(RegExp('<span class="redactor-invisible-space">(.*?)</span>',"gi"),"$1");a=a.replace(/ data-save-url="(.*?[^>])"/gi,"");a=a.replace(/<span(.*?)id="redactor-image-box"(.*?[^>])>([\w\W]*?)<img(.*?)><\/span>/gi, 54"$3<img$4>");a=a.replace(/<span(.*?)id="redactor-image-resizer"(.*?[^>])>(.*?)<\/span>/gi,"");a=a.replace(/<span(.*?)id="redactor-image-editter"(.*?[^>])>(.*?)<\/span>/gi,"");a=this.tidy.load(a);this.opts.linkNofollow&&(a=a.replace(/<a(.*?)rel="nofollow"(.*?[^>])>/gi,"<a$1$2>"),a=a.replace(/<a(.*?[^>])>/gi,'<a$1 rel="nofollow">'));a=a.replace(/<(.*?) data-redactor-tag="(.*?)"(.*?[^>])>/gi,"<$1$3>");a=a.replace(/<(.*?) data-redactor-class="(.*?)"(.*?[^>])>/gi,"<$1$3>");a=a.replace(/<(.*?) data-redactor-style="(.*?)"(.*?[^>])>/gi, 55"<$1$3>");a=a.replace(RegExp('<(.*?) data-verified="redactor"(.*?[^>])>',"gi"),"<$1$2>");return a=a.replace(RegExp('<(.*?) data-verified="redactor">',"gi"),"<$1>")},onPaste:function(a,b){a=c.trim(a);a=a.replace(/\$/g,"$");a=a.replace(/\u201d/g,'"');a=a.replace(/\u201c/g,'"');a=a.replace(/\u2018/g,"'");a=a.replace(/\u2019/g,"'");
55a=a.replace(/<span class="Apple-converted-space"> <\/span>/gi," ");a=a.replace(/<span class="Apple-tab-span"[^>]*>\t<\/span>/gi,"\t");a=a.replace(/<span[^>]*>(\s| )<\/span>/gi, 56" ");if(this.opts.pastePlainText)return this.clean.getPlainText(a);if(!this.utils.isSelectAll()&&"undefined"==typeof b){if(this.utils.isCurrentOrParent(["FIGCAPTION","A"]))return this.clean.getPlainText(a,!1);if(this.utils.isCurrentOrParent("PRE"))return this.clean.getPreCode(a);if(this.utils.isCurrentOrParent("BLOCKQUOTE H1 H2 H3 H4 H5 H6".split(" "))){a=this.clean.getOnlyImages(a);if(!this.utils.browser("msie")){var d=this.selection.getBlock();d&&"P"==d.tagName&&(a=a.replace(/<img(.*?)>/gi,"<p><img$1></p>"))}return a}if(this.utils.isCurrentOrParent(["TD"]))return a= 57this.clean.onPasteTidy(a,"td"),this.opts.linebreaks&&(a=this.clean.replaceParagraphsToBr(a)),a=this.clean.replaceDivsToBr(a);if(this.utils.isCurrentOrParent(["LI"]))return this.clean.onPasteTidy(a,"li")}a=this.clean.isSingleLine(a,b);this.clean.singleLine||(this.opts.linebreaks&&(a=this.clean.replaceParagraphsToBr(a)),this.opts.replaceDivs&&(a=this.clean.replaceDivs(a)),a=this.clean.saveFormTags(a));a=this.clean.onPasteWord(a);a=this.clean.onPasteExtra(a);a=this.clean.onPasteTidy(a,"all");!this.clean.singleLine&& 58this.opts.paragraphize&&(a=this.paragraphize.load(a));a=this.clean.removeDirtyStyles(a);a=this.clean.onPasteRemoveSpans(a);a=this.clean.onPasteRemoveEmpty(a);return a=this.clean.convertInline(a)},onPasteWord:function(a){a=a.replace(/\x3c!--[\s\S]*?--\x3e/gi,"");a=a.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,"");/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(a)&&(a=this.clean.onPasteIeFixLinks(a),a=a.replace(/<img(.*?)v:shapes=(.*?)>/gi,""),a=a.replace(/src="file\:\/\/(.*?)"/,'src=""'), 59a=a.replace(/<p(.*?)class="MsoListParagraphCxSpFirst"([\w\W]*?)<\/p>/gi,"<ul><li$2</li>"),a=a.replace(/<p(.*?)class="MsoListParagraphCxSpMiddle"([\w\W]*?)<\/p>/gi,"<li$2</li>"),a=a.replace(/<p(.*?)class="MsoListParagraphCxSpLast"([\w\W]*?)<\/p>/gi,"<li$2</li></ul>"),a=a.replace(/<p(.*?)class="MsoListParagraph"([\w\W]*?)<\/p>/gi,"<ul><li$2</li></ul>"),a=a.replace(/\u00b7/g,""),a=a.replace(/<p class="Mso(.*?)"/gi,"<p"),a=a.replace(/ class=\"(mso[^\"]*)\"/gi,""),a=a.replace(/ class=(mso\w+)/gi,""),a= 60a.replace(/<o:p(.*?)>([\w\W]*?)<\/o:p>/gi,"$2"),a=a.replace(/\n/g," "),a=a.replace(/<p>\n?<li>/gi,"<li>"));this.opts.cleanSpaces&&(a=a.replace(/(\s| )+/g," "));return a},onPasteExtra:function(a){a=a.replace(/<b\sid="internal-source-marker(.*?)">([\w\W]*?)<\/b>/gi,"$2");a=a.replace(/<b(.*?)id="docs-internal-guid(.*?)">([\w\W]*?)<\/b>/gi,"$3");a=a.replace(/<span[^>]*(font-style: italic; font-weight: bold|font-weight: bold; font-style: italic)[^>]*>/gi,'<span style="font-weight: bold;"><span style="font-style: italic;">'); 61a=a.replace(/<span[^>]*font-style: italic[^>]*>/gi,'<span style="font-style: italic;">');a=a.replace(/<span[^>]*font-weight: bold[^>]*>/gi,'<span style="font-weight: bold;">');a=a.replace(/<span[^>]*text-decoration: underline[^>]*>/gi,'<span style="text-decoration: underline;">');a=a.replace(/<img>/gi,"");a=a.replace(/\n{3,}/gi,"\n");a=a.replace(/<font(.*?)>([\w\W]*?)<\/font>/gi,"$2");a=a.replace(/<p><p>/gi,"<p>");a=a.replace(/<\/p><\/p>/gi,"</p>");a=a.replace(/<li>(\s*|\t*|\n*)<p>/gi,"<li>");a=a.replace(/<\/p>(\s*|\t*|\n*)<\/li>/gi, 62"</li>");a=a.replace(/<\/p>\s<p/gi,"</p><p");a=a.replace(/<img src="webkit-fake-url\:\/\/(.*?)"(.*?)>/gi,"");a=a.replace(/<p>\u2022([\w\W]*?)<\/p>/gi,"<li>$1</li>");this.utils.browser("mozilla")&&(a=a.replace(/<br\s?\/?>$/gi,""));return a},onPasteTidy:function(a,b){var c="span a pre blockquote small em strong code kbd mark address cite var samp dfn sup sub b i u del ol ul li dl dt dd p br video audio iframe embed param object img table td th tr tbody tfoot thead h1 h2 h3 h4 h5 h6".split(" "),e=!1, 63f=[["a","*"],["img",["src","alt"]],["span",["class","rel","data-verified"]],["iframe","*"],["video","*"],["audio","*"],["embed","*"],["object","*"],["param","*"],["source","*"]];"all"==b?(e="p span h1 h2 h3 h4 h5 h6".split(" "),f=[["table","class"],["td",["colspan","rowspan"]],["a","*"],["img",["src","alt","data-redactor-inserted-image"]],["span",["class","rel","data-verified"]],["iframe","*"],["video","*"],["audio","*"],["embed","*"],["object","*"],["param","*"],["source","*"]]):"td"==b?c="ul ol li span a small em strong code kbd mark cite var samp dfn sup sub b i u del ol ul li dl dt dd br iframe video audio embed param object img h1 h2 h3 h4 h5 h6".split(" "): 64"li"==b&&(c="ul ol li span a small em strong code kbd mark cite var samp dfn sup sub b i u del br iframe video audio embed param object img".split(" "));return this.tidy.load(a,{deniedTags:!1,allowedTags:c,removeComments:!0,removePhp:!0,removeAttr:!1,allowedAttr:f,removeEmpty:e})},onPasteRemoveEmpty:function(a){a=a.replace(/<(p|h[1-6])>(|\s|\n|\t|<br\s?\/?>)<\/(p|h[1-6])>/gi,"");this.opts.linebreaks||(a=a.replace(/<br>$/i,""));return a},onPasteRemoveSpans:function(a){a=a.replace(/<span>(.*?)<\/span>/gi, 65"$1");return a=a.replace(/<span[^>]*>\s| <\/span>/gi," ")}
65,onPasteIeFixLinks:function(a){if(!this.utils.browser("msie"))return a;0===c.trim(a).search(/^<a(.*?)>(.*?)<\/a>$/i)&&(a=a.replace(/^<a(.*?)>(.*?)<\/a>$/i,"$2"));return a},isSingleLine:function(a,b){this.clean.singleLine=!1;if(!this.utils.isSelectAll()&&"undefined"==typeof b){var c=this.opts.blockLevelElements.join("|").replace("P|","").replace("DIV|",""),c=a.match(new RegExp("</("+c+")>","gi")),e=a.match(/<\/(p|div)>/gi);!c&&(null=== 66e||e&&1>=e.length)&&(c=a.match(/<br\s?\/?>/gi),e=a.match(/<img(.*?[^>])>/gi),c||e||(this.clean.singleLine=!0,a=a.replace(/<\/?(p|div)(.*?)>/gi,"")))}return a},stripTags:function(a,b){b=(((b||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");return a.replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,function(a,c){return-1<b.indexOf("<"+c.toLowerCase()+">")?a:""})},savePreCode:function(a){var b=a.match(/<(pre|code)(.*?)>([\w\W]*?)<\/(pre|code)>/gi);null!==b&&c.each(b,c.proxy(function(b,c){var f= 67c.match(/<(pre|code)(.*?)>([\w\W]*?)<\/(pre|code)>/i);f[3]=f[3].replace(/<br\s?\/?>/g,"\n");f[3]=f[3].replace(/ /g," ");this.opts.preSpaces&&(f[3]=f[3].replace(/\t/g,Array(this.opts.preSpaces+1).join(" ")));f[3]=this.clean.encodeEntities(f[3]);f[3]=f[3].replace(/\$/g,"$");a=a.replace(c,"<"+f[1]+f[2]+">"+f[3]+"</"+f[1]+">")},this));return a},getTextFromHtml:function(a){a=a.replace(/<br\s?\/?>|<\/H[1-6]>|<\/p>|<\/div>|<\/li>|<\/td>/gi,"\n");var b=document.createElement("div");b.innerHTML=a; 68a=b.textContent||b.innerText;return c.trim(a)},getPlainText:function(a,b){a=this.clean.getTextFromHtml(a);a=a.replace(/\n/g,"<br />");this.opts.paragraphize&&"undefined"==typeof b&&(a=this.paragraphize.load(a));return a},getPreCode:function(a){a=a.replace(/<img(.*?) style="(.*?)"(.*?[^>])>/gi,"<img$1$3>");a=a.replace(/<img(.*?)>/gi,"<img$1>");a=this.clean.getTextFromHtml(a);this.opts.preSpaces&&(a=a.replace(/\t/g,Array(this.opts.preSpaces+1).join(" ")));return a=this.clean.encodeEntities(a)}, 69getOnlyImages:function(a){a=a.replace(/<img(.*?)>/gi,"[img$1]");a=a.replace(/<(.*?)>/gi,"");return a=a.replace(/\[img(.*?)\]/gi,"<img$1>")},getOnlyLinksAndImages:function(a){a=a.replace(/<a(.*?)href="(.*?)"(.*?)>([\w\W]*?)<\/a>/gi,'[a href="$2"]$4[/a]');a=a.replace(/<img(.*?)>/gi,"[img$1]");a=a.replace(/<(.*?)>/gi,"");a=a.replace(/\[a href="(.*?)"\]([\w\W]*?)\[\/a\]/gi,'<a href="$1">$2</a>');return a=a.replace(/\[img(.*?)\]/gi,"<img$1>")},encodeEntities:function(a){a=String(a).replace(/&/g,"&").replace(/</g, 70"<").replace(/>/g,">").replace(/"/g,'"');return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},removeDirtyStyles:function(a){if(this.utils.browser("msie"))return a;var b=document.createElement("div");b.innerHTML=a;this.clean.clearUnverifiedRemove(c(b));a=b.innerHTML;c(b).remove();return a},clearUnverified:function(){if(!this.utils.browser("msie")){this.clean.clearUnverifiedRemove(this.$editor);var a=this.$editor.find("h1, h2, h3, h4, h5, h6");a.find("span").removeAttr("style"); 71a.find(this.opts.verifiedTags.join(", ")).removeAttr("style");this.code.sync()}},clearUnverifiedRemove:function(a){a.find(this.opts.verifiedTags.join(", ")).removeAttr("style");a.find("span").not('[data-verified="redactor"]').removeAttr("style");a.find('span[data-verified="redactor"], img[data-verified="redactor"]').each(function(a,d){var e=c(d);e.attr("style",e.attr("rel"))})},setVerified:function(a){if(this.utils.browser("msie"))return a;a=a.replace(RegExp("<img(.*?[^>])>","gi"),'<img$1 data-verified="redactor">'); 72a=a.replace(RegExp("<span(.*?)>","gi"),'<span$1 data-verified="redactor">');var b=a.match(RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>',"gi"));if(b)for(var c=b.length,e=0;e<c;e++)try{var f=b[e].replace(/style="(.*?)"/i,'style="$1" rel="$1"');a=a.replace(new RegExp(b[e],"gi"),f)}catch(g){}return a},convertInline:function(a){var b=c("<div />").html(a);a=this.opts.inlineTags;a.push("span");b.find(a.join(",")).each(function(){var a=c(this),b=this.tagName.toLowerCase();a.attr("data-redactor-tag",b); 73"span"==b&&(a.attr("style")?a.attr("data-redactor-style",a.attr("style")):a.attr("class")&&a.attr("data-redactor-class",a.attr("class")))});a=b.html();b.remove();return a},normalizeLists:function(){this.$editor.find("li").each(function(a,b){var d=c(b).next();0===d.length||"UL"!=d[0].tagName&&"OL"!=d[0].tagName||c(b).append(d)})},removeSpaces:function(a){a=a.replace(/\n/g,"");a=a.replace(/[\t]*/g,"");a=a.replace(/\n\s*\n/g,"\n");a=a.replace(/^[\s\n]*/g," ");a=a.replace(/[\s\n]*$/g," ");a=a.replace(/>\s{2,}</g, 74"> <");a=a.replace(/\n\n/g,"\n");return a=a.replace(/[\u200B-\u200D\uFEFF]/g,"")},replaceDivs:function(a){this.opts.linebreaks?(a=a.replace(/<div><br\s?\/?><\/div>/gi,"<br />"),a=a.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"$2<br />")):a=a.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"<p$1>$2</p>");return a},replaceDivsToBr:function(a){a=a.replace(/<div\s(.*?)>/gi,"<p>");a=a.replace(/<div><br\s?\/?><\/div>/gi,"<br /><br />");return a=a.replace(/<div>([\w\W]*?)<\/div>/gi,"$1<br /><br />")},replaceParagraphsToBr:function(a){a= 75a.replace(/<p\s(.*?)>/gi,"<p>");a=a.replace(/<p><br\s?\/?><\/p>/gi,"<br />");a=a.replace(/<p>([\w\W]*?)<\/p>/gi,"$1<br /><br />");return a=a.replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi,"</blockquote>")},saveFormTags:function(a){return a.replace(/<form(.*?)>([\w\W]*?)<\/form>/gi,'<section$1 rel="redactor-form-tag">$2</section>')},restoreFormTags:function(a){return a.replace(/<section(.*?) rel="redactor-form-tag"(.*?)>([\w\W]*?)<\/section>/gi,"<form$1$2>$3</form>")}}},tidy:function(){return{setupAllowed:function(){this.opts.allowedTags&& 76(this.opts.deniedTags=!1);this.opts.allowedAttr&&(this.opts.removeAttr=!1);if(!this.opts.linebreaks){var a=["p","section"];this.opts.allowedTags&&this.tidy.addToAllowed(a);this.opts.deniedTags&&this.tidy.removeFromDenied(a)}},addToAllowed:function(a){for(var b=a.length,d=0;d<b;d++)-1==c.inArray(a[d],this.opts.allowedTags)&&this.opts.allowedTags.push(a[d])},removeFromDenied:function(a){for(var b=a.length,d=0;d<b;d++){var e=c.inArray(a[d],this.opts.deniedTags);-1!=e&&this.opts.deniedTags.splice(e,1)}}, 77load:function(a,b){this.tidy.settings={deniedTags:this.opts.deniedTags,allowedTags:this.opts.allowedTags,removeComments:this.opts.removeComments,replaceTags:this.opts.replaceTags,replaceStyles:this.opts.replaceStyles,removeDataAttr:this.opts.removeDataAttr,removeAttr:this.opts.removeAttr,allowedAttr:this.opts.allowedAttr,removeWithoutAttr:this.opts.removeWithoutAttr,removeEmpty:this.opts.removeEmpty};c.extend(this.tidy.settings,b);a=this.tidy.removeComments(a);this.tidy.$div=c("<div />").append(a); 78this.tidy.replaceTags();this.tidy.replaceStyles();this.tidy.removeTags();this.tidy.removeAttr();this.tidy.removeEmpty();this.tidy.removeParagraphsInLists();this.tidy.removeDataAttr();this.tidy.removeWithoutAttr();a=this.tidy.$div.html();this.tidy.$div.remove();return a},removeComments:function(a){return this.tidy.settings.removeComments?a.replace(/\x3c!--[\s\S]*?--\x3e/gi,""):a}
78,replaceTags:function(a){if(!this.tidy.settings.replaceTags)return a;for(var b=this.tidy.settings.replaceTags.length,d=[], 79e=[],f=0;f<b;f++)e.push(this.tidy.settings.replaceTags[f][1]),d.push(this.tidy.settings.replaceTags[f][0]);this.tidy.$div.find(d.join(",")).each(c.proxy(function(a,b){var d=e[a];c(b).replaceWith(function(){for(var a=c("<"+d+" />").append(c(this).contents()),b=0;b<this.attributes.length;b++)a.attr(this.attributes[b].name,this.attributes[b].value);return a})},this));return a},replaceStyles:function(){if(this.tidy.settings.replaceStyles){var a=this.tidy.settings.replaceStyles.length;this.tidy.$div.find("span").each(c.proxy(function(b, 80d){for(var e=c(d),f=e.attr("style"),g=0;g<a;g++)if(f&&f.match(new RegExp("^"+this.tidy.settings.replaceStyles[g][0],"i"))){var k=this.tidy.settings.replaceStyles[g][1];e.replaceWith(function(){var a=document.createElement(k);return c(a).append(c(this).contents())})}},this))}},removeTags:function(){!this.tidy.settings.deniedTags&&this.tidy.settings.allowedTags&&this.tidy.$div.find("*").not(this.tidy.settings.allowedTags.join(",")).each(function(a,b){""===b.innerHTML?c(b).remove():c(b).contents().unwrap()}); 81this.tidy.settings.deniedTags&&this.tidy.$div.find(this.tidy.settings.deniedTags.join(",")).each(function(a,b){""===b.innerHTML?c(b).remove():c(b).contents().unwrap()})},removeAttr:function(){var a;if(!this.tidy.settings.removeAttr&&this.tidy.settings.allowedAttr){var b=[],d=[];a=this.tidy.settings.allowedAttr.length;for(var e=0;e<a;e++)b.push(this.tidy.settings.allowedAttr[e][0]),d.push(this.tidy.settings.allowedAttr[e][1]);this.tidy.$div.find("*").each(c.proxy(function(a,e){var f=c(e),h=c.inArray(f[0].tagName.toLowerCase(), 82b);(h=this.tidy.removeAttrGetRemoves(h,d,f))&&c.each(h,function(a,b){f.removeAttr(b)})},this))}if(this.tidy.settings.removeAttr)for(a=this.tidy.settings.removeAttr.length,e=0;e<a;e++){var f=this.tidy.settings.removeAttr[e][1];c.isArray(f)&&(f=f.join(" "));this.tidy.$div.find(this.tidy.settings.removeAttr[e][0]).removeAttr(f)}},removeAttrGetRemoves:function(a,b,d){var e=[];-1==a?c.each(d[0].attributes,function(a,b){e.push(b.name)}):"*"==b[a]?e=[]:c.each(d[0].attributes,function(d,g){c.isArray(b[a])? 83-1==c.inArray(g.name,b[a])&&e.push(g.name):b[a]!=g.name&&e.push(g.name)});return e},removeAttrs:function(a,b){b=new RegExp(b,"g");return a.each(function(){for(var a=c(this),e=this.attributes.length-1;0<=e;e--){var f=this.attributes[e];f&&f.specified&&0<=f.name.search(b)&&a.removeAttr(f.name)}})},removeEmpty:function(){this.tidy.settings.removeEmpty&&this.tidy.$div.find(this.tidy.settings.removeEmpty.join(",")).each(function(){var a=c(this),b=a.text(),b=b.replace(/[\u200B-\u200D\uFEFF]/g,""),b=b.replace(/ /gi, 84""),b=b.replace(/\s/g,"");""===b&&0===a.children().length&&a.remove()})},removeParagraphsInLists:function(){this.tidy.$div.find("li p").contents().unwrap()},removeDataAttr:function(){if(this.tidy.settings.removeDataAttr){var a=this.tidy.settings.removeDataAttr;c.isArray(this.tidy.settings.removeDataAttr)&&(a=this.tidy.settings.removeDataAttr.join(","));this.tidy.removeAttrs(this.tidy.$div.find(a),"^(data-)")}},removeWithoutAttr:function(){this.tidy.settings.removeWithoutAttr&&this.tidy.$div.find(this.tidy.settings.removeWithoutAttr.join(",")).each(function(){0=== 85this.attributes.length&&c(this).contents().unwrap()})}}},paragraphize:function(){return{load:function(a){if(this.opts.linebreaks)return a;if(""===a||"<p></p>"===a)return this.opts.emptyHtml;this.paragraphize.blocks="table div pre form ul ol h1 h2 h3 h4 h5 h6 dl blockquote figcaption address section header footer aside article object style script iframe select input textarea button option map area math hr fieldset legend hgroup nav figure details menu summary p".split(" ");this.paragraphize.safes= 86[];this.paragraphize.z=0;a=(a+"\n").replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi,"</blockquote>");a=this.paragraphize.getSafes(a);a=this.paragraphize.getSafesComments(a);a=this.paragraphize.replaceBreaksToNewLines(a);a=this.paragraphize.replaceBreaksToParagraphs(a);a=this.paragraphize.clear(a);a=this.paragraphize.restoreSafes(a);a=a.replace(new RegExp("<br\\s?/?>\n?<("+this.paragraphize.blocks.join("|")+")(.*?[^>])>","gi"),"<p><br /></p>\n<$1$2>");return c.trim(a)},getSafes:function(a){var b=c("<div />").append(a); 87b.find("blockquote p").replaceWith(function(){return c(this).append("<br />").contents()});a=b.html();b.find(this.paragraphize.blocks.join(", ")).each(c.proxy(function(b,c){this.paragraphize.z++;this.paragraphize.safes[this.paragraphize.z]=c.outerHTML;a=a.replace(c.outerHTML,"\n{replace"+this.paragraphize.z+"}")},this));return a},getSafesComments:function(a){var b=a.match(/\x3c!--([\w\W]*?)--\x3e/gi);if(!b)return a;c.each(b,c.proxy(function(b,c){this.paragraphize.z++;this.paragraphize.safes[this.paragraphize.z]= 88c;a=a.replace(c,"\n{replace"+this.paragraphize.z+"}")},this));return a},restoreSafes:function(a){c.each(this.paragraphize.safes,function(b,c){a=a.replace("{replace"+b+"}",c)});return a},replaceBreaksToParagraphs:function(a){var b=a.split(RegExp("\n","g"),-1);a="";if(b)for(var c=b.length,e=0;e<c;e++){if(!b.hasOwnProperty(e))return;-1==b[e].search("{replace")?(b[e]=b[e].replace(/<p>\n\t?<\/p>/gi,""),b[e]=b[e].replace(/<p><\/p>/gi,""),""!==b[e]&&(a+="<p>"+b[e].replace(/^\n+|\n+$/g,"")+"</p>")):a+=b[e]}return a}, 89replaceBreaksToNewLines:function(a){a=a.replace(/<br \/>\s*<br \/>/gi,"\n\n");a=a.replace(/<br\s?\/?>\n?<br\s?\/?>/gi,"\n<br /><br />");a=a.replace(RegExp("\r\n","g"),"\n");a=a.replace(RegExp("\r","g"),"\n");return a=a.replace(/\/\n\n+\//,"g","\n\n")},clear:function(a){a=a.replace(RegExp("</blockquote></p>","gi"),"</blockquote>");a=a.replace(RegExp("<p></blockquote>","gi"),"</blockquote>");a=a.replace(RegExp("<p><blockquote>","gi"),"<blockquote>");a=a.replace(RegExp("<blockquote></p>","gi"),"<blockquote>"); 90a=a.replace(RegExp("<p><p ","gi"),"<p ");a=a.replace(RegExp("<p><p>","gi"),"<p>");a=a.replace(RegExp("</p></p>","gi"),"</p>");a=a.replace(RegExp("<p>\\s?</p>","gi"),"");a=a.replace(RegExp("\n</p>","gi"),"</p>");a=a.replace(RegExp("<p>\t?\t?\n?<p>","gi"),"<p>");return a=a.replace(RegExp("<p>\t*</p>","gi"),"")}}}
90,tabifier:function(){return{get:function(a){if(!this.opts.tabifier)return a;var b="area body head hr i?frame link meta noscript style script table tbody thead tfoot".split(" "),c="li dt dt h[1-6] option script".split(" "); 91this.tabifier.lineBefore=new RegExp("^<(/?"+b.join("|/?")+"|"+c.join("|")+")[ >]");this.tabifier.lineAfter=new RegExp("^<(br|/?"+b.join("|/?")+"|/"+c.join("|/")+")[ >]");this.tabifier.newLevel=/^<\/?(blockquote|div|dl|fieldset|form|frameset|map|ol|p|pre|select|td|th|tr|ul)[ >]/;var b=0,c=a.length,e=0,f=null,e=null,g="",k="",g="";for(this.tabifier.cleanlevel=0;b<c;b++){e=b;if(-1==a.substr(b).indexOf("<")){k+=a.substr(b);break}for(;e<c&&"<"!=a.charAt(e);)e++;b!=e&&(g=a.substr(b,e-b),g.match(/^\s{2,}$/g)|| 92("\n"==k.charAt(k.length-1)?k+=this.tabifier.getTabs():"\n"==g.charAt(0)&&(k+="\n"+this.tabifier.getTabs(),g=g.replace(/^\s+/,"")),k+=g),g.match(/\n/)&&(k+="\n"+this.tabifier.getTabs()));for(f=e;e<c&&">"!=a.charAt(e);)e++;g=a.substr(f,e-f);b=e;if("!--"==g.substr(1,3)){if(!g.match(/--$/)){for(;"--\x3e"!=a.substr(e,3);)e++;e+=2;g=a.substr(f,e-f);b=e}"\n"!=k.charAt(k.length-1)&&(k+="\n");k+=this.tabifier.getTabs();k+=g+">\n"}else if("!"==g[1])k=this.tabifier.placeTag(g+">",k);else if("?"==g[1])k+=g+ 93">\n";else if(e=g.match(/^<(script|style|pre)/i)){if(e[1]=e[1].toLowerCase(),g=this.tabifier.cleanTag(g),k=this.tabifier.placeTag(g,k),e=String(a.substr(b+1)).toLowerCase().indexOf("</"+e[1]))g=a.substr(b+1,e),b+=e,k+=g}else g=this.tabifier.cleanTag(g),k=this.tabifier.placeTag(g,k)}return this.tabifier.finish(k)},getTabs:function(){for(var a="",b=0;b<this.tabifier.cleanlevel;b++)a+="\t";return a},finish:function(a){a=a.replace(/\n\s*\n/g,"\n");a=a.replace(/^[\s\n]*/,"");a=a.replace(/[\s\n]*$/,""); 94a=a.replace(/<script(.*?)>\n<\/script>/gi,"<script$1>\x3c/script>");this.tabifier.cleanlevel=0;return a},cleanTag:function(a){var b="";a=a.replace(/\n/g," ");a=a.replace(/\s{2,}/g," ");a=a.replace(/^\s+|\s+$/g," ");var c="";a.match(/\/$/)&&(c="/",a=a.replace(/\/+$/,""));for(var e;e=/\s*([^= ]+)(?:=((['"']).*?\3|[^ ]+))?/.exec(a);)e[2]?b+=e[1].toLowerCase()+"="+e[2]:e[1]&&(b+=e[1].toLowerCase()),b+=" ",a=a.substr(e[0].length);return b.replace(/\s*$/,"")+c+">"},placeTag:function(a,b){var c=a.match(this.tabifier.newLevel); 95if(a.match(this.tabifier.lineBefore)||c)b=b.replace(/\s*$/,""),b+="\n";c&&"/"==a.charAt(1)&&this.tabifier.cleanlevel--;"\n"==b.charAt(b.length-1)&&(b+=this.tabifier.getTabs());c&&"/"!=a.charAt(1)&&this.tabifier.cleanlevel++;b+=a;if(a.match(this.tabifier.lineAfter)||a.match(this.tabifier.newLevel))b=b.replace(/ *$/,""),b+="\n";return b}}},focus:function(){return{setStart:function(){this.$editor.focus();var a=this.$editor.children().first();if(0!==a.size()&&0!==a[0].length&&"BR"!=a[0].tagName&&3!=a[0].nodeType){if("UL"== 96a[0].tagName||"OL"==a[0].tagName){var a=a.find("li").first(),b=a.children().first();if(!this.utils.isBlock(b)&&""===b.text()){this.caret.setStart(b);return}}this.opts.linebreaks&&!this.utils.isBlockTag(a[0].tagName)?(this.selection.get(),this.range.setStart(this.$editor[0],0),this.range.setEnd(this.$editor[0],0),this.selection.addRange()):this.caret.setStart(a)}},setEnd:function(){if(this.utils.browser("mozilla")||this.utils.browser("msie")){var a=this.$editor.children().last();this.caret.setEnd(a)}else{this.selection.get(); 97try{this.range.selectNodeContents(this.$editor[0]),this.range.collapse(!1),this.selection.addRange()}catch(b){}}},isFocused:function(){var a=document.getSelection().focusNode;return null===a?!1:this.opts.linebreaks&&c(a.parentNode).hasClass("redactor-linebreaks")?!0:this.utils.isRedactorParent(a.parentNode)?this.$editor.is(":focus"):!1}}},placeholder:function(){return{enable:function(){this.placeholder.is()&&(this.$editor.attr("placeholder",this.$element.attr("placeholder")),this.placeholder.toggle(), 98this.$editor.on("keyup.redactor-placeholder",c.proxy(this.placeholder.toggle,this)))},toggle:function(){var a="removeClass";this.utils.isEmpty(this.$editor.html(),!1)&&(a="addClass");this.$editor[a]("redactor-placeholder")},remove:function(){this.$editor.removeClass("redactor-placeholder")},is:function(){return this.opts.placeholder?this.$element.attr("placeholder",this.opts.placeholder):!("undefined"==typeof this.$element.attr("placeholder")||""===this.$element.attr("placeholder"))}}},autosave:function(){return{enable:function(){this.opts.autosave&& 99(this.autosave.html=!1,this.autosave.name=this.opts.autosaveName?this.opts.autosaveName:this.$textarea.attr("name"),this.opts.autosaveOnChange||(this.autosaveInterval=setInterval(c.proxy(this.autosave.load,this),1E3*this.opts.autosaveInterval)))},onChange:function(){this.opts.autosaveOnChange&&this.autosave.load()},load:function(){var a=this.code.get();this.autosave.html!==a&&(this.utils.isEmpty(a)||c.ajax({url:this.opts.autosave,type:"post",data:"name="+this.autosave.name+"&"+this.autosave.name+ 100"="+escape(encodeURIComponent(a)),success:c.proxy(function(b){this.autosave.success(b,a)},this)}))},success:function(a,b){var d;try{d=c.parseJSON(a)}catch(e){d=a}this.core.setCallback("undefined"==typeof d.error?"autosave":"autosaveError",this.autosave.name,d);this.autosave.html=b},disable:function(){clearInterval(this.autosaveInterval)}}},buffer:function(){return{set:function(a){"undefined"==typeof a||"undo"==a?this.buffer.setUndo():this.buffer.setRedo()},setUndo:function(){this.selection.save(); 101this.opts.buffer.push(this.$editor.html());
101this.selection.restore()},setRedo:function(){this.selection.save();this.opts.rebuffer.push(this.$editor.html());this.selection.restore()},getUndo:function(){this.$editor.html(this.opts.buffer.pop())},getRedo:function(){this.$editor.html(this.opts.rebuffer.pop())},add:function(){this.opts.buffer.push(this.$editor.html())},undo:function(){0!==this.opts.buffer.length&&(this.buffer.set("redo"),this.buffer.getUndo(),this.selection.restore(),setTimeout(c.proxy(this.observe.load, 102this),50))},redo:function(){0!==this.opts.rebuffer.length&&(this.buffer.set("undo"),this.buffer.getRedo(),this.selection.restore(),setTimeout(c.proxy(this.observe.load,this),50))}}},indent:function(){return{increase:function(){this.utils.browser("msie")||this.$editor.focus();this.buffer.set();this.selection.save();var a=this.selection.getBlock();a&&"LI"==a.tagName?this.indent.increaseLists():!1===a&&this.opts.linebreaks?this.indent.increaseText():this.indent.increaseBlocks();this.selection.restore(); 103this.code.sync()},increaseLists:function(){document.execCommand("indent");this.indent.fixEmptyIndent();this.clean.normalizeLists();this.clean.clearUnverified()},increaseBlocks:function(){c.each(this.selection.getBlocks(),c.proxy(function(a,b){if("TD"!==b.tagName&&"TH"!==b.tagName){var c=this.utils.getAlignmentElement(b),e=this.utils.normalize(c.css("margin-left"))+this.opts.indentValue;c.css("margin-left",e+"px")}},this))},increaseText:function(){var a=this.selection.wrap("div");c(a).attr("data-tagblock", 104"redactor");c(a).css("margin-left",this.opts.indentValue+"px")},decrease:function(){this.buffer.set();this.selection.save();var a=this.selection.getBlock();a&&"LI"==a.tagName?this.indent.decreaseLists():this.indent.decreaseBlocks();this.selection.restore();this.code.sync()},decreaseLists:function(){document.execCommand("outdent");var a=this.selection.getCurrent(),a=c(a).closest("li"),b=a.parent();0!==a.size()&&0!==b.size()&&"LI"==b[0].tagName&&b.after(a);this.indent.fixEmptyIndent();this.opts.linebreaks|| 1050!==a.size()||(document.execCommand("formatblock",!1,"p"),this.$editor.find("ul, ol, blockquote, p").each(c.proxy(this.utils.removeEmpty,this)));this.clean.clearUnverified()},decreaseBlocks:function(){c.each(this.selection.getBlocks(),c.proxy(function(a,b){var c=this.utils.getAlignmentElement(b),e=this.utils.normalize(c.css("margin-left"))-this.opts.indentValue;0>=e?this.opts.linebreaks&&"undefined"!==typeof c.data("tagblock")?c.replaceWith(c.html()+"<br />"):(c.css("margin-left",""),this.utils.removeEmptyAttr(c, 106"style")):c.css("margin-left",e+"px")},this))},fixEmptyIndent:function(){var a=this.selection.getBlock();this.range.collapsed&&a&&"LI"==a.tagName&&this.utils.isEmpty(c(a).text())&&(a=c(a),a.find("span").not(".redactor-selection-marker").contents().unwrap(),a.append("<br>"))}}},alignment:function(){return{left:function(){this.alignment.set("")},right:function(){this.alignment.set("right")},center:function(){this.alignment.set("center")},justify:function(){this.alignment.set("justify")},set:function(a){this.utils.browser("msie")|| 107this.$editor.focus();this.buffer.set();this.selection.save();this.alignment.blocks=this.selection.getBlocks();this.opts.linebreaks&&!1===this.alignment.blocks[0]?this.alignment.setText(a):this.alignment.setBlocks(a);this.selection.restore();this.code.sync()},setText:function(a){var b=this.selection.wrap("div");c(b).attr("data-tagblock","redactor");c(b).css("text-align",a)},setBlocks:function(a){c.each(this.alignment.blocks,c.proxy(function(b,c){var e=this.utils.getAlignmentElement(c);e&&(""===a&& 108"undefined"!==typeof e.data("tagblock")?e.replaceWith(e.html()):(e.css("text-align",a),this.utils.removeEmptyAttr(e,"style")))},this))}}},paste:function(){return{init:function(a){this.opts.cleanOnPaste&&(this.rtePaste=!0,this.buffer.set(),this.selection.save(),this.utils.saveScroll(),this.paste.createPasteBox(),c(window).on("scroll.redactor-freeze",c.proxy(function(){c(window).scrollTop(this.saveBodyScroll)},this)),setTimeout(c.proxy(function(){var a=this.$pasteBox.html();this.$pasteBox.remove(); 109this.selection.restore();this.utils.restoreScroll();this.paste.insert(a);c(window).off("scroll.redactor-freeze")},this),1))},createPasteBox:function(){this.$pasteBox=c("<div>").html(" ").attr("contenteditable","true").css({position:"fixed",width:0,top:0,left:"-9999px"});c(document.body).append(this.$pasteBox);this.$pasteBox.focus()},insert:function(a){a=this.core.setCallback("pasteBefore",a);a=this.utils.isSelectAll()?this.clean.onPaste(a,!1):this.clean.onPaste(a);a=this.core.setCallback("paste", 110a);this.utils.isSelectAll()?this.insert.set(a,!1):this.insert.html(a,!1);this.utils.disableSelectAll();this.rtePaste=!1;setTimeout(c.proxy(this.clean.clearUnverified,this),10)}}}
110,keydown:function(){return{init:function(a){if(!this.rtePaste){var b=a.which,d=37<=b&&40>=b;this.keydown.ctrl=a.ctrlKey||a.metaKey;this.keydown.current=this.selection.getCurrent();this.keydown.parent=this.selection.getParent();this.keydown.block=this.selection.getBlock();this.keydown.pre=this.utils.isTag(this.keydown.current, 111"pre");this.keydown.blockquote=this.utils.isTag(this.keydown.current,"blockquote");this.keydown.figcaption=this.utils.isTag(this.keydown.current,"figcaption");this.shortcuts.init(a,b);this.keydown.checkEvents(d,b);this.keydown.setupBuffer(a,b);this.keydown.addArrowsEvent(d);this.keydown.setupSelectAll(a,b);if(!1===this.core.setCallback("keydown",a))return a.preventDefault(),!1;if(this.opts.enterKey&&b===this.keyCode.DOWN)this.keydown.onArrowDown();if(this.opts.enterKey||b!==this.keyCode.ENTER){if(b== 112this.keyCode.ENTER&&!a.shiftKey&&!a.ctrlKey&&!a.metaKey){if(!1===this.core.setCallback("enter",a))return a.preventDefault(),!1;if(this.keydown.blockquote&&!0===this.keydown.exitFromBlockquote(a))return!1;if(this.keydown.pre)return this.keydown.insertNewLine(a);if(this.keydown.blockquote||this.keydown.figcaption)return b=this.selection.getCurrent(),d=c(b).next(),0!==d.size()&&"BR"==d[0].tagName?this.keydown.insertBreakLine(a):this.utils.isEndOfElement()&&b&&"SPAN"!=b?this.keydown.insertDblBreakLine(a): 113this.keydown.insertBreakLine(a);if(this.opts.linebreaks&&!this.keydown.block)return b=this.selection.getCurrent(),d=c(this.keydown.current).next(),!1!==b&&c(b).hasClass("redactor-invisible-space")?(c(b).remove(),this.keydown.insertDblBreakLine(a)):0===d.length&&!1===b&&"undefined"!=typeof d.context?this.keydown.insertDblBreakLine(a):this.keydown.insertBreakLine(a);if(this.opts.linebreaks&&this.keydown.block)setTimeout(c.proxy(this.keydown.replaceDivToBreakLine,this),1);else if(!this.opts.linebreaks&& 114this.keydown.block&&"LI"!==this.keydown.block.tagName)setTimeout(c.proxy(this.keydown.replaceDivToParagraph,this),1);else if(!this.opts.linebreaks&&!this.keydown.block)return this.keydown.insertParagraph(a)}if(b===this.keyCode.ENTER&&(a.ctrlKey||a.shiftKey))return this.keydown.onShiftEnter(a);if(b===this.keyCode.TAB||a.metaKey&&221===b||a.metaKey&&219===b)return this.keydown.onTab(a,b);if(b===this.keyCode.BACKSPACE||b===this.keyCode.DELETE)if(d=this.selection.getNodes())for(var e=d.length,f,g=0;g< 115e;g++){var k=c(d[g]).children("img");if(0!==k.size()){var h=this;c.each(k,function(a,b){var d=c(b);"none"==d.css("float")&&(h.core.setCallback("imageDelete",b.src,d),f=b)})}else"IMG"==d[g].tagName&&f!=d[g]&&(this.core.setCallback("imageDelete",d[g].src,c(d[g])),f=d[g])}b===this.keyCode.BACKSPACE&&(this.keydown.removeInvisibleSpace(),this.keydown.removeEmptyListInTable(a));this.code.sync()}else a.preventDefault(),this.range.collapsed||this.range.deleteContents()}},checkEvents:function(a,b){a||"click"!= 116this.core.getEvent()&&"arrow"!=this.core.getEvent()||(this.core.addEvent(!1),this.keydown.checkKeyEvents(b)&&this.buffer.set())},checkKeyEvents:function(a){var b=this.keyCode;return-1==c.inArray(a,[b.BACKSPACE,b.DELETE,b.ENTER,b.SPACE,b.ESC,b.TAB,b.CTRL,b.META,b.ALT,b.SHIFT])?!0:!1},addArrowsEvent:function(a){a&&("click"==this.core.getEvent()||"arrow"==this.core.getEvent()?this.core.addEvent(!1):this.core.addEvent("arrow"))},setupBuffer:function(a,b){this.keydown.ctrl&&90===b&&!a.shiftKey&&!a.altKey&& 117this.opts.buffer.length?(a.preventDefault(),this.buffer.undo()):this.keydown.ctrl&&90===b&&a.shiftKey&&!a.altKey&&0!==this.opts.rebuffer.length?(a.preventDefault(),this.buffer.redo()):this.keydown.ctrl||b!=this.keyCode.BACKSPACE&&b!=this.keyCode.DELETE&&(b!=this.keyCode.ENTER||a.ctrlKey||a.shiftKey)&&b!=this.keyCode.SPACE||this.buffer.set()},setupSelectAll:function(a,b){this.keydown.ctrl&&65===b?this.utils.enableSelectAll():b==this.keyCode.LEFT_WIN||this.keydown.ctrl||this.utils.disableSelectAll()}, 118onArrowDown:function(){for(var a=[this.keydown.blockquote,this.keydown.pre,this.keydown.figcaption],b=0;b<a.length;b++)if(a[b])return this.keydown.insertAfterLastElement(a[b]),!1},onShiftEnter:function(a){this.buffer.set();return this.keydown.blockquote&&this.utils.isEndOfElement()?this.keydown.insertDblBreakLine(a):this.keydown.insertBreakLine(a)},onTab:function(a,b){if(!this.opts.tabFocus||this.utils.isEmpty(this.code.get())&&!1===this.opts.tabAsSpaces)return!0;a.preventDefault();var c;this.keydown.pre&& 119!a.shiftKey?(c=this.opts.preSpaces?document.createTextNode(Array(this.opts.preSpaces+1).join("\u00a0")):document.createTextNode("\t"),this.insert.node(c),this.code.sync()):!1!==this.opts.tabAsSpaces?(c=document.createTextNode(Array(this.opts.tabAsSpaces+1).join("\u00a0")),this.insert.node(c),this.code.sync()):a.metaKey&&219===b?this.indent.decrease():a.metaKey&&221===b?this.indent.increase():a.shiftKey?this.indent.decrease():this.indent.increase();return!1},replaceDivToBreakLine:function(){var a= 120this.selection.getBlock(),b=a.innerHTML.replace(/<br\s?\/?>/gi,"");if(("DIV"===a.tagName||"P"===a.tagName)&&""===b&&!c(a).hasClass("redactor-editor"))return b=document.createElement("br"),c(a).replaceWith(b),this.caret.setBefore(b),this.code.sync(),!1},replaceDivToParagraph:function(){var a=this.selection.getBlock(),b=a.innerHTML.replace(/<br\s?\/?>/gi,"");if("DIV"!==a.tagName||""!==b||c(a).hasClass("redactor-editor"))this.opts.cleanStyleOnEnter&&"P"==a.tagName&&c(a).removeAttr("class").removeAttr("style"); 121else return b=document.createElement("p"),b.innerHTML=this.opts.invisibleSpace,c(a).replaceWith(b),this.caret.setStart(b),this.code.sync(),!1},insertParagraph:function(a){a.preventDefault();this.selection.get();a=document.createElement("p");a.innerHTML=this.opts.invisibleSpace;this.range.deleteContents();
121this.range.insertNode(a);this.caret.setStart(a);this.code.sync();return!1},exitFromBlockquote:function(a){if(this.utils.isEndOfElement()){var b=c.trim(c(this.keydown.block).html());if(-1!=b.search(/(<br\s?\/?>){2}$/i))return a.preventDefault(), 122this.opts.linebreaks?(a=document.createElement("br"),c(this.keydown.blockquote).after(a),this.caret.setBefore(a),c(this.keydown.block).html(b.replace(/<br\s?\/?>$/i,""))):(b=c(this.opts.emptyHtml),c(this.keydown.blockquote).after(b),this.caret.setStart(b)),!0}},insertAfterLastElement:function(a){if(this.utils.isEndOfElement())if(this.buffer.set(),this.opts.linebreaks){var b=c("<div>").append(c.trim(this.$editor.html())).contents(),d=b.last()[0];"SPAN"==d.tagName&&""===d.innerHTML&&(d=b.prev()[0]); 123this.utils.getOuterHtml(d)==this.utils.getOuterHtml(a)&&(b=document.createElement("br"),c(a).after(b),this.caret.setAfter(b))}else this.$editor.contents().last()[0]===a&&(b=c(this.opts.emptyHtml),c(a).after(b),this.caret.setStart(b))},insertNewLine:function(a){a.preventDefault();a=document.createTextNode("\n");this.selection.get();this.range.deleteContents();this.range.insertNode(a);this.caret.setAfter(a);this.code.sync();return!1},insertBreakLine:function(a){return this.keydown.insertBreakLineProcessing(a)}, 124insertDblBreakLine:function(a){return this.keydown.insertBreakLineProcessing(a,!0)},insertBreakLineProcessing:function(a,b){a.stopPropagation();this.selection.get();var c=document.createElement("br");this.range.deleteContents();this.range.insertNode(c);!0===b&&(c=document.createElement("br"),this.range.insertNode(c));this.caret.setAfter(c);this.code.sync();return!1},removeInvisibleSpace:function(){var a=c(this.keydown.current);0===a.text().search(/^\u200B$/g)&&a.remove()},removeEmptyListInTable:function(a){var b= 125c(this.keydown.current),d=c(this.keydown.parent),e=b.closest("td");0!==e.size()&&b.closest("li")&&1===d.children("li").size()&&this.utils.isEmpty(b.text())&&(a.preventDefault(),b.remove(),d.remove(),this.caret.setStart(e))}}},keyup:function(){return{init:function(a){if(!this.rtePaste){var b=a.which;this.keyup.current=this.selection.getCurrent();this.keyup.parent=this.selection.getParent();var d=this.utils.isRedactorParent(c(this.keyup.parent).parent());if(!1===this.core.setCallback("keyup",a))return a.preventDefault(), 126!1;!this.opts.linebreaks&&3==this.keyup.current.nodeType&&1>=this.keyup.current.length&&(!1===this.keyup.parent||"BODY"==this.keyup.parent.tagName)&&this.keyup.replaceToParagraph();!c(this.keyup.parent).hasClass("redactor-invisible-space")||!1!==d&&"BODY"!=d[0].tagName||(c(this.keyup.parent).contents().unwrap(),this.keyup.replaceToParagraph());this.opts.convertLinks&&(this.opts.convertUrlLinks||this.opts.convertImageLinks||this.opts.convertVideoLinks)&&b===this.keyCode.ENTER&&(this.formatLinkify(this.opts.linkProtocol, 127this.opts.convertLinks,this.opts.convertUrlLinks,this.opts.convertImageLinks,this.opts.convertVideoLinks,this.opts.linkSize),this.observe.load(),this.code.sync());if(b===this.keyCode.DELETE||b===this.keyCode.BACKSPACE){this.clean.clearUnverified();if(this.observe.image)return a.preventDefault(),this.image.hideResize(),this.buffer.set(),this.image.remove(this.observe.image),this.observe.image=!1;this.$editor.find("p").each(c.proxy(this.utils.removeEmpty,this));this.keyup.current&&"DIV"==this.keyup.current.tagName&& 128this.utils.isEmpty(this.keyup.current.innerHTML)&&this.opts.linebreaks&&(c(this.keyup.current).after(this.selection.getMarkerAsHtml()),this.selection.restore(),c(this.keyup.current).remove());return this.keyup.formatEmpty(a)}}},replaceToParagraph:function(){var a=c(this.keyup.current),b=c("<p>").append(a.clone());a.replaceWith(b);a=c(b).next();"undefined"!==typeof a[0]&&"BR"==a[0].tagName&&a.remove();this.caret.setEnd(b)},formatEmpty:function(a){var b=c.trim(this.$editor.html());if(this.utils.isEmpty(b))return a.preventDefault(), 129this.opts.linebreaks?(this.$editor.html(this.selection.getMarkerAsHtml()),this.selection.restore()):(this.$editor.html("<p><br /></p>"),this.focus.setStart()),this.code.sync(),!1}}},shortcuts:function(){return{init:function(a,b){if(!this.opts.shortcuts)return!a.ctrlKey&&!a.metaKey||66!==b&&73!==b||a.preventDefault(),!1;c.each(this.opts.shortcuts,c.proxy(function(b,e){for(var f=b.split(","),g=f.length,k=0;k<g;k++)"string"===typeof f[k]&&this.shortcuts.handler(a,c.trim(f[k]),c.proxy(function(){var a; 130"-1"!=e.func.search(/\./)?(a=e.func.split("."),"undefined"!=typeof this[a[0]]&&this[a[0]][a[1]].apply(this,e.params)):this[e.func].apply(this,e.params)},this))},this))},handler:function(a,b,d){var e={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"};b=b.toLowerCase().split(" ");var f={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup", 13134:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[a.keyCode],g=String.fromCharCode(a.which).toLowerCase(), 132k="",h={};c.each(["alt","ctrl","meta","shift"],function(b,c){a[c+"Key"]&&f!==c&&(k+=c+"+")});f&&(h[k+f]=!0);g&&(h[k+g]=!0,h[k+e[g]]=!0,"shift+"===k&&(h[e[g]]=!0));e=0;for(g=b.length;e<g;e++)if(h[b[e]])return a.preventDefault(),d.apply(this,arguments)}}},line:function(){return{insert:function(){this.buffer.set();var a=this.selection.getBlocks();!1!==a[0]&&this.line.isExceptLastOrFirst(a)?this.utils.browser("msie")||this.$editor.focus():this.utils.browser("msie")?this.line.insertInIe():this.line.insertInOthersBrowsers()}, 133isExceptLastOrFirst:function(a){var b="li td th blockquote figcaption pre dl dt dd".split(" "),d=a[0].tagName.toLowerCase();a=this.selection.getLastBlock();a="undefined"==typeof a?d:a.tagName.toLowerCase();d=-1!=c.inArray(d,b);b=-1!=c.inArray(a,b);if(d&&b||d)return!0},insertInIe:function(){this.utils.saveScroll();this.buffer.set();this.insert.node(document.createElement("hr"));this.utils.restoreScroll();
133this.code.sync()},insertInOthersBrowsers:function(){this.buffer.set();var a='<p id="redactor-insert-line"><br /></p>'; 134this.opts.linebreaks&&(a='<br id="redactor-insert-line">');document.execCommand("insertHTML",!1,"<hr>"+a);this.line.setFocus();this.code.sync()},setFocus:function(){var a=this.$editor.find("#redactor-insert-line");c(a).next()[0]?(this.caret.setAfter(a),a.remove()):a.removeAttr("id")}}},list:function(){return{toggle:function(a){this.utils.browser("msie")||this.$editor.focus();this.buffer.set();this.selection.save();var b=this.selection.getParent(),b=c(b).closest("ol, ul");this.utils.isRedactorParent(b)|| 1350===b.size()||(b=!1);var d,e,f=!1;b&&b.length&&(f=!0,e=b[0].tagName,d="orderedlist"===a&&"UL"===e,e="unorderedlist"===a&&"OL"===e);d?this.utils.replaceToTag(b,"ol"):e?this.utils.replaceToTag(b,"ul"):f?this.list.remove(a):this.list.insert(a);this.selection.restore();this.code.sync()},insert:function(a){this.utils.browser("msie")&&this.opts.linebreaks?this.list.insertInIe(a):document.execCommand("insert"+a);a=this.selection.getParent();a=c(a).closest("ol, ul");if(this.utils.isEmpty(a.find("li").text())){var b= 136a.children("li");b.find("br").remove();b.append(this.selection.getMarkerAsHtml())}a.length&&(a=a.parent(),this.utils.isRedactorParent(a)&&"LI"!=a[0].tagName&&this.utils.isBlock(a[0])&&a.replaceWith(a.contents()));this.utils.browser("msie")||this.$editor.focus();this.clean.clearUnverified()},insertInIe:function(a){var b=this.selection.wrap("div"),d=c(b).html();a="orderedlist"==a?c("<ol>"):c("<ul>");var e=c("<li>");if(""===c.trim(d))e.append(this.selection.getMarkerAsHtml()),a.append(e),this.$editor.find("#selection-marker-1").replaceWith(a); 137else{var f=d.split(/<br\s?\/?>/gi);if(f)for(d=0;d<f.length;d++)""!==c.trim(f[d])&&a.append(c("<li>").html(f[d]));else e.append(d),a.append(e);c(b).replaceWith(a)}},remove:function(a){document.execCommand("insert"+a);a=c(this.selection.getCurrent());this.indent.fixEmptyIndent();this.opts.linebreaks||0!==a.closest("li, th, td").size()||(document.execCommand("formatblock",!1,"p"),this.$editor.find("ul, ol, blockquote, p").each(c.proxy(this.utils.removeEmpty,this)));a=c(this.selection.getCurrent()).closest("table"); 138var b=a.prev();this.opts.linebreaks||0===a.size()||0===b.size()||"BR"!=b[0].tagName||b.remove();this.clean.clearUnverified()}}},block:function(){return{formatting:function(a){var b,c;"undefined"!=typeof this.formatting[a].data?b="data":"undefined"!=typeof this.formatting[a].attr?b="attr":"undefined"!=typeof this.formatting[a]["class"]&&(b="class");b&&(c=this.formatting[a][b]);this.block.format(this.formatting[a].tag,b,c)},format:function(a,b,d){"quote"==a&&(a="blockquote");-1!=c.inArray(a,"p pre blockquote h1 h2 h3 h4 h5 h6".split(" "))&& 139(this.block.isRemoveInline="pre"==a||-1!=a.search(/h[1-6]/i),this.utils.browser("msie")||this.$editor.focus(),this.block.blocks=this.selection.getBlocks(),this.block.blocksSize=this.block.blocks.length,this.block.type=b,this.block.value=d,this.buffer.set(),this.selection.save(),this.block.set(a),this.selection.restore(),this.code.sync())},set:function(a){this.selection.get();this.block.containerTag=this.range.commonAncestorContainer.tagName;this.range.collapsed?this.block.setCollapsed(a):this.block.setMultiple(a)}, 140setCollapsed:function(a){var b=this.block.blocks[0];!1!==b&&("LI"==b.tagName?"blockquote"==a&&this.block.formatListToBlockquote():"TD"==this.block.containerTag||"TH"==this.block.containerTag?this.opts.linebreaks||"p"!=a||(document.execCommand("formatblock",!1,"<"+a+">"),b=this.selection.getBlock(),this.block.toggle(c(b))):b.tagName.toLowerCase()!=a?this.opts.linebreaks&&"p"==a?(c(b).prepend("<br>").append("<br>"),this.utils.replaceWithContents(b)):(b=this.utils.replaceToTag(b,a),this.block.toggle(b), 141"p"!=a&&"blockquote"!=a&&b.find("img").remove(),this.block.isRemoveInline&&this.utils.removeInlineTags(b),("p"==a||this.block.headTag)&&b.find("p").contents().unwrap()):"blockquote"==a&&b.tagName.toLowerCase()==a?this.opts.linebreaks?(c(b).prepend("<br>").append("<br>"),this.utils.replaceWithContents(b)):(a=this.utils.replaceToTag(b,"p"),this.block.toggle(a)):b.tagName.toLowerCase()==a&&this.block.toggle(c(b)))},setMultiple:function(a){var b=this.block.blocks[0],d="TD"==this.block.containerTag||"TH"== 142this.block.containerTag;if(!1!==b&&1===this.block.blocksSize)b.tagName.toLowerCase()==a&&"blockquote"==a?this.opts.linebreaks?(c(b).prepend("<br>").append("<br>"),this.utils.replaceWithContents(b)):(b=this.utils.replaceToTag(b,"p"),this.block.toggle(b)):"LI"==b.tagName?"blockquote"==a&&this.block.formatListToBlockquote():"BLOCKQUOTE"==this.block.containerTag?this.block.formatBlockquote(a):this.opts.linebreaks&&(d||this.range.commonAncestorContainer!=b)?this.block.formatWrap(a):this.opts.linebreaks&& 143"p"==a?(c(b).prepend("<br>").append("<br>"),this.utils.replaceWithContents(b)):"TD"===b.tagName?this.block.formatWrap(a):(b=this.utils.replaceToTag(b,a),this.block.toggle(b),this.block.isRemoveInline&&this.utils.removeInlineTags(b),("p"==a||this.block.headTag)&&b.find("p").contents().unwrap());
143else if(this.opts.linebreaks||"p"!=a){if("blockquote"==a){for(d=b=0;d<this.block.blocksSize;d++)"BLOCKQUOTE"==this.block.blocks[d].tagName&&b++;if(b==this.block.blocksSize){c.each(this.block.blocks,c.proxy(function(a, 144b){this.opts.linebreaks?(c(b).prepend("<br>").append("<br>"),this.utils.replaceWithContents(b)):this.utils.replaceToTag(b,"p")},this));return}}this.block.formatWrap(a)}else{var b=0,e=!1;"class"==this.block.type&&(e="toggle",b=c(this.block.blocks).filter("."+this.block.value).size(),this.block.blocksSize==b?e="toggle":this.block.blocksSize>b?e="set":0===b&&(e="set"));var f="ul ol li td th dl dt dd".split(" ");c.each(this.block.blocks,c.proxy(function(b,d){if(-1==c.inArray(d.tagName.toLowerCase(),f)){var h= 145this.utils.replaceToTag(d,a);e?"toggle"==e?this.block.toggle(h):"remove"==e?this.block.remove(h):"set"==e&&this.block.set2(h):this.block.toggle(h);"p"!=a&&"blockquote"!=a&&h.find("img").remove();this.block.isRemoveInline&&this.utils.removeInlineTags(h);("p"==a||this.block.headTag)&&h.find("p").contents().unwrap()}},this))}},toggle:function(a){"class"==this.block.type?a.toggleClass(this.block.value):"attr"==this.block.type||"data"==this.block.type?a.attr(this.block.value.name)==this.block.value.value? 146a.removeAttr(this.block.value.name):a.attr(this.block.value.name,this.block.value.value):a.removeAttr("style class")},remove:function(a){a.removeClass(this.block.value)},formatListToBlockquote:function(){var a=c(this.block.blocks[0]).closest("ul, ol");c(a).find("ul, ol").contents().unwrap();c(a).find("li").append(c("<br>")).contents().unwrap();a=this.utils.replaceToTag(a,"blockquote");this.block.toggle(a)},formatBlockquote:function(a){document.execCommand("outdent");document.execCommand("formatblock", 147!1,a);this.clean.clearUnverified();this.$editor.find("p:empty").remove();var b=this.selection.getBlock();"p"!=a&&c(b).find("img").remove();this.opts.linebreaks||this.block.toggle(c(b));this.$editor.find("ul, ol, tr, blockquote, p").each(c.proxy(this.utils.removeEmpty,this));this.opts.linebreaks&&"p"==a&&this.utils.replaceWithContents(b)},formatWrap:function(a){if("UL"==this.block.containerTag||"OL"==this.block.containerTag)if("blockquote"==a)this.block.formatListToBlockquote();else return;var b=this.selection.wrap(a); 148if(!1!==b){b=c(b);this.block.formatTableWrapping(b);var d=b.find(this.opts.blockLevelElements.join(",")+", td, table, thead, tbody, tfoot, th, tr");(this.opts.linebreaks&&"p"==a||"pre"==a||"blockquote"==a)&&d.append("<br />");d.contents().unwrap();"p"!=a&&"blockquote"!=a&&b.find("img").remove();c.each(this.block.blocks,c.proxy(this.utils.removeEmpty,this));b.append(this.selection.getMarker(2));this.opts.linebreaks||this.block.toggle(b);this.$editor.find("ul, ol, tr, blockquote, p").each(c.proxy(this.utils.removeEmpty, 149this));b.find("blockquote:empty").remove();this.block.isRemoveInline&&this.utils.removeInlineTags(b);this.opts.linebreaks&&"p"==a&&this.utils.replaceWithContents(b)}},formatTableWrapping:function(a){0!==a.closest("table").size()&&(0===a.closest("tr").size()&&a.wrap("<tr>"),0===a.closest("td").size()&&0===a.closest("th").size()&&a.wrap("<td>"))},removeData:function(a,b){var d=this.selection.getBlocks();c(d).removeAttr("data-"+a);this.code.sync()},setData:function(a,b){var d=this.selection.getBlocks(); 150c(d).attr("data-"+a,b);this.code.sync()},toggleData:function(a,b){var d=this.selection.getBlocks();c.each(d,function(){c(this).attr("data-"+a)?c(this).removeAttr("data-"+a):c(this).attr("data-"+a,b)})},removeAttr:function(a,b){var d=this.selection.getBlocks();c(d).removeAttr(a);this.code.sync()},setAttr:function(a,b){var d=this.selection.getBlocks();c(d).attr(a,b);this.code.sync()},toggleAttr:function(a,b){var d=this.selection.getBlocks();c.each(d,function(){c(this).attr(name)?c(this).removeAttr(name): 151c(this).attr(name,b)})},removeClass:function(a){var b=this.selection.getBlocks();c(b).removeClass(a);this.utils.removeEmptyAttr(b,"class");this.code.sync()},setClass:function(a){var b=this.selection.getBlocks();c(b).addClass(a);this.code.sync()},toggleClass:function(a){var b=this.selection.getBlocks();c(b).toggleClass(a);
151this.code.sync()}}},inline:function(){return{formatting:function(a){var b,c;"undefined"!=typeof this.formatting[a].style?b="style":"undefined"!=typeof this.formatting[a]["class"]&& 152(b="class");b&&(c=this.formatting[a][b]);this.inline.format(this.formatting[a].tag,b,c)},format:function(a,b,c){if(!this.utils.isCurrentOrParent("PRE")){for(var e="b bold i italic underline strikethrough deleted superscript subscript".split(" "),f="strong strong em em u del del sup sub".split(" "),g=0;g<e.length;g++)a==e[g]&&(a=f[g]);this.inline.type=b||!1;this.inline.value=c||!1;this.buffer.set();this.$editor.focus();this.selection.get();this.range.collapsed?this.inline.formatCollapsed(a):this.inline.formatMultiple(a)}}, 153formatCollapsed:function(a){var b=this.selection.getCurrent(),b=c(b).closest(a+"[data-redactor-tag="+a+"]");0!==b.size()?(this.caret.setAfter(b[0]),this.utils.isEmpty(b.text())&&b.remove()):(a=c("<"+a+">").attr("data-verified","redactor").attr("data-redactor-tag",a),a.html(this.opts.invisibleSpace),a=this.inline.setFormat(a),this.insert.node(a),this.caret.setEnd(a));this.code.sync()},formatMultiple:function(a){this.inline.formatConvert(a);this.selection.save();document.execCommand("strikethrough"); 154this.$editor.find("strike").each(c.proxy(function(b,e){var f=c(e);this.inline.formatRemoveSameChildren(f,a);var g;this.inline.type?(g=c("<span>").attr("data-redactor-tag",a).attr("data-verified","redactor"),g=this.inline.setFormat(g)):g=c("<"+a+">").attr("data-redactor-tag",a).attr("data-verified","redactor");f.replaceWith(g.html(f.contents()));if("span"==a&&(f=g.parent())&&"SPAN"==f[0].tagName&&"style"==this.inline.type){g=this.inline.value.split(";");for(var h=0;h<g.length&&""!==g[h];h++){var l= 155g[h].split(":");f.css(l[0],"");this.utils.removeEmptyAttr(f,"style")&&f.replaceWith(f.contents())}}},this));"span"!=a&&this.$editor.find(this.opts.inlineTags.join(", ")).each(c.proxy(function(a,b){var f=c(b);"line-through"==f.css("text-decoration")&&(f.css("text-decoration",""),this.utils.removeEmptyAttr(f,"style"))},this));if("del"!=a){var b=this;this.$editor.find("inline").each(function(a,c){b.utils.replaceToTag(c,"del")})}this.selection.restore();this.code.sync()},formatRemoveSameChildren:function(a, 156b){a.children(b).each(function(){var a=c(this);a.hasClass("redactor-selection-marker")||a.contents().unwrap()})},formatConvert:function(a){this.selection.save();var b="";"class"==this.inline.type?b="[data-redactor-class="+this.inline.value+"]":"style"==this.inline.type&&(b='[data-redactor-style="'+this.inline.value+'"]');if("del"!=a){var d=this;this.$editor.find("del").each(function(a,b){d.utils.replaceToTag(b,"inline")})}this.$editor.find('[data-redactor-tag="'+a+'"]'+b).each(function(){if(""!== 157b||"span"!=a||this.tagName.toLowerCase()!=a){var d=c(this);d.replaceWith(c("<strike />").html(d.contents()))}});this.selection.restore()},setFormat:function(a){switch(this.inline.type){case "class":a.hasClass(this.inline.value)?(a.removeClass(this.inline.value),a.removeAttr("data-redactor-class")):(a.addClass(this.inline.value),a.attr("data-redactor-class",this.inline.value));break;case "style":a[0].style.cssText=this.inline.value,a.attr("data-redactor-style",this.inline.value)}return a},removeStyle:function(){this.buffer.set(); 158var a=this.selection.getCurrent(),b=this.selection.getInlines();this.selection.save();a&&"SPAN"===a.tagName&&(a=c(a),a.removeAttr("style"),0===a[0].attributes.length&&a.replaceWith(a.contents()));c.each(b,c.proxy(function(a,b){var f=c(b);-1==c.inArray(b.tagName.toLowerCase(),this.opts.inlineTags)||f.hasClass("redactor-selection-marker")||(f.removeAttr("style"),0===f[0].attributes.length&&f.replaceWith(f.contents()))},this));this.selection.restore();this.code.sync()},removeStyleRule:function(a){this.buffer.set(); 159var b=this.selection.getParent(),d=this.selection.getInlines();this.selection.save();b&&"SPAN"===b.tagName&&(b=c(b),b.css(a,""),this.utils.removeEmptyAttr(b,"style"),0===b[0].attributes.length&&b.replaceWith(b.contents()));c.each(d,c.proxy(function(b,d){var g=c(d);-1==c.inArray(d.tagName.toLowerCase(),this.opts.inlineTags)||g.hasClass("redactor-selection-marker")||(g.css(a,""),this.utils.removeEmptyAttr(g,"style"),0===g[0].attributes.length&&g.replaceWith(g.contents()))},this));
159this.selection.restore(); 160this.code.sync()},removeFormat:function(){this.buffer.set();var a=this.selection.getCurrent();this.selection.save();document.execCommand("removeFormat");a&&"SPAN"===a.tagName&&c(a).replaceWith(c(a).contents());c.each(this.selection.getNodes(),c.proxy(function(a,d){var e=c(d);-1==c.inArray(d.tagName.toLowerCase(),this.opts.inlineTags)||e.hasClass("redactor-selection-marker")||e.replaceWith(e.contents())},this));this.selection.restore();this.code.sync()},toggleClass:function(a){this.inline.format("span", 161"class",a)},toggleStyle:function(a){this.inline.format("span","style",a)}}},insert:function(){return{set:function(a,b){this.placeholder.remove();a=this.clean.setVerified(a);"undefined"==typeof b&&(a=this.clean.onPaste(a,!1));this.$editor.html(a);this.selection.remove();this.focus.setEnd();this.clean.normalizeLists();this.code.sync();this.observe.load();"undefined"==typeof b&&setTimeout(c.proxy(this.clean.clearUnverified,this),10)},text:function(a){this.placeholder.remove();a=a.toString();a=c.trim(a); 162a=this.clean.getPlainText(a,!1);this.$editor.focus();if(this.utils.browser("msie"))this.insert.htmlIe(a);else{this.selection.get();this.range.deleteContents();var b=document.createElement("div");b.innerHTML=a;a=document.createDocumentFragment();for(var d,e;d=b.firstChild;)e=a.appendChild(d);this.range.insertNode(a);e&&(b=this.range.cloneRange(),b.setStartAfter(e),b.collapse(!0),this.sel.removeAllRanges(),this.sel.addRange(b))}this.code.sync();this.clean.clearUnverified()},html:function(a,b){this.placeholder.remove(); 163"undefined"==typeof b&&(b=!0);this.$editor.focus();a=this.clean.setVerified(a);b&&(a=this.clean.onPaste(a));this.utils.browser("msie")?this.insert.htmlIe(a):(this.clean.singleLine?this.insert.execHtml(a):document.execCommand("insertHTML",null,a),this.insert.htmlFixMozilla());this.clean.normalizeLists();this.opts.linebreaks||this.$editor.find("p").each(c.proxy(this.utils.removeEmpty,this));this.code.sync();this.observe.load();b&&this.clean.clearUnverified()},htmlFixMozilla:function(){if(this.utils.browser("mozilla")){var a= 164c(this.selection.getBlock()).next();0<a.length&&"P"==a[0].tagName&&""===a.html()&&a.remove()}},htmlIe:function(a){if(this.utils.isIe11()){var b=this.utils.isCurrentOrParent("P"),d=c("<div>").append(a).contents().is("p, :header, dl, ul, ol, div, table, td, blockquote, pre, address, section, header, footer, aside, article");b&&d?this.insert.ie11FixInserting(b,a):this.insert.ie11PasteFrag(a)}else document.selection.createRange().pasteHTML(a)},execHtml:function(a){a=this.clean.setVerified(a);this.selection.get(); 165this.range.deleteContents();var b=document.createElement("div");b.innerHTML=a;a=document.createDocumentFragment();for(var c,e;c=b.firstChild;)e=a.appendChild(c);this.range.insertNode(a);this.range.collapse(!0);this.caret.setAfter(e)},node:function(a,b){a=a[0]||a;this.selection.get();!1!==b&&this.range.deleteContents();this.range.insertNode(a);this.range.collapse(!1);this.selection.addRange();return a},nodeToPoint:function(a,b,c){a=a[0]||a;this.selection.get();var e;document.caretPositionFromPoint? 166(b=document.caretPositionFromPoint(b,c),this.range.setStart(b.offsetNode,b.offset),this.range.collapse(!0),this.range.insertNode(a)):document.caretRangeFromPoint?(e=document.caretRangeFromPoint(b,c),e.insertNode(a)):"undefined"!=typeof document.body.createTextRange&&(e=document.body.createTextRange(),e.moveToPoint(b,c),a=e.duplicate(),a.moveToPoint(b,c),e.setEndPoint("EndToEnd",a),e.select())},nodeToCaretPositionFromPoint:function(a,b){b=b[0]||b;var c,e=a.clientX,f=a.clientY;if(document.caretPositionFromPoint)e= 167document.caretPositionFromPoint(e,f),c=document.getSelection().getRangeAt(0),c.setStart(e.offsetNode,e.offset),c.collapse(!0),c.insertNode(b);else if(document.caretRangeFromPoint)c=document.caretRangeFromPoint(e,f),c.insertNode(b);else if("undefined"!=typeof document.body.createTextRange){c=document.body.createTextRange();c.moveToPoint(e,f);var g=c.duplicate();g.moveToPoint(e,f);c.setEndPoint("EndToEnd",g);c.select()}},ie11FixInserting:function(a,b){var d=document.createElement("span");d.className= 168"redactor-ie-paste";this.insert.node(d);d=c(a).html();d="<p>"+d.replace(/<span class="redactor-ie-paste"><\/span>/gi,"</p>"+b+"<p>")+"</p>";c(a).replaceWith(d)},ie11PasteFrag:function(a){this.selection.get();this.range.deleteContents();var b=document.createElement("div");b.innerHTML=a;a=document.createDocumentFragment();for(var c;c=b.firstChild;)a.appendChild(c);
168this.range.insertNode(a)}}},caret:function(){return{setStart:function(a){if(this.utils.isBlock(a))this.caret.set(a,0,a,0);else{var b=this.utils.createSpaceElement(); 169c(a).prepend(b);this.caret.setEnd(b)}},setEnd:function(a){this.caret.set(a,1,a,1)},set:function(a,b,d,e){this.utils.browser("msie")||this.$editor.focus();a=a[0]||a;d=d[0]||d;this.utils.isBlockTag(a.tagName)&&""===a.innerHTML&&(a.innerHTML=this.opts.invisibleSpace);"BR"==a.tagName&&!1===this.opts.linebreaks&&(d=c(this.opts.emptyHtml)[0],c(a).replaceWith(d),d=a=d);this.selection.get();try{this.range.setStart(a,b),this.range.setEnd(d,e)}catch(f){}this.selection.addRange()},setAfter:function(a){try{var b= 170c(a)[0].tagName;if("BR"==b||this.utils.isBlock(a))"BR"!=b&&this.utils.browser("msie")?this.caret.setStart(c(a).next()):this.caret.setAfterOrBefore(a,"after");else{var d=this.utils.createSpaceElement();c(a).after(d);this.caret.setEnd(d)}}catch(e){d=this.utils.createSpaceElement(),c(a).after(d),this.caret.setEnd(d)}},setBefore:function(a){this.utils.isBlock(a)?this.caret.setEnd(c(a).prev()):this.caret.setAfterOrBefore(a,"before")},setAfterOrBefore:function(a,b){this.utils.browser("msie")||this.$editor.focus(); 171a=a[0]||a;this.selection.get();if("after"==b)try{this.range.setStartAfter(a),this.range.setEndAfter(a)}catch(c){}else try{this.range.setStartBefore(a),this.range.setEndBefore(a)}catch(e){}this.range.collapse(!1);this.selection.addRange()},getOffsetOfElement:function(a){a=a[0]||a;this.selection.get();var b=this.range.cloneRange();b.selectNodeContents(a);b.setEnd(this.range.endContainer,this.range.endOffset);return c.trim(b.toString()).length},getOffset:function(){var a=0;if(0<window.getSelection().rangeCount){var a= 172window.getSelection().getRangeAt(0),b=a.cloneRange();b.selectNodeContents(this.$editor[0]);b.setEnd(a.endContainer,a.endOffset);a=b.toString().length}return a},setOffset:function(a,b){"undefined"==typeof b&&(b=a);this.focus.isFocused()||this.focus.setStart();for(var c=document.createRange(),e=document.getSelection(),f,g=0,h=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);f=h.nextNode();)if(g+=f.nodeValue.length,g>a&&(c.setStart(f,f.nodeValue.length+a-g),a=Infinity),g>=b){c.setEnd(f, 173f.nodeValue.length+b-g);break}e.removeAllRanges();e.addRange(c)},setToPoint:function(a,b){this.caret.setOffset(a,b)},getCoords:function(){return this.caret.getOffset()}}},selection:function(){return{get:function(){this.sel=document.getSelection();this.range=document.getSelection&&this.sel.getRangeAt&&this.sel.rangeCount?this.sel.getRangeAt(0):document.createRange()},addRange:function(){try{this.sel.removeAllRanges()}catch(a){}this.sel.addRange(this.range)},getCurrent:function(){var a=!1;this.selection.get(); 174this.sel&&0<this.sel.rangeCount&&(a=this.sel.getRangeAt(0).startContainer);return this.utils.isRedactorParent(a)},getParent:function(a){return(a=a||this.selection.getCurrent())?this.utils.isRedactorParent(c(a).parent()[0]):!1},getBlock:function(a){for(a=a||this.selection.getCurrent();a;){if(this.utils.isBlockTag(a.tagName))return c(a).hasClass("redactor-editor")?!1:a;a=a.parentNode}return!1},getInlines:function(a){this.selection.get();if(this.range&&this.range.collapsed)return!1;var b=[];a="undefined"== 175typeof a?this.selection.getNodes():a;var d=this.opts.inlineTags;d.push("span");c.each(a,c.proxy(function(a,f){-1!=c.inArray(f.tagName.toLowerCase(),d)&&b.push(f)},this));return 0===b.length?!1:b},getBlocks:function(a){this.selection.get();if(this.range&&this.range.collapsed)return[this.selection.getBlock()];var b=[];a="undefined"==typeof a?this.selection.getNodes():a;c.each(a,c.proxy(function(a,c){this.utils.isBlock(c)&&(this.selection.lastBlock=c,b.push(c))},this));return 0===b.length?[this.selection.getBlock()]: 176b},getLastBlock:function(){return this.selection.lastBlock},getNodes:function(){this.selection.get();var a=this.selection.getNodesMarker(1),b=this.selection.getNodesMarker(2);this.selection.setNodesMarker(this.range,a,!0);!1===this.range.collapsed?this.selection.setNodesMarker(this.range,b,!1):b=a;var d=[],e=0,f=this;this.$editor.find("*").each(function(){if(this==a){var g=c(this).parent();0!==g.length&&"BODY"!=g[0].tagName&&f.utils.isRedactorParent(g[0])&&d.push(g[0]);d.push(this);e=1}else 0<e&& 177(d.push(this),e+=1);if(this==b)return!1});for(var g=[],h=d.length,l=0;l<h;l++)"nodes-marker-1"!=d[l].id&&"nodes-marker-2"!=d[l].id&&g.push(d[l]);this.selection.removeNodesMarkers();return g},getNodesMarker:function(a){return c('<span id="nodes-marker-'+a+'" class="redactor-nodes-marker" data-verified="redactor">'+this.opts.invisibleSpace+"</span>")[0]},setNodesMarker:function(a,b,c){a=a.cloneRange();try{a.collapse(c),a.insertNode(b)}catch(e){}},removeNodesMarkers:function(){c(document).find("span.redactor-nodes-marker").remove(); 178this.$editor.find("span.redactor-nodes-marker").remove()},fromPoint:function(a,b){this.caret.setOffset(a,b)},wrap:function(a){this.selection.get();if(this.range.collapsed)return!1;a=document.createElement(a);a.appendChild(this.range.extractContents());
178this.range.insertNode(a);return a},selectElement:function(a){this.caret.set(a,0,a,1)},selectAll:function(){this.selection.get();this.range.selectNodeContents(this.$editor[0]);this.selection.addRange()},remove:function(){this.selection.get();this.sel.removeAllRanges()}, 179save:function(){this.selection.createMarkers()},createMarkers:function(){this.selection.get();var a=this.selection.getMarker(1);this.selection.setMarker(this.range,a,!0);!1===this.range.collapsed&&(a=this.selection.getMarker(2),this.selection.setMarker(this.range,a,!1));this.savedSel=this.$editor.html()},getMarker:function(a){"undefined"==typeof a&&(a=1);return c('<span id="selection-marker-'+a+'" class="redactor-selection-marker" data-verified="redactor">'+this.opts.invisibleSpace+"</span>")[0]}, 180getMarkerAsHtml:function(a){return this.utils.getOuterHtml(this.selection.getMarker(a))},setMarker:function(a,b,c){a=a.cloneRange();try{a.collapse(c),a.insertNode(b)}catch(e){this.focus.setStart()}},restore:function(){var a=this.$editor.find("span#selection-marker-1"),b=this.$editor.find("span#selection-marker-2");0!==a.length&&0!==b.length?this.caret.set(a,0,b,0):0!==a.length?this.caret.set(a,0,a,0):this.$editor.focus();this.selection.removeMarkers();this.savedSel=!1},removeMarkers:function(){this.$editor.find("span.redactor-selection-marker").remove()}, 181getText:function(){this.selection.get();return this.sel.toString()},getHtml:function(){var a="";this.selection.get();if(this.sel.rangeCount){for(var a=document.createElement("div"),b=this.sel.rangeCount,c=0;c<b;++c)a.appendChild(this.sel.getRangeAt(c).cloneContents());a=a.innerHTML}return this.clean.onSync(a)}}},observe:function(){return{load:function(){this.observe.images();this.observe.links()},buttons:function(a,b){var d=this.selection.getCurrent(),e=this.selection.getParent();this.button.setInactiveAll(b); 182if(!1===a&&"html"!==b)-1!=c.inArray(b,this.opts.activeButtons)&&this.button.toggleActive(b);else{c.each(this.opts.activeButtonsStates,c.proxy(function(a,b){var f=c(e).closest(a),h=c(d).closest(a);(0===f.length||this.utils.isRedactorParent(f))&&this.utils.isRedactorParent(h)&&(0===f.length&&0===h.closest(a).length||this.button.setActive(b))},this));var f=c(e).closest(this.opts.alignmentTags.toString().toLowerCase());this.utils.isRedactorParent(e)&&f.length&&(f=""===f.css("text-align")?"left":f.css("text-align"), 183this.button.setActive("align"+f))}},addButton:function(a,b){this.opts.activeButtons.push(b);this.opts.activeButtonsStates[a]=b},images:function(){this.$editor.find("img").each(c.proxy(function(a,b){var d=c(b);d.closest("a").on("click",function(a){a.preventDefault()});this.utils.browser("msie")&&d.attr("unselectable","on");this.image.setEditable(d)},this));c(document).on("click.redactor-image-delete",c.proxy(function(a){this.observe.image=!1;"IMG"==a.target.tagName&&this.utils.isRedactorParent(a.target)&& 184(this.observe.image=this.observe.image&&this.observe.image==a.target?!1:a.target)},this))},links:function(){this.opts.linkTooltip&&(this.$editor.find("a").on("touchstart click",c.proxy(this.observe.showTooltip,this)),this.$editor.on("touchstart click.redactor",c.proxy(this.observe.closeTooltip,this)),c(document).on("touchstart click.redactor",c.proxy(this.observe.closeTooltip,this)))},getTooltipPosition:function(a){return a.offset()},showTooltip:function(a){var b=c(a.target);if(0!==b.size()&&"A"=== 185b[0].tagName){a=this.observe.getTooltipPosition(b);var d=c('<span class="redactor-link-tooltip"></span>'),e=b.attr("href");void 0===e&&(e="");24<e.length&&(e=e.substring(0,24)+"...");var b=c('<a href="'+b.attr("href")+'" target="_blank" />').html(e).addClass("redactor-link-tooltip-action"),e=c('<a href="#" />').html(this.lang.get("edit")).on("click",c.proxy(this.link.show,this)).addClass("redactor-link-tooltip-action"),f=c('<a href="#" />').html(this.lang.get("unlink")).on("click",c.proxy(this.link.unlink, 186this)).addClass("redactor-link-tooltip-action");d.append(b).append(" | ").append(e).append(" | ").append(f);d.css({top:a.top+20+"px",left:a.left+"px"});c(".redactor-link-tooltip").remove();c("body").append(d)}},closeTooltip:function(a){a=a.originalEvent||a;"A"==a.target.tagName&&!c(a.target).hasClass("redactor-link-tooltip-action")&&this.utils.isRedactorParent(a.target)||c(".redactor-link-tooltip").remove()}}},link:function(){return{show:function(a){"undefined"!=typeof a&&a.preventDefault&&a.preventDefault(); 187this.modal.load("link",this.lang.get("link_insert"),600);this.modal.createCancelButton();this.link.buttonInsert=this.modal.createActionButton(this.lang.get("insert"));this.selection.get();this.link.getData();this.link.cleanUrl();"_blank"==this.link.target&&c("#redactor-link-blank").prop("checked",!0);this.link.$inputUrl=c("#redactor-link-url");this.link.$inputText=c("#redactor-link-url-text");this.link.$inputText.val(this.link.text);this.link.$inputUrl.val(this.link.url);this.link.buttonInsert.on("click", 188c.proxy(this.link.insert,this));this.selection.save();this.modal.show();this.link.$inputUrl.focus()},cleanUrl:function(){var a=self.location.href.replace(/\/$/i,"");this.link.url=this.link.url.replace(a,"");this.link.url=this.link.url.replace(/^\/#/,"#");this.link.url=this.link.url.replace("mailto:","");this.opts.linkProtocol||(this.link.url=this.link.url.replace(new RegExp("^(http|ftp|https)://"+self.location.host,"i"),""))},getData:function(){this.link.$node=!1;var a=c(this.selection.getCurrent()).closest("a"); 1890!==a.size()&&"A"===a[0].tagName?(this.link.$node=a,this.link.url=a.attr("href"),this.link.text=a.text(),this.link.target=a.attr("target")):(this.link.text=this.sel.toString(),this.link.url="",this.link.target="")},insert:function(){var a="",b=this.link.$inputUrl.val(),d=this.link.$inputText.val();if(""===c.trim(b))this.link.$inputUrl.addClass("redactor-input-error").on("keyup",function(){c(this).removeClass("redactor-input-error");c(this).off("keyup")});else{if(-1!=b.search("@")&&!1===/(http|ftp|https):\/\//i.test(b))b= 190"mailto:"+b;else if(0!==b.search("#")){c("#redactor-link-blank").prop("checked")&&(a="_blank");var e=/^((xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}/i;-1==b.search(/^(http|ftp|https):\/\/((xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}/i)&&0===b.search(e)&&this.opts.linkProtocol&&(b=this.opts.linkProtocol+"://"+b)}this.link.set(d,b,a);this.modal.close()}},set:function(a,b,d){a=c.trim(a.replace(/<|>/g,""));
190this.selection.restore();if(""!==a||""!==b)""===a&&""!==b&&(a=b),this.link.$node?(this.buffer.set(), 191this.link.$node.text(a).attr("href",b),""!==d?this.link.$node.attr("target",d):this.link.$node.removeAttr("target"),this.code.sync()):(this.utils.browser("mozilla")&&""===this.link.text?(b=c("<a />").attr("href",b).text(a),""!==d&&b.attr("target",d),this.insert.node(b),this.selection.selectElement(b)):(document.execCommand("createLink",!1,b),b=c(this.selection.getCurrent()).closest("a"),""!==d&&b.attr("target",d),b.removeAttr("style"),""===this.link.text&&(b.text(a),this.selection.selectElement(b))), 192this.code.sync(),this.core.setCallback("insertedLink",b)),setTimeout(c.proxy(function(){this.observe.links()},this),5)},unlink:function(a){"undefined"!=typeof a&&a.preventDefault&&a.preventDefault();if(a=this.selection.getNodes()){this.buffer.set();for(var b=a.length,d=0;d<b;d++)if("A"==a[d].tagName){var e=c(a[d]);e.replaceWith(e.contents())}c(".redactor-link-tooltip").remove();this.code.sync()}}}},image:function(){return{show:function(){this.modal.load("image",this.lang.get("image"),700);this.upload.init("#redactor-modal-image-droparea", 193this.opts.imageUpload,this.image.insert);this.selection.save();this.modal.show()},showEdit:function(a){var b=a.closest("a");this.modal.load("imageEdit",this.lang.get("edit"),705);this.modal.createCancelButton();this.image.buttonDelete=this.modal.createDeleteButton(this.lang.get("_delete"));this.image.buttonSave=this.modal.createActionButton(this.lang.get("save"));this.image.buttonDelete.on("click",c.proxy(function(){this.image.remove(a)},this));this.image.buttonSave.on("click",c.proxy(function(){this.image.update(a)}, 194this));c("#redactor-image-title").val(a.attr("alt"));if(this.opts.imageLink){var d=c("#redactor-image-link");d.attr("href",a.attr("src"));0!==b.size()&&(d.val(b.attr("href")),"_blank"==b.attr("target")&&c("#redactor-image-link-blank").prop("checked",!0))}else c(".redactor-image-link-option").hide();this.opts.imagePosition?(b="block"==a.css("display")&&"none"==a.css("float")?"center":a.css("float"),c("#redactor-image-align").val(b)):c(".redactor-image-position-option").hide();this.modal.show()},setFloating:function(a){var b= 195"",d="",e="";switch(c("#redactor-image-align").val()){case "left":b="left";e="0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin+" 0";break;case "right":b="right";e="0 0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin;break;case "center":d="block",e="auto"}a.css({"float":b,display:d,margin:e});a.attr("rel",a.attr("style"))},update:function(a){this.image.hideResize();this.buffer.set();var b=a.closest("a");a.attr("alt",c("#redactor-image-title").val());this.image.setFloating(a); 196var d=c.trim(c("#redactor-image-link").val());if(""!==d){var e=c("#redactor-image-link-blank").prop("checked")?!0:!1;0===b.size()?(b=c('<a href="'+d+'">'+this.utils.getOuterHtml(a)+"</a>"),e&&b.attr("target","_blank"),a.replaceWith(b)):(b.attr("href",d),e?b.attr("target","_blank"):b.removeAttr("target"))}else 0!==b.size()&&b.replaceWith(this.utils.getOuterHtml(a));this.modal.close();this.observe.images();this.code.sync()},setEditable:function(a){this.opts.imageEditable&&(a.on("dragstart",c.proxy(this.image.onDrag, 197this)),a.on("mousedown",c.proxy(this.image.hideResize,this)),a.on("click touchstart",c.proxy(function(b){this.observe.image=a;if(0!==this.$editor.find("#redactor-image-box").size())return!1;this.image.resizer=this.image.loadEditableControls(a);c(document).on("click.redactor-image-resize-hide",c.proxy(this.image.hideResize,this));this.$editor.on("click.redactor-image-resize-hide",c.proxy(this.image.hideResize,this));if(this.opts.imageResizable)this.image.resizer.on("mousedown.redactor touchstart.redactor", 198c.proxy(function(b){b.preventDefault();this.image.resizeHandle={x:b.pageX,y:b.pageY,el:a,ratio:a.width()/a.height(),h:a.height()};b=b.originalEvent||b;b.targetTouches&&(this.image.resizeHandle.x=b.targetTouches[0].pageX,this.image.resizeHandle.y=b.targetTouches[0].pageY);this.image.startResize()},this))},this)))},startResize:function(){c(document).on("mousemove.redactor-image-resize touchmove.redactor-image-resize",c.proxy(this.image.moveResize,this));c(document).on("mouseup.redactor-image-resize touchend.redactor-image-resize", 199c.proxy(this.image.stopResize,this))},moveResize:function(a){a.preventDefault();a=a.originalEvent||a;var b=this.image.resizeHandle.h,b=a.targetTouches?b+(a.targetTouches[0].pageY-this.image.resizeHandle.y):b+(a.pageY-this.image.resizeHandle.y);a=Math.round(b*this.image.resizeHandle.ratio);50>b||100>a||(this.image.resizeHandle.el.height(b),this.image.resizeHandle.el.width(a),this.code.sync())},stopResize:function(){this.handle=!1;c(document).off(".redactor-image-resize");this.image.hideResize()}
199,onDrag:function(a){if(0!== 200this.$editor.find("#redactor-image-box").size())return a.preventDefault(),!1;this.$editor.on("drop.redactor-image-inside-drop",c.proxy(function(){setTimeout(c.proxy(this.image.onDrop,this),1)},this))},onDrop:function(){this.image.fixImageSourceAfterDrop();this.observe.images();this.$editor.off("drop.redactor-image-inside-drop");this.clean.clearUnverified();this.code.sync()},fixImageSourceAfterDrop:function(){this.$editor.find("img[data-save-url]").each(function(){var a=c(this);a.attr("src",a.attr("data-save-url")); 201a.removeAttr("data-save-url")})},hideResize:function(a){a&&0!==c(a.target).closest("#redactor-image-box").length||(a&&"IMG"==a.target.tagName&&(a=c(a.target),a.attr("data-save-url",a.attr("src"))),a=this.$editor.find("#redactor-image-box"),0!==a.size()&&(this.image.editter.remove(),c(this.image.resizer).remove(),a.find("img").css({marginTop:a[0].style.marginTop,marginBottom:a[0].style.marginBottom,marginLeft:a[0].style.marginLeft,marginRight:a[0].style.marginRight}),a.css("margin",""),a.find("img").css("opacity", 202""),a.replaceWith(function(){return c(this).contents()}),c(document).off("click.redactor-image-resize-hide"),this.$editor.off("click.redactor-image-resize-hide"),this.image.resizeHandle.el.attr("rel",this.image.resizeHandle.el.attr("style")),this.code.sync()))},loadEditableControls:function(a){var b=c('<span id="redactor-image-box" data-redactor="verified">');b.css("float",a.css("float")).attr("contenteditable",!1);"auto"!=a[0].style.margin?(b.css({marginTop:a[0].style.marginTop,marginBottom:a[0].style.marginBottom, 203marginLeft:a[0].style.marginLeft,marginRight:a[0].style.marginRight}),a.css("margin","")):b.css({display:"block",margin:"auto"});a.css("opacity",".5").after(b);this.image.editter=c('<span id="redactor-image-editter" data-redactor="verified">'+this.lang.get("edit")+"</span>");this.image.editter.attr("contenteditable",!1);this.image.editter.on("click",c.proxy(function(){this.image.showEdit(a)},this));b.append(this.image.editter);var d=this.image.editter.innerWidth();this.image.editter.css("margin-left", 204"-"+d/2+"px");if(this.opts.imageResizable&&!this.utils.isMobile())return d=c('<span id="redactor-image-resizer" data-redactor="verified"></span>'),this.utils.isDesktop()||d.css({width:"15px",height:"15px"}),d.attr("contenteditable",!1),b.append(d),b.append(a),d;b.append(a);return!1},remove:function(a){a=c(a);var b=a.closest("a"),d=a.closest("figure"),e=a.parent();0!==c("#redactor-image-box").size()&&(e=c("#redactor-image-box").parent());var f;0!==d.size()?(f=d.next(),d.remove()):0!==b.size()?(e=b.parent(), 205b.remove()):a.remove();c("#redactor-image-box").remove();0!==d.size()?this.caret.setStart(f):this.caret.setStart(e);this.core.setCallback("imageDelete",a[0].src,a);this.modal.close();this.code.sync()},insert:function(a,b,d){if("undefined"!=typeof a.error)this.modal.close(),this.selection.restore(),this.core.setCallback("imageUploadError",a);else{var e;"string"==typeof a?e=c(a).attr("data-redactor-inserted-image","true"):(e=c("<img>"),e.attr("src",a.filelink).attr("data-redactor-inserted-image","true")); 206var f=e,g=this.utils.isCurrentOrParent("P");g&&(f=c("<blockquote />").append(e));b?(this.selection.removeMarkers(),b=this.selection.getMarker(),this.insert.nodeToCaretPositionFromPoint(d,b)):this.modal.close();this.selection.restore();this.buffer.set();this.insert.html(this.utils.getOuterHtml(f),!1);d=this.$editor.find("img[data-redactor-inserted-image=true]").removeAttr("data-redactor-inserted-image");g?d.parent().contents().unwrap().wrap("<p />"):this.opts.linebreaks&&d.before("<br>").after("<br>"); 207"string"!=typeof a&&this.core.setCallback("imageUpload",d,a)}}}},file:function(){return{show:function(){this.modal.load("file",this.lang.get("file"),700);this.upload.init("#redactor-modal-file-upload",this.opts.fileUpload,this.file.insert);this.selection.save();this.selection.get();var a=this.sel.toString();c("#redactor-filename").val(a);this.modal.show()},insert:function(a,b,d){if("undefined"!=typeof a.error)this.modal.close(),this.selection.restore(),this.core.setCallback("fileUploadError",a);else{var e; 208if("string"==typeof a)e=a;else{e=c("#redactor-filename").val();if("undefined"==typeof e||""===e)e=a.filename;e='<a href="'+a.filelink+'" id="filelink-marker">'+e+"</a>"}b?(this.selection.removeMarkers(),b=this.selection.getMarker(),this.insert.nodeToCaretPositionFromPoint(d,b)):this.modal.close();
208this.selection.restore();this.buffer.set();this.insert.html(e);"string"!=typeof a&&(d=c(this.$editor.find("a#filelink-marker")),0!==d.size()?d.removeAttr("id"):d=!1,this.core.setCallback("fileUpload",d,a))}}}}, 209modal:function(){return{callbacks:{},loadTemplates:function(){this.opts.modal={imageEdit:String()+'<section id="redactor-modal-image-edit"><label>'+this.lang.get("title")+'</label><input type="text" id="redactor-image-title" /><label class="redactor-image-link-option">'+this.lang.get("link")+'</label><input type="text" id="redactor-image-link" class="redactor-image-link-option" /><label class="redactor-image-link-option"><input type="checkbox" id="redactor-image-link-blank"> '+this.lang.get("link_new_tab")+ 210'</label><label class="redactor-image-position-option">'+this.lang.get("image_position")+'</label><select class="redactor-image-position-option" id="redactor-image-align"><option value="none">'+this.lang.get("none")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="center">'+this.lang.get("center")+'</option><option value="right">'+this.lang.get("right")+"</option></select></section>",image:String()+'<section id="redactor-modal-image-insert"><div id="redactor-modal-image-droparea"></div></section>', 211file:String()+'<section id="redactor-modal-file-insert"><div id="redactor-modal-file-upload-box"><label>'+this.lang.get("filename")+'</label><input type="text" id="redactor-filename" /><br><br><div id="redactor-modal-file-upload"></div></div></section>',link:String()+'<section id="redactor-modal-link-insert"><label>URL</label><input type="url" id="redactor-link-url" /><label>'+this.lang.get("text")+'</label><input type="text" id="redactor-link-url-text" /><label><input type="checkbox" id="redactor-link-blank"> '+ 212this.lang.get("link_new_tab")+"</label></section>"};c.extend(this.opts,this.opts.modal)},addCallback:function(a,b){this.modal.callbacks[a]=b},createTabber:function(a){this.modal.$tabber=c("<div>").attr("id","redactor-modal-tabber");a.prepend(this.modal.$tabber)},addTab:function(a,b,d){a=c('<a href="#" rel="tab'+a+'">').text(b);d&&a.addClass("active");var e=this;a.on("click",function(a){a.preventDefault();c(".redactor-tab").hide();c(".redactor-"+c(this).attr("rel")).show();e.modal.$tabber.find("a").removeClass("active"); 213c(this).addClass("active")});this.modal.$tabber.append(a)},addTemplate:function(a,b){this.opts.modal[a]=b},getTemplate:function(a){return this.opts.modal[a]},getModal:function(){return this.$modalBody.find("section")},load:function(a,b,c){this.modal.templateName=a;this.modal.width=c;this.modal.build();this.modal.enableEvents();this.modal.setTitle(b);this.modal.setDraggable();this.modal.setContent();"undefined"!=typeof this.modal.callbacks[a]&&this.modal.callbacks[a].call(this)},show:function(){document.activeElement.blur(); 214this.modal.bodyOveflow=c(document.body).css("overflow");c(document.body).css("overflow","hidden");this.utils.isMobile()?this.modal.showOnMobile():this.modal.showOnDesktop();this.$modalOverlay.show();this.$modalBox.show();this.modal.setButtonsWidth();this.utils.saveScroll();this.utils.isMobile()||(setTimeout(c.proxy(this.modal.showOnDesktop,this),0),c(window).on("resize.redactor-modal",c.proxy(this.modal.resize,this)));this.core.setCallback("modalOpened",this.modal.templateName,this.$modal);c(document).off("focusin.modal"); 215this.$modal.find("input[type=text]").on("keydown.redactor-modal",c.proxy(this.modal.setEnter,this))},showOnDesktop:function(){var a=this.$modal.outerHeight(),b=c(window).height(),d=c(window).width();this.modal.width>d?this.$modal.css({width:"96%",marginTop:b/2-a/2+"px"}):a>b?this.$modal.css({width:this.modal.width+"px",marginTop:"20px"}):this.$modal.css({width:this.modal.width+"px",marginTop:b/2-a/2+"px"})},showOnMobile:function(){this.$modal.css({width:"96%",marginTop:"2%"})},resize:function(){this.utils.isMobile()? 216this.modal.showOnMobile():this.modal.showOnDesktop()},setTitle:function(a){this.$modalHeader.html(a)},setContent:function(){this.$modalBody.html(this.modal.getTemplate(this.modal.templateName))},setDraggable:function(){"undefined"!==typeof c.fn.draggable&&(this.$modal.draggable({handle:this.$modalHeader}),this.$modalHeader.css("cursor","move"))},setEnter:function(a){13==a.which&&(a.preventDefault(),this.$modal.find("button.redactor-modal-action-btn").click())},createCancelButton:function(){var a= 217c("<button>").addClass("redactor-modal-btn redactor-modal-close-btn").html(this.lang.get("cancel"));a.on("click",c.proxy(this.modal.close,this));this.$modalFooter.append(a)},createDeleteButton:function(a){return this.modal.createButton(a,"delete")},createActionButton:function(a){return this.modal.createButton(a,"action")},createButton:function(a,b){var d=c("<button>").addClass("redactor-modal-btn").addClass("redactor-modal-"+b+"-btn").html(a);this.$modalFooter.append(d);return d},setButtonsWidth:function(){var a= 218this.$modalFooter.find("button"),b=a.size();0!==b&&a.css("width",100/b+"%")},build:function(){this.modal.buildOverlay();this.$modalBox=c('<div id="redactor-modal-box" />').hide();this.$modal=c('<div id="redactor-modal" />');this.$modalHeader=c("<header />");this.$modalClose=c('<span id="redactor-modal-close" />').html("×");this.$modalBody=c('<div id="redactor-modal-body" />');this.$modalFooter=c("<footer />");this.$modal.append(this.$modalHeader);this.$modal.append(this.$modalClose);this.$modal.append(this.$modalBody); 219this.$modal.append(this.$modalFooter);this.$modalBox.append(this.$modal);this.$modalBox.appendTo(document.body)},buildOverlay:function(){this.$modalOverlay=c('<div id="redactor-modal-overlay">').hide();c("body").prepend(this.$modalOverlay)},enableEvents:function(){this.$modalClose.on("click.redactor-modal",c.proxy(this.modal.close,this));c(document).on("keyup.redactor-modal",c.proxy(this.modal.closeHandler,this));this.$editor.on("keyup.redactor-modal",c.proxy(this.modal.closeHandler,this));this.$modalBox.on("click.redactor-modal", 220c.proxy(this.modal.close,this))},disableEvents:function(){this.$modalClose.off("click.redactor-modal");c(document).off("keyup.redactor-modal");this.$editor.off("keyup.redactor-modal");this.$modalBox.off("click.redactor-modal");c(window).off("resize.redactor-modal")},closeHandler:function(a){a.which==this.keyCode.ESC&&this.modal.close(!1)}
220,close:function(a){if(a){if(!c(a.target).hasClass("redactor-modal-close-btn")&&a.target!=this.$modalClose[0]&&a.target!=this.$modalBox[0])return;a.preventDefault()}this.$modalBox&& 221(this.modal.disableEvents(),this.$modalOverlay.remove(),this.$modalBox.fadeOut("fast",c.proxy(function(){this.$modalBox.remove();setTimeout(c.proxy(this.utils.restoreScroll,this),0);void 0!==a&&this.selection.restore();c(document.body).css("overflow",this.modal.bodyOveflow);this.core.setCallback("modalClosed",this.modal.templateName)},this)))}}},progress:function(){return{show:function(){c(document.body).append(c('<div id="redactor-progress"><span></span></div>'));c("#redactor-progress").fadeIn()}, 222hide:function(){c("#redactor-progress").fadeOut(1500,function(){c(this).remove()})}}},upload:function(){return{init:function(a,b,d){this.upload.direct=!1;this.upload.callback=d;this.upload.url=b;this.upload.$el=c(a);this.upload.$droparea=c('<div id="redactor-droparea" />');this.upload.$placeholdler=c('<div id="redactor-droparea-placeholder" />').text(Yii.t("common","Drop file here or "));this.upload.$input=c('<input type="file" name="file" />');this.upload.$placeholdler.append(this.upload.$input); 223this.upload.$droparea.append(this.upload.$placeholdler);this.upload.$el.append(this.upload.$droparea);this.upload.$droparea.off("redactor.upload");this.upload.$input.off("redactor.upload");this.upload.$droparea.on("dragover.redactor.upload",c.proxy(this.upload.onDrag,this));this.upload.$droparea.on("dragleave.redactor.upload",c.proxy(this.upload.onDragLeave,this));this.upload.$input.on("change.redactor.upload",c.proxy(function(a){a=a.originalEvent||a;this.upload.traverseFile(this.upload.$input[0].files[0], 224a)},this));this.upload.$droparea.on("drop.redactor.upload",c.proxy(function(a){a.preventDefault();this.upload.$droparea.removeClass("drag-hover").addClass("drag-drop");this.upload.onDrop(a)},this))},directUpload:function(a,b){this.upload.direct=!0;this.upload.traverseFile(a,b)},onDrop:function(a){a=a.originalEvent||a;this.upload.traverseFile(a.dataTransfer.files[0],a)},traverseFile:function(a,b){if(this.opts.s3)this.upload.setConfig(a),this.upload.s3uploadFile(a);else{var c=window.FormData?new FormData: 225null;window.FormData&&(this.upload.setConfig(a),c.append("image"==this.upload.type?this.opts.imageUploadParam:this.opts.fileUploadParam,a));this.progress.show();this.upload.sendData(c,b)}},setConfig:function(a){this.upload.getType(a);this.upload.direct&&(this.upload.url="image"==this.upload.type?this.opts.imageUpload:this.opts.fileUpload,this.upload.callback="image"==this.upload.type?this.image.insert:this.file.insert)},getType:function(a){this.upload.type="image";-1==this.opts.imageTypes.indexOf(a.type)&& 226(this.upload.type="file")},getHiddenFields:function(a,b){if(!1===a||"object"!==typeof a)return b;c.each(a,c.proxy(function(a,e){null!==e&&0===e.toString().indexOf("#")&&(e=c(e).val());b.append(a,e)},this));return b},sendData:function(a,b){"image"==this.upload.type?(a=this.upload.getHiddenFields(this.opts.uploadImageFields,a),a=this.upload.getHiddenFields(this.upload.imageFields,a)):(a=this.upload.getHiddenFields(this.opts.uploadFileFields,a),a=this.upload.getHiddenFields(this.upload.fileFields,a)); 227var d=new XMLHttpRequest;d.open("POST",this.upload.url);d.onreadystatechange=c.proxy(function(){if(4==d.readyState){var a=d.responseText,a=a.replace(/^\[/,""),a=a.replace(/\]$/,""),f;try{f="string"===typeof a?c.parseJSON(a):a}catch(g){f={error:!0}}this.progress.hide();this.upload.direct||this.upload.$droparea.removeClass("drag-drop");this.upload.callback(f,this.upload.direct,b)}},this);d.send(a)},onDrag:function(a){a.preventDefault();this.upload.$droparea.addClass("drag-hover")},onDragLeave:function(a){a.preventDefault(); 228this.upload.$droparea.removeClass("drag-hover")},clearImageFields:function(){this.upload.imageFields={}},addImageFields:function(a,b){this.upload.imageFields[a]=b},removeImageFields:function(a){delete this.upload.imageFields[a]},clearFileFields:function(){this.upload.fileFields={}},addFileFields:function(a,b){this.upload.fileFields[a]=b},removeFileFields:function(a){delete this.upload.fileFields[a]},s3uploadFile:function(a){this.upload.s3executeOnSignedUrl(a,c.proxy(function(b){this.upload.s3uploadToS3(a, 229b)},this))},s3executeOnSignedUrl:function(a,b){var c=new XMLHttpRequest,e="?";"-1"!=this.opts.s3.search(/\?/)&&(e="&");c.open("GET",this.opts.s3+e+"name="+a.name+"&type="+a.type,!0);c.overrideMimeType&&c.overrideMimeType("text/plain;
229 charset=x-user-defined");var f=this;c.onreadystatechange=function(a){4==this.readyState&&200==this.status&&(f.progress.show(),b(decodeURIComponent(this.responseText)))};c.send()},s3createCORSRequest:function(a,b){var c=new XMLHttpRequest;"withCredentials"in c?c.open(a, 230b,!0):"undefined"!=typeof XDomainRequest?(c=new XDomainRequest,c.open(a,b)):c=null;return c},s3uploadToS3:function(a,b){var d=this.upload.s3createCORSRequest("PUT",b);d&&(d.onload=c.proxy(function(){if(200==d.status){this.progress.hide();var a=b.split("?");if(!a[0])return!1;this.upload.direct||this.upload.$droparea.removeClass("drag-drop");var c={filelink:a[0]};"file"==this.upload.type&&(a=a[0].split("/"),c.filename=a[a.length-1]);this.upload.callback(c,this.upload.direct,!1)}},this),d.onerror=function(){}, 231d.upload.onprogress=function(a){},d.setRequestHeader("Content-Type",a.type),d.setRequestHeader("x-amz-acl","public-read"),d.send(a))}}},utils:function(){return{isMobile:function(){return/(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent)},isDesktop:function(){return!/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent)},isString:function(a){return"[object String]"==Object.prototype.toString.call(a)},isEmpty:function(a,b){a=a.replace(/[\u200B-\u200D\uFEFF]/g,"");a=a.replace(/ /gi, 232"");a=a.replace(/<\/?br\s?\/?>/g,"");a=a.replace(/\s/g,"");a=a.replace(/^<p>[^\W\w\D\d]*?<\/p>$/i,"");!1!==b&&(a=a.replace(/<[^\/>][^>]*><\/[^>]+>/gi,""),a=a.replace(/<[^\/>][^>]*><\/[^>]+>/gi,""));a=c.trim(a);return""===a},normalize:function(a){return"undefined"===typeof a?0:parseInt(a.replace("px",""),10)},hexToRgb:function(a){if("undefined"!=typeof a){if(-1==a.search(/^#/))return a;a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,c,e,f){return c+c+e+e+f+f});a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); 233return"rgb("+parseInt(a[1],16)+", "+parseInt(a[2],16)+", "+parseInt(a[3],16)+")"}},getOuterHtml:function(a){return c("<div>").append(c(a).eq(0).clone()).html()},getAlignmentElement:function(a){return-1!==c.inArray(a.tagName,this.opts.alignmentTags)?c(a):c(a).closest(this.opts.alignmentTags.toString().toLowerCase(),this.$editor[0])},removeEmptyAttr:function(a,b){var d=c(a);return"undefined"==typeof d.attr(b)?!0:""===d.attr(b)?(d.removeAttr(b),!0):!1},removeEmpty:function(a,b){var d=c(b);d.find(".redactor-invisible-space").replaceWith(function(){return c(this).contents()}); 234if(0===d.find("hr, br, img").length){var e=c.trim(d.text());this.utils.isEmpty(e,!1)&&d.remove()}},saveScroll:function(){this.utils.isSelectAll()||(this.saveEditorScroll=this.$editor.scrollTop(),this.saveBodyScroll=c(window).scrollTop(),this.opts.scrollTarget&&(this.saveTargetScroll=c(this.opts.scrollTarget).scrollTop()))},restoreScroll:function(){if("undefined"!==typeof this.saveScroll||"undefined"!==typeof this.saveBodyScroll)c(window).scrollTop(this.saveBodyScroll),this.$editor.scrollTop(this.saveEditorScroll), 235this.opts.scrollTarget&&c(this.opts.scrollTarget).scrollTop(this.saveTargetScroll)},createSpaceElement:function(){var a=document.createElement("span");a.className="redactor-invisible-space";a.innerHTML=this.opts.invisibleSpace;return a},removeInlineTags:function(a){var b=this.opts.inlineTags;b.push("span");"PRE"==a.tagName&&b.push("a");c(a).find(b.join(",")).not("span.redactor-selection-marker").contents().unwrap()},replaceWithContents:function(a,b){var d=this;c(a).replaceWith(function(){!0===b&& 236d.utils.removeInlineTags(this);return c(this).contents()})},replaceToTag:function(a,b,d){var e,f=this;c(a).replaceWith(function(){e=c("<"+b+" />").append(c(this).contents());for(var a=0;a<this.attributes.length;a++)e.attr(this.attributes[a].name,this.attributes[a].value);!0===d&&f.utils.removeInlineTags(e);return e});return e},isStartOfElement:function(){var a=this.selection.getBlock();return a?0===this.caret.getOffsetOfElement(a)?!0:!1:!1},isEndOfElement:function(){var a=this.selection.getBlock(); 237if(!a)return!1;var b=this.caret.getOffsetOfElement(a),a=c.trim(c(a).text()).replace(/\n\r\n/g,"");return b==a.length?!0:!1},isBlock:function(a){return(a=a[0]||a)&&this.utils.isBlockTag(a.tagName)},isBlockTag:function(a){return"undefined"==typeof a?!1:this.reIsBlock.test(a)},isTag:function(a,b){var d=c(a).closest(b);return 1==d.size()?d[0]:!1},isSelectAll:function(){return this.selectAll},enableSelectAll:function(){this.selectAll=!0},disableSelectAll:function(){this.selectAll=!1},isRedactorParent:function(a){return!a|| 2380===c(a).parents(".redactor-editor").length||c(a).hasClass("redactor-editor")?!1:a},isCurrentOrParent:function(a){var b=this.selection.getParent(),d=this.selection.getCurrent();if(c.isArray(a)){var e=0;c.each(a,c.proxy(function(a,c){this.utils.isCurrentOrParentOne(d,b,c)&&e++},this));return 0===e?!1:!0}return this.utils.isCurrentOrParentOne(d,b,a)},isCurrentOrParentOne:function(a,b,c){return b&&b.tagName===c?b:a&&a.tagName===c?a:!1}
238,isOldIe:function(){return this.utils.browser("msie")&&9>parseInt(this.utils.browser("version"), 23910)?!0:!1},isLessIe10:function(){return this.utils.browser("msie")&&10>parseInt(this.utils.browser("version"),10)?!0:!1},isIe11:function(){return!!navigator.userAgent.match(/Trident\/7\./)},browser:function(a){var b=navigator.userAgent.toLowerCase(),b=/(opr)[\/]([\w.]+)/.exec(b)||/(chrome)[ \/]([\w.]+)/.exec(b)||/(webkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(b)||/(webkit)[ \/]([\w.]+)/.exec(b)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(b)||/(msie) ([\w.]+)/.exec(b)||0<=b.indexOf("trident")&& 240/(rv)(?::| )([\w.]+)/.exec(b)||0>b.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(b)||[];return"version"==a?b[2]:"webkit"==a?"chrome"==b[1]||"webkit"==b[1]:"rv"==b[1]?"msie"==a:"opr"==b[1]?"webkit"==a:a==b[1]}}}};h.prototype.init.prototype=h.prototype;c.Redactor.fn.formatLinkify=function(a,b,d,e,f,g){for(var h=RegExp("((?:http[s]?:\\/\\/(?:www\\.)?|www\\.){1}(?:[0-9A-Za-z\\-%_]+\\.)+[a-zA-Z]{2,}(?::[0-9]+)?(?:(?:/[0-9A-Za-z\\-\\.%_]*)+)?(?:\\?(?:[0-9A-Za-z\\-\\.%_]+(?:=[0-9A-Za-z\\-\\.%_\\+]*)?)?(?:&(?:[0-9A-Za-z\\-\\.%_]+(?:=[0-9A-Za-z\\-\\.%_\\+]*)?)?)*)?(?:#[0-9A-Za-z\\-\\.%_\\+=\\?&;]*)?)", 241"gi"),l=/(https?|ftp):\/\//i,w=/(https?:\/\/.*\.(?:png|jpg|jpeg|gif))/gi,x=(this.$editor?this.$editor[0]:this).childNodes,y=x.length;y--;){var q=x[y];if(3===q.nodeType){var n=q.nodeValue;f&&n&&(n.match(m)?(n=n.replace(m,'<iframe width="500" height="281" src="//www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>'),c(q).after(n).remove()):n.match(p)&&(n=n.replace(p,'<iframe width="500" height="281" src="//player.vimeo.com/video/$2" frameborder="0" allowfullscreen></iframe>'),c(q).after(n).remove())); 242if(e&&n&&n.match(w)){n=n.replace(w,'<img src="$1" />');c(q).after(n).remove();break}-1!=n.search(/\$/g)&&(n=n.replace(/\$/g,"$"));var r=n.match(h);if(d&&n&&r){for(var B=r.length,t=0;t<B;t++){null!==r[t].match(/\.$/)&&(r[t]=r[t].replace(/\.$/,""));var v=r[t],u=v,z="";null!==v.match(/\s$/)&&(z=" ");var A=a+"://";null!==v.match(l)&&(A="");u.length>g&&(u=u.substring(0,g)+"...");u=u.replace(/$/g,"$").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n=n.replace(v,'<a href="'+A+c.trim(v)+ 243'">'+c.trim(u)+"</a>"+z)}c(q).after(n).remove()}}else 1!==q.nodeType||/^(a|button|textarea)$/i.test(q.tagName)||c.Redactor.fn.formatLinkify.call(q,a,b,d,e,f,g)}}})(jQuery); 244(function(c){c.Redactor.opts.langs.ru={html:Yii.t("common","\u041a\u043e\u0434"),video:Yii.t("common","\u0412\u0438\u0434\u0435\u043e"),image:Yii.t("common","\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435"),table:Yii.t("common","\u0422\u0430\u0431\u043b\u0438\u0446\u0430"),link:Yii.t("common","\u0421\u0441\u044b\u043b\u043a\u0430"),link_insert:Yii.t("common","\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 ..."),link_edit:Yii.t("common","\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443"), 245unlink:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443"),formatting:Yii.t("common","\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435"),paragraph:Yii.t("common","\u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442"),quote:Yii.t("common","\u0426\u0438\u0442\u0430\u0442\u0430"),code:Yii.t("common","\u041a\u043e\u0434"),header1:Yii.t("common","\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a 1"), 246header2:Yii.t("common","\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a 2"),header3:Yii.t("common","\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a 3"),header4:Yii.t("common","\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a 4"),header5:Yii.t("common","\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a 5"),bold:Yii.t("common","\u041f\u043e\u043b\u0443\u0436\u0438\u0440\u043d\u044b\u0439"),italic:Yii.t("common","\u041d\u0430\u043a\u043b\u043e\u043d\u043d\u044b\u0439"),fontcolor:Yii.t("common", 247"\u0426\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430"),backcolor:Yii.t("common","\u0417\u0430\u043b\u0438\u0432\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430"),unorderedlist:Yii.t("common","\u041e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a"),orderedlist:Yii.t("common","\u041d\u0443\u043c\u0435\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a"),outdent:Yii.t("common","\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f"), 248indent:Yii.t("common","\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f"),cancel:Yii.t("common","\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c"),insert:Yii.t("common","\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c"),save:Yii.t("common","\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c"),_delete:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c"),insert_table:Yii.t("common","\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443"), 249insert_row_above:Yii.t("common","\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u0432\u0435\u0440\u0445\u0443"),insert_row_below:Yii.t("common","\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043d\u0438\u0437\u0443"),insert_column_left:Yii.t("common","\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u043b\u0435\u0432\u0430"),insert_column_right:Yii.t("common", 250"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441\u043f\u0440\u0430\u0432\u0430"),delete_column:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446"),delete_row:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443"),delete_table:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443"),rows:Yii.t("common","\u0421\u0442\u0440\u043e\u043a\u0438"), 251columns:Yii.t("common","\u0421\u0442\u043e\u043b\u0431\u0446\u044b"),add_head:Yii.t("common","\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a"),delete_head:Yii.t("common","\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a"),title:Yii.t("common","\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430"),image_position:Yii.t("common","\u041e\u0431\u0442\u0435\u043a\u0430\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u043c"),
252none:Yii.t("common","\u041d\u0435\u0442"),left:Yii.t("common","C\u043b\u0435\u0432\u0430"),right:Yii.t("common","C\u043f\u0440\u0430\u0432\u0430"),image_web_link:Yii.t("common","C\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435"),text:Yii.t("common","\u0422\u0435\u043a\u0441\u0442"),mailto:Yii.t("common","\u042d\u043b. \u043f\u043e\u0447\u0442\u0430"),web:Yii.t("common","URL"),video_html_code:Yii.t("common","\u041a\u043e\u0434 \u0432\u0438\u0434\u0435\u043e \u0440\u043e\u043b\u0438\u043a\u0430"), 253file:Yii.t("common","\u0424\u0430\u0439\u043b"),upload:Yii.t("common","\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c"),download:Yii.t("common","\u0421\u043a\u0430\u0447\u0430\u0442\u044c"),choose:Yii.t("common","\u0412\u044b\u0431\u0440\u0430\u0442\u044c"),or_choose:Yii.t("common","\u0418\u043b\u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435"),drop_file_here:Yii.t("common","\u041f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u0441\u044e\u0434\u0430"), 254align_left:Yii.t("common","\u041f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e"),align_center:Yii.t("common","\u041f\u043e \u0446\u0435\u043d\u0442\u0440\u0443"),align_right:Yii.t("common","\u041f\u043e \u043f\u0440\u0430\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e"),align_justify:Yii.t("common","\u0412\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e \u0448\u0438\u0440\u0438\u043d\u0435"),horizontalrule:Yii.t("common","\u0413\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u043b\u0438\u043d\u0435\u0439\u043a\u0430"), 255fullscreen:Yii.t("common","\u0412\u043e \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d"),deleted:Yii.t("common","\u0417\u0430\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439"),anchor:Yii.t("common","\u042f\u043a\u043e\u0440\u044c"),link_new_tab:Yii.t("common","\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0435"),underline:Yii.t("common","\u041f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044b\u0439"), 256alignment:Yii.t("common","\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435"),filename:Yii.t("common","\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 (\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e)"),edit:Yii.t("common","\u0420\u0435\u0434."),center:Yii.t("common","\u041f\u043e \u0446\u0435\u043d\u0442\u0440\u0443")}})(jQuery);if(!RedactorPlugins)var RedactorPlugins={}; 257RedactorPlugins.fontcolor=function(){return{init:function(){for(var c="#ffffff #000000 #eeece1 #1f497d #4f81bd #c0504d #9bbb59 #8064a2 #4bacc6 #f79646 #ffff00 #f2f2f2 #7f7f7f #ddd9c3 #c6d9f0 #dbe5f1 #f2dcdb #ebf1dd #e5e0ec #dbeef3 #fdeada #fff2ca #d8d8d8 #595959 #c4bd97 #8db3e2 #b8cce4 #e5b9b7 #d7e3bc #ccc1d9 #b7dde8 #fbd5b5 #ffe694 #bfbfbf #3f3f3f #938953 #548dd4 #95b3d7 #d99694 #c3d69b #b2a2c7 #b7dde8 #fac08f #f2c314 #a5a5a5 #262626 #494429 #17365d #366092 #953734 #76923c #5f497a #92cddc #e36c09 #c09100 #7f7f7f #0c0c0c #1d1b10 #0f243e #244061 #632423 #4f6128 #3f3151 #31859b #974806 #7f6000".split(" "),h= 258["fontcolor","backcolor"],l=0;2>l;l++){var m=h[l],p=this.button.add(m,this.lang.get(m)),p=this.button.addDropdown(p);p.width(242);this.fontcolor.buildPicker(p,m,c)}},buildPicker:function(c,h,l){var m="backcolor"==h?"background-color":"color";h=l.length;for(var p=this,a=function(a){a.preventDefault();p.fontcolor.set($(this).data("rule"),$(this).attr("rel"))},b=0;b<h;b++){var d=l[b],e=$('<a rel="'+d+'" data-rule="'+m+'" href="#" style="float: left; font-size: 0; border: 2px solid #fff; padding: 0; margin: 0; width: 22px; height: 22px;"></a>'); 259e.css("background-color",d);e.on("click",a);c.append(e)}l=$('<a href="#" style="display: block; clear: both; padding: 5px; font-size: 12px; line-height: 1;"></a>').html(this.lang.get("none"));l.on("click",$.proxy(function(a){a.preventDefault();this.fontcolor.remove(m)},this));c.append(l)},set:function(c,h){this.inline.format("span","style",c+": "+h+";")},remove:function(c){this.inline.removeStyleRule(c)}}};RedactorPlugins||(RedactorPlugins={}); 260RedactorPlugins.fontsize=function(){return{init:function(){var c=this,h={};$.each([10,11,12,14,16,18,20,24,28,30],function(l,p){h["s"+l]={title:p+"px",func:function(){c.fontsize.set(p)}}});h.remove={title:Yii.t("common","Remove Font Size"),func:c.fontsize.reset};
260var l=this.button.add("fontsize",Yii.t("common","\u0420\u0430\u0437\u043c\u0435\u0440 \u0448\u0440\u0438\u0444\u0442\u0430"));this.button.addDropdown(l,h)},set:function(c){this.inline.format("span","style","font-size: "+c+"px;")},reset:function(){this.inline.removeStyleRule("font-size")}}}; 261RedactorPlugins||(RedactorPlugins={}); 262RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'<section id="redactor-modal-table-insert"><label>'+this.lang.get("rows")+'</label><input type="text" size="5" value="2" id="redactor-table-rows" /><label>'+this.lang.get("columns")+'</label><input type="text" size="5" value="3" id="redactor-table-columns" /></section>'},init:function(){var c={};c.insert_table={title:this.lang.get("insert_table"),func:this.table.show};c.insert_row_above={title:this.lang.get("insert_row_above"), 263func:this.table.addRowAbove};c.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow};c.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft};c.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight};c.add_head={title:this.lang.get("add_head"),func:this.table.addHead};c.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead};c.delete_column={title:this.lang.get("delete_column"), 264func:this.table.deleteColumn};c.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow};c.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable};this.observe.addButton("td","table");this.observe.addButton("th","table");var h=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(h,c)},show:function(){this.modal.addTemplate("table",this.table.getTemplate());this.modal.load("table",this.lang.get("insert_table"),300);this.modal.createCancelButton(); 265this.modal.createActionButton(this.lang.get("insert")).on("click",this.table.insert);this.selection.save();this.modal.show();$("#redactor-table-rows").focus()},insert:function(){var c=$("#redactor-table-rows").val(),h=$("#redactor-table-columns").val(),l=$("<div>"),m=Math.floor(99999*Math.random()),p=$('<table id="table'+m+'"><tbody></tbody></table>'),a,b,d,e;for(a=0;a<c;a++){b=$("<tr>");for(d=0;d<h;d++)e=$("<td>"+this.opts.invisibleSpace+"</td>"),0===a&&0===d&&e.append(this.selection.getMarker()), 266$(b).append(e);p.append(b)}l.append(p);c=l.html();this.modal.close();this.selection.restore();this.table.getTable()||(this.buffer.set(),(h=this.selection.getBlock()||this.selection.getCurrent())&&"BODY"!=h.tagName?("LI"==h.tagName&&(h=$(h).closest("ul, ol")),$(h).after(c)):this.insert.html(c),this.selection.restore(),m=this.$editor.find("#table"+m),this.opts.linebreaks||!this.utils.browser("mozilla")&&!this.utils.browser("msie")||0===m.next().length&&m.after(this.opts.emptyHtml),this.observe.buttons(), 267m.find("span.redactor-selection-marker").remove(),m.removeAttr("id"),this.code.sync(),this.core.setCallback("insertedTable",m))},getTable:function(){var c=$(this.selection.getParent()).closest("table");return this.utils.isRedactorParent(c)&&0!==c.size()?c:!1},restoreAfterDelete:function(c){this.selection.restore();c.find("span.redactor-selection-marker").remove();this.code.sync()},deleteTable:function(){var c=this.table.getTable();if(c){this.buffer.set();var h=c.next();this.opts.linebreaks||0===h.length? 268this.caret.setAfter(c):this.caret.setStart(h);c.remove();this.code.sync()}},deleteRow:function(){var c=this.table.getTable();if(c){var h=$(this.selection.getCurrent());this.buffer.set();var h=h.closest("tr"),l=h.prev().length?h.prev():h.next();l.length&&(l=l.children("td, th").first(),l.length&&l.prepend(this.selection.getMarker()));h.remove();this.table.restoreAfterDelete(c)}},deleteColumn:function(){var c=this.table.getTable();if(c){this.buffer.set();var h=$(this.selection.getCurrent()).closest("td, th")[0].cellIndex; 269c.find("tr").each($.proxy(function(c,m){var p=$(m),a=0>h-1?h+1:h-1;0===c&&p.find("td, th").eq(a).prepend(this.selection.getMarker());p.find("td, th").eq(h).remove()},this));this.table.restoreAfterDelete(c)}},addHead:function(){var c=this.table.getTable();if(c)if(this.buffer.set(),0!==c.find("thead").size())this.table.deleteHead();else{var h=c.find("tr").first().clone();h.find("td").html(this.opts.invisibleSpace);$thead=$("<thead></thead>").append(h);c.prepend($thead);
269this.code.sync()}},deleteHead:function(){var c= 270this.table.getTable();c&&(c=c.find("thead"),0!==c.size()&&(this.buffer.set(),c.remove(),this.code.sync()))},addRowAbove:function(){this.table.addRow("before")},addRowBelow:function(){this.table.addRow("after")},addColumnLeft:function(){this.table.addColumn("before")},addColumnRight:function(){this.table.addColumn("after")},addRow:function(c){if(this.table.getTable()){this.buffer.set();var h=$(this.selection.getCurrent()).closest("tr"),l=h.clone();l.find("th").replaceWith(function(){var c=$("<td>"); 271c[0].attributes=this.attributes;return c.append($(this).contents())});l.find("td").html(this.opts.invisibleSpace);"after"==c?h.after(l):h.before(l);this.code.sync()}},addColumn:function(c){var h=this.table.getTable();if(h){var l=0,m=$(this.selection.getCurrent());this.buffer.set();var p=m.closest("tr"),a=m.closest("td, th");p.find("td, th").each($.proxy(function(b,c){$(c)[0]===a[0]&&(l=b)},this));h.find("tr").each($.proxy(function(a,d){var e=$(d).find("td, th").eq(l),f=e.clone();f.html(this.opts.invisibleSpace); 272"after"==c?e.after(f):e.before(f)},this));this.code.sync()}}}};RedactorPlugins||(RedactorPlugins={}); 273RedactorPlugins.video=function(){return{reUrlYoutube:/https?:\/\/(?:[
2730-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,reUrlVimeo:/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,getTemplate:function(){return String()+'<section id="redactor-modal-video-insert"><label>'+this.lang.get("video_html_code")+'</label><textarea id="redactor-insert-video-area" style="height: 160px;"></textarea></section>'},init:function(){var c=this.button.addAfter("image", 274"video",this.lang.get("video"));this.button.addCallback(c,this.video.show)},show:function(){this.modal.addTemplate("video",this.video.getTemplate());this.modal.load("video",this.lang.get("video"),700);this.modal.createCancelButton();this.modal.createActionButton(this.lang.get("insert")).on("click",this.video.insert);this.selection.save();this.modal.show();$("#redactor-insert-video-area").focus()},insert:function(){var c=$("#redactor-insert-video-area").val(),c=this.clean.stripTags(c);c.match(this.video.reUrlYoutube)? 275c=c.replace(this.video.reUrlYoutube,'<iframe style="width: 500px; height: 281px;" src="//www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>'):c.match(this.video.reUrlVimeo)&&(c=c.replace(this.video.reUrlVimeo,'<iframe style="width: 500px; height: 281px;" src="//player.vimeo.com/video/$2" frameborder="0" allowfullscreen></iframe>'));this.selection.restore();this.modal.close();var h=this.selection.getBlock()||this.selection.getCurrent();h?$(h).after(c):this.insert.html(c);this.code.sync()}}};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.