Adds extra features to the original Markdown syntax.
\n" + i + "\n
", "\n\n" + i + "\n\n" + o;
- }), e = e.replace(/~0/, "");
- }
- function v(e) {
- return e = e.replace(/(^\n+|\n+$)/g, ""), "\n\n~K" + (P.push(e) - 1) + "K\n\n";
- }
- function b(e) {
- return e = e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function(e, t, n, i) {
- var o = i;
- return o = o.replace(/^([ \t]*)/g, ""), o = o.replace(/[ \t]*$/g, ""), o = y(o),
- o = o.replace(/:\/\//g, "~P"), t + "" + o + "
";
- });
- }
- function y(e) {
- return e = e.replace(/&/g, "&"), e = e.replace(//g, ">"),
- e = L(e, "*_{}[]\\", !1);
- }
- function w(e) {
- return e = e.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g, "$1$3$4"),
- e = e.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g, "$1$3$4");
- }
- function C(e) {
- return e = e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function(e, t) {
- var n = t;
- return n = n.replace(/^[ \t]*>[ \t]?/gm, "~0"), n = n.replace(/~0/g, ""), n = n.replace(/^[ \t]+$/gm, ""),
- n = r(n), n = n.replace(/(^|\n)/g, "$1 "), n = n.replace(/(\s*[^\r]+?<\/pre>)/gm, function(e, t) { - var n = t; - return n = n.replace(/^ /gm, "~0"), n = n.replace(/~0/g, ""); - }), v("\n" + n + "\n"); - }); - } - function x(e, t) { - e = e.replace(/^\n+/g, ""), e = e.replace(/\n+$/g, ""); - for (var n = e.split(/\n{2,}/g), i = [], o = /~K(\d+)K/, r = n.length, a = 0; r > a; a++) { - var l = n[a]; - o.test(l) ? i.push(l) : /\S/.test(l) && (l = s(l), l = l.replace(/^([ \t]*)/g, ""), - l += "
", i.push(l)); - } - if (!t) { - r = i.length; - for (var a = 0; r > a; a++) for (var c = !0; c; ) c = !1, i[a] = i[a].replace(/~K(\d+)K/g, function(e, t) { - return c = !0, P[t]; - }); - } - return i.join("\n\n"); - } - function S(e) { - return e = e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&"), e = e.replace(/<(?![a-z\/?!]|~D)/gi, "<"); - } - function E(e) { - return e = e.replace(/\\(\\)/g, I), e = e.replace(/\\([`*_{}\[\]()>#+-.!])/g, I); - } - function k(e, t, n, i) { - if (t) return e; - if (")" !== i.charAt(i.length - 1)) return "<" + n + i + ">"; - for (var o = i.match(/[()]/g), r = 0, s = 0; s < o.length; s++) "(" === o[s] ? 0 >= r ? r = 1 : r++ : r--; - var a = ""; - if (0 > r) { - var l = new RegExp("\\){1," + -r + "}$"); - i = i.replace(l, function(e) { - return a = e, ""; - }); - } - if (a) { - var c = i.charAt(i.length - 1); - G.test(c) || (a = c + a, i = i.substr(0, i.length - 1)); - } - return "<" + n + i + ">" + a; - } - function A(e) { - e = e.replace(W, k); - var t = function(e, t) { - return '' + $.plainLinkText(t) + ""; - }; - return e = e.replace(/<((https?|ftp):[^'">\s]+)>/gi, t); - } - function F(e) { - return e = e.replace(/~E(\d+)E/g, function(e, t) { - var n = parseInt(t); - return String.fromCharCode(n); - }); - } - function T(e) { - return e = e.replace(/^(\t|[ ]{1,4})/gm, "~0"), e = e.replace(/~0/g, ""); - } - function D(e) { - if (!/\t/.test(e)) return e; - var t, n = [ " ", " ", " ", " " ], i = 0; - return e.replace(/[\n\t]/g, function(e, o) { - return "\n" === e ? (i = o + 1, e) : (t = (o - i) % 4, i = o + 1, n[t]); - }); - } - function _(e) { - return e ? (e.length, e.replace(q, function(e) { - return "~D" == e ? "%24" : ":" == e ? ":" : "%" + e.charCodeAt(0).toString(16); - })) : ""; - } - function L(e, t, n) { - var i = "([" + t.replace(/([\[\]\\])/g, "\\$1") + "])"; - n && (i = "\\\\" + i); - var o = new RegExp(i, "g"); - return e = e.replace(o, I); - } - function I(e, t) { - var n = t.charCodeAt(0); - return "~E" + n + "E"; - } - var M = {}; - this.setOptions = function(e) { - M = e; - }; - var $ = this.hooks = new n(); - $.addNoop("plainLinkText"), $.addNoop("preConversion"), $.addNoop("postNormalization"), - $.addNoop("preBlockGamut"), $.addNoop("postBlockGamut"), $.addNoop("preSpanGamut"), - $.addNoop("postSpanGamut"), $.addNoop("postConversion"); - var R, B, P, N; - this.makeHtml = function(n) { - if (R) throw new Error("Recursive call to converter.makeHtml"); - return R = new i(), B = new i(), P = [], N = 0, n = $.preConversion(n), n = n.replace(/~/g, "~T"), - n = n.replace(/\$/g, "~D"), n = n.replace(/\r\n/g, "\n"), n = n.replace(/\r/g, "\n"), - n = "\n\n" + n + "\n\n", n = D(n), n = n.replace(/^[ \t]+$/gm, ""), n = $.postNormalization(n), - n = t(n), n = e(n), n = r(n), n = F(n), n = n.replace(/~D/g, "$$"), n = n.replace(/~T/g, "~"), - n = $.postConversion(n), P = B = R = null, n; - }; - var O = function(e) { - return r(e); - }, z = { - ol: "\\d+[.]", - ul: "[*+-]" - }, H = "[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]", j = "[-A-Z0-9+&@#/%=~_|[\\])]", W = new RegExp('(="|<)?\\b(https?|ftp)(://' + H + "*" + j + ")(?=$|\\W)", "gi"), G = new RegExp(j, "i"), q = /(?:["'*()[\]:]|~D)/g; - }; -}(), define("bower-libs/pagedown-ace/Markdown.Converter", function() {}), function() { - function e() {} - function t(e, t) { - this.buttonBar = u.getElementById("wmd-button-bar" + e), this.preview = u.getElementById("wmd-preview" + e), - this.input = t; - } - function n(t) { - var n = this, i = t.input; - this.init = function() { - var e = "undefined" != typeof require ? require("ace/range").Range : ace.require("ace/range").Range; - !function(t) { - n.before = i.session.getTextRange(new e(0, 0, t.start.row, t.start.column)), n.selection = i.session.getTextRange(), - n.after = i.session.getTextRange(new e(t.end.row, t.end.column, Number.MAX_VALUE, Number.MAX_VALUE)); - }(i.selection.getRange()), this.text = [ this.before, this.selection, this.after ].join(""), - this.length = this.text.length, this.setInputAreaSelectionStartEnd(), this.scrollTop = i.renderer.getScrollTop(); - }, this.setInputAreaSelection = function() { - var e = "undefined" != typeof require ? require("ace/range").Range : ace.require("ace/range").Range; - i.selection.setSelectionRange(function(t, n) { - return new e(t.row, t.column, n.row, n.column); - }(i.session.doc.indexToPosition(n.start), i.session.doc.indexToPosition(n.end))), - i.renderer.scrollToY(n.scrollTop), i.focus(); - }, this.setInputAreaSelectionStartEnd = function() { - n.start = n.before.length, n.end = n.after.length; - }, this.restore = function() { - for (var e = 0, t = n.before.length; t > e && n.before.charCodeAt(e) === n.text.charCodeAt(e); ) e++; - for (var o = 0, r = n.after.length, s = n.after.length - 1, a = n.text.length - 1; r > o && n.after.charCodeAt(s - o) === n.text.charCodeAt(a - o); ) o++; - var l = "undefined" != typeof require ? require("ace/range").Range : ace.require("ace/range").Range, c = function(e, t) { - return new l(e.row, e.column, t.row, t.column); - }(i.session.doc.indexToPosition(e), i.session.doc.indexToPosition(n.length - o)); - i.session.replace(c, n.text.substring(e, a - o + 1)), this.setInputAreaSelection(); - }, this.getChunks = function() { - var t = new e(); - return t.before = n.before, t.startTag = "", t.selection = n.selection, t.endTag = "", - t.after = n.after, t.scrollTop = n.scrollTop, t; - }, this.setChunks = function(e) { - e.before = e.before + e.startTag, e.after = e.endTag + e.after, this.start = e.before.length, - this.end = e.before.length + e.selection.length, this.text = e.before + e.selection + e.after, - this.scrollTop = e.scrollTop; - }, this.init(); - } - function i(e, t, n, i) { - var o, r, s, a = 3e3, c = "delayed", d = function() { - var e = 0; - return window.innerHeight ? e = window.pageYOffset : u.documentElement && u.documentElement.scrollTop ? e = u.documentElement.scrollTop : u.body && (e = u.body.scrollTop), - e; - }, h = function() { - if (t.preview) { - var n = t.input.getValue(); - if (!n || n != s) { - s = n; - var i = new Date().getTime(); - n = e.makeHtml(n); - var o = new Date().getTime(); - r = o - i, x(n); - } - } - }; - void 0 !== i && (h = i(h)); - var p = function() { - if (o && (clearTimeout(o), o = void 0), "manual" !== c) { - var e = 0; - "delayed" === c && (e = r), e > a && (e = a), o = setTimeout(h, e); - } - }, g = function(e) { - return e.scrollHeight <= e.clientHeight ? 1 : e.scrollTop / (e.scrollHeight - e.clientHeight); - }, m = function() { - t.preview && (t.preview.scrollTop = (t.preview.scrollHeight - t.preview.clientHeight) * g(t.preview)); - }; - this.refresh = function(e) { - e ? (s = "", h()) : p(); - }, this.processingTime = function() { - return r; - }; - var v, b = !0, y = function(e) { - var n = t.preview, i = n.parentNode, o = n.nextSibling; - i.removeChild(n), n.innerHTML = e, o ? i.insertBefore(n, o) : i.appendChild(n); - }, w = function(e) { - t.preview.innerHTML = e; - }, C = function(e) { - if (v) return v(e); - try { - w(e), v = w; - } catch (t) { - v = y, v(e); - } - }, x = function(e) { - var i = l.getTop(t.input) - d(); - if (t.preview && (C(e), n()), m(), b) return b = !1, void 0; - var o = l.getTop(t.input) - d(); - f.isIE ? setTimeout(function() { - window.scrollBy(0, o - i); - }, 0) : window.scrollBy(0, o - i); - }, S = function() { - t.input.session.on("change", p), t.preview && (t.preview.scrollTop = 0); - }; - S(); - } - function o(e, t, i, o, r, s, a, l) { - function c(e) { - if (0 !== e.length) { - var t = e.pop(); - b.commands.addCommand({ - name: a(t), - bindKey: m[t], - exec: function() { - d(y[t]); - } - }), c(e); - } - } - function d(e) { - b.focus(); - var r = "wmd-link-button" == e.id || "wmd-image-button" == e.id; - if (e.textOp) { - i && !r && i.setCommandMode(); - var s = new n(t); - if (!s) return; - var a = s.getChunks(), l = function() { - b.focus(), a && s.setChunks(a), s.restore(), o.refresh(); - }, c = e.textOp(a, l); - c || l(); - } - e.execute && e.execute(i); - } - function h(e, n) { - var i = "0px", o = "-20px", r = "-40px", s = e.getElementsByTagName("span")[0]; - n ? (s.style.backgroundPosition = e.XShift + " " + i, e.onmouseover = function() { - s.style.backgroundPosition = this.XShift + " " + r; - }, e.onmouseout = function() { - s.style.backgroundPosition = this.XShift + " " + i; - }, f.isIE && (e.onmousedown = function() { - u.activeElement && u.activeElement !== t.input || (t.ieCachedRange = document.selection.createRange(), - t.ieCachedScrollTop = t.input.renderer.getScrollTop()); - }), e.isHelp || (e.onclick = function() { - return this.onmouseout && this.onmouseout(), d(this), !1; - }), e.className = e.className.replace(/ disabled/g, "")) : (s.style.backgroundPosition = e.XShift + " " + o, - e.onmouseover = e.onmouseout = e.onclick = function() {}, e.className += " disabled"); - } - function p(e) { - return "string" == typeof e && (e = r[e]), function() { - e.apply(r, arguments); - }; - } - function g() { - var n = t.buttonBar, i = document.createElement("ul"); - i.id = "wmd-button-row" + e, i.className = "wmd-button-row", i = n.appendChild(i); - var o = 0, r = function(t, n, r, s) { - var a = document.createElement("li"); - a.className = "wmd-button", a.style.left = o + "px", o += 25; - var l = document.createElement("span"); - return a.id = t + e, a.appendChild(l), a.title = n, a.XShift = r, s && (a.textOp = s), - h(a, !0), i.appendChild(a), a; - }, l = function(t) { - var n = document.createElement("li"); - n.className = "wmd-spacer wmd-spacer" + t, n.id = "wmd-spacer" + t + e, i.appendChild(n), - o += 25; - }; - if (y.bold = r("wmd-bold-button", v("bold"), "0px", p("doBold")), y.italic = r("wmd-italic-button", v("italic"), "-20px", p("doItalic")), - l(1), y.link = r("wmd-link-button", v("link"), "-40px", p(function(e, t) { - return this.doLinkOrImage(e, t, !1); - })), y.quote = r("wmd-quote-button", v("quote"), "-60px", p("doBlockquote")), y.code = r("wmd-code-button", v("code"), "-80px", p("doCode")), - y.image = r("wmd-image-button", v("image"), "-100px", p(function(e, t) { - return this.doLinkOrImage(e, t, !0); - })), l(2), y.olist = r("wmd-olist-button", v("olist"), "-120px", p(function(e, t) { - this.doList(e, t, !0); - })), y.ulist = r("wmd-ulist-button", v("ulist"), "-140px", p(function(e, t) { - this.doList(e, t, !1); - })), y.heading = r("wmd-heading-button", v("heading"), "-160px", p("doHeading")), - y.hr = r("wmd-hr-button", v("hr"), "-180px", p("doHorizontalRule")), l(3), y.undo = r("wmd-undo-button", v("undo"), "-200px", null), - y.undo.execute = function() { - b.session.getUndoManager().undo(); - }, y.redo = r("wmd-redo-button", v("redo"), "-220px", null), y.redo.execute = function() { - b.session.getUndoManager().redo(); - }, s) { - var c = document.createElement("li"), u = document.createElement("span"); - c.appendChild(u), c.className = "wmd-button wmd-help-button", c.id = "wmd-help-button" + e, - c.XShift = "-240px", c.isHelp = !0, c.style.right = "0px", c.title = a("help"), - c.onclick = s.handler, h(c, !0), i.appendChild(c), y.help = c; - } - w.setUndoRedoButtonStates(), b.session.on("change", function() { - w.setUndoRedoButtonStates(); - }); - } - var v = function(e) { - return a(e) + " " + l(e); - }, b = t.input, y = {}; - this.setUndoRedoButtonStates = function() { - setTimeout(function() { - h(y.undo, b.session.getUndoManager().hasUndo()), h(y.redo, b.session.getUndoManager().hasRedo()); - }, 50); - }; - var w = this; - g(); - var C = "keydown"; - f.isOpera && (C = "keypress"), c([ "bold", "italic", "link", "quote", "code", "image", "olist", "ulist", "heading", "hr" ]), - this.buttons = y, this.setButtonState = h; - } - function r(e, t) { - this.hooks = e, this.getString = t; - } - function s(e) { - return e.replace(/^\s*(.*?)(?:\s+"(.+)")?\s*$/, function(e, t, n) { - return t = t.replace(/\?.*$/, function(e) { - return e.replace(/\+/g, " "); - }), t = decodeURIComponent(t), t = encodeURI(t).replace(/'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29"), - t = t.replace(/\?.*$/, function(e) { - return e.replace(/\+/g, "%2b"); - }), n && (n = n.trim ? n.trim() : n.replace(/^\s*/, "").replace(/\s*$/, ""), n = n.replace(/"/g, "quot;").replace(/\(/g, "(").replace(/\)/g, ")").replace(//g, ">")), - n ? t + ' "' + n + '"' : t; - }); - } - var a = {}, l = {}, c = {}, u = window.document, d = window.RegExp, h = window.navigator, p = { - lineLength: 72 - }, f = { - isIE: /msie/.test(h.userAgent.toLowerCase()), - isIE_5or6: /msie 6/.test(h.userAgent.toLowerCase()) || /msie 5/.test(h.userAgent.toLowerCase()), - isOpera: /opera/.test(h.userAgent.toLowerCase()) - }, g = { - bold: "Strong ", - boldexample: "strong text", - italic: "Emphasis ", - italicexample: "emphasized text", - link: "Hyperlink ", - linkdescription: "enter link description here", - linkdialog: 'Insert Hyperlink
http://example.com/ "optional title"
', - quote: "Blockquote", - quoteexample: "Blockquote", - code: "Code Sample", - codeexample: "enter code here", - image: "Image ", - imagedescription: "enter image description here", - imagedialog: "
Insert Image
http://example.com/images/diagram.jpg \"optional title\"
", - olist: "Numbered List
Need free image hosting?", - ulist: "Bulleted List
", - litem: "List item", - heading: "Heading
/
", - headingexample: "Heading", - hr: "Horizontal Rule
", - undo: "Undo -", - redo: "Redo -", - help: "Markdown Editing Help" - }, m = { - bold: { - win: "Ctrl-B", - mac: "Command-B|Ctrl-B" - }, - italic: { - win: "Ctrl-I", - mac: "Command-I|Ctrl-I" - }, - link: { - win: "Ctrl-L", - mac: "Command-L|Ctrl-L" - }, - quote: { - win: "Ctrl-Q", - mac: "Command-Q|Ctrl-Q" - }, - code: { - win: "Ctrl-K", - mac: "Command-K|Ctrl-K" - }, - image: { - win: "Ctrl-G", - mac: "Command-G|Ctrl-G" - }, - olist: { - win: "Ctrl-O", - mac: "Command-O|Ctrl-O" - }, - ulist: { - win: "Ctrl-U", - mac: "Command-U|Ctrl-U" - }, - heading: { - win: "Ctrl-H", - mac: "Command-H|Ctrl-H" - }, - hr: { - win: "Ctrl-R", - mac: "Command-R|Ctrl-R" - }, - undo: { - win: "Ctrl-Z", - mac: "Command-Z" - }, - redo: { - win: "Ctrl-Y|Ctrl-Shift-Z", - mac: "Command-Y|Command-Shift-Z" - } - }, v = "http://", b = "http://"; - Markdown.Editor = function(e, n, s) { - if (s = s || {}, "function" == typeof s.handler && (s = { - helpButton: s - }), s.strings = s.strings || {}, s.helpButton && (s.strings.help = s.strings.help || s.helpButton.title), - s.keyStrokes) for (var a in s.keyStrokes) m[a] = s.keyStrokes[a]; - var l = function(e) { - return s.strings[e] || g[e]; - }; - n = n || ""; - var c = this.hooks = new Markdown.HookCollection(); - c.addNoop("onPreviewRefresh"), c.addNoop("postBlockquoteCreation"), c.addFalse("insertImageDialog"), - c.addFalse("insertLinkDialog"), this.getConverter = function() { - return e; - }; - var u, d, h = this; - this.run = function(a, p) { - if (!u) { - u = new t(n, a); - var f, g = new r(c, l), v = new i(e, u, function() { - c.onPreviewRefresh(); - }, p), b = "undefined" != typeof require ? require("ace/lib/useragent") : ace.require("ace/lib/useragent"), y = function(e) { - var t = m[e][b.isMac ? "mac" : "win"], n = t.indexOf("|"); - return t.substring(0, n > 0 ? n : t.length); - }; - f = new o(n, u, d, v, g, s.helpButton, l, y), f.setUndoRedoButtonStates(); - var w = h.refreshPreview = function() { - v.refresh(!0); - }; - w(), h.uiManager = f; - } - }; - }, e.prototype.findTags = function(e, t) { - var n, i = this; - e && (n = a.extendRegExp(e, "", "$"), this.before = this.before.replace(n, function(e) { - return i.startTag = i.startTag + e, ""; - }), n = a.extendRegExp(e, "^", ""), this.selection = this.selection.replace(n, function(e) { - return i.startTag = i.startTag + e, ""; - })), t && (n = a.extendRegExp(t, "", "$"), this.selection = this.selection.replace(n, function(e) { - return i.endTag = e + i.endTag, ""; - }), n = a.extendRegExp(t, "^", ""), this.after = this.after.replace(n, function(e) { - return i.endTag = e + i.endTag, ""; - })); - }, e.prototype.trimWhitespace = function(e) { - var t, n, i = this; - e ? t = n = "" : (t = function(e) { - return i.before += e, ""; - }, n = function(e) { - return i.after = e + i.after, ""; - }), this.selection = this.selection.replace(/^(\s*)/, t).replace(/(\s*)$/, n); - }, e.prototype.skipLines = function(e, t, n) { - void 0 === e && (e = 1), void 0 === t && (t = 1), e++, t++; - var i, o; - if (navigator.userAgent.match(/Chrome/) && "X".match(/()./), this.selection = this.selection.replace(/(^\n*)/, ""), - this.startTag = this.startTag + d.$1, this.selection = this.selection.replace(/(\n*$)/, ""), - this.endTag = this.endTag + d.$1, this.startTag = this.startTag.replace(/(^\n*)/, ""), - this.before = this.before + d.$1, this.endTag = this.endTag.replace(/(\n*$)/, ""), - this.after = this.after + d.$1, this.before) { - for (i = o = ""; e--; ) i += "\\n?", o += "\n"; - n && (i = "\\n*"), this.before = this.before.replace(new d(i + "$", ""), o); - } - if (this.after) { - for (i = o = ""; t--; ) i += "\\n?", o += "\n"; - n && (i = "\\n*"), this.after = this.after.replace(new d(i, ""), o); - } - }, a.isVisible = function(e) { - return window.getComputedStyle ? "none" !== window.getComputedStyle(e, null).getPropertyValue("display") : e.currentStyle ? "none" !== e.currentStyle.display : void 0; - }, a.addEvent = function(e, t, n) { - e.attachEvent ? e.attachEvent("on" + t, n) : e.addEventListener(t, n, !1); - }, a.removeEvent = function(e, t, n) { - e.detachEvent ? e.detachEvent("on" + t, n) : e.removeEventListener(t, n, !1); - }, a.fixEolChars = function(e) { - return e = e.replace(/\r\n/g, "\n"), e = e.replace(/\r/g, "\n"); - }, a.extendRegExp = function(e, t, n) { - (null === t || void 0 === t) && (t = ""), (null === n || void 0 === n) && (n = ""); - var i, o = e.toString(); - return o = o.replace(/\/([gim]*)$/, function(e, t) { - return i = t, ""; - }), o = o.replace(/(^\/|\/$)/g, ""), o = t + o + n, new d(o, i); - }, l.getTop = function(e, t) { - var n = e.offsetTop; - if (!t) for (;e = e.offsetParent; ) n += e.offsetTop; - return n; - }, l.getHeight = function(e) { - return e.offsetHeight || e.scrollHeight; - }, l.getWidth = function(e) { - return e.offsetWidth || e.scrollWidth; - }, l.getPageSize = function() { - var e, t, n, i; - self.innerHeight && self.scrollMaxY ? (e = u.body.scrollWidth, t = self.innerHeight + self.scrollMaxY) : u.body.scrollHeight > u.body.offsetHeight ? (e = u.body.scrollWidth, - t = u.body.scrollHeight) : (e = u.body.offsetWidth, t = u.body.offsetHeight), self.innerHeight ? (n = self.innerWidth, - i = self.innerHeight) : u.documentElement && u.documentElement.clientHeight ? (n = u.documentElement.clientWidth, - i = u.documentElement.clientHeight) : u.body && (n = u.body.clientWidth, i = u.body.clientHeight); - var o = Math.max(e, n), r = Math.max(t, i); - return [ o, r, n, i ]; - }, c.createBackground = function() { - var e = u.createElement("div"), t = e.style; - e.className = "wmd-prompt-background", t.position = "absolute", t.top = "0", t.zIndex = "1000", - f.isIE ? t.filter = "alpha(opacity=50)" : t.opacity = "0.5"; - var n = l.getPageSize(); - return t.height = n[1] + "px", f.isIE ? (t.left = u.documentElement.scrollLeft, - t.width = u.documentElement.clientWidth) : (t.left = "0", t.width = "100%"), u.body.appendChild(e), - e; - }, c.prompt = function(e, t, n) { - var i, o; - void 0 === t && (t = ""); - var r = function(e) { - var t = e.charCode || e.keyCode; - 27 === t && s(!0); - }, s = function(e) { - a.removeEvent(u.body, "keydown", r); - var t = o.value; - return e ? t = null : (t = t.replace(/^http:\/\/(https?|ftp):\/\//, "$1://"), /^(?:https?|ftp):\/\//.test(t) || (t = "http://" + t)), - i.parentNode.removeChild(i), n(t), !1; - }, c = function() { - i = u.createElement("div"), i.className = "wmd-prompt-dialog", i.style.padding = "10px;", - i.style.position = "fixed", i.style.width = "400px", i.style.zIndex = "1001"; - var n = u.createElement("div"); - n.innerHTML = e, n.style.padding = "5px", i.appendChild(n); - var c = u.createElement("form"), d = c.style; - c.onsubmit = function() { - return s(!1); - }, d.padding = "0", d.margin = "0", d.cssFloat = "left", d.width = "100%", d.textAlign = "center", - d.position = "relative", i.appendChild(c), o = u.createElement("input"), o.type = "text", - o.value = t, d = o.style, d.display = "block", d.width = "80%", d.marginLeft = d.marginRight = "auto", - c.appendChild(o); - var h = u.createElement("input"); - h.type = "button", h.onclick = function() { - return s(!1); - }, h.value = "OK", d = h.style, d.margin = "10px", d.display = "inline", d.width = "7em"; - var p = u.createElement("input"); - p.type = "button", p.onclick = function() { - return s(!0); - }, p.value = "Cancel", d = p.style, d.margin = "10px", d.display = "inline", d.width = "7em", - c.appendChild(h), c.appendChild(p), a.addEvent(u.body, "keydown", r), i.style.top = "50%", - i.style.left = "50%", i.style.display = "block", f.isIE_5or6 && (i.style.position = "absolute", - i.style.top = u.documentElement.scrollTop + 200 + "px", i.style.left = "50%"), u.body.appendChild(i), - i.style.marginTop = -(l.getHeight(i) / 2) + "px", i.style.marginLeft = -(l.getWidth(i) / 2) + "px"; - }; - setTimeout(function() { - c(); - var e = t.length; - if (void 0 !== o.selectionStart) o.selectionStart = 0, o.selectionEnd = e; else if (o.createTextRange) { - var n = o.createTextRange(); - n.collapse(!1), n.moveStart("character", -e), n.moveEnd("character", e), n.select(); - } - o.focus(); - }, 0); - }; - var y = r.prototype; - y.prefixes = "(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)", - y.unwrap = function(e) { - var t = new d("([^\\n])\\n(?!(\\n|" + this.prefixes + "))", "g"); - e.selection = e.selection.replace(t, "$1 $2"); - }, y.wrap = function(e, t) { - this.unwrap(e); - var n = new d("(.{1," + t + "})( +|$\\n?)", "gm"), i = this; - e.selection = e.selection.replace(n, function(e, t) { - return new d("^" + i.prefixes, "").test(e) ? e : t + "\n"; - }), e.selection = e.selection.replace(/\s+$/, ""); - }, y.doBold = function(e, t) { - return this.doBorI(e, t, 2, this.getString("boldexample")); - }, y.doItalic = function(e, t) { - return this.doBorI(e, t, 1, this.getString("italicexample")); - }, y.doBorI = function(e, t, n, i) { - e.trimWhitespace(), e.selection = e.selection.replace(/\n{2,}/g, "\n"); - var o = /(\**$)/.exec(e.before)[0], r = /(^\**)/.exec(e.after)[0], s = Math.min(o.length, r.length); - if (s >= n && (2 != s || 1 != n)) e.before = e.before.replace(d("[*]{" + n + "}$", ""), ""), - e.after = e.after.replace(d("^[*]{" + n + "}", ""), ""); else if (!e.selection && r) { - e.after = e.after.replace(/^([*_]*)/, ""), e.before = e.before.replace(/(\s?)$/, ""); - var a = d.$1; - e.before = e.before + r + a; - } else { - e.selection || r || (e.selection = i); - var l = 1 >= n ? "*" : "**"; - e.before = e.before + l, e.after = l + e.after; - } - }, y.stripLinkDefs = function(e, t) { - return e = e.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm, function(e, n, i, o, r) { - return t[n] = e.replace(/\s*$/, ""), o ? (t[n] = e.replace(/["(](.+?)[")]$/, ""), - o + r) : ""; - }); - }, y.addLinkDef = function(e, t) { - var n = 0, i = {}; - e.before = this.stripLinkDefs(e.before, i), e.selection = this.stripLinkDefs(e.selection, i), - e.after = this.stripLinkDefs(e.after, i); - var o = "", r = /(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g, s = function(e) { - n++, e = e.replace(/^[ ]{0,3}\[(\d+)\]:/, " [" + n + "]:"), o += "\n" + e; - }, a = function(e, t, o, l, c, u) { - return o = o.replace(r, a), i[c] ? (s(i[c]), t + o + l + n + u) : e; - }; - e.before = e.before.replace(r, a), t ? s(t) : e.selection = e.selection.replace(r, a); - var l = n; - return e.after = e.after.replace(r, a), e.after && (e.after = e.after.replace(/\n*$/, "")), - e.after || (e.selection = e.selection.replace(/\n*$/, "")), e.after += "\n\n" + o, - l; - }, y.doLinkOrImage = function(e, t, n) { - e.trimWhitespace(), e.findTags(/\s*!?\[/, /\][ ]?(?:\n[ ]*)?(\[.*?\])?/); - var i; - if (!(e.endTag.length > 1 && e.startTag.length > 0)) { - if (e.selection = e.startTag + e.selection + e.endTag, e.startTag = e.endTag = "", - /\n\n/.test(e.selection)) return this.addLinkDef(e, null), void 0; - var o = this, r = function(r) { - if (i.parentNode.removeChild(i), null !== r) { - e.selection = (" " + e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g, "$1\\").substr(1); - var a = " [999]: " + s(r), l = o.addLinkDef(e, a); - e.startTag = n ? "![" : "[", e.endTag = "][" + l + "]", e.selection || (e.selection = n ? o.getString("imagedescription") : o.getString("linkdescription")); - } - t(); - }; - return i = c.createBackground(), n ? this.hooks.insertImageDialog(r) || c.prompt(this.getString("imagedialog"), v, r) : this.hooks.insertLinkDialog(r) || c.prompt(this.getString("linkdialog"), b, r), - !0; - } - e.startTag = e.startTag.replace(/!?\[/, ""), e.endTag = "", this.addLinkDef(e, null); - }, y.doAutoindent = function(e) { - var t = this, n = !1; - e.before = e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/, "\n\n"), e.before = e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/, "\n\n"), - e.before = e.before.replace(/(\n|^)[ \t]+\n$/, "\n\n"), e.selection || /^[ \t]*(?:\n|$)/.test(e.after) || (e.after = e.after.replace(/^[^\n]*/, function(t) { - return e.selection = t, ""; - }), n = !0), /(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before) && t.doList && t.doList(e), - /(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before) && t.doBlockquote && t.doBlockquote(e), - /(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before) && t.doCode && t.doCode(e), n && (e.after = e.selection + e.after, - e.selection = ""); - }, y.doBlockquote = function(e) { - e.selection = e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/, function(t, n, i, o) { - return e.before += n, e.after = o + e.after, i; - }), e.before = e.before.replace(/(>[ \t]*)$/, function(t, n) { - return e.selection = n + e.selection, ""; - }), e.selection = e.selection.replace(/^(\s|>)+$/, ""), e.selection = e.selection || this.getString("quoteexample"); - var t, n = "", i = ""; - if (e.before) { - for (var o = e.before.replace(/\n$/, "").split("\n"), r = !1, s = 0; s < o.length; s++) { - var a = !1; - t = o[s], r = r && t.length > 0, /^>/.test(t) ? (a = !0, !r && t.length > 1 && (r = !0)) : a = /^[ \t]*$/.test(t) ? !0 : r, - a ? n += t + "\n" : (i += n + t, n = "\n"); - } - /(^|\n)>/.test(n) || (i += n, n = ""); - } - e.startTag = n, e.before = i; - var l = function(t) { - var n = t ? "> " : ""; - e.startTag && (e.startTag = e.startTag.replace(/\n((>|\s)*)\n$/, function(e, t) { - return "\n" + t.replace(/^[ ]{0,3}>?[ \t]*$/gm, n) + "\n"; - })), e.endTag && (e.endTag = e.endTag.replace(/^\n((>|\s)*)\n/, function(e, t) { - return "\n" + t.replace(/^[ ]{0,3}>?[ \t]*$/gm, n) + "\n"; - })); - }; - /^(?![ ]{0,3}>)/m.test(e.selection) ? (this.wrap(e, p.lineLength - 2), e.selection = e.selection.replace(/^/gm, "> "), - l(!0), e.skipLines()) : (e.selection = e.selection.replace(/^[ ]{0,3}> ?/gm, ""), - this.unwrap(e), l(!1), !/^(\n|^)[ ]{0,3}>/.test(e.selection) && e.startTag && (e.startTag = e.startTag.replace(/\n{0,2}$/, "\n\n")), - !/(\n|^)[ ]{0,3}>.*$/.test(e.selection) && e.endTag && (e.endTag = e.endTag.replace(/^\n{0,2}/, "\n\n"))), - e.selection = this.hooks.postBlockquoteCreation(e.selection), /\n/.test(e.selection) || (e.selection = e.selection.replace(/^(> *)/, function(t, n) { - return e.startTag += n, ""; - })); - }, y.doCode = function(e) { - var t = /\S[ ]*$/.test(e.before), n = /^[ ]*\S/.test(e.after); - if (!n && !t || /\n/.test(e.selection)) { - e.before = e.before.replace(/[ ]{4}$/, function(t) { - return e.selection = t + e.selection, ""; - }); - var i = 1, o = 1; - /(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before) && (i = 0), /^\n(\t|[ ]{4,})/.test(e.after) && (o = 0), - e.skipLines(i, o), e.selection ? /^[ ]{0,3}\S/m.test(e.selection) ? /\n/.test(e.selection) ? e.selection = e.selection.replace(/^/gm, " ") : e.before += " " : e.selection = e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm, "") : (e.startTag = " ", - e.selection = this.getString("codeexample")); - } else e.trimWhitespace(), e.findTags(/`/, /`/), e.startTag || e.endTag ? e.endTag && !e.startTag ? (e.before += e.endTag, - e.endTag = "") : e.startTag = e.endTag = "" : (e.startTag = e.endTag = "`", e.selection || (e.selection = this.getString("codeexample"))); - }, y.doList = function(e, t, n) { - var i = /(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/, o = /^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/, r = "-", s = 1, a = function() { - var e; - return n ? (e = " " + s + ". ", s++) : e = " " + r + " ", e; - }, l = function(e) { - return void 0 === n && (n = /^\s*\d/.test(e)), e = e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm, function() { - return a(); - }); - }; - if (e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/, null), !e.before || /\n$/.test(e.before) || /^\n/.test(e.startTag) || (e.before += e.startTag, - e.startTag = ""), e.startTag) { - var c = /\d+[.]/.test(e.startTag); - if (e.startTag = "", e.selection = e.selection.replace(/\n[ ]{4}/g, "\n"), this.unwrap(e), - e.skipLines(), c && (e.after = e.after.replace(o, l)), n == c) return; - } - var u = 1; - e.before = e.before.replace(i, function(e) { - return /^\s*([*+-])/.test(e) && (r = d.$1), u = /[^\n]\n\n[^\n]/.test(e) ? 1 : 0, - l(e); - }), e.selection || (e.selection = this.getString("litem")); - var h = a(), f = 1; - e.after = e.after.replace(o, function(e) { - return f = /[^\n]\n\n[^\n]/.test(e) ? 1 : 0, l(e); - }), e.trimWhitespace(!0), e.skipLines(u, f, !0), e.startTag = h; - var g = h.replace(/./g, " "); - this.wrap(e, p.lineLength - g.length), e.selection = e.selection.replace(/\n/g, "\n" + g); - }, y.doHeading = function(e) { - if (e.selection = e.selection.replace(/\s+/g, " "), e.selection = e.selection.replace(/(^\s+|\s+$)/g, ""), - !e.selection) return e.startTag = "## ", e.selection = this.getString("headingexample"), - e.endTag = " ##", void 0; - var t = 0; - e.findTags(/#+[ ]*/, /[ ]*#+/), /#+/.test(e.startTag) && (t = d.lastMatch.length), - e.startTag = e.endTag = "", e.findTags(null, /\s?(-+|=+)/), /=+/.test(e.endTag) && (t = 1), - /-+/.test(e.endTag) && (t = 2), e.startTag = e.endTag = "", e.skipLines(1, 1); - var n = 0 == t ? 2 : t - 1; - if (n > 0) { - var i = n >= 2 ? "-" : "=", o = e.selection.length; - for (o > p.lineLength && (o = p.lineLength), e.endTag = "\n"; o--; ) e.endTag += i; - } - }, y.doHorizontalRule = function(e) { - e.startTag = "----------\n", e.selection = "", e.skipLines(2, 1, !0); - }; -}(), define("pagedown-ace", function() {}), function() { - function e(e) { - return e.replace(/^\s+|\s+$/g, ""); - } - function t(e) { - return e.replace(/\s+$/g, ""); - } - function n(e) { - return e.replace(new RegExp("^(\\t|[ ]{1,4})", "gm"), ""); - } - function i(e, t) { - return -1 != e.indexOf(t); - } - function o(e, t) { - return e.replace(/<[^>]*>?/gi, function(e) { - return e.match(t) ? e : ""; - }); - } - function r(e, t) { - for (var n = {}, i = 0; i < e.length; i++) n[e[i]] = e[i]; - for (i = 0; i < t.length; i++) n[t[i]] = t[i]; - var o = []; - for (var r in n) n.hasOwnProperty(r) && o.push(n[r]); - return o; - } - function s(e) { - return "" != e.charAt(0) && (e = "" + e), "" != e.charAt(e.length - 1) && (e += ""), - e; - } - function a(e) { - return "" == e.charAt(0) && (e = e.substr(1)), "" == e.charAt(e.length - 1) && (e = e.substr(0, e.length - 1)), - e; - } - function l(e, t) { - return o(c(e, t), g); - } - function c(e, t) { - var n = t.blockGamutHookCallback(e); - return n = h(n), n = n.replace(/~D/g, "$$").replace(/~T/g, "~"), n = t.previousPostConversion(n); - } - function u(e) { - return e.replace(/\\\|/g, "~I").replace(/\\:/g, "~i"); - } - function d(e) { - return e.replace(/~I/g, "|").replace(/~i/g, ":"); - } - function h(e) { - return e = e.replace(/~E(\d+)E/g, function(e, t) { - var n = parseInt(t); - return String.fromCharCode(n); - }); - } - function p(e) { - return e.toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, ""); - } - function f(e, t) { - var n = t; - return n = n.replace(/&\#8220;/g, '"'), n = n.replace(/&\#8221;/g, '"'), n = n.replace(/&\#8216;/g, "'"), - n = n.replace(/&\#8217;/g, "'"), n = n.replace(/&\#8212;/g, "---"), n = n.replace(/&\#8211;/g, "--"), - n = n.replace(/&\#8230;/g, "..."); - } - var g = new RegExp([ "^(<\\/?(a|abbr|acronym|applet|area|b|basefont|", "bdo|big|button|cite|code|del|dfn|em|figcaption|", "font|i|iframe|img|input|ins|kbd|label|map|", "mark|meter|object|param|progress|q|ruby|rp|rt|s|", "samp|script|select|small|span|strike|strong|", "sub|sup|textarea|time|tt|u|var|wbr)[^>]*>|", "<(br)\\s?\\/?>)$" ].join(""), "i"); - Array.indexOf || (Array.prototype.indexOf = function(e) { - for (var t = 0; t < this.length; t++) if (this[t] == e) return t; - return -1; - }), Markdown.Extra = function() { - this.converter = null, this.hashBlocks = [], this.footnotes = {}, this.usedFootnotes = [], - this.attributeBlocks = !1, this.googleCodePrettify = !1, this.highlightJs = !1, - this.tableClass = "", this.tabWidth = 4; - }, Markdown.Extra.init = function(e, t) { - var n = new Markdown.Extra(), o = [], r = [], s = [], a = [ "unHashExtraBlocks" ]; - return t = t || {}, t.extensions = t.extensions || [ "all" ], i(t.extensions, "all") && (t.extensions = [ "tables", "fenced_code_gfm", "def_list", "attr_list", "footnotes", "smartypants", "strikethrough", "newlines" ]), - r.push("wrapHeaders"), i(t.extensions, "attr_list") && (o.push("hashFcbAttributeBlocks"), - r.push("hashHeaderAttributeBlocks"), a.push("applyAttributeBlocks"), n.attributeBlocks = !0), - i(t.extensions, "fenced_code_gfm") && (r.push("fencedCodeBlocks"), o.push("fencedCodeBlocks")), - i(t.extensions, "tables") && r.push("tables"), i(t.extensions, "def_list") && r.push("definitionLists"), - i(t.extensions, "footnotes") && (o.push("stripFootnoteDefinitions"), r.push("doFootnotes"), - a.push("printFootnotes")), i(t.extensions, "smartypants") && a.push("runSmartyPants"), - i(t.extensions, "strikethrough") && s.push("strikethrough"), i(t.extensions, "newlines") && s.push("newlines"), - e.hooks.chain("postNormalization", function(e) { - return n.doTransform(o, e) + "\n"; - }), e.hooks.chain("preBlockGamut", function(e, t) { - return n.blockGamutHookCallback = t, e = u(e), e = n.doTransform(r, e) + "\n", e = d(e); - }), e.hooks.chain("postSpanGamut", function(e) { - return n.doTransform(s, e); - }), n.previousPostConversion = e.hooks.postConversion, e.hooks.chain("postConversion", function(e) { - return e = n.doTransform(a, e), n.hashBlocks = [], n.footnotes = {}, n.usedFootnotes = [], - e; - }), "highlighter" in t && (n.googleCodePrettify = "prettify" === t.highlighter, - n.highlightJs = "highlight" === t.highlighter), "table_class" in t && (n.tableClass = t.table_class), - n.converter = e, n; - }, Markdown.Extra.prototype.doTransform = function(e, t) { - for (var n = 0; n < e.length; n++) t = this[e[n]](t); - return t; - }, Markdown.Extra.prototype.hashExtraBlock = function(e) { - return "\n~X" + (this.hashBlocks.push(e) - 1) + "X
\n"; - }, Markdown.Extra.prototype.hashExtraInline = function(e) { - return "~X" + (this.hashBlocks.push(e) - 1) + "X"; - }, Markdown.Extra.prototype.unHashExtraBlocks = function(e) { - function t() { - var i = !1; - e = e.replace(/(?:)?~X(\d+)X(?:<\/p>)?/g, function(e, t) { - i = !0; - var o = parseInt(t, 10); - return n.hashBlocks[o]; - }), i === !0 && t(); - } - var n = this; - return t(), e; - }, Markdown.Extra.prototype.wrapHeaders = function(e) { - function t(e) { - return "\n" + e + "\n"; - } - return e = e.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm, t), e = e.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm, t), - e = e.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm, t); - }; - var m = "\\{[ \\t]*((?:[#.][-_:a-zA-Z0-9]+[ \\t]*)+)\\}", v = new RegExp("^(#{1,6}.*#{0,6})[ \\t]+" + m + "[ \\t]*(?:\\n|0x03)", "gm"), b = new RegExp("^(.*)[ \\t]+" + m + "[ \\t]*\\n" + "(?=[\\-|=]+\\s*(?:\\n|0x03))", "gm"), y = new RegExp("^(```[ \\t]*[^{\\s]*)[ \\t]+" + m + "[ \\t]*\\n" + "(?=([\\s\\S]*?)\\n```[ \\t]*(\\n|0x03))", "gm"); - Markdown.Extra.prototype.hashHeaderAttributeBlocks = function(e) { - function t(e, t, i) { - return "
~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + t + "\n"; - } - var n = this; - return e = e.replace(v, t), e = e.replace(b, t); - }, Markdown.Extra.prototype.hashFcbAttributeBlocks = function(e) { - function t(e, t, i) { - return "~XX" + (n.hashBlocks.push(i) - 1) + "XX
\n" + t + "\n"; - } - var n = this; - return e.replace(y, t); - }, Markdown.Extra.prototype.applyAttributeBlocks = function(e) { - var t = this, n = new RegExp('~XX(\\d+)XX
[\\s]*(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?\\2>))', "gm"); - return e = e.replace(n, function(e, n, i, o, s) { - if (!i) return ""; - for (var a = parseInt(n, 10), l = t.hashBlocks[a], c = l.match(/#[^\s#.]+/g) || [], u = c[0] ? ' id="' + c[0].substr(1, c[0].length - 1) + '"' : "", d = l.match(/\.[^\s#.]+/g) || [], h = 0; h < d.length; h++) d[h] = d[h].substr(1, d[h].length - 1); - var p = ""; - return o && (d = r(d, [ o ])), d.length > 0 && (p = ' class="' + d.join(" ") + '"'), - "<" + i + u + p + s; - }); - }, Markdown.Extra.prototype.tables = function(t) { - function n(t, n, o, r) { - n = n.replace(/^ *[|]/m, ""), o = o.replace(/^ *[|]/m, ""), r = r.replace(/^ *[|]/gm, ""), - n = n.replace(/[|] *$/m, ""), o = o.replace(/[|] *$/m, ""), r = r.replace(/[|] *$/gm, ""), - alignspecs = o.split(/ *[|] */), align = []; - for (var s = 0; s < alignspecs.length; s++) { - var a = alignspecs[s]; - align[s] = a.match(/^ *-+: *$/m) ? ' style="text-align:right;"' : a.match(/^ *:-+: *$/m) ? ' style="text-align:center;"' : a.match(/^ *:-+ *$/m) ? ' style="text-align:left;"' : ""; - } - var c = n.split(/ *[|] */), u = c.length, d = i.tableClass ? ' class="' + i.tableClass + '"' : "", h = [ "\n", "\n", "
\n", i.hashExtraBlock(h); - } - var i = this, o = new RegExp([ "^", "[ ]{0,3}", "[|]", "(.+)\\n", "[ ]{0,3}", "[|]([ ]*[-:]+[-| :]*)\\n", "(", "(?:[ ]*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm"), r = new RegExp([ "^", "[ ]{0,3}", "(\\S.*[|].*)\\n", "[ ]{0,3}", "([-:]+[ ]*[|][-| :]*)\\n", "(", "(?:.*[|].*\\n?)*", ")", "(?:\\n|$)" ].join(""), "gm"); - return t = t.replace(o, n), t = t.replace(r, n); - }, Markdown.Extra.prototype.stripFootnoteDefinitions = function(e) { - var t = this; - return e = e.replace(/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g, function(e, n, i) { - return n = p(n), i += "\n", i = i.replace(/^[ ]{0,3}/g, ""), t.footnotes[n] = i, - "\n"; - }); - }, Markdown.Extra.prototype.doFootnotes = function(e) { - var t = this; - if (t.isConvertingFootnote === !0) return e; - var n = 0; - return e = e.replace(/\[\^(.+?)\]/g, function(e, i) { - var o = p(i), r = t.footnotes[o]; - if (void 0 === r) return e; - n++, t.usedFootnotes.push(o); - var s = '' + n + ""; - return t.hashExtraInline(s); - }); - }, Markdown.Extra.prototype.printFootnotes = function(e) { - var t = this; - if (0 === t.usedFootnotes.length) return e; - e += '\n\n\n" ].join(""); - for (s = 0; u > s; s++) { - var p = l(e(c[s]), i); - h += [ " \n\n"; - var f = r.split("\n"); - for (s = 0; s < f.length; s++) if (!f[s].match(/^\s*$/)) { - for (var g = f[s].split(/ *[|] */), m = u - g.length, v = 0; m > v; v++) g.push(""); - for (h += "", p, " \n" ].join(""); - } - h += "\n", v = 0; u > v; v++) { - var b = l(e(g[v]), i); - h += [ " \n"; - } - return h += "", b, " \n" ].join(""); - } - h += "\n"; - }, Markdown.Extra.prototype.fencedCodeBlocks = function(e) { - function t(e) { - return e = e.replace(/&/g, "&"), e = e.replace(//g, ">"), - e = e.replace(/~D/g, "$$"), e = e.replace(/~T/g, "~"); - } - var n = this; - return e = e.replace(/(?:^|\n)```[ \t]*(\S*)[ \t]*\n([\s\S]*?)\n```[ \t]*(?=\n)/g, function(e, i, o) { - var r = i, s = o, a = n.googleCodePrettify ? ' class="prettyprint"' : "", l = ""; - r && (l = n.googleCodePrettify || n.highlightJs ? ' class="language-' + r + '"' : ' class="' + r + '"'); - var c = [ "
\n\n\n'; - for (var n = 0; n < t.usedFootnotes.length; n++) { - var i = t.usedFootnotes[n], o = t.footnotes[i]; - t.isConvertingFootnote = !0; - var r = l(o, t); - delete t.isConvertingFootnote, e += '
\n- ' + r + ' ↩
\n\n'; - } - return e += "" ].join(""); - return n.hashExtraBlock(c); - }); - }, Markdown.Extra.prototype.educatePants = function(e) { - var t = this, n = "", i = 0; - e.replace(/(?:)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g, function(o, r, s, a, l, c, u) { - var d = e.substring(i, u); - return n += t.applyPants(d), t.smartyPantsLastChar = n.substring(n.length - 1), - i = u + o.length, r ? (/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(s) ? t.smartyPantsLastChar = l.substring(l.length - 1) : l = t.educatePants(l), - n += r + s + a + l + c, void 0) : (n += o, void 0); - }); - var o = e.substring(i); - return n += t.applyPants(o), t.smartyPantsLastChar = n.substring(n.length - 1), - n; - }, Markdown.Extra.prototype.applyPants = function(e) { - return e = e.replace(/---/g, "—").replace(/--/g, "–"), e = e.replace(/\.\.\./g, "…").replace(/\.\s\.\s\./g, "…"), - e = e.replace(/``/g, "“").replace(/''/g, "”"), /^'$/.test(e) ? /\S/.test(this.smartyPantsLastChar) ? "’" : "‘" : /^"$/.test(e) ? /\S/.test(this.smartyPantsLastChar) ? "”" : "“" : (e = e.replace(/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "’"), - e = e.replace(/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/, "”"), e = e.replace(/"'(?=\w)/g, "“‘"), - e = e.replace(/'"(?=\w)/g, "‘“"), e = e.replace(/'(?=\d{2}s)/g, "’"), - e = e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g, "$1‘"), - e = e.replace(/([^\s\[\{\(\-])'/g, "$1’"), e = e.replace(/'(?=\s|s\b)/g, "’"), - e = e.replace(/'/g, "‘"), e = e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g, "$1“"), - e = e.replace(/([^\s\[\{\(\-])"/g, "$1”"), e = e.replace(/"(?=\s)/g, "”"), - e = e.replace(/"/gi, "“")); - }, Markdown.Extra.prototype.runSmartyPants = function(e) { - return this.smartyPantsLastChar = "", e = this.educatePants(e), e = e.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g, f); - }, Markdown.Extra.prototype.definitionLists = function(t) { - var n = new RegExp([ "(\\x02\\n?|\\n\\n)", "(?:", "(", "(", "[ ]{0,3}", "((?:[ \\t]*\\S.*\\n)+)", "\\n?", "[ ]{0,3}:[ ]+", ")", "([\\s\\S]+?)", "(", "(?=\\0x03)", "|", "(?=", "\\n{2,}", "(?=\\S)", "(?!", "[ ]{0,3}", "(?:\\S.*\\n)+?", "\\n?", "[ ]{0,3}:[ ]+", ")", "(?!", "[ ]{0,3}:[ ]+", ")", ")", ")", ")", ")" ].join(""), "gm"), i = this; - return t = s(t), t = t.replace(n, function(t, n, o) { - var r = e(i.processDefListItems(o)); - return r = "", t(s), "
\n" + r + "\n
", n + i.hashExtraBlock(r) + "\n\n"; - }), a(t); - }, Markdown.Extra.prototype.processDefListItems = function(i) { - var o = this, r = new RegExp([ "(\\x02\\n?|\\n\\n+)", "(", "[ ]{0,3}", "(?![:][ ]|[ ])", "(?:\\S.*\\n)+?", ")", "(?=\\n?[ ]{0,3}:[ ])" ].join(""), "gm"), u = new RegExp([ "\\n(\\n+)?", "(", "[ ]{0,3}", "[:][ ]+", ")", "([\\s\\S]+?)", "(?=\\n*", "(?:", "\\n[ ]{0,3}[:][ ]|", "- |\\x03", ")", ")" ].join(""), "gm"); - return i = s(i), i = i.replace(/\n{2,}(?=\\x03)/, "\n"), i = i.replace(r, function(t, n, i) { - for (var r = e(i).split("\n"), s = "", a = 0; a < r.length; a++) { - var c = r[a]; - c = l(e(c), o), s += "\n
- " + c + "
"; - } - return s + "\n"; - }), i = i.replace(u, function(e, i, r, s) { - return i || s.match(/\n{2,}/) ? (s = Array(r.length + 1).join(" ") + s, s = n(s) + "\n\n", - s = "\n" + c(s, o) + "\n") : (s = t(s), s = l(n(s), o)), "\n- " + s + "
\n"; - }), a(i); - }, Markdown.Extra.prototype.strikethrough = function(e) { - return e.replace(/([\W_]|^)~T~T(?=\S)([^\r]*?\S[\*_]*)~T~T([\W_]|$)/g, "$1$2$3"); - }, Markdown.Extra.prototype.newlines = function(e) { - return e.replace(/(<(?:br|\/li)>)?\n/g, function(e, t) { - return t ? e : "
\n"; - }); - }; -}(), define("pagedown-extra", function() {}), define("extensions/markdownExtra", [ "jquery", "underscore", "utils", "classes/Extension", "text!html/markdownExtraSettingsBlock.html", "google-code-prettify", "highlightjs", "pagedown-extra" ], function(e, t, n, i, o, r, s) { - var a = new i("markdownExtra", "Markdown Extra", !0); - a.settingsBlock = o, a.defaultConfig = { - extensions: [ "fenced_code_gfm", "tables", "def_list", "attr_list", "footnotes", "smartypants", "strikethrough", "newlines" ], - intraword: !0, - comments: !0, - highlighter: "prettify" - }, a.onLoadSettings = function() { - function e(e) { - return t.some(a.config.extensions, function(t) { - return t == e; - }); - } - n.setInputChecked("#input-markdownextra-fencedcodegfm", e("fenced_code_gfm")), n.setInputChecked("#input-markdownextra-tables", e("tables")), - n.setInputChecked("#input-markdownextra-deflist", e("def_list")), n.setInputChecked("#input-markdownextra-attrlist", e("attr_list")), - n.setInputChecked("#input-markdownextra-footnotes", e("footnotes")), n.setInputChecked("#input-markdownextra-smartypants", e("smartypants")), - n.setInputChecked("#input-markdownextra-strikethrough", e("strikethrough")), n.setInputChecked("#input-markdownextra-newlines", e("newlines")), - n.setInputChecked("#input-markdownextra-intraword", a.config.intraword), n.setInputChecked("#input-markdownextra-comments", a.config.comments), - n.setInputValue("#input-markdownextra-highlighter", a.config.highlighter); - }, a.onSaveSettings = function(e) { - e.extensions = [], n.getInputChecked("#input-markdownextra-fencedcodegfm") && e.extensions.push("fenced_code_gfm"), - n.getInputChecked("#input-markdownextra-tables") && e.extensions.push("tables"), - n.getInputChecked("#input-markdownextra-deflist") && e.extensions.push("def_list"), - n.getInputChecked("#input-markdownextra-attrlist") && e.extensions.push("attr_list"), - n.getInputChecked("#input-markdownextra-footnotes") && e.extensions.push("footnotes"), - n.getInputChecked("#input-markdownextra-smartypants") && e.extensions.push("smartypants"), - n.getInputChecked("#input-markdownextra-strikethrough") && e.extensions.push("strikethrough"), - n.getInputChecked("#input-markdownextra-newlines") && e.extensions.push("newlines"), - e.intraword = n.getInputChecked("#input-markdownextra-intraword"), e.comments = n.getInputChecked("#input-markdownextra-comments"), - e.highlighter = n.getInputValue("#input-markdownextra-highlighter"); - }; - var l; - return a.onEventMgrCreated = function(e) { - l = e; - }, a.onPagedownConfigure = function(e) { - var n = e.getConverter(); - if (a.config.intraword === !0) { - var i = { - _DoItalicsAndBold: function(e) { - return e = e.replace(/([^\w*]|^)(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\2(?=[^\w*]|$)/g, "$1$3"), - e = e.replace(/([^\w*]|^)(\*|_)(?=\S)(.+?)(?=\S)\2(?=[^\w*]|$)/g, "$1$3"); - } - }; - n.setOptions(i); - } - a.config.comments === !0 && n.hooks.chain("postConversion", function(e) { - return e.replace(//g, function(e) { - return e.replace(/^$/, ' $1 '); - }); - }); - var o = { - extensions: a.config.extensions - }; - if ("highlight" == a.config.highlighter) { - o.highlighter = "prettify"; - var l = document.getElementById("preview-contents"); - e.hooks.chain("onPreviewRefresh", function() { - t.each(l.querySelectorAll(".prettyprint > code"), function(e) { - !e.highlighted && s.highlightBlock(e), e.highlighted = !0; - }); - }); - } else "prettify" == a.config.highlighter && (o.highlighter = "prettify", e.hooks.chain("onPreviewRefresh", r.prettyPrint)); - Markdown.Extra.init(n, o); - }, a; -}), define("text!html/mathJaxSettingsBlock.html", [], function() { - return 'Allows StackEdit to interpret LaTeX mathematical expressions.
\n\n\nMore info'; -}), define("text!libs/mathjax_config.js", [], function() { - return 'MathJax.Hub.Config({\n "HTML-CSS": {\n preferredFont: "TeX",\n availableFonts: [\n "STIX",\n "TeX"\n ],\n linebreaks: {\n automatic: true\n },\n EqnChunk: 10,\n imageFont: null\n },\n tex2jax: <%= tex2jax || \'{ inlineMath: [["$","$"],["\\\\\\\\\\\\\\\\(","\\\\\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\\\\\[","\\\\\\\\]"]], processEscapes: true }\' %>,\n TeX: $.extend({\n noUndefined: {\n attributes: {\n mathcolor: "red",\n mathbackground: "#FFEEEE",\n mathsize: "90%"\n }\n },\n Safe: {\n allow: {\n URLs: "safe",\n classes: "safe",\n cssIDs: "safe",\n styles: "safe",\n fontsize: "all"\n }\n }\n }, <%= tex %>),\n messageStyle: "none"\n});\n'; -}), define("libs/mathjax_init", [ "settings", "text!libs/mathjax_config.js" ], function(e, t) { - var n = document.createElement("script"); - n.type = "text/x-mathjax-config", n.innerHTML = _.template(t, { - tex: e.extensionSettings.mathJax ? e.extensionSettings.mathJax.tex : "undefined", - tex2jax: e.extensionSettings.mathJax ? e.extensionSettings.mathJax.tex2jax : void 0 - }), document.getElementsByTagName("head")[0].appendChild(n); -}), define("extensions/mathJax", [ "utils", "classes/Extension", "text!html/mathJaxSettingsBlock.html", "mathjax" ], function(e, t, n) { - function i(e, t, n) { - var i = u.slice(e, t + 1).join("").replace(/&/g, "&").replace(//g, ">"); - for (w.Browser.isMSIE && (i = i.replace(/(%[^\n]*)\n/g, "$1\n \n\n\n \n\n\n \n\n\n \n\n
\n")); t > e; ) u[t] = "", - t--; - u[e] = "@@" + g.length + "@@", n && (i = n(i)), g.push(i), d = h = p = null; - } - function o(e) { - d = h = p = null, g = []; - var t; - /`/.test(e) ? (e = e.replace(/~/g, "~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, function(e) { - return e.replace(/\$/g, "~D"); - }), t = function(e) { - return e.replace(/~([TD])/g, function(e, t) { - return { - T: "~", - D: "$" - }[t]; - }); - }) : t = function(e) { - return e; - }, u = C(e.replace(/\r\n?/g, "\n"), x); - for (var e = 1, n = u.length; n > e; e += 2) { - var o = u[e]; - "@" === o.charAt(0) ? (u[e] = "@@" + g.length + "@@", g.push(o)) : d ? o === h ? f ? p = e : i(d, e, t) : o.match(/\n.*\n/) ? (p && (e = p, - i(d, e, t)), d = h = p = null, f = 0) : "{" === o ? f++ : "}" === o && f && f-- : o === y || "$$" === o ? (d = e, - h = o, f = 0) : "begin" === o.substr(1, 5) && (d = e, h = "\\end" + o.substr(6), - f = 0); - } - return p && i(d, p, t), t(u.join("")); - } - function r(e) { - return e = e.replace(/@@(\d+)@@/g, function(e, t) { - return g[t]; - }), g = null, e; - } - function s() { - v = !1, w.cancelTypeset = !1, w.Queue([ "Typeset", w, b ]), w.Queue(c); - } - function a() { - !v && (v = !0, w.Cancel(), w.Queue(s)); - } - var l = new t("mathJax", "MathJax", !0); - l.settingsBlock = n, l.defaultConfig = { - tex: "{}", - tex2jax: '{ inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true }' - }, l.onLoadSettings = function() { - e.setInputValue("#input-mathjax-config-tex", l.config.tex), e.setInputValue("#input-mathjax-config-tex2jax", l.config.tex2jax); - }, l.onSaveSettings = function(t, n) { - t.tex = e.getInputJsValue("#input-mathjax-config-tex", n), t.tex2jax = e.getInputJsValue("#input-mathjax-config-tex2jax", n); - }, l.onPagedownConfigure = function(e) { - b = document.getElementById("preview-contents"); - var t = e.getConverter(); - t.hooks.chain("preConversion", o), t.hooks.chain("postConversion", r); - }; - var c; - l.onAsyncPreview = function(e) { - c = e, a(); - }; - var u, d, h, p, f, g, m = !1, v = !1, b = null, y = "$", w = MathJax.Hub; - w.Queue(function() { - m = !0, w.processUpdateTime = 50, w.Config({ - "HTML-CSS": { - EqnChunk: 10, - EqnChunkFactor: 1 - }, - SVG: { - EqnChunk: 10, - EqnChunkFactor: 1 - } - }); - }); - var C, x = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i; - return C = 3 === "aba".split(/(b)/).length ? function(e, t) { - return e.split(t); - } : function(e, t) { - var n, i = []; - if (!t.global) { - n = t.toString(); - var o = ""; - n = n.replace(/^\/(.*)\/([im]*)$/, function(e, t, n) { - return o = n, t; - }), t = RegExp(n, o + "g"); - } - for (var r = t.lastIndex = 0; n = t.exec(e); ) i.push(e.substring(r, n.index)), - i.push.apply(i, n.slice(1)), r = n.index + n[0].length; - return i.push(e.substring(r)), i; - }, function() { - var e = MathJax.Hub; - if (!e.Cancel) { - e.cancelTypeset = !1, e.Register.StartupHook("HTML-CSS Jax Config", function() { - var t = MathJax.OutputJax["HTML-CSS"], n = t.Translate; - t.Augment({ - Translate: function(i, o) { - if (e.cancelTypeset || o.cancelled) throw Error("MathJax Canceled"); - return n.call(t, i, o); - } - }); - }), e.Register.StartupHook("SVG Jax Config", function() { - var t = MathJax.OutputJax.SVG, n = t.Translate; - t.Augment({ - Translate: function(i, o) { - if (e.cancelTypeset || o.cancelled) throw Error("MathJax Canceled"); - return n.call(t, i, o); - } - }); - }), e.Register.StartupHook("TeX Jax Config", function() { - var t = MathJax.InputJax.TeX, n = t.Translate; - t.Augment({ - Translate: function(i, o) { - if (e.cancelTypeset || o.cancelled) throw Error("MathJax Canceled"); - return n.call(t, i, o); - } - }); - }); - var t = e.processError; - e.processError = function(n, i, o) { - return "MathJax Canceled" !== n.message ? t.call(e, n, i, o) : (MathJax.Message.Clear(0, 0), - i.jaxIDs = [], i.jax = {}, i.scripts = [], i.i = i.j = 0, i.cancelled = !0, null); - }, e.Cancel = function() { - this.cancelTypeset = !0; - }; - } - }(), l; -}), define("extensions/markdownSectionParser", [ "underscore", "extensions/markdownExtra", "extensions/mathJax", "classes/Extension" ], function(e, t, n, i) { - var o, r = new i("markdownSectionParser", "Markdown section parser"); - return r.onEventMgrCreated = function(e) { - o = e; - }, r.onPagedownConfigure = function(i) { - var r = "^.+[ \\t]*\\n=+[ \\t]*\\n+|^.+[ \\t]*\\n-+[ \\t]*\\n+|^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*\\n+"; - t.enabled && e.some(t.config.extensions, function(e) { - return "fenced_code_gfm" == e; - }) && (r = "^```.*\\n[\\s\\S]*?\\n```|" + r), n.enabled && (r = "^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|" + r, - r = "^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|" + r, r = "^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|" + r), - r = new RegExp(r, "gm"); - var s = i.getConverter(); - s.hooks.chain("preConversion", function(t) { - function n(e, t) { - var n = i.substring(a, t); - s.push({ - text: n, - textWithDelimiter: '\n\n\n' + n + "\n" - }); - } - o.previewStartTime = new Date(); - var i = t + "\n\n", s = [], a = 0; - return i.replace(r, function(e, t) { - n(a, t), a = t; - }), n(a, t.length), o.onSectionsCreated(s), e.reduce(s, function(e, t) { - return e + t.textWithDelimiter; - }, ""); - }); - }, r; -}), define("text!html/partialRenderingSettingsBlock.html", [], function() { - return "Renders modified sections only.
\n\n NOTE: Document sections are based on title elements (h1, h2...). Therefore if\n your document does not contain any title, performance will not be increased.\n"; -}), define("extensions/partialRendering", [ "underscore", "crel", "extensions/markdownExtra", "classes/Extension", "text!html/partialRenderingSettingsBlock.html" ], function(e, t, n, i, o) { - function r(t, n) { - if (g = [], f = [], d = void 0, m === !0 || u != n) return m = !1, u = n, f = p, - p = t, g = t, void 0; - var i = p.length; - e.some(p, function(e, n) { - return n >= t.length || e.text != t[n].text ? (i = n, !0) : void 0; - }); - var o = -p.length; - e.some(p.slice().reverse(), function(e, n) { - return n >= t.length || e.text != t[t.length - n - 1].text ? (o = -n, !0) : void 0; - }), i - o > p.length && (o = i - p.length); - var r = p.slice(0, i); - g = t.slice(i, t.length + o); - var s = p.slice(p.length + o, p.length); - d = e.first(s), f = p.slice(i, p.length + o), p = r.concat(g).concat(s); - } - function s(e) { - var t = e.id.substring(3); - C[t] = e; - } - function a() { - function n(n) { - for (var i = t("div", { - id: "wmd-preview-section-" + n.id, - "class": "wmd-preview-section preview-content" - }), r = !1; o; ) { - var a = o.nextSibling; - if (r === !0 && "DIV" == o.tagName && "se-section-delimiter" == o.className) break; - r = !0, "DIV" == o.tagName && "footnotes" == o.className ? e.each(o.querySelectorAll("ol > li"), s) : i.appendChild(o), - o = a; - } - return i; - } - e.each(f, function(e) { - var t = document.getElementById("wmd-preview-section-" + e.id); - w.removeChild(t); - }); - var i = document.getElementById("wmd-preview"), o = i.firstChild, r = document.createDocumentFragment(); - e.each(g, function(e) { - r.appendChild(n(e)); - }), i.innerHTML = ""; - var a = y; - void 0 !== d && (a = document.getElementById("wmd-preview-section-" + d.id)), w.insertBefore(r, a), - y.innerHTML = ""; - var l = []; - if (b === !0) { - var c = t("ol"); - e.each(w.querySelectorAll("a.footnote"), function(e, t) { - e.textContent = t + 1; - var n = e.id.substring(6); - l.push(n), c.appendChild(C[n].cloneNode(!0)); - }), l.length > 0 && y.appendChild(t("div", { - "class": "footnotes" - }, t("hr"), c)), C = e.pick(C, l); - } - } - var l = new i("partialRendering", "Partial Rendering", !0); - l.settingsBlock = o; - var c, u, d, h = 0, p = [], f = [], g = [], m = !1, v = !1, b = !1; - l.onSectionsCreated = function(t) { - var n = [], i = "\n"; - b = !1, e.each(t, function(e) { - var t = e.textWithDelimiter + "\n"; - v && (t = t.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm, function(e, t) { - return t ? (b = !0, i += e.replace(/^\s*\n/gm, "") + "\n", "") : e; - })), t = t.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm, function(e, t) { - return t ? (i += e.replace(/^\s*\n/gm, "") + "\n", "") : e; - }), n.push({ - id: ++h, - text: t + "\n" - }); - }), r(n, i); - }; - var y, w, C = {}; - return l.onPagedownConfigure = function(t) { - c = t.getConverter(), c.hooks.chain("preConversion", function() { - var t = e.map(g, function(e) { - return e.text; - }); - return t.push(u + "\n\n"), t.join(""); - }), t.hooks.chain("onPreviewRefresh", function() { - a(); - }); - }, l.onInit = function() { - n.enabled && e.some(n.config.extensions, function(e) { - return "footnotes" == e; - }) && (v = !0); - }, l.onReady = function() { - y = t("div", { - id: "wmd-preview-section-footnotes", - "class": "preview-content" - }), w = document.getElementById("preview-contents"), w.appendChild(y); - }, l.onFileSelected = function() { - m = !0; - }, l; -}), define("text!html/buttonMarkdownSyntax.html", [], function() { - return '\n \n'; -}), define("extensions/buttonMarkdownSyntax", [ "jquery", "classes/Extension", "text!html/buttonMarkdownSyntax.html" ], function(e, t, n) { - var i = new t("buttonMarkdownSyntax", 'Button "Markdown syntax', !0, !0); - return i.settingsBlock = 'Adds a "Markdown syntax" button over the preview.
', - i.onCreatePreviewButton = function() { - return n; - }, i; -}), define("extensions/googleAnalytics", [ "jquery", "underscore", "constants", "utils", "classes/Extension", "settings" ], function(e, t, n, i, o, r) { - function s() { - i.currentTime - d > 18e4 && (_gaq.push([ "_trackPageview" ]), d = i.currentTime); - } - var a = new o("googleAnalytics", "Google Analytics", !0); - a.settingsBlock = "Sends anonymous statistics about usage and errors to help improve StackEdit.
"; - var l = !1, c = !1; - window._gaq = []; - var u = function() { - if (l === !1 && c === !1) { - var t = "/ga.js"; - location.search.match(/(\?|&)console/) && (t = "/u/ga_debug.js"), e.ajax({ - url: "https://ssl.google-analytics.com" + t, - dataType: "script" - }).done(function() { - l = !0; - }); - } - }, d = 0; - a.onPeriodicRun = function() { - s(); - }, a.onReady = function() { - _gaq.push([ "_setAccount", n.GOOGLE_ANALYTICS_ACCOUNT_ID ]), s(), _gaq.push([ "_trackEvent", "About", "version", n.VERSION ]), - _gaq.push([ "_trackEvent", "Settings", "layoutOrientation", "" + r.layoutOrientation ]), - _gaq.push([ "_trackEvent", "Settings", "theme", "" + window.theme ]), _gaq.push([ "_trackEvent", "Settings", "lazyRendering", "" + r.lazyRendering ]), - _gaq.push([ "_trackEvent", "Settings", "editorFontFamily", "" + r.editorFontFamily ]), - _gaq.push([ "_trackEvent", "Settings", "editorFontSize", "" + r.editorFontSize ]), - _gaq.push([ "_trackEvent", "Settings", "defaultContent backlink", "" + (-1 !== r.defaultContent.indexOf(n.MAIN_URL)) ]), - _gaq.push([ "_trackEvent", "Settings", "commitMsg backlink", "" + (-1 !== r.commitMsg.indexOf(n.MAIN_URL)) ]), - _gaq.push([ "_trackEvent", "Settings", "sshProxy unchanged", "" + (r.sshProxy == n.SSH_PROXY_URL) ]), - t.each(r.extensionSettings, function(e, t) { - _gaq.push([ "_trackEvent", "Extensions", t + " enabled", "" + (e.enabled === !0) ]); - }), window.onerror = function(e, t, n) { - _gaq.push([ "_trackEvent", "Error", e, t + ":" + n + i.formatEventList() ]); - }, u(); - }, a.onOfflineChanged = function(e) { - c = e, u(); - }; - var h = 0; - return a.onSyncRunning = function(e) { - e === !0 && (h = new Date().getTime()); - }, a.onPublishRunning = function(e) { - e === !0 && (h = new Date().getTime()); - }, a.onSyncSuccess = function() { - var e = new Date().getTime(); - _gaq.push([ "_trackTiming", "Sync", "SyncTime", e - h ]); - }, a.onSyncImportSuccess = function(e, t) { - _gaq.push([ "_trackEvent", "Sync", "SyncImport" ]), _gaq.push([ "_trackEvent", "Sync", "SyncImport provider", t.providerId ]); - }, a.onSyncExportSuccess = function(e, t) { - _gaq.push([ "_trackEvent", "Sync", "SyncExport" ]), _gaq.push([ "_trackEvent", "Sync", "SyncExport provider", t.provider.providerId ]); - }, a.onPublishSuccess = function(e) { - var n = new Date().getTime(); - _gaq.push([ "_trackTiming", "Publish", "PublishSuccess", n - h ]), t.each(e.publishLocations, function(e) { - _gaq.push([ "_trackEvent", "Publish", "PublishSuccess provider", e.provider.providerId ]); - }); - }, a.onNewPublishSuccess = function(e, t) { - _gaq.push([ "_trackEvent", "Publish", "NewPublish provider", t.provider.providerId ]); - }, a.onError = function(e) { - !t.isString(e) && e.message && _gaq.push([ "_trackEvent", "Error", "message", e.message + i.formatEventList() ]); - }, a; -}), define("extensions/twitter", [ "jquery", "underscore", "constants", "utils", "classes/Extension" ], function(e, t, n, i, o) { - var r = new o("twitter", "Twitter", !1, !0), s = !1, a = !1, l = function() { - s === !1 && a === !1 && e.ajax({ - url: "https://platform.twitter.com/widgets.js", - dataType: "script" - }).done(function() { - s = !0; - }); - }; - return r.onReady = function() { - l(); - }, r.onOfflineChanged = function(e) { - a = e, l(); - }, r.onTweet = function() { - s && window.twttr.widgets.load(); - }, r; -}), define("text!html/dialogAbout.html", [], function() { - return '\n\n'; -}), define("extensions/dialogAbout", [ "underscore", "constants", "utils", "classes/Extension", "text!html/dialogAbout.html" ], function(e, t, n, i, o) { - var r = new i("dialogAbout", 'Dialog "About"'), s = { - ACE: "http://ace.c9.io/", - Bootstrap: "http://getbootstrap.com/", - "Bootstrap Tour": "http://bootstraptour.com/", - crel: "https://github.com/KoryNunn/crel", - "Dropbox-js": "https://github.com/dropbox/dropbox-js", - "FileSaver.js": "https://github.com/eligrey/FileSaver.js/", - Fontello: "http://fontello.com/", - "Font Awesome and others...": "res/libs/fontello/LICENSE.txt", - Gatekeeper: "https://github.com/prose/gatekeeper", - "Github.js": "https://github.com/michael/github", - "Highlight.js": "http://softwaremaniacs.org/soft/highlight/en/", - jGrowl: "https://github.com/stanlemon/jGrowl/", - jQuery: "http://jquery.com/", - "lz-string": "http://pieroxy.net/blog/pages/lz-string/index.html", - MathJax: "http://www.mathjax.org/", - Mousetrap: "http://craig.is/killing/mice", - "PageDown ACE": "https://github.com/benweet/pagedown-ace", - "PageDown Extra": "https://github.com/jmcmanus/pagedown-extra/", - Prettify: "https://code.google.com/p/google-code-prettify/", - RequireJS: "http://requirejs.org/", - "RequireJS LESS plugin": "https://github.com/guybedford/require-less", - "stacktrace.js": "http://stacktracejs.com/", - "to-markdown": "https://github.com/domchristie/to-markdown", - "Typo.js": "https://github.com/cfinke/Typo.js", - "UI Layout": "http://layout.jquery-dev.net/", - "Underscore.js": "http://underscorejs.org/", - waitForImages: "https://github.com/alexanderdickson/waitForImages", - XRegExp: "https://github.com/slevithan/xregexp", - "yaml.js": "https://github.com/jeremyfa/yaml.js" - }, a = { - "StackEdit Download Proxy": "https://github.com/benweet/stackedit-download-proxy", - "StackEdit HTMLtoPDF": "https://github.com/benweet/stackedit-htmltopdf", - "StackEdit Picasa Proxy": "https://github.com/benweet/stackedit-picasa-proxy", - "StackEdit SSH Proxy": "https://github.com/benweet/stackedit-ssh-proxy", - "StackEdit Tumblr Proxy": "https://github.com/benweet/stackedit-tumblr-proxy", - "StackEdit WordPress Proxy": "https://github.com/benweet/stackedit-wordpress-proxy" - }; - return r.onReady = function() { - n.addModal("modal-about", e.template(o, { - libraries: s, - projects: a, - version: t.VERSION - })); - }, r; -}), define("text!html/dialogManagePublicationLocation.html", [], function() { - return ' \n\n'; -}), define("extensions/dialogManagePublication", [ "jquery", "underscore", "classes/Extension", "text!html/dialogManagePublicationLocation.html" ], function(e, t, n, i) { - var o, r = new n("dialogManagePublication", 'Dialog "Manage publication"', !1, !0); - r.onEventMgrCreated = function(e) { - o = e; - }; - var s, a, l, c, u = function(n) { - if (void 0 === n || n === s) { - t.size(s.publishLocations) > 0 ? (l.removeClass("hide"), c.addClass("hide")) : (l.addClass("hide"), - c.removeClass("hide")); - var r = t.reduce(s.publishLocations, function(e, n) { - var o = t.omit(n, "provider", "publishIndex", "sharingLink"); - return o.password && (o.password = "********"), o = JSON.stringify(o).replace(/{|}|"/g, "").replace(/,/g, ", "), - e + t.template(i, { - publishAttributes: n, - publishDesc: o - }); - }, ""); - a.innerHTML = r, t.each(a.querySelectorAll(".remove-button"), function(t) { - var n = e(t), i = s.publishLocations[n.data("publishIndex")]; - n.click(function() { - s.removePublishLocation(i), o.onPublishRemoved(s, i); - }); - }); - } - }; - return r.onFileSelected = function(e) { - s = e, u(e); - }, r.onNewPublishSuccess = u, r.onPublishRemoved = u, r.onReady = function() { - var t = document.querySelector(".modal-manage-publish"); - a = t.querySelector(".publish-list"), l = e(t.querySelectorAll(".msg-publish-list")), - c = e(t.querySelectorAll(".msg-no-publish")); - }, r; -}), define("text!html/dialogManageSynchronizationLocation.html", [], function() { - return '\n'; -}), define("extensions/dialogManageSynchronization", [ "jquery", "underscore", "classes/Extension", "text!html/dialogManageSynchronizationLocation.html" ], function(e, t, n, i) { - var o, r = new n("dialogManageSynchronization", 'Dialog "Manage synchronization"', !1, !0); - r.onEventMgrCreated = function(e) { - o = e; - }; - var s; - r.onSynchronizerCreated = function(e) { - s = e; - }; - var a, l, c, u, d = function(n) { - if (void 0 === n || n === a) { - t.size(a.syncLocations) > 0 ? (c.removeClass("hide"), u.addClass("hide")) : (c.addClass("hide"), - u.removeClass("hide")); - var r = t.reduce(a.syncLocations, function(e, n) { - return e + t.template(i, { - syncAttributes: n, - syncDesc: n.id || n.path - }); - }, ""); - l.innerHTML = r, t.each(l.querySelectorAll(".remove-button"), function(t) { - var n = e(t), i = a.syncLocations[n.data("syncIndex")]; - n.click(function() { - s.tryStopRealtimeSync(), a.removeSyncLocation(i), o.onSyncRemoved(a, i); - }); - }); - } - }; - return r.onFileSelected = function(e) { - a = e, d(e); - }, r.onSyncExportSuccess = d, r.onSyncRemoved = d, r.onReady = function() { - var t = document.querySelector(".modal-manage-sync"); - l = t.querySelector(".sync-list"), c = e(t.querySelectorAll(".msg-sync-list")), - u = e(t.querySelectorAll(".msg-no-sync")); - }, r; -}), define("text!html/dialogManageSharingLocation.html", [], function() { - return ' \n\n'; -}), define("extensions/dialogManageSharing", [ "jquery", "underscore", "classes/Extension", "text!html/dialogManageSharingLocation.html" ], function(e, t, n, i) { - var o, r = new n("dialogManageSharing", 'Button "Share"', !1, !0); - r.onEventMgrCreated = function(e) { - o = e; - }; - var s, a, l, c, u = function(e) { - if (void 0 === e || e === s) { - var n = t.reduce(s.publishLocations, function(e, n) { - return n.sharingLink && (e += t.template(i, { - link: n.sharingLink, - title: s.title - })), e; - }, ""); - a.innerHTML = n, o.onTweet(), l.toggleClass("hide", 0 === n.length), c.toggleClass("hide", 0 !== n.length); - } - }; - return r.onFileSelected = function(e) { - s = e, u(e); - }, r.onNewPublishSuccess = function(t, n) { - u(t), n.sharingLink && (e(".modal").modal("hide"), e(".modal-manage-sharing").modal("show")); - }, r.onPublishRemoved = u, r.onReady = function() { - var t = document.querySelector(".modal-manage-sharing"); - a = t.querySelector(".share-list"), l = e(t.querySelectorAll(".msg-share-list")), - c = e(t.querySelectorAll(".msg-no-share")); - }, r; -}), function() { - var e = this, t = {}, n = !1; - "undefined" != typeof module && module.exports ? (module.exports = t, e.toMarkdown = t, - n = !0) : e.toMarkdown = t, t.converter = function(e) { - e && e.elements && $.isArray(e.elements) && (c = c.concat(e.elements)), this.makeMd = function(e, t) { - var o; - if (n) { - var r = require("jsdom"); - r.env({ - html: e, - scripts: [ "http://code.jquery.com/jquery-1.6.4.min.js" ], - done: function(n, o) { - "function" == typeof t && t(i(e, o.$)); - } - }); - } else o = i(e, $); - return o; - }; - }; - var i = function(e, t) { - e = e.replace(/(\d+)\. /g, "$1\\. "); - var n = t(""), i = n.html(e); - i.find("*:not(pre, code)").contents().filter(function() { - return 3 === this.nodeType && /^\s+$/.test(this.nodeValue); - }).remove(); - for (var o = [], r = 0, a = c.length; a > r; r++) o.push(c[r].selector); - for (o = o.join(","); i.find(o).length; ) for (var r = 0, a = c.length; a > r; r++) $matches = i.find(c[r].selector + ':not(:has("' + o + '"))'), - $matches.each(function(e, n) { - var i = t(n); - i.before(c[r].replacement(i.html(), i)).remove(); - }); - return s(i.html()); - }, o = function(e) { - return e.replace(/^[\n\r\f]+|[\n\r\f]+$/g, ""); - }, r = function(e) { - return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"'); - }, s = function(e) { - return e = e.replace(/^[\t\r\n]+|[\t\r\n]+$/g, ""), e = e.replace(/\n\s+\n/g, "\n\n"), - e = e.replace(/\n{3,}/g, "\n\n"), e = r(e); - }, a = function(e) { - return e = o(e), e ? "**" + e + "**" : ""; - }, l = function(e) { - return e = o(e), e ? "_" + e + "_" : ""; - }, c = [ { - selector: "p", - replacement: function(e) { - return e = $.trim(e), e ? "\n\n" + e + "\n\n" : ""; - } - }, { - selector: "br", - replacement: function() { - return "\n"; - } - }, { - selector: "h1,h2,h3,h4,h5,h6", - replacement: function(e, t) { - e = $.trim(e); - for (var n = t.prop("nodeName").charAt(1), i = "", o = 0; n > o; o++) i += "#"; - return e ? "\n\n" + i + " " + e + "\n\n" : ""; - } - }, { - selector: "hr", - replacement: function() { - return "\n\n* * *\n\n"; - } - }, { - selector: "a[href]", - replacement: function(e, t) { - if (e) { - e = o(e); - var n = t.attr("href"), i = t.attr("title") || ""; - return "[" + e + "]" + "(" + n + (i ? ' "' + i + '"' : "") + ")"; - } - return !1; - } - }, { - selector: "b", - replacement: a - }, { - selector: "strong", - replacement: a - }, { - selector: "i", - replacement: l - }, { - selector: "em", - replacement: l - }, { - selector: "code", - replacement: function(e) { - return e = o(e), e ? "`" + e + "`" : ""; - } - }, { - selector: "img", - replacement: function(e, t) { - var n = t.attr("alt") || "", i = t.attr("src") || "", o = t.attr("title") || ""; - return "![" + n + "]" + "(" + i + (o ? ' "' + o + '"' : "") + ")"; - } - }, { - selector: "pre", - replacement: function(e) { - return /^\s*\`/.test(e) ? (e = e.replace(/\`/g, ""), " " + e.replace(/\n/g, "\n ")) : ""; - } - }, { - selector: "li", - replacement: function(e, t) { - e = e.replace(/^\s+|\s+$/, "").replace(/\n/gm, "\n "); - var n = "* ", i = "", o = t.parent(), r = o.contents().filter(function() { - return 1 === this.nodeType && "LI" === this.nodeName || 3 === this.nodeType; - }), s = r.index(t) + 1; - return n = o.is("ol") ? s + ". " : "* ", s == r.length && (t.parents("li").length || (i = "\n"), - e = e.replace(/\s+$/, ""), t.unwrap()), n + e + i + "\n"; - } - }, { - selector: "blockquote", - replacement: function(e) { - return e = e = $.trim(e).replace(/\n{3,}/g, "\n\n"), e = e.replace(/\n/g, "\n> "), - "> " + e; - } - } ]; -}(), define("toMarkdown", [ "jquery" ], function(e) { - return function() { - var t; - return t || e.toMarkdown; - }; -}(this)), define("extensions/dialogOpenHarddrive", [ "jquery", "underscore", "constants", "utils", "classes/Extension", "toMarkdown" ], function(e, t, n, i, o, r) { - function s(i) { - i.stopPropagation(), i.preventDefault(); - var o = (i.dataTransfer || i.target).files; - e(".modal-import-harddrive-markdown, .modal-import-harddrive-html").modal("hide"), - t.each(o, function(t) { - if (!e(i.target).is("#wmd-input *") || !t.name.match(/.(jpe?g|png|gif)$/i)) { - var o = new FileReader(); - o.onload = function(e) { - return function(t) { - var n = t.target.result; - if (n.match(/\uFFFD/)) return h.onError(e.name + " is a binary file."), void 0; - if (n = p ? p(n) : n, void 0 === n) return h.onError(e.name + " is not a valid HTML file."), - void 0; - var i = e.name, o = i.lastIndexOf("."); - i = -1 !== o ? i.substring(0, o) : i; - var r = u.createFile(i, n); - u.selectFile(r); - }; - }(t); - var r = t.slice(0, n.IMPORT_FILE_MAX_CONTENT_SIZE); - o.readAsText(r); - } - }); - } - function a(e) { - p = void 0, s(e); - } - function l(e) { - p = g, s(e); - } - function c(e) { - e.stopPropagation(), e.preventDefault(), e.dataTransfer.dropEffect = "copy"; - } - var u, d = new o("dialogOpenHarddrive", 'Dialog "Open from"'); - d.onFileMgrCreated = function(e) { - u = e; - }; - var h; - d.onEventMgrCreated = function(e) { - h = e; - }; - var p, f, g = function(e) { - return f.makeMd(e); - }; - return d.onReady = function() { - f = new r.converter(), e("#input-file-import-harddrive-markdown").change(a), e("#dropzone-import-harddrive-markdown, #wmd-input").each(function() { - this.addEventListener("dragover", c, !1), this.addEventListener("drop", a, !1); - }), e("#input-file-import-harddrive-html").change(l), e("#dropzone-import-harddrive-html").each(function() { - this.addEventListener("dragover", c, !1), this.addEventListener("drop", l, !1); - }), e(".action-convert-html").click(function(e) { - var t = i.getInputTextValue("#input-convert-html", e); - if (void 0 !== t) { - if (t = f.makeMd(t), void 0 === t) return h.onError("Invalid HTML code."), void 0; - var n = u.createFile(void 0, t); - u.selectFile(n); - } - }); - }, d; -}), define("extensions/documentTitle", [ "jquery", "underscore", "classes/Extension" ], function(e, t, n) { - var i, o = new n("documentTitle", "Document Title"); - o.onLayoutCreated = function(e) { - i = e; - }; - var r, s, a = t.debounce(function(t) { - if (t === r) { - var n = r.title; - document.title = "StackEdit – " + n, s.html(r.composeTitle()), e(".file-title").text(n), - e(".input-file-title").val(n), i && i.resizeAll(); - } - }, 50); - return o.onFileSelected = function(e) { - r = e, a(e); - }, o.onTitleChanged = a, o.onSyncExportSuccess = a, o.onSyncRemoved = a, o.onNewPublishSuccess = a, - o.onPublishRemoved = a, o.onReady = a, o.onReady = function() { - s = e(".file-title-navbar"), s.hover(function() { - var e = s[0].scrollWidth - s.outerWidth(); - s.stop(!0, !0).animate({ - scrollLeft: e - }, 15 * e, "linear"); - }, function() { - s.stop(!0, !0).scrollLeft(0); - }).click(function() { - s.stop(!0, !0).scrollLeft(0); - }); - }, o; -}), function(e, t) { - function n(e, t, n) { - return e.addEventListener ? (e.addEventListener(t, n, !1), void 0) : (e.attachEvent("on" + t, n), - void 0); - } - function i(e) { - if ("keypress" == e.type) { - var t = String.fromCharCode(e.which); - return e.shiftKey || (t = t.toLowerCase()), t; - } - return E[e.which] ? E[e.which] : k[e.which] ? k[e.which] : String.fromCharCode(e.which).toLowerCase(); - } - function o(e, t) { - return e.sort().join(",") === t.sort().join(","); - } - function r(e) { - e = e || {}; - var t, n = !1; - for (t in _) e[t] ? n = !0 : _[t] = 0; - n || (M = !1); - } - function s(e, t, n, i, r, s) { - var a, l, c = [], u = n.type; - if (!T[e]) return []; - for ("keyup" == u && p(e) && (t = [ e ]), a = 0; a < T[e].length; ++a) if (l = T[e][a], - (i || !l.seq || _[l.seq] == l.level) && u == l.action && ("keypress" == u && !n.metaKey && !n.ctrlKey || o(t, l.modifiers))) { - var d = !i && l.combo == r, h = i && l.seq == i && l.level == s; - (d || h) && T[e].splice(a, 1), c.push(l); - } - return c; - } - function a(e) { - var t = []; - return e.shiftKey && t.push("shift"), e.altKey && t.push("alt"), e.ctrlKey && t.push("ctrl"), - e.metaKey && t.push("meta"), t; - } - function l(e) { - return e.preventDefault ? (e.preventDefault(), void 0) : (e.returnValue = !1, void 0); - } - function c(e) { - return e.stopPropagation ? (e.stopPropagation(), void 0) : (e.cancelBubble = !0, - void 0); - } - function u(e, t, n, i) { - R.stopCallback(t, t.target || t.srcElement, n, i) || e(t, n) === !1 && (l(t), c(t)); - } - function d(e, t, n) { - var i, o = s(e, t, n), a = {}, l = 0, c = !1; - for (i = 0; i < o.length; ++i) o[i].seq && (l = Math.max(l, o[i].level)); - for (i = 0; i < o.length; ++i) if (o[i].seq) { - if (o[i].level != l) continue; - c = !0, a[o[i].seq] = 1, u(o[i].callback, n, o[i].combo, o[i].seq); - } else c || u(o[i].callback, n, o[i].combo); - var d = "keypress" == n.type && I; - n.type != M || p(e) || d || r(a), I = c && "keydown" == n.type; - } - function h(e) { - "number" != typeof e.which && (e.which = e.keyCode); - var t = i(e); - if (t) return "keyup" == e.type && L === t ? (L = !1, void 0) : (R.handleKey(t, a(e), e), - void 0); - } - function p(e) { - return "shift" == e || "ctrl" == e || "alt" == e || "meta" == e; - } - function f() { - clearTimeout(S), S = setTimeout(r, 1e3); - } - function g() { - if (!x) { - x = {}; - for (var e in E) e > 95 && 112 > e || E.hasOwnProperty(e) && (x[E[e]] = e); - } - return x; - } - function m(e, t, n) { - return n || (n = g()[e] ? "keydown" : "keypress"), "keypress" == n && t.length && (n = "keydown"), - n; - } - function v(e, t, n, o) { - function s(t) { - return function() { - M = t, ++_[e], f(); - }; - } - function a(t) { - u(n, t, e), "keyup" !== o && (L = i(t)), setTimeout(r, 10); - } - _[e] = 0; - for (var l = 0; l < t.length; ++l) { - var c = l + 1 === t.length, d = c ? a : s(o || y(t[l + 1]).action); - w(t[l], d, o, e, l); - } - } - function b(e) { - return "+" === e ? [ "+" ] : e.split("+"); - } - function y(e, t) { - var n, i, o, r = []; - for (n = b(e), o = 0; o < n.length; ++o) i = n[o], F[i] && (i = F[i]), t && "keypress" != t && A[i] && (i = A[i], - r.push("shift")), p(i) && r.push(i); - return t = m(i, r, t), { - key: i, - modifiers: r, - action: t - }; - } - function w(e, t, n, i, o) { - D[e + ":" + n] = t, e = e.replace(/\s+/g, " "); - var r, a = e.split(" "); - return a.length > 1 ? (v(e, a, t, n), void 0) : (r = y(e, n), T[r.key] = T[r.key] || [], - s(r.key, r.modifiers, { - type: r.action - }, i, e, o), T[r.key][i ? "unshift" : "push"]({ - callback: t, - modifiers: r.modifiers, - action: r.action, - seq: i, - level: o, - combo: e - }), void 0); - } - function C(e, t, n) { - for (var i = 0; i < e.length; ++i) w(e[i], t, n); - } - for (var x, S, E = { - 8: "backspace", - 9: "tab", - 13: "enter", - 16: "shift", - 17: "ctrl", - 18: "alt", - 20: "capslock", - 27: "esc", - 32: "space", - 33: "pageup", - 34: "pagedown", - 35: "end", - 36: "home", - 37: "left", - 38: "up", - 39: "right", - 40: "down", - 45: "ins", - 46: "del", - 91: "meta", - 93: "meta", - 224: "meta" - }, k = { - 106: "*", - 107: "+", - 109: "-", - 110: ".", - 111: "/", - 186: ";", - 187: "=", - 188: ",", - 189: "-", - 190: ".", - 191: "/", - 192: "`", - 219: "[", - 220: "\\", - 221: "]", - 222: "'" - }, A = { - "~": "`", - "!": "1", - "@": "2", - "#": "3", - $: "4", - "%": "5", - "^": "6", - "&": "7", - "*": "8", - "(": "9", - ")": "0", - _: "-", - "+": "=", - ":": ";", - '"': "'", - "<": ",", - ">": ".", - "?": "/", - "|": "\\" - }, F = { - option: "alt", - command: "meta", - "return": "enter", - escape: "esc", - mod: /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? "meta" : "ctrl" - }, T = {}, D = {}, _ = {}, L = !1, I = !1, M = !1, $ = 1; 20 > $; ++$) E[111 + $] = "f" + $; - for ($ = 0; 9 >= $; ++$) E[$ + 96] = $; - n(t, "keypress", h), n(t, "keydown", h), n(t, "keyup", h); - var R = { - bind: function(e, t, n) { - return e = e instanceof Array ? e : [ e ], C(e, t, n), this; - }, - unbind: function(e, t) { - return R.bind(e, function() {}, t); - }, - trigger: function(e, t) { - return D[e + ":" + t] && D[e + ":" + t]({}, e), this; - }, - reset: function() { - return T = {}, D = {}, this; - }, - stopCallback: function(e, t) { - return (" " + t.className + " ").indexOf(" mousetrap ") > -1 ? !1 : "INPUT" == t.tagName || "SELECT" == t.tagName || "TEXTAREA" == t.tagName || t.isContentEditable; - }, - handleKey: d - }; - e.Mousetrap = R, "function" == typeof define && define.amd && define("mousetrap", R); -}(window, document), define("classes/FileDescriptor", [ "underscore", "utils", "storage", "ace/range" ], function(e, t, n, i) { - function o(t, i, o, s) { - this.fileIndex = t, this._title = i || n[t + ".title"], this._editorScrollTop = parseInt(n[t + ".editorScrollTop"]) || 0, - this._editorSelectRange = function() { - try { - var i = n[t + ".editorSelectRange"].split(";"); - return i = e.map(i, function(e) { - return parseInt(e); - }), new r(i[0], i[1], i[2], i[3]); - } catch (o) { - return new r(0, 0, 0, 0); - } - }(), this._editorEnd = parseInt(n[t + ".editorEnd"]) || 0, this._previewScrollTop = parseInt(n[t + ".previewScrollTop"]) || 0, - this._selectTime = parseInt(n[t + ".selectTime"]) || 0, this.syncLocations = o || {}, - this.publishLocations = s || {}, Object.defineProperty(this, "title", { - get: function() { - return this._title; - }, - set: function(e) { - this._title = e, n[this.fileIndex + ".title"] = e; - } - }), Object.defineProperty(this, "content", { - get: function() { - return n[this.fileIndex + ".content"]; - }, - set: function(e) { - n[this.fileIndex + ".content"] = e; - } - }), Object.defineProperty(this, "editorScrollTop", { - get: function() { - return this._editorScrollTop; - }, - set: function(e) { - this._editorScrollTop = e, n[this.fileIndex + ".editorScrollTop"] = e; - } - }), Object.defineProperty(this, "editorSelectRange", { - get: function() { - return this._editorSelectRange; - }, - set: function(e) { - this._editorSelectRange = e, n[this.fileIndex + ".editorSelectRange"] = [ e.start.row, e.start.column, e.end.row, e.end.column ].join(";"); - } - }), Object.defineProperty(this, "previewScrollTop", { - get: function() { - return this._previewScrollTop; - }, - set: function(e) { - this._previewScrollTop = e, n[this.fileIndex + ".previewScrollTop"] = e; - } - }), Object.defineProperty(this, "selectTime", { - get: function() { - return this._selectTime; - }, - set: function(e) { - this._selectTime = e, n[this.fileIndex + ".selectTime"] = e; - } - }); - } - var r = i.Range; - return o.prototype.addSyncLocation = function(e) { - t.storeAttributes(e), t.appendIndexToArray(this.fileIndex + ".sync", e.syncIndex), - this.syncLocations[e.syncIndex] = e; - }, o.prototype.removeSyncLocation = function(e) { - t.removeIndexFromArray(this.fileIndex + ".sync", e.syncIndex), delete this.syncLocations[e.syncIndex], - n.removeItem(e.syncIndex); - }, o.prototype.addPublishLocation = function(e) { - t.storeAttributes(e), t.appendIndexToArray(this.fileIndex + ".publish", e.publishIndex), - this.publishLocations[e.publishIndex] = e; - }, o.prototype.removePublishLocation = function(e) { - t.removeIndexFromArray(this.fileIndex + ".publish", e.publishIndex), delete this.publishLocations[e.publishIndex], - n.removeItem(e.publishIndex); - }, o.prototype.composeTitle = function() { - var t = []; - return e.chain(this.syncLocations).sortBy(function(e) { - return e.provider.providerId; - }).each(function(e) { - var n = "icon-provider-" + e.provider.providerId; - e.isRealtime === !0 && (n += " realtime"), t.push(''); - }), 0 !== e.size(this.syncLocations) && t.push(''), - e.chain(this.publishLocations).sortBy(function(e) { - return e.provider.providerId; - }).each(function(e) { - var n = "icon-provider-" + e.provider.providerId; - e.isRealtime === !0 && (n += " realtime"), t.push(''); - }), 0 !== e.size(this.publishLocations) && t.push(''), - t.push(e.escape(this.title)), t.join(""); - }, o; -}), define("fileSystem", [ "underscore", "utils", "classes/FileDescriptor", "storage" ], function(e, t, n) { - var i = {}; - return e.each(t.retrieveIndexArray("file.list"), function(e) { - i[e] = new n(e); - }), i; -}), define("text!html/documentSelectorSettingsBlock.html", [], function() { - return 'Allows toggling document with keyboard shortcuts.
\n\n'; -}), define("extensions/documentSelector", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "fileSystem", "text!html/documentSelectorSettingsBlock.html" ], function(e, t, n, i, o, r, s, a) { - var l = new o("documentSelector", "Document Selector", !0, !0); - l.settingsBlock = a, l.defaultConfig = { - orderBy: "mru", - shortcutPrevious: "Ctrl+[", - shortcutNext: "Ctrl+]" - }, l.onLoadSettings = function() { - i.setInputValue("#select-document-selector-orderby", l.config.orderBy), i.setInputValue("#input-document-selector-shortcut-previous", l.config.shortcutPrevious), - i.setInputValue("#input-document-selector-shortcut-next", l.config.shortcutNext); - }, l.onSaveSettings = function(e, t) { - e.orderBy = i.getInputValue("#select-document-selector-orderby"), e.shortcutPrevious = i.getInputTextValue("#input-document-selector-shortcut-previous", t), - e.shortcutNext = i.getInputTextValue("#input-document-selector-shortcut-next", t); - }; - var c; - l.onAceCreated = function(e) { - c = e; - }; - var u; - l.onFileMgrCreated = function(e) { - u = e; - }; - var d, h, p, f, g, m, v, b = [ '\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n- " data-file-index="<%= fileDesc.fileIndex %>">', ' ', " <%= fileDesc.composeTitle() %>", " ", "
" ].join(""), y = t.debounce(function() { - var n = t.chain(s).sortBy(f).reduce(function(e, n) { - return e + t.template(b, { - fileDesc: n, - isCurrent: n === g - }); - }, "").value(); - d.innerHTML = n, p = [], h = {}, t.each(d.querySelectorAll("li"), function(t) { - var n = e(t); - p.push(n); - var i = s[n.data("fileIndex")]; - h[i.fileIndex] = n, n.find("a").click(function() { - m = void 0, n.hasClass("disabled") ? void 0 !== c ? c.focus() : v.focus() : u.selectFile(i); - }); - }); - }, 50); - return l.onFileSelected = function(e) { - g = e, y(); - }, l.onFileCreated = y, l.onFileDeleted = y, l.onTitleChanged = y, l.onSyncExportSuccess = y, - l.onSyncRemoved = y, l.onNewPublishSuccess = y, l.onPublishRemoved = y, l.onReady = function() { - v = e("#wmd-input"), "title" == l.config.orderBy ? f = function(e) { - return e.title.toLowerCase(); - } : "mru" == l.config.orderBy && (f = function(e) { - return -e.selectTime; - }), d = n("ul", { - "class": "dropdown-menu dropdown-file-selector" - }), document.querySelector(".ui-layout-resizer-north").appendChild(n("div", n("div", { - "data-toggle": "dropdown" - }), d)); - var i = e(d).dropdown(), o = e(".document-panel .collapse-button"); - o.prop("title", t.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>", { - title: o.prop("title"), - shortcutPrevious: l.config.shortcutPrevious, - shortcutNext: l.config.shortcutNext - })); - var s = l.config.shortcutPrevious.toLowerCase(); - r.bind(s, function() { - void 0 === m && (i.dropdown("toggle"), m = h[g.fileIndex]); - var e = t.indexOf(p, m) - 1; - return -2 === e && (e = -1), m = p[(e + p.length) % p.length], t.defer(function() { - m.find("a").focus(); - }), !1; - }); - var a = l.config.shortcutNext.toLowerCase(); - r.bind(l.config.shortcutNext.toLowerCase(), function() { - void 0 === m && (i.dropdown("toggle"), m = h[g.fileIndex]); - var e = t.indexOf(p, m) + 1; - return m = p[e % p.length], t.defer(function() { - m.find("a").focus(); - }), !1; - }); - var c = s.indexOf("+"), u = -1 === c ? s : s.substring(0, c), b = a.indexOf("+"), y = -1 === b ? a : a.substring(0, b); - r.bind([ u, y ], function() { - void 0 !== m && m.find("a").click(); - }, "keyup"); - }, l; -}), define("classes/FolderDescriptor", [ "underscore", "utils", "storage", "fileSystem" ], function(e, t, n, i) { - function o(o, r) { - this.folderIndex = o, this._name = r || n[o + ".name"], this.fileList = {}, e.each(t.retrieveIndexArray(o + ".files"), function(e) { - try { - var n = i[e]; - n.folder = this, this.fileList[e] = n; - } catch (r) { - t.removeIndexFromArray(o + ".files", e); - } - }, this), Object.defineProperty(this, "name", { - get: function() { - return this._name; - }, - set: function(e) { - this._name = e, n[this.folderIndex + ".name"] = e; - } - }); - } - return o.prototype.addFile = function(e) { - e.folder = this, t.appendIndexToArray(this.folderIndex + ".files", e.fileIndex), - this.fileList[e.fileIndex] = e; - }, o.prototype.removeFile = function(e) { - e.folder = void 0, t.removeIndexFromArray(this.folderIndex + ".files", e.fileIndex), - delete this.fileList[e.fileIndex]; - }, o; -}), define("folderList", [ "underscore", "utils", "classes/FolderDescriptor", "storage" ], function(e, t, n) { - var i = {}; - return e.each(t.retrieveIndexArray("folder.list"), function(e) { - i[e] = new n(e); - }), i; -}), define("extensions/documentPanel", [ "jquery", "underscore", "utils", "classes/Extension", "folderList", "fileSystem" ], function(e, t, n, i, o, r) { - function s(n) { - if (n != y) { - if (y = n, b.scrollTop = 0, !n) return p.addClass("hide"), d.removeClass("hide"), - void 0; - var i = n.toLowerCase().split(/\s+/); - t.each(h.querySelectorAll(".file"), function(n) { - var o = e(n), r = o.text().toLowerCase(); - o.toggle(!t.some(i, function(e) { - return -1 === r.indexOf(e); - })); - }), p.removeClass("hide"), d.addClass("hide"); - } - } - var a, l = new i("documentPanel", "Document Panel"); - l.onFileMgrCreated = function(e) { - a = e; - }; - var c, u, d, h, p, f, g = [ '', '', " <%= _.size(folderDesc.fileList) %>", "", ' <%= folderDesc.name %>', "", '', " <%= fileListHtml %>", "" ].join(""), m = [ '"', ' data-file-index="<%= fileDesc.fileIndex %>"', ' data-toggle="collapse"', ' data-target=".document-panel">', " <%= fileDesc.composeTitle() %>", "" ].join(""), v = t.debounce(function() { - var n = t.filter(r, function(e) { - return void 0 === e.folder; - }), i = t.chain(n).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + "- " + t.template(m, { - fileDesc: n, - selectedFileDesc: f - }) + "
"; - }, "").value(); - i = i && ' ", t.chain(o).sortBy(function(e) { - return e.name.toLowerCase(); - }).each(function(e) { - var n = t.chain(e.fileList).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + "- " + t.template(m, { - fileDesc: n, - selectedFileDesc: f - }) + "
"; - }, "").value(); - n = n && ' ", i += t.template(g, { - folderDesc: e, - fileListHtml: n, - id: e.folderIndex.replace(".", "") - }); - }), u.innerHTML = i; - var s = t.chain(r).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + "- " + t.template(m, { - fileDesc: n, - selectedFileDesc: f - }) + "
"; - }, "").value(); - s = ' ", h.innerHTML = s, t.each(c.querySelectorAll(".file"), function(t) { - var n = e(t); - n.click(function() { - var e = r[n.data("fileIndex")]; - e && e !== f && a.selectFile(e); - }); - }); - }, 50); - l.onFileSelected = function(e) { - f = e, v(); - }, l.onFileCreated = v, l.onFileDeleted = v, l.onTitleChanged = v, l.onSyncExportSuccess = v, - l.onSyncRemoved = v, l.onNewPublishSuccess = v, l.onPublishRemoved = v, l.onFoldersChanged = v; - var b, y = ""; - return l.onReady = function() { - c = document.querySelector(".document-panel"), b = c.querySelector(".panel-content"), - u = c.querySelector(".document-list"), d = e(u), h = c.querySelector(".document-list-filtered"), - p = e(h), e(c).on("show.bs.collapse", function(t) { - if (t.target === c) { - var n = f.folder; - void 0 !== n && e(c.querySelector(".file-list." + n.folderIndex.replace(".", ""))).collapse("show"); - } - }).on("shown.bs.collapse", function(e) { - if (e.target === c) { - t.val(""), s(""); - var n = u.querySelector(".file.active"); - n && (b.scrollTop += n.getBoundingClientRect().top - 120); - } - }); - var t = e(c.querySelector(".search-bar .form-control")); - t.bind("propertychange keyup input paste", function() { - s(t.val()); - }); - }, l; -}), define("extensions/documentManager", [ "jquery", "underscore", "constants", "utils", "storage", "classes/Extension", "classes/FolderDescriptor", "folderList", "fileSystem" ], function(e, t, n, i, o, r, s, a, l) { - function c() { - _ = [], D = [], t.each(b.querySelectorAll('input[type="checkbox"]:checked'), function(t) { - var n = e(t.parentNode.parentNode), i = a[n.data("folderIndex")], o = l[n.data("fileIndex")]; - void 0 !== i ? _.push(i) : void 0 !== o && D.push(o); - }); - } - function u() { - if (0 === t.size(D)) return d(), void 0; - var n = t.chain(D).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + t.template(T, { - fileDesc: n - }); - }, "").value(); - y.innerHTML = '' + n + "
", e(v.querySelectorAll(".document-list")).addClass("hide"), - e(v.querySelectorAll(".confirm-delete, .selected-document-list")).removeClass("hide"); - } - function d() { - t.each(D, function(e) { - e.folder && e.folder.removeFile(e), p.deleteFile(e); - }), t.each(_, function(e) { - i.removeIndexFromArray("folder.list", e.folderIndex), o.removeItem(e.folderIndex + ".name"), - o.removeItem(e.folderIndex + ".files"), delete a[e.folderIndex]; - }), g.onFoldersChanged(); - } - function h() { - c(), w.toggleClass("disabled", 0 === t.size(a) || 0 === t.size(D)), C.toggleClass("disabled", 0 === t.size(_) && 0 === t.size(D)); - } - var p, f = new r("documentManager", "Document Manager", !1, !0); - f.onFileMgrCreated = function(e) { - p = e; - }; - var g; - f.onEventMgrCreated = function(e) { - g = e; - }; - var m, v, b, y, w, C, x, S, E, k = [ '', '', '', '', '<%= _.size(folderDesc.fileList) %>', '', "<%= folderDesc.name %>", '', '<%= fileListHtml %>' ].join(""), A = [ '- ', '', '', '', '
' ].join(""), F = [ '', '<%= fileDesc.composeTitle() %>', '<%= _.size(folderDesc.fileList) %>', '', "<%= folderDesc.name %>" ].join(""), T = [ '- ', '
' ].join(""), D = [], _ = [], L = t.debounce(function() { - if (m !== !1) { - h(), S.text(t.size(l)), E.text(t.size(a) + 1), x = t.filter(l, function(e) { - return void 0 === e.folder; - }); - var n = [ '', '', '<%= fileDesc.composeTitle() %>', t.size(x), "", '', "ROOT folder" ].join(""), i = t.chain(x).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + t.template(A, { - fileDesc: n - }); - }, "").value(); - i = i && ' ", n += '' + i + "", - t.chain(a).sortBy(function(e) { - return e.name.toLowerCase(); - }).each(function(e) { - var i = t.chain(e.fileList).sortBy(function(e) { - return e.title.toLowerCase(); - }).reduce(function(e, n) { - return e + t.template(A, { - fileDesc: n - }); - }, "").value(); - i = i && ' ", n += t.template(k, { - folderDesc: e, - fileListHtml: i, - id: e.folderIndex.replace(".", "") - }); - }), b.innerHTML = n, t.each(b.querySelectorAll(".button-delete"), function(t) { - var n = e(t); - n.click(function(e) { - e.stopPropagation(); - var t = n.parent(), i = a[t.data("folderIndex")], o = l[t.data("fileIndex")]; - D = [], _ = [], i ? (_.push(i), D = i.fileList) : o && D.push(o), u(); - }); - }), t.each(b.querySelectorAll(".button-rename"), function(t) { - var n = e(t); - n.click(function(e) { - e.stopPropagation(); - var t, i = n.parent(), o = a[i.data("folderIndex")], r = l[i.data("fileIndex")]; - o ? t = o.name : r && (t = r.title), i.find(".name").addClass("hide"), i.find(".input-rename").removeClass("hide").val(t)[0].select(); - }); - }), t.each(b.querySelectorAll(".input-rename"), function(t) { - function n() { - var t = i.parent(), n = e.trim(i.val()), o = a[t.data("folderIndex")], r = l[t.data("fileIndex")]; - n && o && n != o.name ? (o.name = n, g.onFoldersChanged()) : n && r && n != r.title ? (r.title = n, - g.onTitleChanged(r)) : (i.addClass("hide"), t.find(".name").removeClass("hide")); - } - var i = e(t); - i.blur(function() { - n(); - }).keyup(function(e) { - 13 == e.keyCode && (n(), e.stopPropagation()), 27 == e.keyCode && (i.val(""), n(), - e.stopPropagation()); - }); - }), t.each(b.querySelectorAll(".file .checkbox"), function(t) { - var n = e(t); - n.click(function(e) { - e.stopPropagation(); - }).find("[type=checkbox]").change(function() { - n.parents(".list-group").find(".folder [type=checkbox]").prop("checked", !1); - }); - }), t.each(b.querySelectorAll(".folder .checkbox"), function(t) { - var n = e(t); - n.click(function(e) { - e.stopPropagation(); - }).find("[type=checkbox]").change(function() { - n.parent().next().find("[type=checkbox]").prop("checked", this.checked); - }); - }), e(b.querySelectorAll("[type=checkbox]")).change(h); - } - }, 50); - return f.onFileCreated = L, f.onFileDeleted = L, f.onSyncExportSuccess = L, f.onSyncRemoved = L, - f.onNewPublishSuccess = L, f.onPublishRemoved = L, f.onFoldersChanged = L, f.onTitleChanged = function(t) { - m !== !1 && (e(b).find('[data-file-index="' + t.fileIndex + '"] .name').html(t.composeTitle()).removeClass("hide"), - e(b.querySelectorAll(".input-rename")).addClass("hide")); - }, f.onReady = function() { - v = document.querySelector(".modal-document-manager"), b = v.querySelector(".list-group.document-list"), - S = e(v.querySelectorAll(".document-count")), E = e(v.querySelectorAll(".folder-count")), - y = v.querySelector(".list-group.selected-document-list"); - var r = v.querySelector(".list-group.select-folder-list"); - e(v).on("show.bs.modal", function() { - m = !0, L(), setTimeout(function() { - e(b.querySelectorAll(".root-folder")).click(); - }, 250); - }).on("hide.bs.modal", function() { - m = !1, b.innerHTML = ""; - }), e(v.querySelectorAll(".action-create-folder")).click(function() { - var r; - do r = "folder." + i.randomString(); while (t.has(a, r)); - o[r + ".name"] = n.DEFAULT_FOLDER_NAME; - var l = new s(r, n.DEFAULT_FOLDER_NAME); - i.appendIndexToArray("folder.list", r), a[r] = l, g.onFoldersChanged(), setTimeout(function() { - var t = e(v.querySelector('[data-folder-index="' + r + '"] .button-rename')).click(); - v.scrollTop += t.offset().top - 50; - }, 60); - }), e(v.querySelectorAll(".action-select-all")).click(function() { - e(b.querySelectorAll('input[type="checkbox"]')).prop("checked", !0).change(); - }), e(v.querySelectorAll(".action-unselect-all")).click(function() { - e(b.querySelectorAll('input[type="checkbox"]')).prop("checked", !1).change(); - }); - var l = e(v.querySelectorAll(".action-delete-items")).click(function() { - C.hasClass("disabled") || (c(), u()); - }); - C = l.parent(), e(v.querySelectorAll(".action-delete-items-confirm")).click(function() { - d(), e(v.querySelectorAll(".document-list")).removeClass("hide"), e(v.querySelectorAll(".confirm-delete, .selected-document-list")).addClass("hide"); - }); - var h = e(v.querySelectorAll(".action-move-items")).click(function() { - if (!w.hasClass("disabled")) { - c(); - var n = [ '', '', t.size(x), "", '', "ROOT folder" ].join(""); - n += t.chain(a).sortBy(function(e) { - return e.name.toLowerCase(); - }).reduce(function(e, n) { - return e + t.template(F, { - folderDesc: n - }); - }, "").value(), r.innerHTML = n, t.each(r.querySelectorAll(".folder"), function(n) { - n = e(n), n.click(function() { - var i = a[n.data("folderIndex")]; - t.each(D, function(e) { - e.folder && e.folder.removeFile(e), i && i.addFile(e); - }), g.onFoldersChanged(), e(v.querySelectorAll(".document-list")).removeClass("hide"), - e(v.querySelectorAll(".choose-folder, .select-folder-list")).addClass("hide"); - }); - }), e(v.querySelectorAll(".document-list")).addClass("hide"), e(v.querySelectorAll(".choose-folder, .select-folder-list")).removeClass("hide"); - } - }); - w = h.parent(), e(v.querySelectorAll(".action-cancel")).click(function() { - e(v.querySelectorAll(".document-list")).removeClass("hide"), e(v.querySelectorAll(".confirm-delete, .choose-folder, .selected-document-list, .select-folder-list")).addClass("hide"); - }); - }, f; -}), define("extensions/workingIndicator", [ "jquery", "underscore", "classes/Extension" ], function(e, t, n) { - var i, o, r = new n("workingIndicator", "Working Indicator"); - return r.onAsyncRunning = function(e) { - i.toggleClass("working", e), o.toggleClass("hide", !e); - }, r.onReady = function() { - i = e(document.body), o = e(''), e(".working-indicator").append(o); - for (var t = 0; 3 > t; t++) o.append(e('