(function($) {'use strict';if(!Function.prototype.bind) {Function.prototype.bind=function(scope) {var fn=this;return function() {return fn.apply(scope);};};} var uuid=0;$.fn.redactor=function(options) {var val=[];var args=Array.prototype.slice.call(arguments,1);if(typeof options==='string') {this.each(function() {var instance=$.data(this,'redactor');var func;if(options.search(/\./)!='-1') {func=options.split('.');if(typeof instance[func[0]]!='undefined') {func=instance[func[0]][func[1]];}} else {func=instance[options];} if(typeof instance!=='undefined'&&$.isFunction(func)) {var methodVal=func.apply(instance,args);if(methodVal!==undefined&&methodVal!==instance) {val.push(methodVal);}} else {$.error('No such method "'+options+'" for Redactor');}});} else {this.each(function() {$.data(this,'redactor',{});$.data(this,'redactor',Redactor(this,options));});} if(val.length===0)return this;else if(val.length===1)return val[0];else return val;};function Redactor(el,options) {return new Redactor.prototype.init(el,options);} $.Redactor=Redactor;$.Redactor.VERSION='10.1.0';$.Redactor.modules=['alignment','autosave','block','buffer','build','button','caret','clean','code','core','dropdown','file','focus','image','indent','inline','insert','keydown','keyup','lang','line','link','list','modal','observe','paragraphize','paste','placeholder','progress','selection','shortcuts','tabifier','tidy','toolbar','upload','utils','linkify'];$.Redactor.opts={lang:'en',direction:'ltr',plugins:false,focus:false,focusEnd:false,placeholder:false,visual:true,tabindex:false,minHeight:false,maxHeight:false,linebreaks:false,replaceDivs:true,paragraphize:true,cleanStyleOnEnter:false,enterKey:true,cleanOnPaste:true,cleanSpaces:true,pastePlainText:false,autosave:false,autosaveName:false,autosaveInterval:60,autosaveOnChange:false,autosaveFields:false,linkTooltip:true,linkProtocol:'http',linkNofollow:false,linkSize:50,imageEditable:true,imageLink:true,imagePosition:true,imageFloatMargin:'10px',imageResizable:true,imageUpload:null,imageUploadParam:'file',uploadImageField:false,dragImageUpload:true,fileUpload:null,fileUploadParam:'file',dragFileUpload:true,s3:false,convertLinks:true,convertUrlLinks:true,convertImageLinks:true,convertVideoLinks:true,preSpaces:4,tabAsSpaces:false,tabKey:true,scrollTarget:false,toolbar:true,toolbarFixed:true,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:false,toolbarOverflow:false,source:true,buttons:['html','formatting','bold','italic','deleted','unorderedlist','orderedlist','outdent','indent','image','file','link','alignment','horizontalrule'],buttonsHide:[],buttonsHideOnMobile:[],formatting:['p','blockquote','pre','h1','h2','h3','h4','h5','h6'],formattingAdd:false,tabifier:true,deniedTags:['script','style'],allowedTags:false,removeComments:false,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:false,removeAttr:false,allowedAttr:false,removeWithoutAttr:['span'],removeEmpty:['p'],activeButtons:['deleted','italic','bold','underline','unorderedlist','orderedlist','alignleft','aligncenter','alignright','justify'],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']},'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:false,buffer:[],rebuffer:[],emptyHtml:'

',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'],inlineTags:['strong','b','u','em','i','code','del','ins','samp','kbd','sup','sub','mark','var','cite','small'],alignmentTags:['P','H1','H2','H3','H4','H5','H6','DL','DT','DD','DIV','TD','BLOCKQUOTE','OUTPUT','FIGCAPTION','ADDRESS','SECTION','HEADER','FOOTER','ASIDE','ARTICLE'],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',bold:'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',add_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',horizontalrule:'Insert Horizontal Rule',deleted:'Deleted',anchor:'Anchor',link_new_tab:'Open link in new tab',underline:'Underline',alignment:'Alignment',filename:'Name (optional)',edit:'Edit',upload_label:'Drop file here or '}},linkify:{regexps:{youtube:/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,vimeo:/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,image:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/ig,url:/((?: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\-\.%_\+=\?&;]*)?)/ig,}},codemirror:false};Redactor.fn=$.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,RIGHT:39,LEFT:37,LEFT_WIN:91},init:function(el,options) {this.$element=$(el);this.uuid=uuid++;this.rtePaste=false;this.$pasteBox=false;this.loadOptions(options);this.loadModules();this.formatting={};$.merge(this.opts.blockLevelElements,this.opts.alignmentTags);this.reIsBlock=new RegExp('^('+this.opts.blockLevelElements.join('|')+')$','i');this.tidy.setupAllowed();if(this.opts.deniedTags!==false) {var tags=['html','head','link','body','meta','applet'];for(var i=0;i');block=this.selection.getBlock();this.block.toggle($(block));} else if(block.tagName.toLowerCase()!=tag) {if(this.opts.linebreaks&&tag=='p') {$(block).prepend('
').append('
');this.utils.replaceWithContents(block);} else {var $formatted=this.utils.replaceToTag(block,tag);this.block.toggle($formatted);if(tag!='p'&&tag!='blockquote')$formatted.find('img').remove();if(this.block.isRemoveInline)this.utils.removeInlineTags($formatted);if(tag=='p'||this.block.headTag)$formatted.find('p').contents().unwrap();this.block.formatTableWrapping($formatted);}} else if(tag=='blockquote'&&block.tagName.toLowerCase()==tag) {if(this.opts.linebreaks) {$(block).prepend('
').append('
');this.utils.replaceWithContents(block);} else {var $el=this.utils.replaceToTag(block,'p');this.block.toggle($el);}} else if(block.tagName.toLowerCase()==tag) {this.block.toggle($(block));} if(typeof this.block.type=='undefined'&&typeof this.block.value=='undefined') {$(block).removeAttr('class').removeAttr('style');}},setMultiple:function(tag) {var block=this.block.blocks[0];var isContainerTable=(this.block.containerTag=='TD'||this.block.containerTag=='TH');if(block!==false&&this.block.blocksSize===1) {if(block.tagName.toLowerCase()==tag&&tag=='blockquote') {if(this.opts.linebreaks) {$(block).prepend('
').append('
');this.utils.replaceWithContents(block);} else {var $el=this.utils.replaceToTag(block,'p');this.block.toggle($el);}} else if(block.tagName=='LI') {if(tag!='blockquote')return;this.block.formatListToBlockquote();} else if(this.block.containerTag=='BLOCKQUOTE') {this.block.formatBlockquote(tag);} else if(this.opts.linebreaks&&((isContainerTable)||(this.range.commonAncestorContainer!=block))) {this.block.formatWrap(tag);} else {if(this.opts.linebreaks&&tag=='p') {$(block).prepend('
').append('
');this.utils.replaceWithContents(block);} else if(block.tagName==='TD') {this.block.formatWrap(tag);} else {var $formatted=this.utils.replaceToTag(block,tag);this.block.toggle($formatted);if(this.block.isRemoveInline)this.utils.removeInlineTags($formatted);if(tag=='p'||this.block.headTag)$formatted.find('p').contents().unwrap();}}} else {if(this.opts.linebreaks||tag!='p') {if(tag=='blockquote') {var count=0;for(var i=0;i').append('
');$formatted=this.utils.replaceWithContents(s);} else {$formatted=this.utils.replaceToTag(s,'p');} if($formatted&&typeof this.block.type=='undefined'&&typeof this.block.value=='undefined') {$formatted.removeAttr('class').removeAttr('style');}},this));return;}} this.block.formatWrap(tag);} else {var classSize=0;var toggleType=false;if(this.block.type=='class') {toggleType='toggle';classSize=$(this.block.blocks).filter('.'+this.block.value).length;if(this.block.blocksSize==classSize)toggleType='toggle';else if(this.block.blocksSize>classSize)toggleType='set';else if(classSize===0)toggleType='set';} var exceptTags=['ul','ol','li','td','th','dl','dt','dd'];$.each(this.block.blocks,$.proxy(function(i,s) {if($.inArray(s.tagName.toLowerCase(),exceptTags)!=-1)return;var $formatted=this.utils.replaceToTag(s,tag);if(toggleType) {if(toggleType=='toggle')this.block.toggle($formatted);else if(toggleType=='remove')this.block.remove($formatted);else if(toggleType=='set')this.block.setForce($formatted);} else this.block.toggle($formatted);if(tag!='p'&&tag!='blockquote')$formatted.find('img').remove();if(this.block.isRemoveInline)this.utils.removeInlineTags($formatted);if(tag=='p'||this.block.headTag)$formatted.find('p').contents().unwrap();if(typeof this.block.type=='undefined'&&typeof this.block.value=='undefined') {$formatted.removeAttr('class').removeAttr('style');}},this));}}},setForce:function($el) {if(this.block.clearStyle) {$el.removeAttr('class').removeAttr('style');} if(this.block.type=='class') {$el.addClass(this.block.value);return;} else if(this.block.type=='attr'||this.block.type=='data') {$el.attr(this.block.value.name,this.block.value.value);return;}},toggle:function($el) {if(this.block.clearStyle) {$el.removeAttr('class').removeAttr('style');} if(this.block.type=='class') {$el.toggleClass(this.block.value);return;} else if(this.block.type=='attr'||this.block.type=='data') {if($el.attr(this.block.value.name)==this.block.value.value) {$el.removeAttr(this.block.value.name);} else {$el.attr(this.block.value.name,this.block.value.value);} return;} else {$el.removeAttr('style class');return;}},remove:function($el) {$el.removeClass(this.block.value);},formatListToBlockquote:function() {var block=$(this.block.blocks[0]).closest('ul, ol',this.$editor[0]);$(block).find('ul, ol').contents().unwrap();$(block).find('li').append($('
')).contents().unwrap();var $el=this.utils.replaceToTag(block,'blockquote');this.block.toggle($el);},formatBlockquote:function(tag) {document.execCommand('outdent');document.execCommand('formatblock',false,tag);this.clean.clearUnverified();this.$editor.find('p:empty').remove();var formatted=this.selection.getBlock();if(tag!='p') {$(formatted).find('img').remove();} if(!this.opts.linebreaks) {this.block.toggle($(formatted));} this.$editor.find('ul, ol, tr, blockquote, p').each($.proxy(this.utils.removeEmpty,this));if(this.opts.linebreaks&&tag=='p') {this.utils.replaceWithContents(formatted);}},formatWrap:function(tag) {if(this.block.containerTag=='UL'||this.block.containerTag=='OL') {if(tag=='blockquote') {this.block.formatListToBlockquote();} else {return;}} var formatted=this.selection.wrap(tag);if(formatted===false)return;var $formatted=$(formatted);this.block.formatTableWrapping($formatted);var $elements=$formatted.find(this.opts.blockLevelElements.join(',')+', td, table, thead, tbody, tfoot, th, tr');if((this.opts.linebreaks&&tag=='p')||tag=='pre'||tag=='blockquote') {$elements.append('
');} $elements.contents().unwrap();if(tag!='p'&&tag!='blockquote')$formatted.find('img').remove();$.each(this.block.blocks,$.proxy(this.utils.removeEmpty,this));$formatted.append(this.selection.getMarker(2));if(!this.opts.linebreaks) {this.block.toggle($formatted);} this.$editor.find('ul, ol, tr, blockquote, p').each($.proxy(this.utils.removeEmpty,this));$formatted.find('blockquote:empty').remove();if(this.block.isRemoveInline) {this.utils.removeInlineTags($formatted);} if(this.opts.linebreaks&&tag=='p') {this.utils.replaceWithContents($formatted);}},formatTableWrapping:function($formatted) {if($formatted.closest('table',this.$editor[0]).length===0)return;if($formatted.closest('tr',this.$editor[0]).length===0)$formatted.wrap('');if($formatted.closest('td',this.$editor[0]).length===0&&$formatted.closest('th').length===0) {$formatted.wrap('');}},removeData:function(name,value) {var blocks=this.selection.getBlocks();$(blocks).removeAttr('data-'+name);this.code.sync();},setData:function(name,value) {var blocks=this.selection.getBlocks();$(blocks).attr('data-'+name,value);this.code.sync();},toggleData:function(name,value) {var blocks=this.selection.getBlocks();$.each(blocks,function() {if($(this).attr('data-'+name)) {$(this).removeAttr('data-'+name);} else {$(this).attr('data-'+name,value);}});},removeAttr:function(attr,value) {var blocks=this.selection.getBlocks();$(blocks).removeAttr(attr);this.code.sync();},setAttr:function(attr,value) {var blocks=this.selection.getBlocks();$(blocks).attr(attr,value);this.code.sync();},toggleAttr:function(attr,value) {var blocks=this.selection.getBlocks();$.each(blocks,function() {if($(this).attr(name)) {$(this).removeAttr(name);} else {$(this).attr(name,value);}});},removeClass:function(className) {var blocks=this.selection.getBlocks();$(blocks).removeClass(className);this.utils.removeEmptyAttr(blocks,'class');this.code.sync();},setClass:function(className) {var blocks=this.selection.getBlocks();$(blocks).addClass(className);this.code.sync();},toggleClass:function(className) {var blocks=this.selection.getBlocks();$(blocks).toggleClass(className);this.code.sync();}};},buffer:function() {return{set:function(type) {if(typeof type=='undefined'||type=='undo') {this.buffer.setUndo();} else {this.buffer.setRedo();}},setUndo:function() {this.selection.save();this.opts.buffer.push(this.$editor.html());this.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() {if(this.opts.buffer.length===0)return;this.buffer.set('redo');this.buffer.getUndo();this.selection.restore();setTimeout($.proxy(this.observe.load,this),50);},redo:function() {if(this.opts.rebuffer.length===0)return;this.buffer.set('undo');this.buffer.getRedo();this.selection.restore();setTimeout($.proxy(this.observe.load,this),50);}};},build:function() {return{run:function() {this.build.createContainerBox();this.build.loadContent();this.build.loadEditor();this.build.enableEditor();this.build.setCodeAndCall();},isTextarea:function() {return(this.$element[0].tagName==='TEXTAREA');},createContainerBox:function() {this.$box=$('
');},createTextarea:function() {this.$textarea=$('