|
@@ -1,2 +1,2 @@
|
|
|
-(function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||h.defaults,this.rules=c.normal,this.options.gfm&&(this.options.tables?this.rules=c.tables:this.rules=c.gfm)}function t(e,t){if(this.options=t||h.defaults,this.links=e,this.rules=u.normal,this.renderer=this.options.renderer||new n,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=u.breaks:this.rules=u.gfm:this.options.pedantic&&(this.rules=u.pedantic)}function n(e){this.options=e||{}}function i(e){this.tokens=[],this.token=null,this.options=e||h.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options}function s(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function o(e,t){return e=e.source,t=t||"",function n(i,s){return i?(s=s.source||s,s=s.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(i,s),n):new RegExp(e,t)}}function a(){}function l(e){for(var t,n,i=1;i<arguments.length;i++){t=arguments[i];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function h(t,n,r){if(r||"function"==typeof n){r||(r=n,n=null),n=l({},h.defaults,n||{});var o,a,c=n.highlight,u=0;try{o=e.lex(t,n)}catch(d){return r(d)}a=o.length;var p=function(e){if(e)return n.highlight=c,r(e);var t;try{t=i.parse(o,n)}catch(s){e=s}return n.highlight=c,e?r(e):r(null,t)};if(!c||c.length<3)return p();if(delete n.highlight,!a)return p();for(;u<o.length;u++)!function(e){return"code"!==e.type?--a||p():c(e.text,e.lang,function(t,n){return t?p(t):null==n||n===e.text?--a||p():(e.text=n,e.escaped=!0,void(--a||p()))})}(o[u])}else try{return n&&(n=l({},h.defaults,n)),i.parse(e.lex(t,n),n)}catch(d){if(d.message+="\nPlease report this to https://github.com/chjj/marked.",(n||h.defaults).silent)return"<p>An error occured:</p><pre>"+s(d.message+"",!0)+"</pre>";throw d}}var c={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:a,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:a,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:a,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};c.bullet=/(?:[*+-]|\d+\.)/,c.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,c.item=o(c.item,"gm")(/bull/g,c.bullet)(),c.list=o(c.list)(/bull/g,c.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+c.def.source+")")(),c.blockquote=o(c.blockquote)("def",c.def)(),c._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",c.html=o(c.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,c._tag)(),c.paragraph=o(c.paragraph)("hr",c.hr)("heading",c.heading)("lheading",c.lheading)("blockquote",c.blockquote)("tag","<"+c._tag)("def",c.def)(),c.normal=l({},c),c.gfm=l({},c.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),c.gfm.paragraph=o(c.paragraph)("(?!","(?!"+c.gfm.fences.source.replace("\\1","\\2")+"|"+c.list.source.replace("\\1","\\3")+"|")(),c.tables=l({},c.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=c,e.lex=function(t,n){var i=new e(n);return i.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,n){for(var i,s,r,o,a,l,h,u,d,e=e.replace(/^ +$/gm,"");e;)if((r=this.rules.newline.exec(e))&&(e=e.substring(r[0].length),r[0].length>1&&this.tokens.push({type:"space"})),r=this.rules.code.exec(e))e=e.substring(r[0].length),r=r[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?r:r.replace(/\n+$/,"")});else if(r=this.rules.fences.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"code",lang:r[2],text:r[3]||""});else if(r=this.rules.heading.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"heading",depth:r[1].length,text:r[2]});else if(t&&(r=this.rules.nptable.exec(e))){for(e=e.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].split(/ *\| */);this.tokens.push(l)}else if(r=this.rules.lheading.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"heading",depth:"="===r[2]?1:2,text:r[1]});else if(r=this.rules.hr.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"hr"});else if(r=this.rules.blockquote.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"blockquote_start"}),r=r[0].replace(/^ *> ?/gm,""),this.token(r,t,!0),this.tokens.push({type:"blockquote_end"});else if(r=this.rules.list.exec(e)){for(e=e.substring(r[0].length),o=r[2],this.tokens.push({type:"list_start",ordered:o.length>1}),r=r[0].match(this.rules.item),i=!1,d=r.length,u=0;d>u;u++)l=r[u],h=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(h-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+h+"}","gm"),"")),this.options.smartLists&&u!==d-1&&(a=c.bullet.exec(r[u+1])[0],o===a||o.length>1&&a.length>1||(e=r.slice(u+1).join("\n")+e,u=d-1)),s=i||/\n\n(?!\s*$)/.test(l),u!==d-1&&(i="\n"===l.charAt(l.length-1),s||(s=i)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(r=this.rules.html.exec(e))e=e.substring(r[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===r[1]||"script"===r[1]||"style"===r[1]),text:r[0]});else if(!n&&t&&(r=this.rules.def.exec(e)))e=e.substring(r[0].length),this.tokens.links[r[1].toLowerCase()]={href:r[2],title:r[3]};else if(t&&(r=this.rules.table.exec(e))){for(e=e.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<l.align.length;u++)/^ *-+: *$/.test(l.align[u])?l.align[u]="right":/^ *:-+: *$/.test(l.align[u])?l.align[u]="center":/^ *:-+ *$/.test(l.align[u])?l.align[u]="left":l.align[u]=null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(t&&(r=this.rules.paragraph.exec(e)))e=e.substring(r[0].length),this.tokens.push({type:"paragraph",text:"\n"===r[1].charAt(r[1].length-1)?r[1].slice(0,-1):r[1]});else if(r=this.rules.text.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"text",text:r[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var u={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:a,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:a,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};u._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,u._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=o(u.link)("inside",u._inside)("href",u._href)(),u.reflink=o(u.reflink)("inside",u._inside)(),u.normal=l({},u),u.pedantic=l({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=l({},u.normal,{escape:o(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=l({},u.gfm,{br:o(u.br)("{2,}","*")(),text:o(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,n,i){var s=new t(n,i);return s.output(e)},t.prototype.output=function(e){for(var t,n,i,r,o="";e;)if(r=this.rules.escape.exec(e))e=e.substring(r[0].length),o+=r[1];else if(r=this.rules.autolink.exec(e))e=e.substring(r[0].length),"@"===r[2]?(n=":"===r[1].charAt(6)?this.mangle(r[1].substring(7)):this.mangle(r[1]),i=this.mangle("mailto:")+n):(n=s(r[1]),i=n),o+=this.renderer.link(i,null,n);else if(this.inLink||!(r=this.rules.url.exec(e))){if(r=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(r[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(r[0])&&(this.inLink=!1),e=e.substring(r[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):s(r[0]):r[0];else if(r=this.rules.link.exec(e))e=e.substring(r[0].length),this.inLink=!0,o+=this.outputLink(r,{href:r[2],title:r[3]}),this.inLink=!1;else if((r=this.rules.reflink.exec(e))||(r=this.rules.nolink.exec(e))){if(e=e.substring(r[0].length),t=(r[2]||r[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=r[0].charAt(0),e=r[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(r,t),this.inLink=!1}else if(r=this.rules.strong.exec(e))e=e.substring(r[0].length),o+=this.renderer.strong(this.output(r[2]||r[1]));else if(r=this.rules.em.exec(e))e=e.substring(r[0].length),o+=this.renderer.em(this.output(r[2]||r[1]));else if(r=this.rules.code.exec(e))e=e.substring(r[0].length),o+=this.renderer.codespan(s(r[2],!0));else if(r=this.rules.br.exec(e))e=e.substring(r[0].length),o+=this.renderer.br();else if(r=this.rules.del.exec(e))e=e.substring(r[0].length),o+=this.renderer.del(this.output(r[1]));else if(r=this.rules.text.exec(e))e=e.substring(r[0].length),o+=this.renderer.text(s(this.smartypants(r[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(r[0].length),n=s(r[1]),i=n,o+=this.renderer.link(i,null,n);return o},t.prototype.outputLink=function(e,t){var n=s(t.href),i=t.title?s(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,i,this.output(e[1])):this.renderer.image(n,i,s(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",i=e.length,s=0;i>s;s++)t=e.charCodeAt(s),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},n.prototype.code=function(e,t,n){if(this.options.highlight){var i=this.options.highlight(e,t);null!=i&&i!==e&&(n=!0,e=i)}return t?'<pre><code class="'+this.options.langPrefix+s(t,!0)+'">'+(n?e:s(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:s(e,!0))+"\n</code></pre>"},n.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},n.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},n.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},n.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},n.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},n.prototype.tablecell=function(e,t){var n=t.header?"th":"td",i=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return i+e+"</"+n+">\n"},n.prototype.strong=function(e){return"<strong>"+e+"</strong>"},n.prototype.em=function(e){return"<em>"+e+"</em>"},n.prototype.codespan=function(e){return"<code>"+e+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(e){return"<del>"+e+"</del>"},n.prototype.link=function(e,t,n){if(this.options.sanitize){try{var i=decodeURIComponent(r(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(s){return""}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:"))return""}var o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>"},n.prototype.image=function(e,t,n){var i='<img src="'+e+'" alt="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=this.options.xhtml?"/>":">"},n.prototype.text=function(e){return e},i.parse=function(e,t,n){var s=new i(t,n);return s.parse(e)},i.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=this.tok();return n},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,i,s,r="",o="";for(n="",e=0;e<this.token.header.length;e++)i={header:!0,align:this.token.align[e]},n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(r+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",s=0;s<t.length;s++)n+=this.renderer.tablecell(this.inline.output(t[s]),{header:!1,align:this.token.align[s]});o+=this.renderer.tablerow(n)}return this.renderer.table(r,o);case"blockquote_start":for(var o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":for(var o="",a=this.token.ordered;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,a);case"list_item_start":for(var o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(var o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},a.exec=a,h.options=h.setOptions=function(e){return l(h.defaults,e),h},h.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new n,xhtml:!1},h.Parser=i,h.parser=i.parse,h.Renderer=n,h.Lexer=e,h.lexer=e.lex,h.InlineLexer=t,h.inlineLexer=t.output,h.parse=h,"undefined"!=typeof module&&"object"==typeof exports?module.exports=h:"function"==typeof define&&define.amd?define(function(){return h}):this.marked=h}).call(function(){return this||("undefined"!=typeof window?window:global)}()),!function(e){"use strict";var t=function(t,n){var i=["autofocus","savable","hideable","width","height","resize","iconlibrary","language","footer","fullscreen","hiddenButtons","disabledButtons"];e.each(i,function(i,s){"undefined"!=typeof e(t).data(s)&&(n="object"==typeof n?n:{},n[s]=e(t).data(s))}),this.$ns="bootstrap-markdown",this.$element=e(t),this.$editable={el:null,type:null,attrKeys:[],attrValues:[],content:null},this.$options=e.extend(!0,{},e.fn.markdown.defaults,n,this.$element.data("options")),this.$oldContent=null,this.$isPreview=!1,this.$isFullscreen=!1,this.$editor=null,this.$textarea=null,this.$handler=[],this.$callback=[],this.$nextTab=[],this.showEditor()};t.prototype={constructor:t,__alterButtons:function(t,n){var i=this.$handler,s="all"==t,r=this;e.each(i,function(e,i){var o=!0;o=s?!1:i.indexOf(t)<0,o===!1&&n(r.$editor.find('button[data-handler="'+i+'"]'))})},__buildButtons:function(t,n){var i,s=this.$ns,r=this.$handler,o=this.$callback;for(i=0;i<t.length;i++){var a,l=t[i];for(a=0;a<l.length;a++){var h,c=l[a].data,u=e("<div/>",{"class":"btn-group"});for(h=0;h<c.length;h++){var d,p,f=c[h],g=s+"-"+f.name,_=this.__getIcon(f.icon),m=f.btnText?f.btnText:"",b=f.btnClass?f.btnClass:"btn",y=f.tabIndex?f.tabIndex:"-1",v="undefined"!=typeof f.hotkey?f.hotkey:"",k="undefined"!=typeof jQuery.hotkeys&&""!==v?" ("+v+")":"";d=e("<button></button>"),d.text(" "+this.__localize(m)).addClass("btn-default btn-sm").addClass(b),b.match(/btn\-(primary|success|info|warning|danger|link)/)&&d.removeClass("btn-default"),d.attr({type:"button",title:this.__localize(f.title)+k,tabindex:y,"data-provider":s,"data-handler":g,"data-hotkey":v}),f.toggle===!0&&d.attr("data-toggle","button"),p=e("<span/>"),p.addClass(_),p.prependTo(d),u.append(d),r.push(g),o.push(f.callback)}n.append(u)}}return n},__setListener:function(){var t="undefined"!=typeof this.$textarea.attr("rows"),n=this.$textarea.val().split("\n").length>5?this.$textarea.val().split("\n").length:"5",i=t?this.$textarea.attr("rows"):n;this.$textarea.attr("rows",i),this.$options.resize&&this.$textarea.css("resize",this.$options.resize),this.$textarea.on("focus",e.proxy(this.focus,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)).on("change",e.proxy(this.change,this)).on("select",e.proxy(this.select,this)),this.eventSupported("keydown")&&this.$textarea.on("keydown",e.proxy(this.keydown,this)),this.$textarea.data("markdown",this)},__handle:function(t){var n=e(t.currentTarget),i=this.$handler,s=this.$callback,r=n.attr("data-handler"),o=i.indexOf(r),a=s[o];e(t.currentTarget).focus(),a(this),this.change(this),r.indexOf("cmdSave")<0&&this.$textarea.focus(),t.preventDefault()},__localize:function(t){var n=e.fn.markdown.messages,i=this.$options.language;return"undefined"!=typeof n&&"undefined"!=typeof n[i]&&"undefined"!=typeof n[i][t]?n[i][t]:t},__getIcon:function(e){return"object"==typeof e?e[this.$options.iconlibrary]:e},setFullscreen:function(t){var n=this.$editor,i=this.$textarea;t===!0?(n.addClass("md-fullscreen-mode"),e("body").addClass("md-nooverflow"),this.$options.onFullscreen(this)):(n.removeClass("md-fullscreen-mode"),e("body").removeClass("md-nooverflow"),1==this.$isPreview&&this.hidePreview().showPreview()),this.$isFullscreen=t,i.focus()},showEditor:function(){var t,n=this,i=this.$ns,s=this.$element,r=(s.css("height"),s.css("width"),this.$editable),o=this.$handler,a=this.$callback,l=this.$options,h=e("<div/>",{"class":"md-editor",click:function(){n.focus()}});if(null===this.$editor){var c=e("<div/>",{"class":"md-header btn-toolbar"}),u=[];if(l.buttons.length>0&&(u=u.concat(l.buttons[0])),l.additionalButtons.length>0&&(u=u.concat(l.additionalButtons[0])),l.reorderButtonGroups.length>0&&(u=u.filter(function(e){return l.reorderButtonGroups.indexOf(e.name)>-1}).sort(function(e,t){return l.reorderButtonGroups.indexOf(e.name)<l.reorderButtonGroups.indexOf(t.name)?-1:l.reorderButtonGroups.indexOf(e.name)>l.reorderButtonGroups.indexOf(t.name)?1:0})),u.length>0&&(c=this.__buildButtons([u],c)),l.fullscreen.enable&&c.append('<div class="md-controls"><a class="md-control md-control-fullscreen" href="#"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOn)+'"></span></a></div>').on("click",".md-control-fullscreen",function(e){e.preventDefault(),n.setFullscreen(!0)}),h.append(c),s.is("textarea"))s.before(h),t=s,t.addClass("md-input"),h.append(t);else{var d="function"==typeof toMarkdown?toMarkdown(s.html()):s.html(),p=e.trim(d);t=e("<textarea/>",{"class":"md-input",val:p}),h.append(t),r.el=s,r.type=s.prop("tagName").toLowerCase(),r.content=s.html(),e(s[0].attributes).each(function(){r.attrKeys.push(this.nodeName),r.attrValues.push(this.nodeValue)}),s.replaceWith(h)}var f=e("<div/>",{"class":"md-footer"}),g=!1,_="";if(l.savable){g=!0;var m="cmdSave";o.push(m),a.push(l.onSave),f.append('<button class="btn btn-success" data-provider="'+i+'" data-handler="'+m+'"><i class="icon icon-white icon-ok"></i> '+this.__localize("Save")+"</button>")}if(_="function"==typeof l.footer?l.footer(this):l.footer,""!==e.trim(_)&&(g=!0,f.append(_)),g&&h.append(f),l.width&&"inherit"!==l.width&&(jQuery.isNumeric(l.width)?(h.css("display","table"),t.css("width",l.width+"px")):h.addClass(l.width)),l.height&&"inherit"!==l.height)if(jQuery.isNumeric(l.height)){var b=l.height;c&&(b=Math.max(0,b-c.outerHeight())),f&&(b=Math.max(0,b-f.outerHeight())),t.css("height",b+"px")}else h.addClass(l.height);this.$editor=h,this.$textarea=t,this.$editable=r,this.$oldContent=this.getContent(),this.__setListener(),this.$editor.attr("id",(new Date).getTime()),this.$editor.on("click",'[data-provider="bootstrap-markdown"]',e.proxy(this.__handle,this)),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this.eventSupported("keydown")&&"object"==typeof jQuery.hotkeys&&c.find('[data-provider="bootstrap-markdown"]').each(function(){var n=e(this),i=n.attr("data-hotkey");""!==i.toLowerCase()&&t.bind("keydown",i,function(){return n.trigger("click"),!1})}),"preview"===l.initialstate?this.showPreview():"fullscreen"===l.initialstate&&l.fullscreen.enable&&this.setFullscreen(!0)}else this.$editor.show();return l.autofocus&&(this.$textarea.focus(),this.$editor.addClass("active")),l.fullscreen.enable&&l.fullscreen!==!1&&(this.$editor.append('<div class="md-fullscreen-controls"><a href="#" class="exit-fullscreen" title="Exit fullscreen"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOff)+'"></span></a></div>'),this.$editor.on("click",".exit-fullscreen",function(e){e.preventDefault(),n.setFullscreen(!1)})),this.hideButtons(l.hiddenButtons),this.disableButtons(l.disabledButtons),l.onShow(this),this},parseContent:function(e){var t,e=e||this.$textarea.val();return t=this.$options.parser?this.$options.parser(e):"object"==typeof markdown?markdown.toHTML(e):"function"==typeof marked?marked(e):e},showPreview:function(){var t,n,i=this.$options,s=this.$textarea,r=s.next(),o=e("<div/>",{"class":"md-preview","data-provider":"markdown-preview"});return 1==this.$isPreview?this:(this.$isPreview=!0,this.disableButtons("all").enableButtons("cmdPreview"),n=i.onPreview(this),t="string"==typeof n?n:this.parseContent(),o.html(t),r&&"md-footer"==r.attr("class")?o.insertBefore(r):s.parent().append(o),o.css({width:s.outerWidth()+"px",height:s.outerHeight()+"px"}),this.$options.resize&&o.css("resize",this.$options.resize),s.hide(),o.data("markdown",this),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this)},hidePreview:function(){this.$isPreview=!1;var e=this.$editor.find('div[data-provider="markdown-preview"]');return e.remove(),this.enableButtons("all"),this.disableButtons(this.$options.disabledButtons),this.$textarea.show(),this.__setListener(),this},isDirty:function(){return this.$oldContent!=this.getContent()},getContent:function(){return this.$textarea.val()},setContent:function(e){return this.$textarea.val(e),this},findSelection:function(e){var t,n=this.getContent();if(t=n.indexOf(e),t>=0&&e.length>0){var i,s=this.getSelection();return this.setSelection(t,t+e.length),i=this.getSelection(),this.setSelection(s.start,s.end),i}return null},getSelection:function(){var e=this.$textarea[0];return("selectionStart"in e&&function(){var t=e.selectionEnd-e.selectionStart;return{start:e.selectionStart,end:e.selectionEnd,length:t,text:e.value.substr(e.selectionStart,t)}}||function(){return null})()},setSelection:function(e,t){var n=this.$textarea[0];return("selectionStart"in n&&function(){n.selectionStart=e,n.selectionEnd=t}||function(){return null})()},replaceSelection:function(e){var t=this.$textarea[0];return("selectionStart"in t&&function(){return t.value=t.value.substr(0,t.selectionStart)+e+t.value.substr(t.selectionEnd,t.value.length),t.selectionStart=t.value.length,this}||function(){return t.value+=e,jQuery(t)})()},getNextTab:function(){if(0===this.$nextTab.length)return null;var e,t=this.$nextTab.shift();return"function"==typeof t?e=t():"object"==typeof t&&t.length>0&&(e=t),e},setNextTab:function(e,t){if("string"==typeof e){var n=this;this.$nextTab.push(function(){return n.findSelection(e)})}else if("number"==typeof e&&"number"==typeof t){var i=this.getSelection();this.setSelection(e,t),this.$nextTab.push(this.getSelection()),this.setSelection(i.start,i.end)}},__parseButtonNameParam:function(e){var t=[];return t="string"==typeof e?e.split(","):e},enableButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e,t){i.__alterButtons(n[e],function(e){e.removeAttr("disabled")})}),this},disableButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e,t){i.__alterButtons(n[e],function(e){e.attr("disabled","disabled")})}),this},hideButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e,t){i.__alterButtons(n[e],function(e){e.addClass("hidden")})}),this},showButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e,t){i.__alterButtons(n[e],function(e){e.removeClass("hidden")})}),this},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t="function"==typeof this.$element[e]),t},keyup:function(e){var t=!1;switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:var n;if(n=this.getNextTab(),null!==n){var i=this;setTimeout(function(){i.setSelection(n.start,n.end)},500),t=!0}else{var s=this.getSelection();s.start==s.end&&s.end==this.getContent().length?t=!1:(this.setSelection(this.getContent().length,this.getContent().length),t=!0)}break;case 13:t=!1;break;case 27:this.$isFullscreen&&this.setFullscreen(!1),t=!1;break;default:t=!1}t&&(e.stopPropagation(),e.preventDefault()),this.$options.onChange(this)},change:function(e){return this.$options.onChange(this),this},select:function(e){return this.$options.onSelect(this),this},focus:function(t){var n=this.$options,i=(n.hideable,this.$editor);return i.addClass("active"),e(document).find(".md-editor").each(function(){if(e(this).attr("id")!==i.attr("id")){var t;t=e(this).find("textarea").data("markdown"),null===t&&(t=e(this).find('div[data-provider="markdown-preview"]').data("markdown")),t&&t.blur()}}),n.onFocus(this),this},blur:function(t){var n=this.$options,i=n.hideable,s=this.$editor,r=this.$editable;if(s.hasClass("active")||0===this.$element.parent().length){if(s.removeClass("active"),i)if(null!==r.el){var o=e("<"+r.type+"/>"),a=this.getContent(),l=this.parseContent(a);e(r.attrKeys).each(function(e,t){o.attr(r.attrKeys[e],r.attrValues[e])}),o.html(l),s.replaceWith(o)}else s.hide();n.onBlur(this)}return this}};var n=e.fn.markdown;e.fn.markdown=function(n){return this.each(function(){var i=e(this),s=i.data("markdown"),r="object"==typeof n&&n;s||i.data("markdown",s=new t(this,r))})},e.fn.markdown.messages={},e.fn.markdown.defaults={autofocus:!1,hideable:!1,savable:!1,width:"inherit",height:"inherit",resize:"none",iconlibrary:"glyph",language:"en",initialstate:"editor",parser:null,buttons:[[{name:"groupFont",data:[{name:"cmdBold",hotkey:"Ctrl+B",title:"Bold",icon:{glyph:"glyphicon glyphicon-bold",fa:"fa fa-bold","fa-3":"icon-bold"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("strong text"):i.text,"**"===s.substr(i.start-2,2)&&"**"===s.substr(i.end,2)?(e.setSelection(i.start-2,i.end+2),e.replaceSelection(t),n=i.start-2):(e.replaceSelection("**"+t+"**"),n=i.start+2),e.setSelection(n,n+t.length)}},{name:"cmdItalic",title:"Italic",hotkey:"Ctrl+I",icon:{glyph:"glyphicon glyphicon-italic",fa:"fa fa-italic","fa-3":"icon-italic"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("emphasized text"):i.text,"_"===s.substr(i.start-1,1)&&"_"===s.substr(i.end,1)?(e.setSelection(i.start-1,i.end+1),e.replaceSelection(t),n=i.start-1):(e.replaceSelection("_"+t+"_"),n=i.start+1),e.setSelection(n,n+t.length)}},{name:"cmdHeading",title:"Heading",hotkey:"Ctrl+H",icon:{glyph:"glyphicon glyphicon-header",fa:"fa fa-header","fa-3":"icon-font"},callback:function(e){var t,n,i,s,r=e.getSelection(),o=e.getContent();t=0===r.length?e.__localize("heading text"):r.text+"\n",i=4,"### "===o.substr(r.start-i,i)||(i=3,"###"===o.substr(r.start-i,i))?(e.setSelection(r.start-i,r.end),e.replaceSelection(t),n=r.start-i):r.start>0&&(s=o.substr(r.start-1,1),!!s&&"\n"!=s)?(e.replaceSelection("\n\n### "+t),n=r.start+6):(e.replaceSelection("### "+t),n=r.start+4),e.setSelection(n,n+t.length)}}]},{name:"groupLink",data:[{name:"cmdUrl",title:"URL/Link",hotkey:"Ctrl+L",icon:{glyph:"glyphicon glyphicon-link",fa:"fa fa-link","fa-3":"icon-link"},callback:function(t){var n,i,s,r=t.getSelection();t.getContent();if(n=0===r.length?t.__localize("enter link description here"):r.text,s=prompt(t.__localize("Insert Hyperlink"),"http://"),null!==s&&""!==s&&"http://"!==s&&"http"===s.substr(0,4)){var o=e("<div>"+s+"</div>").text();t.replaceSelection("["+n+"]("+o+")"),i=r.start+1,t.setSelection(i,i+n.length)}}},{name:"cmdImage",title:"Image",hotkey:"Ctrl+G",icon:{glyph:"glyphicon glyphicon-picture",fa:"fa fa-picture-o","fa-3":"icon-picture"},callback:function(t){var n,i,s,r=t.getSelection();t.getContent();if(n=0===r.length?t.__localize("enter image description here"):r.text,s=prompt(t.__localize("Insert Image Hyperlink"),"http://"),null!==s&&""!==s&&"http://"!==s&&"http"===s.substr(0,4)){var o=e("<div>"+s+"</div>").text();t.replaceSelection("+'")'),i=r.start+2,t.setNextTab(t.__localize("enter image title here")),t.setSelection(i,i+n.length)}}}]},{name:"groupMisc",data:[{name:"cmdList",hotkey:"Ctrl+U",title:"Unordered List",icon:{glyph:"glyphicon glyphicon-list",fa:"fa fa-list","fa-3":"icon-list-ul"},callback:function(t){var n,i,s=t.getSelection();t.getContent();if(0===s.length)n=t.__localize("list text here"),t.replaceSelection("- "+n),i=s.start+2;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("- "+n),i=s.start+2;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="- "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+4}t.setSelection(i,i+n.length)}},{name:"cmdListO",hotkey:"Ctrl+O",title:"Ordered List",icon:{glyph:"glyphicon glyphicon-th-list",fa:"fa fa-list-ol","fa-3":"icon-list-ol"},callback:function(t){var n,i,s=t.getSelection();t.getContent();if(0===s.length)n=t.__localize("list text here"),t.replaceSelection("1. "+n),i=s.start+3;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("1. "+n),i=s.start+3;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="1. "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+5}t.setSelection(i,i+n.length)}},{name:"cmdCode",hotkey:"Ctrl+K",title:"Code",icon:{glyph:"glyphicon glyphicon-asterisk",fa:"fa fa-code","fa-3":"icon-code"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("code text here"):i.text,
|
|
|
-"```\n"===s.substr(i.start-4,4)&&"\n```"===s.substr(i.end,4)?(e.setSelection(i.start-4,i.end+4),e.replaceSelection(t),n=i.start-4):"`"===s.substr(i.start-1,1)&&"`"===s.substr(i.end,1)?(e.setSelection(i.start-1,i.end+1),e.replaceSelection(t),n=i.start-1):s.indexOf("\n")>-1?(e.replaceSelection("```\n"+t+"\n```"),n=i.start+4):(e.replaceSelection("`"+t+"`"),n=i.start+1),e.setSelection(n,n+t.length)}},{name:"cmdQuote",hotkey:"Ctrl+Q",title:"Quote",icon:{glyph:"glyphicon glyphicon-comment",fa:"fa fa-quote-left","fa-3":"icon-quote-left"},callback:function(t){var n,i,s=t.getSelection();t.getContent();if(0===s.length)n=t.__localize("quote here"),t.replaceSelection("> "+n),i=s.start+2;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("> "+n),i=s.start+2;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="> "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+4}t.setSelection(i,i+n.length)}}]},{name:"groupUtil",data:[{name:"cmdPreview",toggle:!0,hotkey:"Ctrl+P",title:"Preview",btnText:"Preview",btnClass:"btn btn-primary btn-sm",icon:{glyph:"glyphicon glyphicon-search",fa:"fa fa-search","fa-3":"icon-search"},callback:function(e){var t=e.$isPreview;t===!1?e.showPreview():e.hidePreview()}}]}]],additionalButtons:[],reorderButtonGroups:[],hiddenButtons:[],disabledButtons:[],footer:"",fullscreen:{enable:!0,icons:{fullscreenOn:{fa:"fa fa-expand",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-full"},fullscreenOff:{fa:"fa fa-compress",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-small"}}},onShow:function(e){},onPreview:function(e){},onSave:function(e){},onBlur:function(e){},onFocus:function(e){},onChange:function(e){},onFullscreen:function(e){},onSelect:function(e){}},e.fn.markdown.Constructor=t,e.fn.markdown.noConflict=function(){return e.fn.markdown=n,this};var i=function(e){var t=e;return t.data("markdown")?void t.data("markdown").showEditor():void t.markdown()},s=function(t){var n=e(document.activeElement);e(document).find(".md-editor").each(function(){var t=e(this),i=n.closest(".md-editor")[0]===this,s=t.find("textarea").data("markdown")||t.find('div[data-provider="markdown-preview"]').data("markdown");s&&!i&&s.blur()})};e(document).on("click.markdown.data-api",'[data-provide="markdown-editable"]',function(t){i(e(this)),t.preventDefault()}).on("click focusin",function(e){s(e)}).ready(function(){e('textarea[data-provide="markdown"]').each(function(){i(e(this))})})}(window.jQuery),!function(e){if("function"==typeof define&&define.amd)define(["jquery"],e);else if("object"==typeof module&&module.exports){var t=require("jquery");module.exports=e(t)}else e(jQuery)}(function(e){if("undefined"==typeof e)throw new Error("jQuery.textcomplete requires jQuery");return+function(e){"use strict";var t=function(e){console.warn&&console.warn(e)},n=1;e.fn.textcomplete=function(i,s){var r=Array.prototype.slice.call(arguments);return this.each(function(){var o=this,a=e(this),l=a.data("textComplete");if(l||(s||(s={}),s._oid=n++,l=new e.fn.textcomplete.Completer(this,s),a.data("textComplete",l)),"string"==typeof i){if(!l)return;r.shift(),l[i].apply(l,r),"destroy"===i&&a.removeData("textComplete")}else e.each(i,function(n){e.each(["header","footer","placement","maxCount"],function(e){n[e]&&(l.option[e]=n[e],t(e+"as a strategy param is deprecated. Use option."),delete n[e])})}),l.register(e.fn.textcomplete.Strategy.parse(i,{el:o,$el:a}))})}}(e),+function(e){"use strict";function t(n,i){if(this.$el=e(n),this.id="textcomplete"+r++,this.strategies=[],this.views=[],this.option=e.extend({},t._getDefaults(),i),!this.$el.is("input[type=text]")&&!this.$el.is("textarea")&&!n.isContentEditable&&"true"!=n.contentEditable)throw new Error("textcomplete must be called on a Textarea or a ContentEditable.");if(n===document.activeElement)this.initialize();else{var s=this;this.$el.one("focus."+this.id,function(){s.initialize()})}}var n=function(e){var t,n;return function(){var i=Array.prototype.slice.call(arguments);if(t)return void(n=i);t=!0;var s=this;i.unshift(function r(){if(n){var i=n;n=void 0,i.unshift(r),e.apply(s,i)}else t=!1}),e.apply(this,i)}},i=function(e){return"[object String]"===Object.prototype.toString.call(e)},s=function(e){return"[object Function]"===Object.prototype.toString.call(e)},r=0;t._getDefaults=function(){return t.DEFAULTS||(t.DEFAULTS={appendTo:e("body"),zIndex:"100"}),t.DEFAULTS},e.extend(t.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,initialize:function(){var t=this.$el.get(0);this.dropdown=new e.fn.textcomplete.Dropdown(t,this,this.option);var n,i;this.option.adapter?n=this.option.adapter:(i=this.$el.is("textarea")||this.$el.is("input[type=text]")?"number"==typeof t.selectionEnd?"Textarea":"IETextarea":"ContentEditable",n=e.fn.textcomplete[i]),this.adapter=new n(t,this,this.option)},destroy:function(){this.$el.off("."+this.id),this.adapter&&this.adapter.destroy(),this.dropdown&&this.dropdown.destroy(),this.$el=this.adapter=this.dropdown=null},trigger:function(e,t){this.dropdown||this.initialize(),null!=e||(e=this.adapter.getTextFromHeadToCaret());var n=this._extractSearchQuery(e);if(n.length){var i=n[1];if(t&&this._term===i)return;this._term=i,this._search.apply(this,n)}else this._term=null,this.dropdown.deactivate()},fire:function(e){var t=Array.prototype.slice.call(arguments,1);return this.$el.trigger(e,t),this},register:function(e){Array.prototype.push.apply(this.strategies,e)},select:function(e,t,n){this._term=null,this.adapter.select(e,t,n),this.fire("change").fire("textComplete:select",e,t),this.adapter.focus()},_clearAtNext:!0,_term:null,_extractSearchQuery:function(e){for(var t=0;t<this.strategies.length;t++){var n=this.strategies[t],r=n.context(e);if(r||""===r){var o=s(n.match)?n.match(e):n.match;i(r)&&(e=r);var a=e.match(o);if(a)return[n,a[n.index],a]}}return[]},_search:n(function(e,t,n,i){var s=this;t.search(n,function(i,r){s.dropdown.shown||s.dropdown.activate(),s._clearAtNext&&(s.dropdown.clear(),s._clearAtNext=!1),s.dropdown.setPosition(s.adapter.getCaretPosition()),s.dropdown.render(s._zip(i,t,n)),r||(e(),s._clearAtNext=!0)},i)}),_zip:function(t,n,i){return e.map(t,function(e){return{value:e,strategy:n,term:i}})}}),e.fn.textcomplete.Completer=t}(e),+function(e){"use strict";function t(n,i,r){this.$el=t.createElement(r),this.completer=i,this.id=i.id+"dropdown",this._data=[],this.$inputEl=e(n),this.option=r,r.listPosition&&(this.setPosition=r.listPosition),r.height&&this.$el.height(r.height);var o=this;e.each(["maxCount","placement","footer","header","noResultsMessage","className"],function(e,t){null!=r[t]&&(o[t]=r[t])}),this._bindEvents(n),s[this.id]=this}var n=e(window),i=function(e,t){var n,i,s=t.strategy.idProperty;for(n=0;n<e.length;n++)if(i=e[n],i.strategy===t.strategy)if(s){if(i.value[s]===t.value[s])return!0}else if(i.value===t.value)return!0;return!1},s={};e(document).on("click",function(t){var n=t.originalEvent&&t.originalEvent.keepTextCompleteDropdown;e.each(s,function(e,t){e!==n&&t.deactivate()})});var r={SKIP_DEFAULT:0,KEY_UP:1,KEY_DOWN:2,KEY_ENTER:3,KEY_PAGEUP:4,KEY_PAGEDOWN:5,KEY_ESCAPE:6};e.extend(t,{createElement:function(t){var n=t.appendTo;n instanceof e||(n=e(n));var i=e("<ul></ul>").addClass("dropdown-menu textcomplete-dropdown").attr("id","textcomplete-dropdown-"+t._oid).css({display:"none",left:0,position:"absolute",zIndex:t.zIndex}).appendTo(n);return i}}),e.extend(t.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:10,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el=this.$inputEl=this.completer=null,delete s[this.id]},render:function(t){var n=this._buildContents(t),i=e.map(this.data,function(e){return e.value});this.data.length?(this._renderHeader(i),this._renderFooter(i),n&&(this._renderContents(n),this._fitToBottom(),this._activateIndexedItem()),this._setScroll()):this.noResultsMessage?this._renderNoResultsMessage(i):this.shown&&this.deactivate()},setPosition:function(t){this.$el.css(this._applyPlacement(t));var n="absolute";return this.$inputEl.add(this.$inputEl.parents()).each(function(){return"absolute"===e(this).css("position")?!1:"fixed"===e(this).css("position")?(n="fixed",!1):void 0}),this.$el.css({position:n}),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=this._$noResultsMessage=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(e){return 38===e.keyCode||e.ctrlKey&&80===e.keyCode},isDown:function(e){return 40===e.keyCode||e.ctrlKey&&78===e.keyCode},isEnter:function(e){var t=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey;return!t&&(13===e.keyCode||9===e.keyCode||this.option.completeOnSpace===!0&&32===e.keyCode)},isPageup:function(e){return 33===e.keyCode},isPagedown:function(e){return 34===e.keyCode},isEscape:function(e){return 27===e.keyCode},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",e.proxy(this._onClick,this)),this.$el.on("touchstart."+this.id,".textcomplete-item",e.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",e.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,e.proxy(this._onKeydown,this))},_onClick:function(t){var n=e(t.target);t.preventDefault(),t.originalEvent.keepTextCompleteDropdown=this.id,n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item"));var i=this.data[parseInt(n.data("index"),10)];this.completer.select(i.value,i.strategy,t);var s=this;setTimeout(function(){s.deactivate(),"touchstart"===t.type&&s.$inputEl.focus()},0)},_onMouseover:function(t){var n=e(t.target);t.preventDefault(),n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item")),this._index=parseInt(n.data("index"),10),this._activateIndexedItem()},_onKeydown:function(t){if(this.shown){var n;switch(e.isFunction(this.option.onKeydown)&&(n=this.option.onKeydown(t,r)),null==n&&(n=this._defaultKeydown(t)),n){case r.KEY_UP:t.preventDefault(),this._up();break;case r.KEY_DOWN:t.preventDefault(),this._down();break;case r.KEY_ENTER:t.preventDefault(),this._enter(t);break;case r.KEY_PAGEUP:t.preventDefault(),this._pageup();break;case r.KEY_PAGEDOWN:t.preventDefault(),this._pagedown();break;case r.KEY_ESCAPE:t.preventDefault(),this.deactivate()}}},_defaultKeydown:function(e){return this.isUp(e)?r.KEY_UP:this.isDown(e)?r.KEY_DOWN:this.isEnter(e)?r.KEY_ENTER:this.isPageup(e)?r.KEY_PAGEUP:this.isPagedown(e)?r.KEY_PAGEDOWN:this.isEscape(e)?r.KEY_ESCAPE:void 0},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(e){var t=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(t.value,t.strategy,e),this.deactivate()},_pageup:function(){var t=0,n=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(i){return e(this).position().top+e(this).outerHeight()>n?(t=i,!1):void 0}),this._index=t,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var t=this.data.length-1,n=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(i){return e(this).position().top>n?(t=i,!1):void 0}),this._index=t,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var e=this._getActiveElement(),t=e.position().top,n=e.outerHeight(),i=this.$el.innerHeight(),s=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>t?this.$el.scrollTop(t+s):t+n>i&&this.$el.scrollTop(t+n+s-i)},_buildContents:function(e){var t,n,s,r="";for(n=0;n<e.length&&this.data.length!==this.maxCount;n++)t=e[n],i(this.data,t)||(s=this.data.length,this.data.push(t),r+='<li class="textcomplete-item" data-index="'+s+'"><a>',r+=t.strategy.template(t.value,t.term),r+="</a></li>");return r},_renderHeader:function(t){if(this.header){this._$header||(this._$header=e('<li class="textcomplete-header"></li>').prependTo(this.$el));var n=e.isFunction(this.header)?this.header(t):this.header;this._$header.html(n)}},_renderFooter:function(t){if(this.footer){this._$footer||(this._$footer=e('<li class="textcomplete-footer"></li>').appendTo(this.$el));var n=e.isFunction(this.footer)?this.footer(t):this.footer;this._$footer.html(n)}},_renderNoResultsMessage:function(t){if(this.noResultsMessage){this._$noResultsMessage||(this._$noResultsMessage=e('<li class="textcomplete-no-results-message"></li>').appendTo(this.$el));var n=e.isFunction(this.noResultsMessage)?this.noResultsMessage(t):this.noResultsMessage;this._$noResultsMessage.html(n)}},_renderContents:function(e){this._$footer?this._$footer.before(e):this.$el.append(e)},_fitToBottom:function(){var e=n.scrollTop()+n.height(),t=this.$el.height();this.$el.position().top+t>e&&this.$el.offset({top:e-t})},_applyPlacement:function(e){return-1!==this.placement.indexOf("top")?e={top:"auto",bottom:this.$el.parent().height()-e.top+e.lineHeight,left:e.left}:(e.bottom="auto",delete e.lineHeight),-1!==this.placement.indexOf("absleft")?e.left=0:-1!==this.placement.indexOf("absright")&&(e.right=0,e.left="auto"),e}}),e.fn.textcomplete.Dropdown=t,e.extend(e.fn.textcomplete,r)}(e),+function(e){"use strict";function t(t){e.extend(this,t),this.cache&&(this.search=n(this.search))}var n=function(e){var t={};return function(n,i){t[n]?i(t[n]):e.call(this,n,function(e){t[n]=(t[n]||[]).concat(e),i.apply(null,arguments)})}};t.parse=function(n,i){return e.map(n,function(e){var n=new t(e);return n.el=i.el,n.$el=i.$el,n})},e.extend(t.prototype,{match:null,replace:null,search:null,cache:!1,context:function(){return!0},index:2,template:function(e){return e},idProperty:null}),e.fn.textcomplete.Strategy=t}(e),+function(e){"use strict";function t(){}var n=Date.now||function(){return(new Date).getTime()},i=function(e,t){var i,s,r,o,a,l=function(){var h=n()-o;t>h?i=setTimeout(l,t-h):(i=null,a=e.apply(r,s),r=s=null)};return function(){return r=this,s=arguments,o=n(),i||(i=setTimeout(l,t)),a}};e.extend(t.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(t,n,s){this.el=t,this.$el=e(t),this.id=n.id+this.constructor.name,this.completer=n,this.option=s,this.option.debounce&&(this._onKeyup=i(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var e=this._getCaretRelativePosition(),t=this.$el.offset();return e.top+=t.top,e.left+=t.left,e},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,e.proxy(this._onKeyup,this))},_onKeyup:function(e){this._skipSearch(e)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(e){switch(e.keyCode){case 13:case 40:case 38:return!0}if(e.ctrlKey)switch(e.keyCode){case 78:case 80:return!0}}}),e.fn.textcomplete.Adapter=t}(e),+function(e){"use strict";function t(e,t,n){this.initialize(e,t,n)}t.DIV_PROPERTIES={left:-9999,position:"absolute",top:0,whiteSpace:"pre-wrap"},t.COPY_PROPERTIES=["border-width","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","word-spacing","line-height","text-decoration","text-align","width","padding-top","padding-right","padding-bottom","padding-left","margin-top","margin-right","margin-bottom","margin-left","border-style","box-sizing","tab-size"],e.extend(t.prototype,e.fn.textcomplete.Adapter.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=this.el.value.substring(this.el.selectionEnd),o=n.replace(t,i);"undefined"!=typeof o&&(e.isArray(o)&&(r=o[1]+r,o=o[0]),s=s.replace(n.match,o),this.$el.val(s+r),this.el.selectionStart=this.el.selectionEnd=s.length)},_getCaretRelativePosition:function(){var t=e("<div></div>").css(this._copyCss()).text(this.getTextFromHeadToCaret()),n=e("<span></span>").text(".").appendTo(t);this.$el.before(t);var i=n.position();return i.top+=n.height()-this.$el.scrollTop(),i.lineHeight=n.height(),t.remove(),i},_copyCss:function(){return e.extend({overflow:this.el.scrollHeight>this.el.offsetHeight?"scroll":"auto"},t.DIV_PROPERTIES,this._getStyles())},_getStyles:function(e){var n=e("<div></div>").css(["color"]).color;return"undefined"!=typeof n?function(){return this.$el.css(t.COPY_PROPERTIES)}:function(){var n=this.$el,i={};return e.each(t.COPY_PROPERTIES,function(e,t){i[t]=n.css(t)}),i}}(e),getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)}}),e.fn.textcomplete.Textarea=t}(e),+function(e){"use strict";function t(t,i,s){this.initialize(t,i,s),e("<span>"+n+"</span>").css({position:"absolute",top:-9999,left:-9999}).insertBefore(t)}var n="吶";e.extend(t.prototype,e.fn.textcomplete.Textarea.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=this.el.value.substring(s.length),o=n.replace(t,i);if("undefined"!=typeof o){e.isArray(o)&&(r=o[1]+r,o=o[0]),s=s.replace(n.match,o),this.$el.val(s+r),this.el.focus();var a=this.el.createTextRange();a.collapse(!0),a.moveEnd("character",s.length),a.moveStart("character",s.length),a.select()}},getTextFromHeadToCaret:function(){this.el.focus();var e=document.selection.createRange();e.moveStart("character",-this.el.value.length);var t=e.text.split(n);return 1===t.length?t[0]:t[1]}}),e.fn.textcomplete.IETextarea=t}(e),+function(e){"use strict";function t(e,t,n){this.initialize(e,t,n)}e.extend(t.prototype,e.fn.textcomplete.Adapter.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=window.getSelection(),o=r.getRangeAt(0),a=o.cloneRange();a.selectNodeContents(o.startContainer);var l=a.toString(),h=l.substring(o.startOffset),c=n.replace(t,i);if("undefined"!=typeof c){e.isArray(c)&&(h=c[1]+h,c=c[0]),s=s.replace(n.match,c),o.selectNodeContents(o.startContainer),o.deleteContents();var u=document.createTextNode(s+h);o.insertNode(u),o.setStart(u,s.length),o.collapse(!0),r.removeAllRanges(),r.addRange(o)}},_getCaretRelativePosition:function(){var t=window.getSelection().getRangeAt(0).cloneRange(),n=document.createElement("span");t.insertNode(n),t.selectNodeContents(n),t.deleteContents();var i=e(n),s=i.offset();return s.left-=this.$el.offset().left,s.top+=i.height()-this.$el.offset().top,s.lineHeight=i.height(),i.remove(),s},getTextFromHeadToCaret:function(){var e=window.getSelection().getRangeAt(0),t=e.cloneRange();return t.selectNodeContents(e.startContainer),t.toString().substring(0,e.startOffset)}}),e.fn.textcomplete.ContentEditable=t}(e),e});var emojies=["+1","-1","100","1234","8ball","a","ab","abc","abcd","accept","aerial_tramway","airplane","alarm_clock","alien","ambulance","anchor","angel","anger","angry","anguished","ant","apple","aquarius","aries","arrow_backward","arrow_double_down","arrow_double_up","arrow_down","arrow_down_small","arrow_forward","arrow_heading_down","arrow_heading_up","arrow_left","arrow_lower_left","arrow_lower_right","arrow_right","arrow_right_hook","arrow_up","arrow_up_down","arrow_up_small","arrow_upper_left","arrow_upper_right","arrows_clockwise","arrows_counterclockwise","art","articulated_lorry","astonished","athletic_shoe","atm","b","baby","baby_bottle","baby_chick","baby_symbol","back","baggage_claim","balloon","ballot_box_with_check","bamboo","banana","bangbang","bank","bar_chart","barber","baseball","basketball","bath","bathtub","battery","bear","bee","beer","beers","beetle","beginner","bell","bento","bicyclist","bike","bikini","bird","birthday","black_circle","black_joker","black_large_square","black_medium_small_square","black_medium_square","black_nib","black_small_square","black_square_button","blossom","blowfish","blue_book","blue_car","blue_heart","blush","boar","boat","bomb","book","bookmark","bookmark_tabs","books","boom","boot","bouquet","bow","bowling","bowtie","boy","bread","bride_with_veil","bridge_at_night","briefcase","broken_heart","bug","bulb","bullettrain_front","bullettrain_side","bus","busstop","bust_in_silhouette","busts_in_silhouette","cactus","cake","calendar","calling","camel","camera","cancer","candy","capital_abcd","capricorn","car","card_index","carousel_horse","cat","cat2","cd","chart","chart_with_downwards_trend","chart_with_upwards_trend","checkered_flag","cherries","cherry_blossom","chestnut","chicken","children_crossing","chocolate_bar","christmas_tree","church","cinema","circus_tent","city_sunrise","city_sunset","cl","clap","clapper","clipboard","clock1","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock130","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","closed_book","closed_lock_with_key","closed_umbrella","cloud","clubs","cn","cocktail","coffee","cold_sweat","collision","computer","confetti_ball","confounded","confused","congratulations","construction","construction_worker","convenience_store","cookie","cool","cop","copyright","corn","couple","couple_with_heart","couplekiss","cow","cow2","credit_card","crescent_moon","crocodile","crossed_flags","crown","cry","crying_cat_face","crystal_ball","cupid","curly_loop","currency_exchange","curry","custard","customs","cyclone","dancer","dancers","dango","dart","dash","date","de","deciduous_tree","department_store","diamond_shape_with_a_dot_inside","diamonds","disappointed","disappointed_relieved","dizzy","dizzy_face","do_not_litter","dog","dog2","dollar","dolls","dolphin","door","doughnut","dragon","dragon_face","dress","dromedary_camel","droplet","dvd","e-mail","ear","ear_of_rice","earth_africa","earth_americas","earth_asia","egg","eggplant","eight","eight_pointed_black_star","eight_spoked_asterisk","electric_plug","elephant","email","end","envelope","envelope_with_arrow","es","euro","european_castle","european_post_office","evergreen_tree","exclamation","expressionless","eyeglasses","eyes","facepunch","factory","fallen_leaf","family","fast_forward","fax","fearful","feelsgood","feet","ferris_wheel","file_folder","finnadie","fire","fire_engine","fireworks","first_quarter_moon","first_quarter_moon_with_face","fish","fish_cake","fishing_pole_and_fish","fist","five","flags","flashlight","floppy_disk","flower_playing_cards","flushed","foggy","football","footprints","fork_and_knife","fountain","four","four_leaf_clover","fr","free","fried_shrimp","fries","frog","frowning","fu","fuelpump","full_moon","full_moon_with_face","game_die","gb","gem","gemini","ghost","gift","gift_heart","girl","globe_with_meridians","goat","goberserk","godmode","golf","grapes","green_apple","green_book","green_heart","grey_exclamation","grey_question","grimacing","grin","grinning","guardsman","guitar","gun","haircut","hamburger","hammer","hamster","hand","handbag","hankey","hash","hatched_chick","hatching_chick","headphones","hear_no_evil","heart","heart_decoration","heart_eyes","heart_eyes_cat","heartbeat","heartpulse","hearts","heavy_check_mark","heavy_division_sign","heavy_dollar_sign","heavy_exclamation_mark","heavy_minus_sign","heavy_multiplication_x","heavy_plus_sign","helicopter","herb","hibiscus","high_brightness","high_heel","hocho","honey_pot","honeybee","horse","horse_racing","hospital","hotel","hotsprings","hourglass","hourglass_flowing_sand","house","house_with_garden","hurtrealbad","hushed","ice_cream","icecream","id","ideograph_advantage","imp","inbox_tray","incoming_envelope","information_desk_person","information_source","innocent","interrobang","iphone","it","izakaya_lantern","jack_o_lantern","japan","japanese_castle","japanese_goblin","japanese_ogre","jeans","joy","joy_cat","jp","key","keycap_ten","kimono","kiss","kissing","kissing_cat","kissing_closed_eyes","kissing_heart","kissing_smiling_eyes","koala","koko","kr","lantern","large_blue_circle","large_blue_diamond","large_orange_diamond","last_quarter_moon","last_quarter_moon_with_face","laughing","leaves","ledger","left_luggage","left_right_arrow","leftwards_arrow_with_hook","lemon","leo","leopard","libra","light_rail","link","lips","lipstick","lock","lock_with_ink_pen","lollipop","loop","loudspeaker","love_hotel","love_letter","low_brightness","m","mag","mag_right","mahjong","mailbox","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","man","man_with_gua_pi_mao","man_with_turban","mans_shoe","maple_leaf","mask","massage","meat_on_bone","mega","melon","memo","mens","metal","metro","microphone","microscope","milky_way","minibus","minidisc","mobile_phone_off","money_with_wings","moneybag","monkey","monkey_face","monorail","moon","mortar_board","mount_fuji","mountain_bicyclist","mountain_cableway","mountain_railway","mouse","mouse2","movie_camera","moyai","muscle","mushroom","musical_keyboard","musical_note","musical_score","mute","nail_care","name_badge","neckbeard","necktie","negative_squared_cross_mark","neutral_face","new","new_moon","new_moon_with_face","newspaper","ng","nine","no_bell","no_bicycles","no_entry","no_entry_sign","no_good","no_mobile_phones","no_mouth","no_pedestrians","no_smoking","non-potable_water","nose","notebook","notebook_with_decorative_cover","notes","nut_and_bolt","o","o2","ocean","octocat","octopus","oden","office","ok","ok_hand","ok_woman","older_man","older_woman","on","oncoming_automobile","oncoming_bus","oncoming_police_car","oncoming_taxi","one","open_book","open_file_folder","open_hands","open_mouth","ophiuchus","orange_book","outbox_tray","ox","package","page_facing_up","page_with_curl","pager","palm_tree","panda_face","paperclip","parking","part_alternation_mark","partly_sunny","passport_control","paw_prints","peach","pear","pencil","pencil2","penguin","pensive","performing_arts","persevere","person_frowning","person_with_blond_hair","person_with_pouting_face","phone","pig","pig2","pig_nose","pill","pineapple","pisces","pizza","point_down","point_left","point_right","point_up","point_up_2","police_car","poodle","poop","post_office","postal_horn","postbox","potable_water","pouch","poultry_leg","pound","pouting_cat","pray","princess","punch","purple_heart","purse","pushpin","put_litter_in_its_place","question","rabbit","rabbit2","racehorse","radio","radio_button","rage","rage1","rage2","rage3","rage4","railway_car","rainbow","raised_hand","raised_hands","raising_hand","ram","ramen","rat","recycle","red_car","red_circle","registered","relaxed","relieved","repeat","repeat_one","restroom","revolving_hearts","rewind","ribbon","rice","rice_ball","rice_cracker","rice_scene","ring","rocket","roller_coaster","rooster","rose","rotating_light","round_pushpin","rowboat","ru","rugby_football","runner","running","running_shirt_with_sash","sa","sagittarius","sailboat","sake","sandal","santa","satellite","satisfied","saxophone","school","school_satchel","scissors","scorpius","scream","scream_cat","scroll","seat","secret","see_no_evil","seedling","seven","shaved_ice","sheep","shell","ship","shipit","shirt","shit","shoe","shower","signal_strength","six","six_pointed_star","ski","skull","sleeping","sleepy","slot_machine","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","smile","smile_cat","smiley","smiley_cat","smiling_imp","smirk","smirk_cat","smoking","snail","snake","snowboarder","snowflake","snowman","sob","soccer","soon","sos","sound","space_invader","spades","spaghetti","sparkle","sparkler","sparkles","sparkling_heart","speak_no_evil","speaker","speech_balloon","speedboat","squirrel","star","star2","stars","station","statue_of_liberty","steam_locomotive","stew","straight_ruler","strawberry","stuck_out_tongue","stuck_out_tongue_closed_eyes","stuck_out_tongue_winking_eye","sun_with_face","sunflower","sunglasses","sunny","sunrise","sunrise_over_mountains","surfer","sushi","suspect","suspension_railway","sweat","sweat_drops","sweat_smile","sweet_potato","swimmer","symbols","syringe","tada","tanabata_tree","tangerine","taurus","taxi","tea","telephone","telephone_receiver","telescope","tennis","tent","thought_balloon","three","thumbsdown","thumbsup","ticket","tiger","tiger2","tired_face","tm","toilet","tokyo_tower","tomato","tongue","top","tophat","tractor","traffic_light","train","train2","tram","triangular_flag_on_post","triangular_ruler","trident","triumph","trolleybus","trollface","trophy","tropical_drink","tropical_fish","truck","trumpet","tshirt","tulip","turtle","tv","twisted_rightwards_arrows","two","two_hearts","two_men_holding_hands","two_women_holding_hands","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7981","u7a7a","uk","umbrella","unamused","underage","unlock","up","us","v","vertical_traffic_light","vhs","vibration_mode","video_camera","video_game","violin","virgo","volcano","vs","walking","waning_crescent_moon","waning_gibbous_moon","warning","watch","water_buffalo","watermelon","wave","wavy_dash","waxing_crescent_moon","waxing_gibbous_moon","wc","weary","wedding","whale","whale2","wheelchair","white_check_mark","white_circle","white_flower","white_large_square","white_medium_small_square","white_medium_square","white_small_square","white_square_button","wind_chime","wine_glass","wink","wolf","woman","womans_clothes","womans_hat","womens","worried","wrench","x","yellow_heart","yen","yum","zap","zero","zzz"];
|
|
|
+(function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||c.defaults,this.rules=h.normal,this.options.gfm&&(this.rules=this.options.tables?h.tables:h.gfm)}function t(e,t){if(this.options=t||c.defaults,this.links=e,this.rules=u.normal,this.renderer=this.options.renderer||new n,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?u.breaks:u.gfm:this.options.pedantic&&(this.rules=u.pedantic)}function n(e){this.options=e||{}}function i(e){this.tokens=[],this.token=null,this.options=e||c.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options}function s(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?String.fromCharCode("x"===t.charAt(1)?parseInt(t.substring(2),16):+t.substring(1)):""})}function o(e,t){return e=e.source,t=t||"",function n(i,s){return i?(s=s.source||s,s=s.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(i,s),n):new RegExp(e,t)}}function a(){}function l(e){for(var t,n,i=1;i<arguments.length;i++){t=arguments[i];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}function c(t,n,r){if(r||"function"==typeof n){r||(r=n,n=null),n=l({},c.defaults,n||{});var o,a,h=n.highlight,u=0;try{o=e.lex(t,n)}catch(d){return r(d)}a=o.length;var p=function(e){if(e)return n.highlight=h,r(e);var t;try{t=i.parse(o,n)}catch(s){e=s}return n.highlight=h,e?r(e):r(null,t)};if(!h||h.length<3)return p();if(delete n.highlight,!a)return p();for(;u<o.length;u++)!function(e){return"code"!==e.type?--a||p():h(e.text,e.lang,function(t,n){return t?p(t):null==n||n===e.text?--a||p():(e.text=n,e.escaped=!0,void(--a||p()))})}(o[u])}else try{return n&&(n=l({},c.defaults,n)),i.parse(e.lex(t,n),n)}catch(d){if(d.message+="\nPlease report this to https://github.com/chjj/marked.",(n||c.defaults).silent)return"<p>An error occured:</p><pre>"+s(d.message+"",!0)+"</pre>";throw d}}var h={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:a,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:a,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:a,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};h.bullet=/(?:[*+-]|\d+\.)/,h.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,h.item=o(h.item,"gm")(/bull/g,h.bullet)(),h.list=o(h.list)(/bull/g,h.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+h.def.source+")")(),h.blockquote=o(h.blockquote)("def",h.def)(),h._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",h.html=o(h.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,h._tag)(),h.paragraph=o(h.paragraph)("hr",h.hr)("heading",h.heading)("lheading",h.lheading)("blockquote",h.blockquote)("tag","<"+h._tag)("def",h.def)(),h.normal=l({},h),h.gfm=l({},h.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),h.gfm.paragraph=o(h.paragraph)("(?!","(?!"+h.gfm.fences.source.replace("\\1","\\2")+"|"+h.list.source.replace("\\1","\\3")+"|")(),h.tables=l({},h.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=h,e.lex=function(t,n){var i=new e(n);return i.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,n){for(var i,s,r,o,a,l,c,u,d,e=e.replace(/^ +$/gm,"");e;)if((r=this.rules.newline.exec(e))&&(e=e.substring(r[0].length),r[0].length>1&&this.tokens.push({type:"space"})),r=this.rules.code.exec(e))e=e.substring(r[0].length),r=r[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?r:r.replace(/\n+$/,"")});else if(r=this.rules.fences.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"code",lang:r[2],text:r[3]||""});else if(r=this.rules.heading.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"heading",depth:r[1].length,text:r[2]});else if(t&&(r=this.rules.nptable.exec(e))){for(e=e.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/\n$/,"").split("\n")},u=0;u<l.align.length;u++)l.align[u]=/^ *-+: *$/.test(l.align[u])?"right":/^ *:-+: *$/.test(l.align[u])?"center":/^ *:-+ *$/.test(l.align[u])?"left":null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].split(/ *\| */);this.tokens.push(l)}else if(r=this.rules.lheading.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"heading",depth:"="===r[2]?1:2,text:r[1]});else if(r=this.rules.hr.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"hr"});else if(r=this.rules.blockquote.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"blockquote_start"}),r=r[0].replace(/^ *> ?/gm,""),this.token(r,t,!0),this.tokens.push({type:"blockquote_end"});else if(r=this.rules.list.exec(e)){for(e=e.substring(r[0].length),o=r[2],this.tokens.push({type:"list_start",ordered:o.length>1}),r=r[0].match(this.rules.item),i=!1,d=r.length,u=0;d>u;u++)l=r[u],c=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&u!==d-1&&(a=h.bullet.exec(r[u+1])[0],o===a||o.length>1&&a.length>1||(e=r.slice(u+1).join("\n")+e,u=d-1)),s=i||/\n\n(?!\s*$)/.test(l),u!==d-1&&(i="\n"===l.charAt(l.length-1),s||(s=i)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(r=this.rules.html.exec(e))e=e.substring(r[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===r[1]||"script"===r[1]||"style"===r[1]),text:r[0]});else if(!n&&t&&(r=this.rules.def.exec(e)))e=e.substring(r[0].length),this.tokens.links[r[1].toLowerCase()]={href:r[2],title:r[3]};else if(t&&(r=this.rules.table.exec(e))){for(e=e.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<l.align.length;u++)l.align[u]=/^ *-+: *$/.test(l.align[u])?"right":/^ *:-+: *$/.test(l.align[u])?"center":/^ *:-+ *$/.test(l.align[u])?"left":null;for(u=0;u<l.cells.length;u++)l.cells[u]=l.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(t&&(r=this.rules.paragraph.exec(e)))e=e.substring(r[0].length),this.tokens.push({type:"paragraph",text:"\n"===r[1].charAt(r[1].length-1)?r[1].slice(0,-1):r[1]});else if(r=this.rules.text.exec(e))e=e.substring(r[0].length),this.tokens.push({type:"text",text:r[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var u={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:a,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:a,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};u._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,u._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=o(u.link)("inside",u._inside)("href",u._href)(),u.reflink=o(u.reflink)("inside",u._inside)(),u.normal=l({},u),u.pedantic=l({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=l({},u.normal,{escape:o(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=l({},u.gfm,{br:o(u.br)("{2,}","*")(),text:o(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,n,i){var s=new t(n,i);return s.output(e)},t.prototype.output=function(e){for(var t,n,i,r,o="";e;)if(r=this.rules.escape.exec(e))e=e.substring(r[0].length),o+=r[1];else if(r=this.rules.autolink.exec(e))e=e.substring(r[0].length),"@"===r[2]?(n=this.mangle(":"===r[1].charAt(6)?r[1].substring(7):r[1]),i=this.mangle("mailto:")+n):(n=s(r[1]),i=n),o+=this.renderer.link(i,null,n);else if(this.inLink||!(r=this.rules.url.exec(e))){if(r=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(r[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(r[0])&&(this.inLink=!1),e=e.substring(r[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):s(r[0]):r[0];else if(r=this.rules.link.exec(e))e=e.substring(r[0].length),this.inLink=!0,o+=this.outputLink(r,{href:r[2],title:r[3]}),this.inLink=!1;else if((r=this.rules.reflink.exec(e))||(r=this.rules.nolink.exec(e))){if(e=e.substring(r[0].length),t=(r[2]||r[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=r[0].charAt(0),e=r[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(r,t),this.inLink=!1}else if(r=this.rules.strong.exec(e))e=e.substring(r[0].length),o+=this.renderer.strong(this.output(r[2]||r[1]));else if(r=this.rules.em.exec(e))e=e.substring(r[0].length),o+=this.renderer.em(this.output(r[2]||r[1]));else if(r=this.rules.code.exec(e))e=e.substring(r[0].length),o+=this.renderer.codespan(s(r[2],!0));else if(r=this.rules.br.exec(e))e=e.substring(r[0].length),o+=this.renderer.br();else if(r=this.rules.del.exec(e))e=e.substring(r[0].length),o+=this.renderer.del(this.output(r[1]));else if(r=this.rules.text.exec(e))e=e.substring(r[0].length),o+=this.renderer.text(s(this.smartypants(r[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(r[0].length),n=s(r[1]),i=n,o+=this.renderer.link(i,null,n);return o},t.prototype.outputLink=function(e,t){var n=s(t.href),i=t.title?s(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,i,this.output(e[1])):this.renderer.image(n,i,s(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",i=e.length,s=0;i>s;s++)t=e.charCodeAt(s),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},n.prototype.code=function(e,t,n){if(this.options.highlight){var i=this.options.highlight(e,t);null!=i&&i!==e&&(n=!0,e=i)}return t?'<pre><code class="'+this.options.langPrefix+s(t,!0)+'">'+(n?e:s(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:s(e,!0))+"\n</code></pre>"},n.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},n.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},n.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},n.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},n.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},n.prototype.tablecell=function(e,t){var n=t.header?"th":"td",i=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return i+e+"</"+n+">\n"},n.prototype.strong=function(e){return"<strong>"+e+"</strong>"},n.prototype.em=function(e){return"<em>"+e+"</em>"},n.prototype.codespan=function(e){return"<code>"+e+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(e){return"<del>"+e+"</del>"},n.prototype.link=function(e,t,n){if(this.options.sanitize){try{var i=decodeURIComponent(r(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(s){return""}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:"))return""}var o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>"},n.prototype.image=function(e,t,n){var i='<img src="'+e+'" alt="'+n+'"';return t&&(i+=' title="'+t+'"'),i+=this.options.xhtml?"/>":">"},n.prototype.text=function(e){return e},i.parse=function(e,t,n){var s=new i(t,n);return s.parse(e)},i.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=this.tok();return n},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},i.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,i,s,r="",o="";for(n="",e=0;e<this.token.header.length;e++)i={header:!0,align:this.token.align[e]},n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(r+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",s=0;s<t.length;s++)n+=this.renderer.tablecell(this.inline.output(t[s]),{header:!1,align:this.token.align[s]});o+=this.renderer.tablerow(n)}return this.renderer.table(r,o);case"blockquote_start":for(var o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":for(var o="",a=this.token.ordered;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,a);case"list_item_start":for(var o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(var o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},a.exec=a,c.options=c.setOptions=function(e){return l(c.defaults,e),c},c.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new n,xhtml:!1},c.Parser=i,c.parser=i.parse,c.Renderer=n,c.Lexer=e,c.lexer=e.lex,c.InlineLexer=t,c.inlineLexer=t.output,c.parse=c,"undefined"!=typeof module&&"object"==typeof exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):this.marked=c}).call(function(){return this||("undefined"!=typeof window?window:global)}()),!function(e){"use strict";var t=function(t,n){var i=["autofocus","savable","hideable","width","height","resize","iconlibrary","language","footer","fullscreen","hiddenButtons","disabledButtons"];e.each(i,function(i,s){"undefined"!=typeof e(t).data(s)&&(n="object"==typeof n?n:{},n[s]=e(t).data(s))}),this.$ns="bootstrap-markdown",this.$element=e(t),this.$editable={el:null,type:null,attrKeys:[],attrValues:[],content:null},this.$options=e.extend(!0,{},e.fn.markdown.defaults,n,this.$element.data("options")),this.$oldContent=null,this.$isPreview=!1,this.$isFullscreen=!1,this.$editor=null,this.$textarea=null,this.$handler=[],this.$callback=[],this.$nextTab=[],this.showEditor()};t.prototype={constructor:t,__alterButtons:function(t,n){var i=this.$handler,s="all"==t,r=this;e.each(i,function(e,i){var o=!0;o=s?!1:i.indexOf(t)<0,o===!1&&n(r.$editor.find('button[data-handler="'+i+'"]'))})},__buildButtons:function(t,n){var i,s=this.$ns,r=this.$handler,o=this.$callback;for(i=0;i<t.length;i++){var a,l=t[i];for(a=0;a<l.length;a++){var c,h=l[a].data,u=e("<div/>",{"class":"btn-group"});for(c=0;c<h.length;c++){var d,p,f=h[c],g=s+"-"+f.name,_=this.__getIcon(f.icon),m=f.btnText?f.btnText:"",b=f.btnClass?f.btnClass:"btn",y=f.tabIndex?f.tabIndex:"-1",v="undefined"!=typeof f.hotkey?f.hotkey:"",k="undefined"!=typeof jQuery.hotkeys&&""!==v?" ("+v+")":"";d=e("<button></button>"),d.text(" "+this.__localize(m)).addClass("btn-default btn-sm").addClass(b),b.match(/btn\-(primary|success|info|warning|danger|link)/)&&d.removeClass("btn-default"),d.attr({type:"button",title:this.__localize(f.title)+k,tabindex:y,"data-provider":s,"data-handler":g,"data-hotkey":v}),f.toggle===!0&&d.attr("data-toggle","button"),p=e("<span/>"),p.addClass(_),p.prependTo(d),u.append(d),r.push(g),o.push(f.callback)}n.append(u)}}return n},__setListener:function(){var t="undefined"!=typeof this.$textarea.attr("rows"),n=this.$textarea.val().split("\n").length>5?this.$textarea.val().split("\n").length:"5",i=t?this.$textarea.attr("rows"):n;this.$textarea.attr("rows",i),this.$options.resize&&this.$textarea.css("resize",this.$options.resize),this.$textarea.on("focus",e.proxy(this.focus,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)).on("change",e.proxy(this.change,this)).on("select",e.proxy(this.select,this)),this.eventSupported("keydown")&&this.$textarea.on("keydown",e.proxy(this.keydown,this)),this.$textarea.data("markdown",this)},__handle:function(t){var n=e(t.currentTarget),i=this.$handler,s=this.$callback,r=n.attr("data-handler"),o=i.indexOf(r),a=s[o];e(t.currentTarget).focus(),a(this),this.change(this),r.indexOf("cmdSave")<0&&this.$textarea.focus(),t.preventDefault()},__localize:function(t){var n=e.fn.markdown.messages,i=this.$options.language;return"undefined"!=typeof n&&"undefined"!=typeof n[i]&&"undefined"!=typeof n[i][t]?n[i][t]:t},__getIcon:function(e){return"object"==typeof e?e[this.$options.iconlibrary]:e},setFullscreen:function(t){var n=this.$editor,i=this.$textarea;t===!0?(n.addClass("md-fullscreen-mode"),e("body").addClass("md-nooverflow"),this.$options.onFullscreen(this)):(n.removeClass("md-fullscreen-mode"),e("body").removeClass("md-nooverflow"),1==this.$isPreview&&this.hidePreview().showPreview()),this.$isFullscreen=t,i.focus()},showEditor:function(){var t,n=this,i=this.$ns,s=this.$element,r=(s.css("height"),s.css("width"),this.$editable),o=this.$handler,a=this.$callback,l=this.$options,c=e("<div/>",{"class":"md-editor",click:function(){n.focus()}});if(null===this.$editor){var h=e("<div/>",{"class":"md-header btn-toolbar"}),u=[];if(l.buttons.length>0&&(u=u.concat(l.buttons[0])),l.additionalButtons.length>0&&(u=u.concat(l.additionalButtons[0])),l.reorderButtonGroups.length>0&&(u=u.filter(function(e){return l.reorderButtonGroups.indexOf(e.name)>-1}).sort(function(e,t){return l.reorderButtonGroups.indexOf(e.name)<l.reorderButtonGroups.indexOf(t.name)?-1:l.reorderButtonGroups.indexOf(e.name)>l.reorderButtonGroups.indexOf(t.name)?1:0})),u.length>0&&(h=this.__buildButtons([u],h)),l.fullscreen.enable&&h.append('<div class="md-controls"><a class="md-control md-control-fullscreen" href="#"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOn)+'"></span></a></div>').on("click",".md-control-fullscreen",function(e){e.preventDefault(),n.setFullscreen(!0)}),c.append(h),s.is("textarea"))s.before(c),t=s,t.addClass("md-input"),c.append(t);else{var d="function"==typeof toMarkdown?toMarkdown(s.html()):s.html(),p=e.trim(d);t=e("<textarea/>",{"class":"md-input",val:p}),c.append(t),r.el=s,r.type=s.prop("tagName").toLowerCase(),r.content=s.html(),e(s[0].attributes).each(function(){r.attrKeys.push(this.nodeName),r.attrValues.push(this.nodeValue)}),s.replaceWith(c)}var f=e("<div/>",{"class":"md-footer"}),g=!1,_="";if(l.savable){g=!0;var m="cmdSave";o.push(m),a.push(l.onSave),f.append('<button class="btn btn-success" data-provider="'+i+'" data-handler="'+m+'"><i class="icon icon-white icon-ok"></i> '+this.__localize("Save")+"</button>")}if(_="function"==typeof l.footer?l.footer(this):l.footer,""!==e.trim(_)&&(g=!0,f.append(_)),g&&c.append(f),l.width&&"inherit"!==l.width&&(jQuery.isNumeric(l.width)?(c.css("display","table"),t.css("width",l.width+"px")):c.addClass(l.width)),l.height&&"inherit"!==l.height)if(jQuery.isNumeric(l.height)){var b=l.height;h&&(b=Math.max(0,b-h.outerHeight())),f&&(b=Math.max(0,b-f.outerHeight())),t.css("height",b+"px")}else c.addClass(l.height);this.$editor=c,this.$textarea=t,this.$editable=r,this.$oldContent=this.getContent(),this.__setListener(),this.$editor.attr("id",(new Date).getTime()),this.$editor.on("click",'[data-provider="bootstrap-markdown"]',e.proxy(this.__handle,this)),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this.eventSupported("keydown")&&"object"==typeof jQuery.hotkeys&&h.find('[data-provider="bootstrap-markdown"]').each(function(){var n=e(this),i=n.attr("data-hotkey");""!==i.toLowerCase()&&t.bind("keydown",i,function(){return n.trigger("click"),!1})}),"preview"===l.initialstate?this.showPreview():"fullscreen"===l.initialstate&&l.fullscreen.enable&&this.setFullscreen(!0)}else this.$editor.show();return l.autofocus&&(this.$textarea.focus(),this.$editor.addClass("active")),l.fullscreen.enable&&l.fullscreen!==!1&&(this.$editor.append('<div class="md-fullscreen-controls"><a href="#" class="exit-fullscreen" title="Exit fullscreen"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOff)+'"></span></a></div>'),this.$editor.on("click",".exit-fullscreen",function(e){e.preventDefault(),n.setFullscreen(!1)})),this.hideButtons(l.hiddenButtons),this.disableButtons(l.disabledButtons),l.onShow(this),this},parseContent:function(e){var t,e=e||this.$textarea.val();return t=this.$options.parser?this.$options.parser(e):"object"==typeof markdown?markdown.toHTML(e):"function"==typeof marked?marked(e):e},showPreview:function(){var t,n,i=this.$options,s=this.$textarea,r=s.next(),o=e("<div/>",{"class":"md-preview","data-provider":"markdown-preview"});return 1==this.$isPreview?this:(this.$isPreview=!0,this.disableButtons("all").enableButtons("cmdPreview"),n=i.onPreview(this),t="string"==typeof n?n:this.parseContent(),o.html(t),r&&"md-footer"==r.attr("class")?o.insertBefore(r):s.parent().append(o),o.css({width:s.outerWidth()+"px",height:s.outerHeight()+"px"}),this.$options.resize&&o.css("resize",this.$options.resize),s.hide(),o.data("markdown",this),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this)},hidePreview:function(){this.$isPreview=!1;var e=this.$editor.find('div[data-provider="markdown-preview"]');return e.remove(),this.enableButtons("all"),this.disableButtons(this.$options.disabledButtons),this.$textarea.show(),this.__setListener(),this},isDirty:function(){return this.$oldContent!=this.getContent()},getContent:function(){return this.$textarea.val()},setContent:function(e){return this.$textarea.val(e),this},findSelection:function(e){var t,n=this.getContent();if(t=n.indexOf(e),t>=0&&e.length>0){var i,s=this.getSelection();return this.setSelection(t,t+e.length),i=this.getSelection(),this.setSelection(s.start,s.end),i}return null},getSelection:function(){var e=this.$textarea[0];return("selectionStart"in e&&function(){var t=e.selectionEnd-e.selectionStart;return{start:e.selectionStart,end:e.selectionEnd,length:t,text:e.value.substr(e.selectionStart,t)}}||function(){return null})()},setSelection:function(e,t){var n=this.$textarea[0];return("selectionStart"in n&&function(){n.selectionStart=e,n.selectionEnd=t}||function(){return null})()},replaceSelection:function(e){var t=this.$textarea[0];return("selectionStart"in t&&function(){return t.value=t.value.substr(0,t.selectionStart)+e+t.value.substr(t.selectionEnd,t.value.length),t.selectionStart=t.value.length,this}||function(){return t.value+=e,jQuery(t)})()},getNextTab:function(){if(0===this.$nextTab.length)return null;var e,t=this.$nextTab.shift();return"function"==typeof t?e=t():"object"==typeof t&&t.length>0&&(e=t),e},setNextTab:function(e,t){if("string"==typeof e){var n=this;this.$nextTab.push(function(){return n.findSelection(e)})}else if("number"==typeof e&&"number"==typeof t){var i=this.getSelection();this.setSelection(e,t),this.$nextTab.push(this.getSelection()),this.setSelection(i.start,i.end)}},__parseButtonNameParam:function(e){var t=[];return t="string"==typeof e?e.split(","):e},enableButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e){i.__alterButtons(n[e],function(e){e.removeAttr("disabled")})}),this},disableButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e){i.__alterButtons(n[e],function(e){e.attr("disabled","disabled")})}),this},hideButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e){i.__alterButtons(n[e],function(e){e.addClass("hidden")})}),this},showButtons:function(t){var n=this.__parseButtonNameParam(t),i=this;return e.each(n,function(e){i.__alterButtons(n[e],function(e){e.removeClass("hidden")})}),this},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t="function"==typeof this.$element[e]),t},keyup:function(e){var t=!1;switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:var n;if(n=this.getNextTab(),null!==n){var i=this;setTimeout(function(){i.setSelection(n.start,n.end)},500),t=!0}else{var s=this.getSelection();s.start==s.end&&s.end==this.getContent().length?t=!1:(this.setSelection(this.getContent().length,this.getContent().length),t=!0)}break;case 13:t=!1;break;case 27:this.$isFullscreen&&this.setFullscreen(!1),t=!1;break;default:t=!1}t&&(e.stopPropagation(),e.preventDefault()),this.$options.onChange(this)},change:function(){return this.$options.onChange(this),this},select:function(){return this.$options.onSelect(this),this},focus:function(){var t=this.$options,n=(t.hideable,this.$editor);return n.addClass("active"),e(document).find(".md-editor").each(function(){if(e(this).attr("id")!==n.attr("id")){var t;t=e(this).find("textarea").data("markdown"),null===t&&(t=e(this).find('div[data-provider="markdown-preview"]').data("markdown")),t&&t.blur()}}),t.onFocus(this),this},blur:function(){var t=this.$options,n=t.hideable,i=this.$editor,s=this.$editable;if(i.hasClass("active")||0===this.$element.parent().length){if(i.removeClass("active"),n)if(null!==s.el){var r=e("<"+s.type+"/>"),o=this.getContent(),a=this.parseContent(o);e(s.attrKeys).each(function(e){r.attr(s.attrKeys[e],s.attrValues[e])}),r.html(a),i.replaceWith(r)}else i.hide();t.onBlur(this)}return this}};var n=e.fn.markdown;e.fn.markdown=function(n){return this.each(function(){var i=e(this),s=i.data("markdown"),r="object"==typeof n&&n;s||i.data("markdown",s=new t(this,r))})},e.fn.markdown.messages={},e.fn.markdown.defaults={autofocus:!1,hideable:!1,savable:!1,width:"inherit",height:"inherit",resize:"none",iconlibrary:"glyph",language:"en",initialstate:"editor",parser:null,buttons:[[{name:"groupFont",data:[{name:"cmdBold",hotkey:"Ctrl+B",title:"Bold",icon:{glyph:"glyphicon glyphicon-bold",fa:"fa fa-bold","fa-3":"icon-bold"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("strong text"):i.text,"**"===s.substr(i.start-2,2)&&"**"===s.substr(i.end,2)?(e.setSelection(i.start-2,i.end+2),e.replaceSelection(t),n=i.start-2):(e.replaceSelection("**"+t+"**"),n=i.start+2),e.setSelection(n,n+t.length)}},{name:"cmdItalic",title:"Italic",hotkey:"Ctrl+I",icon:{glyph:"glyphicon glyphicon-italic",fa:"fa fa-italic","fa-3":"icon-italic"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("emphasized text"):i.text,"_"===s.substr(i.start-1,1)&&"_"===s.substr(i.end,1)?(e.setSelection(i.start-1,i.end+1),e.replaceSelection(t),n=i.start-1):(e.replaceSelection("_"+t+"_"),n=i.start+1),e.setSelection(n,n+t.length)}},{name:"cmdHeading",title:"Heading",hotkey:"Ctrl+H",icon:{glyph:"glyphicon glyphicon-header",fa:"fa fa-header","fa-3":"icon-font"},callback:function(e){var t,n,i,s,r=e.getSelection(),o=e.getContent();t=0===r.length?e.__localize("heading text"):r.text+"\n",i=4,"### "===o.substr(r.start-i,i)||(i=3,"###"===o.substr(r.start-i,i))?(e.setSelection(r.start-i,r.end),e.replaceSelection(t),n=r.start-i):r.start>0&&(s=o.substr(r.start-1,1),!!s&&"\n"!=s)?(e.replaceSelection("\n\n### "+t),n=r.start+6):(e.replaceSelection("### "+t),n=r.start+4),e.setSelection(n,n+t.length)}}]},{name:"groupLink",data:[{name:"cmdUrl",title:"URL/Link",hotkey:"Ctrl+L",icon:{glyph:"glyphicon glyphicon-link",fa:"fa fa-link","fa-3":"icon-link"},callback:function(t){{var n,i,s,r=t.getSelection();t.getContent()}if(n=0===r.length?t.__localize("enter link description here"):r.text,s=prompt(t.__localize("Insert Hyperlink"),"http://"),null!==s&&""!==s&&"http://"!==s&&"http"===s.substr(0,4)){var o=e("<div>"+s+"</div>").text();t.replaceSelection("["+n+"]("+o+")"),i=r.start+1,t.setSelection(i,i+n.length)}}},{name:"cmdImage",title:"Image",hotkey:"Ctrl+G",icon:{glyph:"glyphicon glyphicon-picture",fa:"fa fa-picture-o","fa-3":"icon-picture"},callback:function(t){{var n,i,s,r=t.getSelection();t.getContent()}if(n=0===r.length?t.__localize("enter image description here"):r.text,s=prompt(t.__localize("Insert Image Hyperlink"),"http://"),null!==s&&""!==s&&"http://"!==s&&"http"===s.substr(0,4)){var o=e("<div>"+s+"</div>").text();t.replaceSelection("+'")'),i=r.start+2,t.setNextTab(t.__localize("enter image title here")),t.setSelection(i,i+n.length)}}}]},{name:"groupMisc",data:[{name:"cmdList",hotkey:"Ctrl+U",title:"Unordered List",icon:{glyph:"glyphicon glyphicon-list",fa:"fa fa-list","fa-3":"icon-list-ul"},callback:function(t){{var n,i,s=t.getSelection();t.getContent()}if(0===s.length)n=t.__localize("list text here"),t.replaceSelection("- "+n),i=s.start+2;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("- "+n),i=s.start+2;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="- "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+4}t.setSelection(i,i+n.length)}},{name:"cmdListO",hotkey:"Ctrl+O",title:"Ordered List",icon:{glyph:"glyphicon glyphicon-th-list",fa:"fa fa-list-ol","fa-3":"icon-list-ol"},callback:function(t){{var n,i,s=t.getSelection();t.getContent()}if(0===s.length)n=t.__localize("list text here"),t.replaceSelection("1. "+n),i=s.start+3;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("1. "+n),i=s.start+3;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="1. "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+5}t.setSelection(i,i+n.length)}},{name:"cmdCode",hotkey:"Ctrl+K",title:"Code",icon:{glyph:"glyphicon glyphicon-asterisk",fa:"fa fa-code","fa-3":"icon-code"},callback:function(e){var t,n,i=e.getSelection(),s=e.getContent();t=0===i.length?e.__localize("code text here"):i.text,"```\n"===s.substr(i.start-4,4)&&"\n```"===s.substr(i.end,4)?(e.setSelection(i.start-4,i.end+4),e.replaceSelection(t),n=i.start-4):"`"===s.substr(i.start-1,1)&&"`"===s.substr(i.end,1)?(e.setSelection(i.start-1,i.end+1),e.replaceSelection(t),n=i.start-1):s.indexOf("\n")>-1?(e.replaceSelection("```\n"+t+"\n```"),n=i.start+4):(e.replaceSelection("`"+t+"`"),n=i.start+1),e.setSelection(n,n+t.length)
|
|
|
+}},{name:"cmdQuote",hotkey:"Ctrl+Q",title:"Quote",icon:{glyph:"glyphicon glyphicon-comment",fa:"fa fa-quote-left","fa-3":"icon-quote-left"},callback:function(t){{var n,i,s=t.getSelection();t.getContent()}if(0===s.length)n=t.__localize("quote here"),t.replaceSelection("> "+n),i=s.start+2;else if(s.text.indexOf("\n")<0)n=s.text,t.replaceSelection("> "+n),i=s.start+2;else{var r=[];r=s.text.split("\n"),n=r[0],e.each(r,function(e,t){r[e]="> "+t}),t.replaceSelection("\n\n"+r.join("\n")),i=s.start+4}t.setSelection(i,i+n.length)}}]},{name:"groupUtil",data:[{name:"cmdPreview",toggle:!0,hotkey:"Ctrl+P",title:"Preview",btnText:"Preview",btnClass:"btn btn-primary btn-sm",icon:{glyph:"glyphicon glyphicon-search",fa:"fa fa-search","fa-3":"icon-search"},callback:function(e){var t=e.$isPreview;t===!1?e.showPreview():e.hidePreview()}}]}]],additionalButtons:[],reorderButtonGroups:[],hiddenButtons:[],disabledButtons:[],footer:"",fullscreen:{enable:!0,icons:{fullscreenOn:{fa:"fa fa-expand",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-full"},fullscreenOff:{fa:"fa fa-compress",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-small"}}},onShow:function(){},onPreview:function(){},onSave:function(){},onBlur:function(){},onFocus:function(){},onChange:function(){},onFullscreen:function(){},onSelect:function(){}},e.fn.markdown.Constructor=t,e.fn.markdown.noConflict=function(){return e.fn.markdown=n,this};var i=function(e){var t=e;return t.data("markdown")?void t.data("markdown").showEditor():void t.markdown()},s=function(){var t=e(document.activeElement);e(document).find(".md-editor").each(function(){var n=e(this),i=t.closest(".md-editor")[0]===this,s=n.find("textarea").data("markdown")||n.find('div[data-provider="markdown-preview"]').data("markdown");s&&!i&&s.blur()})};e(document).on("click.markdown.data-api",'[data-provide="markdown-editable"]',function(t){i(e(this)),t.preventDefault()}).on("click focusin",function(e){s(e)}).ready(function(){e('textarea[data-provide="markdown"]').each(function(){i(e(this))})})}(window.jQuery),!function(e){if("function"==typeof define&&define.amd)define(["jquery"],e);else if("object"==typeof module&&module.exports){var t=require("jquery");module.exports=e(t)}else e(jQuery)}(function(e){if("undefined"==typeof e)throw new Error("jQuery.textcomplete requires jQuery");return+function(e){"use strict";var t=function(e){console.warn&&console.warn(e)},n=1;e.fn.textcomplete=function(i,s){var r=Array.prototype.slice.call(arguments);return this.each(function(){var o=this,a=e(this),l=a.data("textComplete");if(l||(s||(s={}),s._oid=n++,l=new e.fn.textcomplete.Completer(this,s),a.data("textComplete",l)),"string"==typeof i){if(!l)return;r.shift(),l[i].apply(l,r),"destroy"===i&&a.removeData("textComplete")}else e.each(i,function(n){e.each(["header","footer","placement","maxCount"],function(e){n[e]&&(l.option[e]=n[e],t(e+"as a strategy param is deprecated. Use option."),delete n[e])})}),l.register(e.fn.textcomplete.Strategy.parse(i,{el:o,$el:a}))})}}(e),+function(e){"use strict";function t(n,i){if(this.$el=e(n),this.id="textcomplete"+r++,this.strategies=[],this.views=[],this.option=e.extend({},t._getDefaults(),i),!this.$el.is("input[type=text]")&&!this.$el.is("textarea")&&!n.isContentEditable&&"true"!=n.contentEditable)throw new Error("textcomplete must be called on a Textarea or a ContentEditable.");if(n===document.activeElement)this.initialize();else{var s=this;this.$el.one("focus."+this.id,function(){s.initialize()})}}var n=function(e){var t,n;return function(){var i=Array.prototype.slice.call(arguments);if(t)return void(n=i);t=!0;var s=this;i.unshift(function r(){if(n){var i=n;n=void 0,i.unshift(r),e.apply(s,i)}else t=!1}),e.apply(this,i)}},i=function(e){return"[object String]"===Object.prototype.toString.call(e)},s=function(e){return"[object Function]"===Object.prototype.toString.call(e)},r=0;t._getDefaults=function(){return t.DEFAULTS||(t.DEFAULTS={appendTo:e("body"),zIndex:"100"}),t.DEFAULTS},e.extend(t.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,initialize:function(){var t=this.$el.get(0);this.dropdown=new e.fn.textcomplete.Dropdown(t,this,this.option);var n,i;this.option.adapter?n=this.option.adapter:(i=this.$el.is("textarea")||this.$el.is("input[type=text]")?"number"==typeof t.selectionEnd?"Textarea":"IETextarea":"ContentEditable",n=e.fn.textcomplete[i]),this.adapter=new n(t,this,this.option)},destroy:function(){this.$el.off("."+this.id),this.adapter&&this.adapter.destroy(),this.dropdown&&this.dropdown.destroy(),this.$el=this.adapter=this.dropdown=null},trigger:function(e,t){this.dropdown||this.initialize(),null!=e||(e=this.adapter.getTextFromHeadToCaret());var n=this._extractSearchQuery(e);if(n.length){var i=n[1];if(t&&this._term===i)return;this._term=i,this._search.apply(this,n)}else this._term=null,this.dropdown.deactivate()},fire:function(e){var t=Array.prototype.slice.call(arguments,1);return this.$el.trigger(e,t),this},register:function(e){Array.prototype.push.apply(this.strategies,e)},select:function(e,t,n){this._term=null,this.adapter.select(e,t,n),this.fire("change").fire("textComplete:select",e,t),this.adapter.focus()},_clearAtNext:!0,_term:null,_extractSearchQuery:function(e){for(var t=0;t<this.strategies.length;t++){var n=this.strategies[t],r=n.context(e);if(r||""===r){var o=s(n.match)?n.match(e):n.match;i(r)&&(e=r);var a=e.match(o);if(a)return[n,a[n.index],a]}}return[]},_search:n(function(e,t,n,i){var s=this;t.search(n,function(i,r){s.dropdown.shown||s.dropdown.activate(),s._clearAtNext&&(s.dropdown.clear(),s._clearAtNext=!1),s.dropdown.setPosition(s.adapter.getCaretPosition()),s.dropdown.render(s._zip(i,t,n)),r||(e(),s._clearAtNext=!0)},i)}),_zip:function(t,n,i){return e.map(t,function(e){return{value:e,strategy:n,term:i}})}}),e.fn.textcomplete.Completer=t}(e),+function(e){"use strict";function t(n,i,r){this.$el=t.createElement(r),this.completer=i,this.id=i.id+"dropdown",this._data=[],this.$inputEl=e(n),this.option=r,r.listPosition&&(this.setPosition=r.listPosition),r.height&&this.$el.height(r.height);var o=this;e.each(["maxCount","placement","footer","header","noResultsMessage","className"],function(e,t){null!=r[t]&&(o[t]=r[t])}),this._bindEvents(n),s[this.id]=this}var n=e(window),i=function(e,t){var n,i,s=t.strategy.idProperty;for(n=0;n<e.length;n++)if(i=e[n],i.strategy===t.strategy)if(s){if(i.value[s]===t.value[s])return!0}else if(i.value===t.value)return!0;return!1},s={};e(document).on("click",function(t){var n=t.originalEvent&&t.originalEvent.keepTextCompleteDropdown;e.each(s,function(e,t){e!==n&&t.deactivate()})});var r={SKIP_DEFAULT:0,KEY_UP:1,KEY_DOWN:2,KEY_ENTER:3,KEY_PAGEUP:4,KEY_PAGEDOWN:5,KEY_ESCAPE:6};e.extend(t,{createElement:function(t){var n=t.appendTo;n instanceof e||(n=e(n));var i=e("<ul></ul>").addClass("dropdown-menu textcomplete-dropdown").attr("id","textcomplete-dropdown-"+t._oid).css({display:"none",left:0,position:"absolute",zIndex:t.zIndex}).appendTo(n);return i}}),e.extend(t.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:10,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el=this.$inputEl=this.completer=null,delete s[this.id]},render:function(t){var n=this._buildContents(t),i=e.map(this.data,function(e){return e.value});this.data.length?(this._renderHeader(i),this._renderFooter(i),n&&(this._renderContents(n),this._fitToBottom(),this._activateIndexedItem()),this._setScroll()):this.noResultsMessage?this._renderNoResultsMessage(i):this.shown&&this.deactivate()},setPosition:function(t){this.$el.css(this._applyPlacement(t));var n="absolute";return this.$inputEl.add(this.$inputEl.parents()).each(function(){return"absolute"===e(this).css("position")?!1:"fixed"===e(this).css("position")?(n="fixed",!1):void 0}),this.$el.css({position:n}),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=this._$noResultsMessage=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(e){return 38===e.keyCode||e.ctrlKey&&80===e.keyCode},isDown:function(e){return 40===e.keyCode||e.ctrlKey&&78===e.keyCode},isEnter:function(e){var t=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey;return!t&&(13===e.keyCode||9===e.keyCode||this.option.completeOnSpace===!0&&32===e.keyCode)},isPageup:function(e){return 33===e.keyCode},isPagedown:function(e){return 34===e.keyCode},isEscape:function(e){return 27===e.keyCode},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",e.proxy(this._onClick,this)),this.$el.on("touchstart."+this.id,".textcomplete-item",e.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",e.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,e.proxy(this._onKeydown,this))},_onClick:function(t){var n=e(t.target);t.preventDefault(),t.originalEvent.keepTextCompleteDropdown=this.id,n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item"));var i=this.data[parseInt(n.data("index"),10)];this.completer.select(i.value,i.strategy,t);var s=this;setTimeout(function(){s.deactivate(),"touchstart"===t.type&&s.$inputEl.focus()},0)},_onMouseover:function(t){var n=e(t.target);t.preventDefault(),n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item")),this._index=parseInt(n.data("index"),10),this._activateIndexedItem()},_onKeydown:function(t){if(this.shown){var n;switch(e.isFunction(this.option.onKeydown)&&(n=this.option.onKeydown(t,r)),null==n&&(n=this._defaultKeydown(t)),n){case r.KEY_UP:t.preventDefault(),this._up();break;case r.KEY_DOWN:t.preventDefault(),this._down();break;case r.KEY_ENTER:t.preventDefault(),this._enter(t);break;case r.KEY_PAGEUP:t.preventDefault(),this._pageup();break;case r.KEY_PAGEDOWN:t.preventDefault(),this._pagedown();break;case r.KEY_ESCAPE:t.preventDefault(),this.deactivate()}}},_defaultKeydown:function(e){return this.isUp(e)?r.KEY_UP:this.isDown(e)?r.KEY_DOWN:this.isEnter(e)?r.KEY_ENTER:this.isPageup(e)?r.KEY_PAGEUP:this.isPagedown(e)?r.KEY_PAGEDOWN:this.isEscape(e)?r.KEY_ESCAPE:void 0},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(e){var t=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(t.value,t.strategy,e),this.deactivate()},_pageup:function(){var t=0,n=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(i){return e(this).position().top+e(this).outerHeight()>n?(t=i,!1):void 0}),this._index=t,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var t=this.data.length-1,n=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(i){return e(this).position().top>n?(t=i,!1):void 0}),this._index=t,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var e=this._getActiveElement(),t=e.position().top,n=e.outerHeight(),i=this.$el.innerHeight(),s=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>t?this.$el.scrollTop(t+s):t+n>i&&this.$el.scrollTop(t+n+s-i)},_buildContents:function(e){var t,n,s,r="";for(n=0;n<e.length&&this.data.length!==this.maxCount;n++)t=e[n],i(this.data,t)||(s=this.data.length,this.data.push(t),r+='<li class="textcomplete-item" data-index="'+s+'"><a>',r+=t.strategy.template(t.value,t.term),r+="</a></li>");return r},_renderHeader:function(t){if(this.header){this._$header||(this._$header=e('<li class="textcomplete-header"></li>').prependTo(this.$el));var n=e.isFunction(this.header)?this.header(t):this.header;this._$header.html(n)}},_renderFooter:function(t){if(this.footer){this._$footer||(this._$footer=e('<li class="textcomplete-footer"></li>').appendTo(this.$el));var n=e.isFunction(this.footer)?this.footer(t):this.footer;this._$footer.html(n)}},_renderNoResultsMessage:function(t){if(this.noResultsMessage){this._$noResultsMessage||(this._$noResultsMessage=e('<li class="textcomplete-no-results-message"></li>').appendTo(this.$el));var n=e.isFunction(this.noResultsMessage)?this.noResultsMessage(t):this.noResultsMessage;this._$noResultsMessage.html(n)}},_renderContents:function(e){this._$footer?this._$footer.before(e):this.$el.append(e)},_fitToBottom:function(){var e=n.scrollTop()+n.height(),t=this.$el.height();this.$el.position().top+t>e&&this.$el.offset({top:e-t})},_applyPlacement:function(e){return-1!==this.placement.indexOf("top")?e={top:"auto",bottom:this.$el.parent().height()-e.top+e.lineHeight,left:e.left}:(e.bottom="auto",delete e.lineHeight),-1!==this.placement.indexOf("absleft")?e.left=0:-1!==this.placement.indexOf("absright")&&(e.right=0,e.left="auto"),e}}),e.fn.textcomplete.Dropdown=t,e.extend(e.fn.textcomplete,r)}(e),+function(e){"use strict";function t(t){e.extend(this,t),this.cache&&(this.search=n(this.search))}var n=function(e){var t={};return function(n,i){t[n]?i(t[n]):e.call(this,n,function(e){t[n]=(t[n]||[]).concat(e),i.apply(null,arguments)})}};t.parse=function(n,i){return e.map(n,function(e){var n=new t(e);return n.el=i.el,n.$el=i.$el,n})},e.extend(t.prototype,{match:null,replace:null,search:null,cache:!1,context:function(){return!0},index:2,template:function(e){return e},idProperty:null}),e.fn.textcomplete.Strategy=t}(e),+function(e){"use strict";function t(){}var n=Date.now||function(){return(new Date).getTime()},i=function(e,t){var i,s,r,o,a,l=function(){var c=n()-o;t>c?i=setTimeout(l,t-c):(i=null,a=e.apply(r,s),r=s=null)};return function(){return r=this,s=arguments,o=n(),i||(i=setTimeout(l,t)),a}};e.extend(t.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(t,n,s){this.el=t,this.$el=e(t),this.id=n.id+this.constructor.name,this.completer=n,this.option=s,this.option.debounce&&(this._onKeyup=i(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var e=this._getCaretRelativePosition(),t=this.$el.offset();return e.top+=t.top,e.left+=t.left,e},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,e.proxy(this._onKeyup,this))},_onKeyup:function(e){this._skipSearch(e)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(e){switch(e.keyCode){case 13:case 40:case 38:return!0}if(e.ctrlKey)switch(e.keyCode){case 78:case 80:return!0}}}),e.fn.textcomplete.Adapter=t}(e),+function(e){"use strict";function t(e,t,n){this.initialize(e,t,n)}t.DIV_PROPERTIES={left:-9999,position:"absolute",top:0,whiteSpace:"pre-wrap"},t.COPY_PROPERTIES=["border-width","font-family","font-size","font-style","font-variant","font-weight","height","letter-spacing","word-spacing","line-height","text-decoration","text-align","width","padding-top","padding-right","padding-bottom","padding-left","margin-top","margin-right","margin-bottom","margin-left","border-style","box-sizing","tab-size"],e.extend(t.prototype,e.fn.textcomplete.Adapter.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=this.el.value.substring(this.el.selectionEnd),o=n.replace(t,i);"undefined"!=typeof o&&(e.isArray(o)&&(r=o[1]+r,o=o[0]),s=s.replace(n.match,o),this.$el.val(s+r),this.el.selectionStart=this.el.selectionEnd=s.length)},_getCaretRelativePosition:function(){var t=e("<div></div>").css(this._copyCss()).text(this.getTextFromHeadToCaret()),n=e("<span></span>").text(".").appendTo(t);this.$el.before(t);var i=n.position();return i.top+=n.height()-this.$el.scrollTop(),i.lineHeight=n.height(),t.remove(),i},_copyCss:function(){return e.extend({overflow:this.el.scrollHeight>this.el.offsetHeight?"scroll":"auto"},t.DIV_PROPERTIES,this._getStyles())},_getStyles:function(e){var n=e("<div></div>").css(["color"]).color;return"undefined"!=typeof n?function(){return this.$el.css(t.COPY_PROPERTIES)}:function(){var n=this.$el,i={};return e.each(t.COPY_PROPERTIES,function(e,t){i[t]=n.css(t)}),i}}(e),getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)}}),e.fn.textcomplete.Textarea=t}(e),+function(e){"use strict";function t(t,i,s){this.initialize(t,i,s),e("<span>"+n+"</span>").css({position:"absolute",top:-9999,left:-9999}).insertBefore(t)}var n="吶";e.extend(t.prototype,e.fn.textcomplete.Textarea.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=this.el.value.substring(s.length),o=n.replace(t,i);if("undefined"!=typeof o){e.isArray(o)&&(r=o[1]+r,o=o[0]),s=s.replace(n.match,o),this.$el.val(s+r),this.el.focus();var a=this.el.createTextRange();a.collapse(!0),a.moveEnd("character",s.length),a.moveStart("character",s.length),a.select()}},getTextFromHeadToCaret:function(){this.el.focus();var e=document.selection.createRange();e.moveStart("character",-this.el.value.length);var t=e.text.split(n);return 1===t.length?t[0]:t[1]}}),e.fn.textcomplete.IETextarea=t}(e),+function(e){"use strict";function t(e,t,n){this.initialize(e,t,n)}e.extend(t.prototype,e.fn.textcomplete.Adapter.prototype,{select:function(t,n,i){var s=this.getTextFromHeadToCaret(),r=window.getSelection(),o=r.getRangeAt(0),a=o.cloneRange();a.selectNodeContents(o.startContainer);var l=a.toString(),c=l.substring(o.startOffset),h=n.replace(t,i);if("undefined"!=typeof h){e.isArray(h)&&(c=h[1]+c,h=h[0]),s=s.replace(n.match,h),o.selectNodeContents(o.startContainer),o.deleteContents();var u=document.createTextNode(s+c);o.insertNode(u),o.setStart(u,s.length),o.collapse(!0),r.removeAllRanges(),r.addRange(o)}},_getCaretRelativePosition:function(){var t=window.getSelection().getRangeAt(0).cloneRange(),n=document.createElement("span");t.insertNode(n),t.selectNodeContents(n),t.deleteContents();var i=e(n),s=i.offset();return s.left-=this.$el.offset().left,s.top+=i.height()-this.$el.offset().top,s.lineHeight=i.height(),i.remove(),s},getTextFromHeadToCaret:function(){var e=window.getSelection().getRangeAt(0),t=e.cloneRange();return t.selectNodeContents(e.startContainer),t.toString().substring(0,e.startOffset)}}),e.fn.textcomplete.ContentEditable=t}(e),e});var emojies=["+1","-1","100","1234","8ball","a","ab","abc","abcd","accept","aerial_tramway","airplane","alarm_clock","alien","ambulance","anchor","angel","anger","angry","anguished","ant","apple","aquarius","aries","arrow_backward","arrow_double_down","arrow_double_up","arrow_down","arrow_down_small","arrow_forward","arrow_heading_down","arrow_heading_up","arrow_left","arrow_lower_left","arrow_lower_right","arrow_right","arrow_right_hook","arrow_up","arrow_up_down","arrow_up_small","arrow_upper_left","arrow_upper_right","arrows_clockwise","arrows_counterclockwise","art","articulated_lorry","astonished","athletic_shoe","atm","b","baby","baby_bottle","baby_chick","baby_symbol","back","baggage_claim","balloon","ballot_box_with_check","bamboo","banana","bangbang","bank","bar_chart","barber","baseball","basketball","bath","bathtub","battery","bear","bee","beer","beers","beetle","beginner","bell","bento","bicyclist","bike","bikini","bird","birthday","black_circle","black_joker","black_large_square","black_medium_small_square","black_medium_square","black_nib","black_small_square","black_square_button","blossom","blowfish","blue_book","blue_car","blue_heart","blush","boar","boat","bomb","book","bookmark","bookmark_tabs","books","boom","boot","bouquet","bow","bowling","bowtie","boy","bread","bride_with_veil","bridge_at_night","briefcase","broken_heart","bug","bulb","bullettrain_front","bullettrain_side","bus","busstop","bust_in_silhouette","busts_in_silhouette","cactus","cake","calendar","calling","camel","camera","cancer","candy","capital_abcd","capricorn","car","card_index","carousel_horse","cat","cat2","cd","chart","chart_with_downwards_trend","chart_with_upwards_trend","checkered_flag","cherries","cherry_blossom","chestnut","chicken","children_crossing","chocolate_bar","christmas_tree","church","cinema","circus_tent","city_sunrise","city_sunset","cl","clap","clapper","clipboard","clock1","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock130","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","closed_book","closed_lock_with_key","closed_umbrella","cloud","clubs","cn","cocktail","coffee","cold_sweat","collision","computer","confetti_ball","confounded","confused","congratulations","construction","construction_worker","convenience_store","cookie","cool","cop","copyright","corn","couple","couple_with_heart","couplekiss","cow","cow2","credit_card","crescent_moon","crocodile","crossed_flags","crown","cry","crying_cat_face","crystal_ball","cupid","curly_loop","currency_exchange","curry","custard","customs","cyclone","dancer","dancers","dango","dart","dash","date","de","deciduous_tree","department_store","diamond_shape_with_a_dot_inside","diamonds","disappointed","disappointed_relieved","dizzy","dizzy_face","do_not_litter","dog","dog2","dollar","dolls","dolphin","door","doughnut","dragon","dragon_face","dress","dromedary_camel","droplet","dvd","e-mail","ear","ear_of_rice","earth_africa","earth_americas","earth_asia","egg","eggplant","eight","eight_pointed_black_star","eight_spoked_asterisk","electric_plug","elephant","email","end","envelope","envelope_with_arrow","es","euro","european_castle","european_post_office","evergreen_tree","exclamation","expressionless","eyeglasses","eyes","facepunch","factory","fallen_leaf","family","fast_forward","fax","fearful","feelsgood","feet","ferris_wheel","file_folder","finnadie","fire","fire_engine","fireworks","first_quarter_moon","first_quarter_moon_with_face","fish","fish_cake","fishing_pole_and_fish","fist","five","flags","flashlight","floppy_disk","flower_playing_cards","flushed","foggy","football","footprints","fork_and_knife","fountain","four","four_leaf_clover","fr","free","fried_shrimp","fries","frog","frowning","fu","fuelpump","full_moon","full_moon_with_face","game_die","gb","gem","gemini","ghost","gift","gift_heart","girl","globe_with_meridians","goat","goberserk","godmode","golf","grapes","green_apple","green_book","green_heart","grey_exclamation","grey_question","grimacing","grin","grinning","guardsman","guitar","gun","haircut","hamburger","hammer","hamster","hand","handbag","hankey","hash","hatched_chick","hatching_chick","headphones","hear_no_evil","heart","heart_decoration","heart_eyes","heart_eyes_cat","heartbeat","heartpulse","hearts","heavy_check_mark","heavy_division_sign","heavy_dollar_sign","heavy_exclamation_mark","heavy_minus_sign","heavy_multiplication_x","heavy_plus_sign","helicopter","herb","hibiscus","high_brightness","high_heel","hocho","honey_pot","honeybee","horse","horse_racing","hospital","hotel","hotsprings","hourglass","hourglass_flowing_sand","house","house_with_garden","hurtrealbad","hushed","ice_cream","icecream","id","ideograph_advantage","imp","inbox_tray","incoming_envelope","information_desk_person","information_source","innocent","interrobang","iphone","it","izakaya_lantern","jack_o_lantern","japan","japanese_castle","japanese_goblin","japanese_ogre","jeans","joy","joy_cat","jp","key","keycap_ten","kimono","kiss","kissing","kissing_cat","kissing_closed_eyes","kissing_heart","kissing_smiling_eyes","koala","koko","kr","lantern","large_blue_circle","large_blue_diamond","large_orange_diamond","last_quarter_moon","last_quarter_moon_with_face","laughing","leaves","ledger","left_luggage","left_right_arrow","leftwards_arrow_with_hook","lemon","leo","leopard","libra","light_rail","link","lips","lipstick","lock","lock_with_ink_pen","lollipop","loop","loudspeaker","love_hotel","love_letter","low_brightness","m","mag","mag_right","mahjong","mailbox","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","man","man_with_gua_pi_mao","man_with_turban","mans_shoe","maple_leaf","mask","massage","meat_on_bone","mega","melon","memo","mens","metal","metro","microphone","microscope","milky_way","minibus","minidisc","mobile_phone_off","money_with_wings","moneybag","monkey","monkey_face","monorail","moon","mortar_board","mount_fuji","mountain_bicyclist","mountain_cableway","mountain_railway","mouse","mouse2","movie_camera","moyai","muscle","mushroom","musical_keyboard","musical_note","musical_score","mute","nail_care","name_badge","neckbeard","necktie","negative_squared_cross_mark","neutral_face","new","new_moon","new_moon_with_face","newspaper","ng","nine","no_bell","no_bicycles","no_entry","no_entry_sign","no_good","no_mobile_phones","no_mouth","no_pedestrians","no_smoking","non-potable_water","nose","notebook","notebook_with_decorative_cover","notes","nut_and_bolt","o","o2","ocean","octocat","octopus","oden","office","ok","ok_hand","ok_woman","older_man","older_woman","on","oncoming_automobile","oncoming_bus","oncoming_police_car","oncoming_taxi","one","open_book","open_file_folder","open_hands","open_mouth","ophiuchus","orange_book","outbox_tray","ox","package","page_facing_up","page_with_curl","pager","palm_tree","panda_face","paperclip","parking","part_alternation_mark","partly_sunny","passport_control","paw_prints","peach","pear","pencil","pencil2","penguin","pensive","performing_arts","persevere","person_frowning","person_with_blond_hair","person_with_pouting_face","phone","pig","pig2","pig_nose","pill","pineapple","pisces","pizza","point_down","point_left","point_right","point_up","point_up_2","police_car","poodle","poop","post_office","postal_horn","postbox","potable_water","pouch","poultry_leg","pound","pouting_cat","pray","princess","punch","purple_heart","purse","pushpin","put_litter_in_its_place","question","rabbit","rabbit2","racehorse","radio","radio_button","rage","rage1","rage2","rage3","rage4","railway_car","rainbow","raised_hand","raised_hands","raising_hand","ram","ramen","rat","recycle","red_car","red_circle","registered","relaxed","relieved","repeat","repeat_one","restroom","revolving_hearts","rewind","ribbon","rice","rice_ball","rice_cracker","rice_scene","ring","rocket","roller_coaster","rooster","rose","rotating_light","round_pushpin","rowboat","ru","rugby_football","runner","running","running_shirt_with_sash","sa","sagittarius","sailboat","sake","sandal","santa","satellite","satisfied","saxophone","school","school_satchel","scissors","scorpius","scream","scream_cat","scroll","seat","secret","see_no_evil","seedling","seven","shaved_ice","sheep","shell","ship","shipit","shirt","shit","shoe","shower","signal_strength","six","six_pointed_star","ski","skull","sleeping","sleepy","slot_machine","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","smile","smile_cat","smiley","smiley_cat","smiling_imp","smirk","smirk_cat","smoking","snail","snake","snowboarder","snowflake","snowman","sob","soccer","soon","sos","sound","space_invader","spades","spaghetti","sparkle","sparkler","sparkles","sparkling_heart","speak_no_evil","speaker","speech_balloon","speedboat","squirrel","star","star2","stars","station","statue_of_liberty","steam_locomotive","stew","straight_ruler","strawberry","stuck_out_tongue","stuck_out_tongue_closed_eyes","stuck_out_tongue_winking_eye","sun_with_face","sunflower","sunglasses","sunny","sunrise","sunrise_over_mountains","surfer","sushi","suspect","suspension_railway","sweat","sweat_drops","sweat_smile","sweet_potato","swimmer","symbols","syringe","tada","tanabata_tree","tangerine","taurus","taxi","tea","telephone","telephone_receiver","telescope","tennis","tent","thought_balloon","three","thumbsdown","thumbsup","ticket","tiger","tiger2","tired_face","tm","toilet","tokyo_tower","tomato","tongue","top","tophat","tractor","traffic_light","train","train2","tram","triangular_flag_on_post","triangular_ruler","trident","triumph","trolleybus","trollface","trophy","tropical_drink","tropical_fish","truck","trumpet","tshirt","tulip","turtle","tv","twisted_rightwards_arrows","two","two_hearts","two_men_holding_hands","two_women_holding_hands","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7981","u7a7a","uk","umbrella","unamused","underage","unlock","up","us","v","vertical_traffic_light","vhs","vibration_mode","video_camera","video_game","violin","virgo","volcano","vs","walking","waning_crescent_moon","waning_gibbous_moon","warning","watch","water_buffalo","watermelon","wave","wavy_dash","waxing_crescent_moon","waxing_gibbous_moon","wc","weary","wedding","whale","whale2","wheelchair","white_check_mark","white_circle","white_flower","white_large_square","white_medium_small_square","white_medium_square","white_small_square","white_square_button","wind_chime","wine_glass","wink","wolf","woman","womans_clothes","womans_hat","womens","worried","wrench","x","yellow_heart","yen","yum","zap","zero","zzz"];$(".flaskbb-editor").markdown({iconlibrary:"fa",hiddenButtons:"cmdPreview",additionalButtons:[[{name:"groupHelp",data:[{name:"cmdHelp",toggle:!1,title:"Help",icon:"fa fa-question",btnClass:"btn btn-success",callback:function(){$("#editor-help").modal("show")}}]},{name:"groupPreview",data:[{name:"cmdNewPreview",toggle:!0,hotkey:"Ctrl+P",title:"Preview",btnText:"Preview",btnClass:"btn btn-primary btn-sm",icon:"fa fa-search",callback:function(e){var t=e.$isPreview;t===!1?(e.showPreview(),e.enableButtons("cmdNewPreview")):e.hidePreview()}}]}]]}),$(".flaskbb-editor").textcomplete([{match:/\B:([\-+\w]*)$/,search:function(e,t){t($.map(emojies,function(t){return 0===t.indexOf(e)?t:null}))},template:function(e){return'<img class="emoji" src="/static/emoji/'+e+'.png"></img>'+e},replace:function(e){return":"+e+": "},index:1}],{onKeydown:function(e,t){return e.ctrlKey&&74===e.keyCode?t.KEY_ENTER:void 0}});
|