{ "version": 3, "sources": ["src/docuK-postProcess-2.3.ts"], "sourcesContent": ["(function (m, $) {\r\n\tm.version1 = \".1\";\r\n\tm.printMode = true;\r\n\tm.ripplesDisabled = true;\r\n\t// SEE (Super Easy Edit)\r\n\tlet $SEE: JQuery = $(\"codeprint.SEE\");\r\n\tm.SEEHTMLs = m.SEEHTMLs || [];\r\n\tfor (let i = 0; i < $SEE.length; i++) {\r\n\t\tlet $SEEi = $SEE.eq(i);\r\n\t\tlet SEEHTMLi = \"\";\r\n\t\tif (!!m.SEEHTMLs[i]) {\r\n\t\t\tSEEHTMLi = m.SEEHTMLs[i].trim();\r\n\t\t} else {\r\n\t\t\tSEEHTMLi = $SEEi.html().trim();\r\n\t\t}\r\n\t\t$SEEi.html(\"\");\r\n\t\t$SEEi.after(m.renderToDocuK(SEEHTMLi, i));\r\n\t}\r\n\r\n\tm.$docuK = $(\".docuK\");\r\n\r\n\t$(\"code\").each((index: number, elem: HTMLElement) => {\r\n\t\tconst $elem = $(elem);\r\n\t\tif (!$elem.hasClass(\"no-escape-HTML\")) {\r\n\t\t\t$elem.html(m.escapeOnlyTag($elem.html()));\r\n\t\t}\r\n\t});\r\n\t$(\"code\").addClass(\"prettyprint\");\r\n\t// and tags to MathJax format\r\n\tlet $eqs: JQuery = $(\"eq\");\r\n\tfor (let i = 0; i < $eqs.length; i++) {\r\n\t\t$eqs.eq(i).html(function (ith, orgTxt) {\r\n\t\t\treturn \"\\\\( \" + orgTxt.trim() + \" \\\\)\";\r\n\t\t});\r\n\t}\r\n\tlet $eqqs: JQuery = $(\"eqq\");\r\n\tfor (let i = 0; i < $eqqs.length; i++) {\r\n\t\t$eqqs.eq(i).html(function (ith, orgTxt) {\r\n\t\t\treturn \"\\\\[ \" + orgTxt.trim() + \" \\\\]\";\r\n\t\t});\r\n\t}\r\n\tm.logPrint(`

<eq> and <eqq> tags are rendered to MathJax format, being enclosed by \\\\ ( \\\\ ) and \\\\ [ \\\\ ].`);\r\n\r\n\t// docuK process.\r\n\tm.$docuK.has(\"script\").addClass(\"noDIdHandle\");\r\n\tif (m.$docuK.length <= 2) {\r\n\t\tm.$docuK.addClass(\"noDIdHandle\");\r\n\t}\r\n\tlet k = m.$docuK.length;\r\n\tfor (let i = 1; i < k; i++) {\r\n\t\tm.docuKProcess(i); // * (docuKI)\r\n\t}\r\n\r\n\tm.$bubbleRefs = m.$docuK.find(\".bubbleRef\"); // for function m.ShowBR\r\n\r\n\tlet $inRefs: JQuery = m.$docuK.find(\".inRef\"); // The whole ref elements.\r\n\t// Centering arrow.\r\n\t$inRefs.each(function () {\r\n\t\tlet $elem = $(this);\r\n\t\tlet width = $elem.width() - 2;\r\n\t\tlet $arrow = $elem.find(\".arrow\");\r\n\t\tlet borderWidth = parseFloat($arrow.css(\"borderWidth\"));\r\n\t\tlet fontSize = parseFloat($arrow.css(\"fontSize\"));\r\n\t\t$arrow.css({\r\n\t\t\tmarginLeft: ((width / 2 - borderWidth) / fontSize).toFixed(2) + \"em\",\r\n\t\t});\r\n\t});\r\n\t// Delayed-Load in bubble ref.\r\n\t$inRefs.on(\"mouseenter.delayedLoad\", function () {\r\n\t\tm.logPrint(`
Do delayed-load in bubble ref.`);\r\n\t\tm.$window.trigger(\"scroll.delayedLoad\");\r\n\t\t$(this).off(\"mouseenter.delayedLoad\");\r\n\t});\r\n\r\n\t//////////////////////////////////////////\r\n\t// Fuzzy search fullList\r\n\t//////////////////////////////////////////\r\n\tlet $list = $(\".docuK .p, .docuK .cmt, .docuK .bcf, .docuK li, .docuK pre\");\r\n\tfor (let i = 0; i < $list.length; i++) {\r\n\t\tlet $listI = $list.eq(i);\r\n\t\tlet $sec = $listI.parents(\".docuK>.sec\");\r\n\t\tlet txt = \"\";\r\n\t\tlet html = \"\";\r\n\t\tif ($sec.length) {\r\n\t\t\tlet cat = $sec.find(\"h2:first-child .head-txt\").text();\r\n\t\t\tlet $subSec = $listI.parents(\".subsec\");\r\n\t\t\tif ($subSec.length) {\r\n\t\t\t\tcat += \"\\n  -- \" + $subSec.find(\"h3:first-child .head-txt\").text();\r\n\t\t\t\tlet $subSubSec = $listI.parents(\".subsubsec\");\r\n\t\t\t\tif ($subSubSec.length) {\r\n\t\t\t\t\tcat += \"\\n    -- \" + $subSubSec.find(\"h4:first-child .head-txt\").text();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttxt = cat.replace(/\\n   /g, \"\").replace(/\\n /g, \"\") + \"\\n\";\r\n\t\t\thtml = '
' + cat.replace(/\\n/g, \"
\") + \"
\";\r\n\t\t}\r\n\t\ttxt += \"* \" + $listI.text();\r\n\t\thtml += `
* ${$listI.html().trim().replace(/\\sid=/g, \" squasi-id=\")}
`;\r\n\t\tm.fsGo.fullList[$list.length - 1 - i] = {\r\n\t\t\ti: $list.length - 1 - i,\r\n\t\t\ttxt: m.splitHangul(txt),\r\n\t\t\thtml: html,\r\n\t\t\t$listI: $listI,\r\n\t\t};\r\n\t}\r\n\r\n\t// Scripts will be appended on this.\r\n\tm.$headOrBody = $(\"head\") || $(\"body\") || $(\"#docuK-style\");\r\n\r\n\twindow.onpopstate = function (e) {\r\n\t\tif (!!e.state) {\r\n\t\t\tif (e.state?.goOn !== m.goOn) {\r\n\t\t\t\tm.$window.trigger({ type: \"keydown\", code: \"KeyG\" } as any);\r\n\t\t\t}\r\n\t\t\tif (e.state?.logOn !== m.logOn) {\r\n\t\t\t\tm.$window.trigger({ type: \"keydown\", code: \"KeyK\" } as any);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t// On ready.\r\n\tm.$document.ready(function () {\r\n\t\t// Disqus js script, and Redirect to the canonical URL.\r\n\t\tif (window.disqus_config) {\r\n\t\t\tm.disqusVars = { page: {} };\r\n\t\t\twindow.disqus_config.apply(m.disqusVars);\r\n\t\t\tlet url = (m.canonicalURI = m.disqusVars.page.url);\r\n\t\t\t$('link[rel=\"canonical\"]').remove();\r\n\t\t\t($(\"head\") || $(\"#docuK-style\")).append(``);\r\n\t\t\tlet hrefAnalyzed = new URL(window.location.href);\r\n\t\t\tlet urlAnalyzed = new URL(url);\r\n\t\t\tif (hrefAnalyzed.hostname === \"kipid.tistory.com\" && hrefAnalyzed.protocol.toLowerCase() === urlAnalyzed.protocol.toLowerCase() && decodeURIComponent(hrefAnalyzed.pathname) !== decodeURIComponent(urlAnalyzed.pathname)) {\r\n\t\t\t\twindow.location.pathname = urlAnalyzed.pathname;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsetTimeout(function () {\r\n\t\t\tlet parsedHref = new URL(window.location.href);\r\n\t\t\tlet origin = parsedHref.origin.toLowerCase();\r\n\t\t\tif (origin === \"https://kipid.tistory.com\" || origin === \"http://localhost:8080\" || origin === \"http://127.0.0.1:8080\" || origin === \"https://recoeve.net\" || origin === \"https://www.recoeve.net\") {\r\n\t\t\t\tlet blogStat = `URI\\treferer\\tREACTION_GUEST\\n${window.location.href}\\t${document.referrer}\\t${m.docCookies.getItem(\"REACTION_GUEST\")}`;\r\n\t\t\t\t$.ajax({\r\n\t\t\t\t\ttype: \"POST\",\r\n\t\t\t\t\turl: \"https://recoeve.net/BlogStat\",\r\n\t\t\t\t\tdata: blogStat,\r\n\t\t\t\t\tdataType: \"text\",\r\n\t\t\t\t})\r\n\t\t\t\t\t.fail(async function (resp) {\r\n\t\t\t\t\t\tm.logPrint(\"

BlogStat failed. \" + (await m.uriRendering(resp.toString(), true, false)));\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.done(async function (resp) {\r\n\t\t\t\t\t\tm.logPrint(\"

BlogStat is logged. \" + (await m.uriRendering(resp.toString(), true, false)));\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, 8 * m.wait);\r\n\r\n\t\tm.$title.html(m.$title.html() + ` at ${window.location.host}`);\r\n\r\n\t\tm.$log.after(`
\r\n
\u25BC Hide
\r\n
Toggle a mess
\r\n
\r\nGo (FS)\r\n
\r\n
\r\nTofC\r\n
\r\n
\r\nDocuK Log\r\n
\r\n
\r\nBackward\r\n
\r\n
\r\nForward\r\n
\r\n
\r\nRRA\r\n
\r\n
\r\nLists\r\n
\r\n
\r\nCmtZ\r\n
\r\n
\r\nCmtX\r\n
\r\n
\r\nHandle CmtZ\r\n
\r\n${\r\n\tm.docCookies.hasItem(\"REACTION_GUEST\")\r\n\t\t? `
\r\nLog in\r\n
`\r\n\t\t: `
\r\nLog out\r\n
`\r\n}\r\n
\u25B2
`);\r\n\t\tm.$floating_key = $(\"#floating-key\");\r\n\t\tif (m.docCookies.getItem(\"hideFK\") === \"y\") {\r\n\t\t\tm.$floating_key.hide();\r\n\t\t}\r\n\t\tif (!m.printMode) {\r\n\t\t\tfor (let i = 1; i < m.$docuK.length; i++) {\r\n\t\t\t\tm.$docuK.eq(i).before(m.promoting(`promoting-${i}-0`));\r\n\t\t\t\tm.$docuK.eq(i).after(m.promoting(`promoting-${i}-1`));\r\n\t\t\t}\r\n\t\t}\r\n\t\twindow.$fuzzy_search.trigger(\"keyup.fs\");\r\n\t\twindow.$button_Go = $(\".button-Go\");\r\n\t\twindow.$button_log = $(\".button-log\");\r\n\t\t// Printing codes in with id (which starts with \"code-\") into
.\r\n\t\tlet $codeprints: JQuery = $(\"codeprint\");\r\n\t\tfor (let i = 0; i < $codeprints.length; i++) {\r\n\t\t\tlet codeId = $codeprints.eq(i).attr(\"id\");\r\n\t\t\tif (codeId !== null && codeId !== undefined && codeId.startsWith(\"code-\")) {\r\n\t\t\t\tm.printCode(codeId);\r\n\t\t\t}\r\n\t\t}\r\n\t\tm.logPrint(`

<codeprint> tags are printed to corresponding <pre> tags, only when the tags exist in the document.`);\r\n\r\n\t\t// Hiding hiden sections.\r\n\t\tm.$docuK.find(\".sec.hiden\").find(\">.sec-contents\").css({ display: \"none\" });\r\n\r\n\t\t// Setting and Printing Styles\r\n\t\tm.$deviceInfo = m.$docuK.find(\".deviceInfo\");\r\n\r\n\t\tlet cookieItem: string | null;\r\n\t\tm.logPrint(`
`);\r\n\r\n\t\tcookieItem = m.docCookies.getItem(\"m.mode\");\r\n\t\tif (cookieItem !== null) {\r\n\t\t\tm.Cmode(cookieItem as \"Bright\" | \"Dark\");\r\n\t\t\tm.logPrint(`
Mode ${cookieItem} is set from cookie.`);\r\n\t\t} else {\r\n\t\t\tm.Cmode(\"Bright\");\r\n\t\t}\r\n\t\tfor (let i = 1; i < m.$docuK.length; i++) {\r\n\t\t\t$(`#button${i}-${m.mode}`).prop(\"checked\", true);\r\n\t\t}\r\n\r\n\t\tcookieItem = m.docCookies.getItem(\"m.fontFamily\");\r\n\t\tif (cookieItem !== null) {\r\n\t\t\tm.CfontFamily(cookieItem as string);\r\n\t\t\tm.logPrint(`
Font ${cookieItem} is set from cookie.`);\r\n\t\t\tfor (let i = 1; i < m.$docuK.length; i++) {\r\n\t\t\t\t($(`#input${i}-font-family`)[0] as HTMLInputElement).value = m.fontFamily;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tcookieItem = m.docCookies.getItem(\"m.fontSize\");\r\n\t\tif (cookieItem !== null) {\r\n\t\t\tm.CfontSize(Number(cookieItem) - m.defaultStyles.fontSize);\r\n\t\t\tm.logPrint(`
Font-size ${(Number(cookieItem) * 1.8).toFixed(1)} is set from cookie.`);\r\n\t\t}\r\n\r\n\t\tcookieItem = m.docCookies.getItem(\"m.lineHeight10\");\r\n\t\tif (cookieItem !== null) {\r\n\t\t\tm.ClineHeight(Number(cookieItem) - m.defaultStyles.lineHeight10);\r\n\t\t\tm.logPrint(`
Line-height ${(Number(cookieItem) / 10).toFixed(1)} is set from cookie.`);\r\n\t\t}\r\n\r\n\t\tm.plink = $('meta[property=\"dg:plink\"]').attr(\"content\");\r\n\t\tm.logPrint(`

Current styles (dark/bright mode, font-family, font-size, line-height) are shown.`);\r\n\t\tm.printDeviceInfo();\r\n\r\n\t\twindow.$disqus_thread = $(\"#disqus_thread\");\r\n\t\tif (!window.$disqus_thread.length) {\r\n\t\t\t($(\"#docuK-script\") || $(\"body\")).append(`
`);\r\n\t\t\twindow.$disqus_thread = $(\"#disqus_thread\");\r\n\t\t}\r\n\t\tlet $disqus_js: JQuery = $(`