kubernetes-handbook/node_modules/gitbook-plugin-flexible-alerts/dist/book/plugin.js.map

1 line
3.6 KiB
Plaintext

{"version":3,"file":"plugin.js","sources":["../../src/book/plugin.js"],"sourcesContent":["function findAlertSetting(input, key, fallback, callback) {\n const match = (input || '').match(new RegExp(`${key}:(([^\\\\r\\\\n|]*))`));\n if (!match) {\n return callback ? callback(fallback) : fallback;\n }\n\n return callback ? callback(match[1]) : match[1];\n}\n\nrequire(['gitbook', 'jQuery'], function (gitbook, $) {\n gitbook.events.bind('page.change', function () {\n const options = gitbook.state.config.pluginsConfig['flexible-alerts'];\n\n $('blockquote').each(function () {\n const origin = $(this).html();\n const content = origin.replace(/\\[!(\\w*)((?:\\|\\w*:.*)*?)\\]([\\s\\S]*)/g, (match, key, settings, value) => {\n const config = options[key.toLowerCase()];\n\n if (!config) {\n return match;\n }\n\n // Style configuration\n const style = findAlertSetting(settings, 'style', options.style);\n let isIconVisible = findAlertSetting(settings, 'iconVisibility', 'visible', (value) => value !== 'hidden');\n let isLabelVisible = findAlertSetting(settings, 'labelVisibility', 'visible', (value) => value !== 'hidden');\n let label = findAlertSetting(settings, 'label', config.label);\n const icon = findAlertSetting(settings, 'icon', config.icon);\n const className = findAlertSetting(settings, 'className', config.className);\n\n // Label can be language specific and could be specified via user configuration\n if (typeof label === 'object') {\n const language = gitbook.state.innerLanguage;\n\n if (language && label.hasOwnProperty(language)) {\n label = label[language];\n } else {\n isLabelVisible = false;\n isIconVisible = false;\n }\n }\n\n const iconTag = `<i class=\"${icon}\"></i>`;\n\n return (\n `<div class=\"alert ${style} ${className}\">\n <p class=\"title\">\n ${isIconVisible ? iconTag : ''}\n ${isLabelVisible ? label : ''}\n </p>\n <p>${value}\n </div>`\n );\n });\n\n // Do not change blockquotes without alert indicator.\n if (content !== origin) {\n $(this).replaceWith(content);\n }\n });\n });\n});\n"],"names":["findAlertSetting","input","key","fallback","callback","match","RegExp","require","gitbook","$","events","bind","options","state","config","pluginsConfig","each","origin","this","html","content","replace","settings","value","toLowerCase","style","isIconVisible","isLabelVisible","label","icon","className","_typeof","language","innerLanguage","hasOwnProperty","iconTag","replaceWith"],"mappings":";;;;;;;8PAAA,SAASA,iBAAiBC,EAAOC,EAAKC,EAAUC,OACxCC,GAASJ,GAAS,IAAII,MAAM,IAAIC,iBAAUJ,+BAC3CG,EAIED,EAAWA,EAASC,EAAM,IAAMA,EAAM,GAHpCD,EAAWA,EAASD,GAAYA,EAM3CI,QAAQ,CAAC,UAAW,UAAW,SAAUC,EAASC,GAChDD,EAAQE,OAAOC,KAAK,cAAe,eAC3BC,EAAUJ,EAAQK,MAAMC,OAAOC,cAAc,mBAEnDN,EAAE,cAAcO,KAAK,eACbC,EAASR,EAAES,MAAMC,OACjBC,EAAUH,EAAOI,QAAQ,uCAAwC,SAAChB,EAAOH,EAAKoB,EAAUC,OACtFT,EAASF,EAAQV,EAAIsB,mBAEtBV,SACIT,MAIHoB,EAAQzB,iBAAiBsB,EAAU,QAASV,EAAQa,OACtDC,EAAgB1B,iBAAiBsB,EAAU,iBAAkB,UAAW,SAACC,SAAoB,WAAVA,IACnFI,EAAiB3B,iBAAiBsB,EAAU,kBAAmB,UAAW,SAACC,SAAoB,WAAVA,IACrFK,EAAQ5B,iBAAiBsB,EAAU,QAASR,EAAOc,OACjDC,EAAO7B,iBAAiBsB,EAAU,OAAQR,EAAOe,MACjDC,EAAY9B,iBAAiBsB,EAAU,YAAaR,EAAOgB,cAG5C,WAAjBC,QAAOH,GAAoB,KACvBI,EAAWxB,EAAQK,MAAMoB,cAE3BD,GAAYJ,EAAMM,eAAeF,GACnCJ,EAAQA,EAAMI,GAGdN,EADAC,GAAiB,MAKfQ,sBAAuBN,8CAGNJ,cAASK,oEAEpBJ,EAAgBS,EAAU,kCAC1BR,EAAiBC,EAAQ,qDAE1BL,4BAMTH,IAAYH,GACdR,EAAES,MAAMkB,YAAYhB"}