diff --git a/README.md b/README.md index 424f6a63..bfc70cfa 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@

让你瞬间进入沉浸式阅读的扩展,还原阅读的本质,提升你的阅读体验。

为了达到完美的阅读模式这个小目标 ,我适配了 数百种类型 的网站,因此诞生了简悦。

- +

- + @@ -51,7 +51,7 @@ *** ## 马上使用 -* [Chrome 应用商店](https://chrome.google.com/webstore/detail/%E7%AE%80%E6%82%A6-simpread/ijllcpnolfcooahcekpamkbidhejabll) 或者 [离线下载](http://ksria.com/simpread/crx/1.1.3/simpread.crx) +* [Chrome 应用商店](https://chrome.google.com/webstore/detail/%E7%AE%80%E6%82%A6-simpread/ijllcpnolfcooahcekpamkbidhejabll) 或者 [离线下载](http://ksria.com/simpread/crx/1.1.4/simpread.crx) * [Firefox 扩展中心](https://addons.mozilla.org/zh-CN/firefox/addon/simpread) @@ -84,7 +84,7 @@ * 支持 [论坛类页面及分页](http://ksria.com/simpread/docs/#/论坛类页面及分页) 如:知乎 · 百度贴吧等 - * ![new纯色.png](https://i.loli.net/2018/09/05/5b8f718046acb.png) 支持 [代码段的高亮](http://ksria.com/simpread/docs/#/代码段的高亮),包含了大部分常见的网站 + * ![new纯色.png](https://i.loli.net/2018/09/05/5b8f718046acb.png) 支持 [代码段的高亮](https://github.com/Kenshin/simpread/issues/500),包含了大部分常见的网站 * 支持 [TXT 阅读器](http://ksria.com/simpread/docs/#/TXT-阅读器) · 支持 [LaTeX 解析](http://ksria.com/simpread/docs/#/LaTeX-阅读器) · [Markdown 阅读器](http://ksria.com/simpread/docs/#/Markdown-阅读器) @@ -130,7 +130,7 @@ - 导出到 `Pocket` `Linnk` `Instapaper` 的功能,包括:`当前页面的链接` `稍后读` - - 导出到生产力工具,包括:`坚果云` `语雀` `Dropbox` `Onenote` `Google Drive` `印象笔记 / Evernote`,详细请看 [导出到生产力](http://ksria.com/simpread/docs/#/导出到生产力工具) + - 导出到生产力工具,包括:`坚果云` `语雀` `有道云笔记` `为知笔记` `Dropbox` `Notion` `Onenote` `Google Drive` `印象笔记 / Evernote`,详细请看 [导出到生产力](http://ksria.com/simpread/docs/#/导出到生产力工具) - 同步 · 上传/下载 配置 · 同步适配列表 · [快捷键支持](http://ksria.com/simpread/docs/#/快捷键) 等; @@ -141,7 +141,7 @@ ## 全部功能

- +
## 截图 @@ -234,20 +234,7 @@ _如发现下图显示不全,请直接访问 http://sr.ksria.cn/zhifu_m2.png_ ![支付](http://sr.ksria.cn/zhifu_m2.png) ## 简悦的诞生离不开它们 -- [Node.js](https://nodejs.org/) · [NPM](https://www.npmjs.com) -- [Webpack](https://webpack.github.io/) -- [React](https://facebook.github.io/react) -- [ES6](http://es6-features.org/) · [Babel](https://babeljs.io) -- [PostCSS](http://postcss.org/) · [cssnext](http://cssnext.io/) -- [jQuery](https://jquery.com/) · [Mousetrap](https://craig.is/killing/mice) · [pangu.js](https://github.com/vinta/pangu.js) · [ProgressBar.js](https://kimmobrunfeldt.github.io/progressbar.js/) · [timego.js](http://timeago.org/) · [Velocity.js](http://velocityjs.org/) · [minimatch](https://github.com/isaacs/minimatch) · [to-markdown](https://github.com/domchristie/to-markdown) · [FileSaver.js](https://github.com/eligrey/FileSaver.js) · [dom-to-image](https://github.com/tsayen/dom-to-image) · [WebDAV]( https://github.com/aslakhellesoy/webdavjs) -- [Visual Studio Code](https://code.visualstudio.com/) -- [Sketch](https://www.sketchapp.com/) · [Pixelmator](http://www.pixelmator.com/) -- Icon from -- [Welcome PuRead II](http://sr.ksria.cn/welcome-puread-ii.png) via [www.freepik.com](https://www.freepik.com/free-vector/it-specialists-upgrading-operating-system-illustration_4332393.htm) -- Mockup Design usage -- Material Design usage -- Mind Maps -- 咖啡 · 网易音乐 · Google Chrome · rMBP + ## 许可 [![license-badge]][license-link] @@ -255,11 +242,11 @@ _如发现下图显示不全,请直接访问 http://sr.ksria.cn/zhifu_m2.png_ [www-badge]: https://img.shields.io/badge/website-_simpread.ksria.com-1DBA90.svg [www-link]: http://ksria.com/simpread -[version-badge]: https://img.shields.io/badge/lastest_version-1.1.3-blue.svg +[version-badge]: https://img.shields.io/badge/lastest_version-1.1.4-blue.svg [version-link]: https://github.com/kenshin/simpread/releases [chrome-badge]: https://img.shields.io/badge/download-_chrome_webstore-brightgreen.svg [chrome-link]: https://chrome.google.com/webstore/detail/%E7%AE%80%E6%82%A6-simpread/ijllcpnolfcooahcekpamkbidhejabll [offline-badge]: https://img.shields.io/badge/download-_crx-brightgreen.svg -[offline-link]: http://ksria.com/simpread/crx/1.1.3/simpread.crx +[offline-link]: http://ksria.com/simpread/crx/1.1.4/simpread.crx [license-badge]: https://img.shields.io/github/license/mashape/apistatus.svg [license-link]: https://opensource.org/licenses/MIT diff --git a/src/assets/css/options_page.css b/src/assets/css/options_page.css index fc6e6819..c4d2d124 100644 --- a/src/assets/css/options_page.css +++ b/src/assets/css/options_page.css @@ -37,6 +37,68 @@ a { text-decoration: none; } +input, textarea { + font-family: Raleway, Menlo, "Dank Mono", Inconsolata, "Operator Mono", Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace!important; +} + +.loadingbar { + position: fixed; + top: 0; + left: 0; + + display: flex; + justify-content: center; + align-items: center; + + height: 100%; + width: 100%; + + background-color: #fafafa; + + z-index: 200; +} + +.animated { + animation-duration: 1s; + animation-fill-mode: both; + animation-iteration-count: infinite; +} + +.heartBeat { + animation-name: heartBeat; + animation-duration: 1.3s; + animation-timing-function: ease-in-out; +} + +@keyframes heartBeat { + 0% { + transform: scale(1); + } + + 14% { + transform: scale(1.3); + } + + 28% { + transform: scale(1); + } + + 42% { + transform: scale(1.3); + } + + 70% { + transform: scale(1); + } +} + +.topnav { + position: fixed; + z-index: 200; + left: 12px; + top: 12px; +} + .header { display: flex; align-items: center; @@ -140,6 +202,9 @@ a { color: var(--secondary-color); font-size: 1.3rem; + + opacity: 1; + transition: all .25s ease-out; } .welcome { @@ -160,6 +225,12 @@ a { z-index: 3; } +.dividers { + margin: 10px 0; + width: 100%; + border-bottom: 1px solid rgba(0,0,0,.12); +} + /** * Labs style */ @@ -396,7 +467,7 @@ card-empty a { * Notice bubbles */ .bubbles { - position: fixed; + position: fixed!important; bottom: 20px; display: flex; @@ -414,10 +485,11 @@ card-empty a { cursor: pointer; transition: all 500ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; + overflow: initial; } .bubbles.notice { - right: 94px; + right: 164px; background-color: #16666f; } @@ -462,7 +534,7 @@ card-empty a { * Help bubbles */ .bubbles.help { - right: 24px; + right: 94px; background-color: #607D8B; } @@ -661,3 +733,237 @@ guid-card-tips span { font-size: 30px; letter-spacing: .6em; } + +/** + * Feedback bubbles + */ +.bubbles.feedback { + right: 24px; + background-color: #fb7756; +} + +.feedback:hover { + background-color: rgba(251, 119, 86, .8); +} + +/** + * URL Scheme source form simpread.css + */ + +.simpread-urlscheme, +.simpread-feedback { + position: fixed; + right: 20px; + bottom: 20px; + + z-index: 2147483646; +} + +simpread-urlscheme, +simpread-feedback { + display: flex; + justify-content: center; + align-items: flex-start; + flex-direction: column; + + padding: 20px 20px 0; + + width: 500px; + + color: rgba(51, 51, 51, .87); + background-color: #fff; + border-radius: 3px; + + box-shadow: rgba(0, 0, 0, 0.12) 0px 0px 2px, rgba(0, 0, 0, 0.26) 0px 2px 2px; + overflow: hidden; + + transform-origin: bottom; + transition: all .6s ease; +} + +simpread-urlscheme *, +simpread-feedback * { + font-size: 12px!important; + box-sizing: border-box; +} + +simpread-urlscheme.active, +simpread-feedback.active { + animation-name: srFadeInUp; + animation-duration: 450ms; + animation-fill-mode: both; +} + +simpread-urlscheme.hide, +simpread-feedback.hide { + animation-name: srFadeInDown; + animation-duration: 450ms; + animation-fill-mode: both; +} + +simpread-urlscheme sr-urls-label, +simpread-feedback sr-fb-label { + width: 100%; +} + +simpread-urlscheme sr-urls-head, +simpread-feedback sr-fb-head { + display: flex; + align-items: center; + flex-direction: row; + + margin-bottom: 5px; + width: 100%; +} + +simpread-urlscheme sr-urls-content, +simpread-feedback sr-fb-content { + margin-bottom: 5px; + width: 100%; +} + +simpread-urlscheme sr-urls-footer, +simpread-feedback sr-urls-footer { + display: flex; + justify-content: flex-end; + width: 100%; +} + +simpread-urlscheme sr-urls-a, +simpread-feedback sr-fb-a { + color: #2163f7; + cursor: pointer; +} + +simpread-urlscheme text-field-state, +simpread-feedback text-field-state { + border-top: none rgba(34, 101, 247, 0.8)!important; + border-left: none rgba(34, 101, 247, 0.8)!important; + border-right: none rgba(34, 101, 247, 0.8)!important; + border-bottom: 2px solid rgba(34, 101, 247, 0.8)!important; +} + +simpread-urlscheme switch, +simpread-feedback switch { + margin-top: 0!important; +} + +@keyframes srFadeInUp { + from { + opacity: 0; + transform: translateY(100px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes srFadeInDown { + from { + opacity: 1; + transform: translateY(0); + } + + to { + opacity: 0; + transform: translateY(100px); + } +} + +/** + * Feeback + */ + +simpread-feedback sr-fb-head { + font-weight: bold; +} + +simpread-feedback sr-fb-content { + display: flex; + flex-direction: column; +} + +simpread-feedback sr-fb-footer { + display: flex; + flex-direction: row; + justify-content: flex-end; + + width: 100%; +} + +/** + * Feeback: stars + */ + +simpread-feedback sr-close { + position: absolute; + right: 20px; + cursor: pointer; + transition: all 1000ms cubic-bezier(0.23, 1, 0.32, 1) 100ms; + z-index: 200; +} + +simpread-feedback sr-close:hover { + transform: rotate(-15deg) scale(1.3); +} + +simpread-feedback sr-stars { + display: flex; + flex-direction: row; + justify-content: center; + + margin-top: 10px; +} + +simpread-feedback sr-stars { + display: flex; + flex-direction: row; + justify-content: center; + + margin-top: 10px; +} + +simpread-feedback sr-stars i { + margin-right: 10px; + cursor: pointer; +} + +simpread-feedback sr-stars i svg { + transition: all 1000ms cubic-bezier(0.23, 1, 0.32, 1) 100ms; +} + +simpread-feedback sr-stars i svg:hover { + transform: rotate(-15deg) scale(1.3); +} + +simpread-feedback sr-stars i.active svg { + transform: rotate(0) scale(1); +} + +simpread-feedback sr-emojis { + display: block; + height: 100px; + overflow: hidden; +} + +simpread-feedback sr-emoji { + display: flex; + flex-direction: column; + align-items: center; + transition: .3s; +} + +simpread-feedback sr-emoji > svg { + margin: 15px 0; + width: 70px; + height: 70px; + flex-shrink: 0; +} + +simpread-feedback sr-stars-footer { + display: flex; + justify-content: center; + margin: 10px 0 20px 0; +} \ No newline at end of file diff --git a/src/assets/css/setting.css b/src/assets/css/setting.css index 56f28c61..067d8536 100644 --- a/src/assets/css/setting.css +++ b/src/assets/css/setting.css @@ -24,6 +24,10 @@ sr-opt-gp { font-size: 15px; } +sr-opt-gp textarea, sr-opt-gp input { + font-family: Inconsolata, "Operator Mono", Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace!important; +} + sr-opt-gp sr-opt-label { display: block; position: absolute; @@ -66,12 +70,12 @@ sr-opt-theme { box-sizing: border-box; opacity: 1; - transition: all 500ms opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0ms; + transition: all 500ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; } sr-opt-theme:hover { - opacity: .2; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),0 1px 5px 0 rgba(0,0,0,0.12),0 3px 1px -2px rgba(0,0,0,0.2); + transform: translateY(-1px); + box-shadow: 0 5px 10px rgba(0,0,0,.2); } sr-opt-theme:not(:first-child) { @@ -79,5 +83,6 @@ sr-opt-theme:not(:first-child) { } sr-opt-theme[sr-type="active"] { - box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),0 2px 20px 0 rgba(0,0,0,0.12),0 3px 1px -2px rgba(0,0,0,0.7); + box-shadow: 0 5px 10px rgba(0,0,0,.2); + border: none; } diff --git a/src/assets/css/simpread.css b/src/assets/css/simpread.css index 4a0cfa21..09f492a4 100644 --- a/src/assets/css/simpread.css +++ b/src/assets/css/simpread.css @@ -1,5 +1,5 @@ /** - * SimpRead + * SimpRead: Read mode */ .simpread-font { @@ -16,47 +16,10 @@ display: none; } -/** - * Focus: Background( root ) style - */ -.simpread-focus-root { - display: block; - position: fixed; - - top: 0; - left: 0; - right: 0; - bottom: 0; - - background-color: rgba( 235, 235, 235, 0.9 ); - z-index: 2147483645; - - opacity: 0; - transition : opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0ms; -} - -.simpread-focus-highlight { - position: relative; - - box-shadow: 0 0 0 20px #fff; - background-color: #fff; - - overflow: visible; - z-index: 2147483646; -} - -.sr-controlbar-bg sr-rd-crlbar { - z-index: 2147483647; -} - -.sr-controlbar-bg sr-rd-crlbar fab { - z-index: 2147483647; -} - /** * Read: background( root ) style */ -.simpread-read-root { + .simpread-read-root { display: -webkit-flex; justify-content:center; align-items:center; @@ -216,6 +179,67 @@ sr-rd-footer a:active { border-bottom: 1px dotted!important; } +/** + * Special blocks + */ +.simpread-blocks { + text-decoration: none!important; +} + +.simpread-blocks * { + margin: 0; +} + +.simpread-blocks a { + padding: 0; + text-decoration: none!important; +} + +.simpread-blocks img { + margin: 0; + padding: 0; + border: 0; + background: transparent; + box-shadow: none; +} + +/** + * Focus: Background( root ) style + */ +.simpread-focus-root { + display: block; + position: fixed; + + top: 0; + left: 0; + right: 0; + bottom: 0; + + background-color: rgba( 235, 235, 235, 0.9 ); + z-index: 2147483645; + + opacity: 0; + transition : opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0ms; +} + +.simpread-focus-highlight { + position: relative; + + box-shadow: 0 0 0 20px #fff; + background-color: #fff; + + overflow: visible; + z-index: 2147483646; +} + +.sr-controlbar-bg sr-rd-crlbar { + z-index: 2147483647; +} + +.sr-controlbar-bg sr-rd-crlbar fab { + z-index: 2147483647; +} + /** * Controlbar: focus mode and read mode */ @@ -278,8 +302,8 @@ sr-rd-crlbar.controlbar:hover { transition: opacity .5s ease !important; } - -simpread-highlight { +simpread-highlight, +sr-snapshot-ctlbar { position: fixed; top: 0; @@ -297,6 +321,7 @@ simpread-highlight { background-color: rgba(50, 50, 50, .9); box-shadow: 0 2px 5px rgba(0, 0, 0, .26); + box-sizing: border-box; z-index: 2147483640; } @@ -497,7 +522,7 @@ kbd-mapping { flex-flow: row; width: 500px; - height: 590px; + height: 625px; background-color: #fff; @@ -644,7 +669,7 @@ sharecard-content { max-height: 500px; font-size: 20px; - text-align: left; + text-align: justify; background-color: rgb(33, 150, 243); @@ -705,4 +730,249 @@ sharecard-control { height: 80px; background-color: #fff; +} + +/** + * Snapshot + */ + +simpread-snapshot { + position: fixed; + left: 0; + top: 0; + + width: 100%; + height: 100%; + + cursor: move; + z-index: 2147483645; +} + +sr-mask { + position: fixed; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .1); +} + +/** + * URL Scheme + */ + +.simpread-urlscheme, +.simpread-feedback { + position: fixed; + right: 20px; + bottom: 20px; + + z-index: 2147483646; +} + +simpread-urlscheme, +simpread-feedback { + display: flex; + justify-content: center; + align-items: flex-start; + flex-direction: column; + + padding: 20px 20px 0; + + width: 500px; + + color: rgba(51, 51, 51, .87); + background-color: #fff; + border-radius: 3px; + + box-shadow: rgba(0, 0, 0, 0.12) 0px 0px 2px, rgba(0, 0, 0, 0.26) 0px 2px 2px; + overflow: hidden; + + transform-origin: bottom; + transition: all .6s ease; +} + +simpread-urlscheme *, +simpread-feedback * { + font-size: 12px!important; + box-sizing: border-box; +} + +simpread-urlscheme.active, +simpread-feedback.active { + animation-name: srFadeInUp; + animation-duration: 450ms; + animation-fill-mode: both; +} + +simpread-urlscheme.hide, +simpread-feedback.hide { + animation-name: srFadeInDown; + animation-duration: 450ms; + animation-fill-mode: both; +} + +simpread-urlscheme sr-urls-label, +simpread-feedback sr-fb-label { + width: 100%; +} + +simpread-urlscheme sr-urls-head, +simpread-feedback sr-fb-head { + display: flex; + align-items: center; + flex-direction: row; + + margin-bottom: 5px; + width: 100%; +} + +simpread-urlscheme sr-urls-content, +simpread-feedback sr-fb-content { + margin-bottom: 5px; + width: 100%; +} + +simpread-urlscheme sr-urls-footer, +simpread-feedback sr-urls-footer { + display: flex; + justify-content: flex-end; + width: 100%; +} + +simpread-urlscheme sr-urls-a, +simpread-feedback sr-fb-a { + color: #2163f7; + cursor: pointer; +} + +simpread-urlscheme text-field-state, +simpread-feedback text-field-state { + border-top: none rgba(34, 101, 247, 0.8)!important; + border-left: none rgba(34, 101, 247, 0.8)!important; + border-right: none rgba(34, 101, 247, 0.8)!important; + border-bottom: 2px solid rgba(34, 101, 247, 0.8)!important; +} + +simpread-urlscheme switch, +simpread-feedback switch { + margin-top: 0!important; +} + +@keyframes srFadeInUp { + from { + opacity: 0; + transform: translateY(100px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes srFadeInDown { + from { + opacity: 1; + transform: translateY(0); + } + + to { + opacity: 0; + transform: translateY(100px); + } +} + +/** + * Feeback + */ + +simpread-feedback sr-fb-head { + font-weight: bold; +} + +simpread-feedback sr-fb-content { + display: flex; + flex-direction: column; +} + +simpread-feedback sr-fb-footer { + display: flex; + flex-direction: row; + justify-content: flex-end; + + width: 100%; +} + +/** + * Feeback: stars + */ + + simpread-feedback sr-close { + position: absolute; + right: 20px; + cursor: pointer; + transition: all 1000ms cubic-bezier(0.23, 1, 0.32, 1) 100ms; + z-index: 200; +} + +simpread-feedback sr-close:hover { + transform: rotate(-15deg) scale(1.3); +} + +simpread-feedback sr-stars { + display: flex; + flex-direction: row; + justify-content: center; + + margin-top: 10px; +} + +simpread-feedback sr-stars { + display: flex; + flex-direction: row; + justify-content: center; + + margin-top: 10px; +} + +simpread-feedback sr-stars i { + margin-right: 10px; + cursor: pointer; +} + +simpread-feedback sr-stars i svg { + transition: all 1000ms cubic-bezier(0.23, 1, 0.32, 1) 100ms; +} + +simpread-feedback sr-stars i svg:hover { + transform: rotate(-15deg) scale(1.3); +} + +simpread-feedback sr-stars i.active svg { + transform: rotate(0) scale(1); +} + +simpread-feedback sr-emojis { + display: block; + height: 100px; + overflow: hidden; +} + +simpread-feedback sr-emoji { + display: flex; + flex-direction: column; + align-items: center; + transition: .3s; +} + +simpread-feedback sr-emoji > svg { + margin: 15px 0; + width: 70px; + height: 70px; + flex-shrink: 0; +} + +simpread-feedback sr-stars-footer { + display: flex; + justify-content: center; + margin: 10px 0 20px 0; } \ No newline at end of file diff --git a/src/assets/css/theme_common.css b/src/assets/css/theme_common.css index 0d8601f4..caf4e6ce 100644 --- a/src/assets/css/theme_common.css +++ b/src/assets/css/theme_common.css @@ -28,7 +28,7 @@ sr-rd-content { } sr-rd-desc { - text-align: left; + text-align: justify; line-height: 2.4; margin: 0 0 1.2em 0; } @@ -65,7 +65,7 @@ sr-rd-content a { sr-rd-content a, sr-rd-content a:link { color: inherit; - font-size: initial; + font-size: inherit; font-weight: inherit; border:none; } @@ -77,11 +77,19 @@ sr-rd-content a:hover { sr-rd-content img { margin: 10px; padding: 5px; + + max-width: 100%; + background: #fff; border: 1px solid #bbb; box-shadow: 1px 1px 3px #d4d4d4; } +sr-rd-content figcaption { + text-align: center; + font-size: 14px; +} + sr-rd-content sr-blockquote { display: block; position: relative; diff --git a/src/assets/css/theme_mobile.css b/src/assets/css/theme_mobile.css new file mode 100644 index 00000000..9bf13834 --- /dev/null +++ b/src/assets/css/theme_mobile.css @@ -0,0 +1,181 @@ +/** + * Mobile media + */ +@media (pointer:coarse) { + sr-read { + margin: 20px 5%!important; + min-width: initial!important; + max-width: 90%!important; + } + + sr-rd-title { + margin-top: 0; + font-size: 2.7rem; + } + + sr-rd-desc, + sr-rd-content sr-blockquote { + margin: 10 0!important; + padding: 0 0 0 10px !important; + width: 90%; + + font-size: 1.8rem; + font-style: normal; + line-height: 1.7; + text-align: justify; + } + + sr-rd-content { + font-size: 1.75rem; + font-weight: 300; + } + + sr-rd-content figure { + margin: 0; + padding: 0; + text-align: center; + } + + sr-rd-content a, sr-rd-content a:link { + font-size: inherit; + } + + sr-rd-content li code, sr-rd-content p code { + font-size: inherit; + } + + sr-rd-footer { + margin-top: 20px; + } + + sr-blockquote, sr-blockquote * { + margin: 5px !important; + padding: 5px !important; + } + + sr-rd-title, sr-rd-content h1, sr-rd-content h2, sr-rd-content h3, sr-rd-content h4, sr-rd-content h5, sr-rd-content h6 { + font-family: PingFang SC, Verdana, Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; + color: #000; + font-weight: 100; + line-height: 1.35; + } + + sr-rd-content h1, sr-rd-content h2, sr-rd-content h3, sr-rd-content h4, sr-rd-content h5, sr-rd-content h6, + sr-rd-content-h1, sr-rd-content-h2, sr-rd-content-h3, sr-rd-content-h4, sr-rd-content-h5, sr-rd-content-h6 { + margin-top: 1.2em; + margin-bottom: 0.6em; + line-height: 1.35; + } + + sr-rd-content h1, sr-rd-content-h1 { + font-size: 1.8em; + } + + sr-rd-content h2, sr-rd-content-h2 { + font-size: 1.6em; + } + + sr-rd-content h3, sr-rd-content-h3 { + font-size: 1.4em; + } + + sr-rd-content h4, sr-rd-content-h4 { + font-size: 1.2em; + } + + sr-rd-content h5, sr-rd-content h6, sr-rd-content-h5, sr-rd-content-h6 { + font-size: 1.2em; + } + + sr-rd-content ul, sr-rd-content-ul { + margin-left: 1.3em!important; + list-style: disc; + } + + sr-rd-content ol, sr-rd-content-ol { + list-style: decimal; + margin-left: 1.9em!important; + } + + sr-rd-content li ul, sr-rd-content li ol, sr-rd-content-ul ul, sr-rd-content-ul ol, sr-rd-content-ol ul, sr-rd-content-ol ol { + margin-bottom: 0.8em; + margin-left: 2em!important;; + } + + sr-rd-content img { + margin: 0; + padding: 0; + border: 0; + max-width: 100%!important; + height: auto; + box-shadow: 0 20px 20px -10px rgba(0,0,0,0.1); + } + + sr-rd-mult { + min-width: initial; + background-color: #fff; + box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28); + border-radius: 8px; + } + + sr-rd-mult sr-rd-mult-avatar div { + margin: 0; + } + + sr-rd-mult sr-rd-mult-avatar .sr-rd-content-center-small { + margin: 7px 0!important; + } + + sr-rd-mult sr-rd-mult-avatar span { + display: block; + } + + sr-rd-mult sr-rd-mult-content { + padding-left: 0; + } + + /** + * iPad pro 12 and below + */ + @media only screen and (max-device-width: 1024px) { + html, .simpread-theme-root { + font-size: 80%!important; + } + + sr-rd-mult sr-rd-mult-avatar img { + width: 50px; + height: 50px; + min-width: 50px; + min-height: 50px; + } + } + + /** + * iPhone XS Max and below + */ + @media only screen and (max-device-width: 414px) { + html, .simpread-theme-root { + font-size: 70%!important; + } + + sr-rd-mult sr-rd-mult-avatar img { + width: 30px; + height: 30px; + min-width: 30px; + min-height: 30px; + } + } + + /** + * iPhone SE and below + */ + @media only screen and (max-device-width: 320px) { + html, .simpread-theme-root { + font-size: 90%!important; + } + + sr-rd-content p { + margin-bottom: .5em; + } + } +} diff --git a/src/assets/images/about_icon.png b/src/assets/images/about_icon.png deleted file mode 100644 index 02c2f08c..00000000 Binary files a/src/assets/images/about_icon.png and /dev/null differ diff --git a/src/assets/images/bear_icon.png b/src/assets/images/bear_icon.png new file mode 100644 index 00000000..263d59ba Binary files /dev/null and b/src/assets/images/bear_icon.png differ diff --git a/src/assets/images/common_icon.png b/src/assets/images/common_icon.png deleted file mode 100644 index bb87ff72..00000000 Binary files a/src/assets/images/common_icon.png and /dev/null differ diff --git a/src/assets/images/focus_mode_icon.png b/src/assets/images/focus_mode_icon.png deleted file mode 100644 index 500aa9d2..00000000 Binary files a/src/assets/images/focus_mode_icon.png and /dev/null differ diff --git a/src/assets/images/help_icon.png b/src/assets/images/help_icon.png deleted file mode 100644 index 7ba7f62e..00000000 Binary files a/src/assets/images/help_icon.png and /dev/null differ diff --git a/src/assets/images/labs_icon.png b/src/assets/images/labs_icon.png deleted file mode 100644 index 23f9d21f..00000000 Binary files a/src/assets/images/labs_icon.png and /dev/null differ diff --git a/src/assets/images/markdown_icon.png b/src/assets/images/markdown_icon.png index d2bd862f..c48cd58e 100644 Binary files a/src/assets/images/markdown_icon.png and b/src/assets/images/markdown_icon.png differ diff --git a/src/assets/images/notion_icon.png b/src/assets/images/notion_icon.png new file mode 100644 index 00000000..33b4e0da Binary files /dev/null and b/src/assets/images/notion_icon.png differ diff --git a/src/assets/images/offline_html_icon.png b/src/assets/images/offline_html_icon.png new file mode 100644 index 00000000..8f515778 Binary files /dev/null and b/src/assets/images/offline_html_icon.png differ diff --git a/src/assets/images/offline_markdown_icon.png b/src/assets/images/offline_markdown_icon.png new file mode 100644 index 00000000..d2bd862f Binary files /dev/null and b/src/assets/images/offline_markdown_icon.png differ diff --git a/src/assets/images/plugins_icon.png b/src/assets/images/plugins_icon.png deleted file mode 100644 index e4204fe6..00000000 Binary files a/src/assets/images/plugins_icon.png and /dev/null differ diff --git a/src/assets/images/read_later_icon.png b/src/assets/images/read_later_icon.png deleted file mode 100644 index 06e067e3..00000000 Binary files a/src/assets/images/read_later_icon.png and /dev/null differ diff --git a/src/assets/images/read_mode_icon.png b/src/assets/images/read_mode_icon.png deleted file mode 100644 index b0988984..00000000 Binary files a/src/assets/images/read_mode_icon.png and /dev/null differ diff --git a/src/assets/images/snapshot_icon.png b/src/assets/images/snapshot_icon.png new file mode 100644 index 00000000..b345fac1 Binary files /dev/null and b/src/assets/images/snapshot_icon.png differ diff --git a/src/assets/images/ulysses_icon.png b/src/assets/images/ulysses_icon.png new file mode 100644 index 00000000..b7f4d699 Binary files /dev/null and b/src/assets/images/ulysses_icon.png differ diff --git a/src/assets/images/wiz_icon.png b/src/assets/images/wiz_icon.png new file mode 100644 index 00000000..667557ba Binary files /dev/null and b/src/assets/images/wiz_icon.png differ diff --git a/src/assets/images/youdao_icon.png b/src/assets/images/youdao_icon.png new file mode 100644 index 00000000..6b193061 Binary files /dev/null and b/src/assets/images/youdao_icon.png differ diff --git a/src/background.js b/src/background.js index 1f2c315f..87d4de50 100644 --- a/src/background.js +++ b/src/background.js @@ -8,7 +8,9 @@ import * as ver from 'version'; import * as menu from 'menu'; import * as watch from 'watch'; import * as WebDAV from 'webdav'; - +import * as permission + from 'permission'; +import * as tips from 'tips'; import PureRead from 'puread'; // global update site tab id @@ -64,6 +66,7 @@ function getNewsitesHandler( result ) { */ menu.OnClicked( ( info, tab ) => { console.log( "background contentmenu Listener", info, tab ); + tracked({ eventCategory: "menu", eventAction: "menu", eventValue: info.menuItemId }); if ( info.menuItemId == "link" ) { info.linkUrl && browser.tabs.create({ url: info.linkUrl + "?simpread_mode=read" }); } else if ( info.menuItemId == "list" ) { @@ -76,6 +79,8 @@ menu.OnClicked( ( info, tab ) => { browser.tabs.sendMessage( tab.id, msg.Add( msg.MESSAGE_ACTION.menu_blacklist, {url: info.pageUrl } )); } else if ( info.menuItemId == "unrdist" ) { browser.tabs.sendMessage( tab.id, msg.Add( msg.MESSAGE_ACTION.menu_unrdist, {url: info.pageUrl } )); + } else if ( info.menuItemId == "lazyload" ) { + browser.tabs.sendMessage( tab.id, msg.Add( msg.MESSAGE_ACTION.menu_lazyload, {url: info.pageUrl } )); } else { if ( !tab.url.startsWith( "chrome://" ) ) browser.tabs.sendMessage( tab.id, msg.Add(info.menuItemId)); } @@ -144,7 +149,76 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) }); /** - * Listen runtime message, include: `shortcuts` `browser_action` + * Listen runtime message, include: `download`, `base64` && `permission` + */ +browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) { + if ( request.type == msg.MESSAGE_ACTION.download ) { + const { data, name } = request.value; + const blob = new Blob([data], { + type: "html/plain;charset=utf-8" + }); + const url = URL.createObjectURL(blob); + browser.downloads.download({ + url : url, + filename: name.replace( /[|]/ig, "" ), + }, downloadId => { + sendResponse({ done: downloadId }); + }); + } else if ( request.type == msg.MESSAGE_ACTION.base64 ) { + const { url } = request.value; + fetch( url ) + .then( response => response.blob() ) + .then( blob => new Promise(( resolve, reject ) => { + const reader = new FileReader() + reader.onloadend = event => { + sendResponse({ done: { url, uri: event.target.result }}); + }; + reader.onerror = error => { + sendResponse({ fail: { error, url } }); + }; + reader.readAsDataURL( blob ); + })) + .catch( error => { + sendResponse({ fail: { error, url } }); + }); + } else if ( request.type == msg.MESSAGE_ACTION.permission ) { + permission.Get({ permissions: [ "downloads" ] }, result => { + sendResponse({ done: result }); + }); + } + return true; +}); + +/** + * Listen runtime message, include: `snapshot` + */ +browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) { + if ( request.type == msg.MESSAGE_ACTION.snapshot ) { + const { left, top, width, height } = request.value; + chrome.tabs.captureVisibleTab( { format: "png" }, base64 => { + const image = new Image(); + image.src = base64; + image.onload = () => { + const canvas = document.createElement( "canvas" ), + ctx = canvas.getContext( "2d" ), + dpi = window.devicePixelRatio, + sx = left * dpi, + sy = top * dpi, + sWidth = width * dpi, + sHeight = height * dpi; + canvas.width = sWidth; + canvas.height = sHeight; + ctx.drawImage( image, sx, sy, sWidth, height * dpi, 0, 0, sWidth, sHeight ); + const uri = canvas.toDataURL( "image/png" ); + sendResponse({ done: uri }); + }; + }); + } + return true; +}); + +/** + * Listen runtime message */ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) { console.log( "background runtime Listener", request ); @@ -218,6 +292,12 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) case msg.MESSAGE_ACTION.speak_stop: browser.tts.stop(); break; + case msg.MESSAGE_ACTION.tips: + tips.Verify( request.value.code, sendResponse ); + break; + case msg.MESSAGE_ACTION.tips_norepeat: + tips.Done( request.value.code ); + break; } }); @@ -333,27 +413,9 @@ function setMenuAndIcon( id, code ) { * * @param {object} google analytics track object */ -function tracked({ eventCategory, eventAction, eventLabel }) { - console.log( "current track is", eventCategory, eventAction, eventLabel ) - ga( 'send', { - hitType : 'event', - eventCategory, - eventAction, - eventLabel - }); -} - -/** - * Google analytics - */ -analytics(); -function analytics() { - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-405976-12', 'auto'); - ga('send', 'pageview'); +function tracked({ eventCategory, eventAction, eventValue }) { + console.log( "current track is", eventCategory, eventAction, eventValue ) + _gaq.push([ '_trackEvent', eventCategory, eventValue ]); } /** @@ -361,4 +423,5 @@ function analytics() { */ function uninstall() { browser.runtime.setUninstallURL( storage.option.uninstall ? storage.service + "/uninstall" : "" ); + tracked({ eventCategory: "install", eventAction: "install", eventValue: "uninstall" }); } \ No newline at end of file diff --git a/src/contentscripts.js b/src/contentscripts.js index 278cc742..18e29ffe 100644 --- a/src/contentscripts.js +++ b/src/contentscripts.js @@ -3,7 +3,6 @@ console.log( "=== simpread contentscripts load ===" ) import './assets/css/simpread.css'; import './assets/css/setting.css'; import 'notify_css'; -import 'mintooltip'; import Velocity from 'velocity'; import Notify from 'notify'; @@ -13,6 +12,7 @@ import * as read from 'read'; import * as setting from 'setting'; import * as kbd from 'keyboard'; import * as highlight from 'highlight'; +import * as scheme from 'urlscheme'; import * as util from 'util'; import { storage, STORAGE_MODE as mode } from 'storage'; @@ -46,7 +46,7 @@ storage.Read( () => { }); } else { bindShortcuts(); - preload() && autoOpen(); + !isLazyload() && autoOpen(); } }); @@ -56,49 +56,19 @@ storage.Read( () => { * @return {boolean} true: is blacklist; false: is't blacklist */ function blacklist() { - for ( const item of storage.option.blacklist ) { - if ( item.trim() != "" && !item.startsWith( "http" ) ) { - if ( location.hostname.includes( item ) ) { - is_blacklist = true; - break; - } - } else { - if ( location.href == item ) { - is_blacklist = true; - break; - } - } - } + is_blacklist = util.Blacklist( puplugin.Plugin( "minimatch" ), storage.option ); console.log( "current site is blacklist", is_blacklist ) return is_blacklist; } /** - * Preload verify + * isLazyload verify * - * @return {boolen} + * @return {boolen} true: lazyload; false: preload */ -function preload() { - let is_proload = true; - if ( storage.option.preload == false ) { - is_proload = false; - } else if ( storage.option.preload ) { - for ( const item of storage.option.lazyload ) { - if ( item.trim() != "" && !item.startsWith( "http" ) ) { - if ( location.hostname.includes( item ) ) { - is_proload = false; - break; - } - } else { - if ( location.href == item ) { - is_proload = false; - break; - } - } - } - } - return is_proload; +function isLazyload() { + return util.Lazyload( puplugin.Plugin( "minimatch" ), storage.option ); } /** @@ -116,7 +86,7 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) bindShortcuts(); break; case msg.MESSAGE_ACTION.tab_selected: - if ( preload() == false ) { + if ( isLazyload() ) { browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.browser_action, { code: 0 , url: window.location.href } )); } else browserAction( request.value.is_update ); break; @@ -144,25 +114,37 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) case msg.MESSAGE_ACTION.menu_whitelist: case msg.MESSAGE_ACTION.menu_exclusion: case msg.MESSAGE_ACTION.menu_blacklist: + case msg.MESSAGE_ACTION.menu_lazyload: case msg.MESSAGE_ACTION.menu_unrdist: - if ( request.type == msg.MESSAGE_ACTION.menu_whitelist ) { - storage.read.whitelist.push( request.value.url ); - new Notify().Render( "已加入到白名单。" ); - } else if ( request.type == msg.MESSAGE_ACTION.menu_exclusion ) { - storage.read.exclusion.push( request.value.url ); - new Notify().Render( "已加入到排除列表。" ); - } else if ( request.type == msg.MESSAGE_ACTION.menu_blacklist ) { - storage.option.blacklist.push( request.value.url ); - new Notify().Render( "已加入到黑名单。" ); - } else if ( request.type == msg.MESSAGE_ACTION.menu_unrdist ) { - storage.UnRead( "add", { url: request.value.url, title: $("head").find("title").text() , desc: "" }, success => { - success && new Notify().Render( 0, "成功加入未读列表。" ); - !success && new Notify().Render( 0, "已加入未读列表,请勿重新加入。" ); + const menuSrv = ( type, url ) => { + if ( type == msg.MESSAGE_ACTION.menu_whitelist ) { + storage.read.whitelist.push( url ); + new Notify().Render( "已加入到白名单。" ); + } else if ( type == msg.MESSAGE_ACTION.menu_exclusion ) { + storage.read.exclusion.push( url ); + new Notify().Render( "已加入到排除列表。" ); + } else if ( type == msg.MESSAGE_ACTION.menu_blacklist ) { + storage.option.blacklist.push( url ); + new Notify().Render( "已加入到黑名单。" ); + } else if ( type == msg.MESSAGE_ACTION.menu_lazyload ) { + storage.option.lazyload.push( url ); + new Notify().Render( "已加入到延迟加载。" ); + } else if ( type == msg.MESSAGE_ACTION.menu_unrdist ) { + storage.UnRead( "add", util.GetPageInfo(), success => { + success && new Notify().Render( 0, "成功加入未读列表。" ); + !success && new Notify().Render( 0, "已加入未读列表,请勿重新加入。" ); + }); + } + storage.Write( () => { + watch.SendMessage( "option", true ); }); - } - storage.Write( () => { - watch.SendMessage( "option", true ); - }); + }; + if ( storage.option.urlscheme && /whitelist|exclusion|blacklist|lazyload/ig.test( request.type )) { + scheme.Render( request.type.replace( "menu_", "" ), storage.option.urlscheme, ( type, off, value ) => { + storage.option.urlscheme = off; + menuSrv( "menu_" + type, value ); + }); + } else menuSrv( request.type, request.value.url ); break; } }); @@ -250,13 +232,21 @@ function readMode() { } /** - * Auto open read mode + * Auto open read mode, include: + * + * - http://xxxx?simpread_mode=read + * - auto && location.href not include exclusion list + * - location.href include white list */ function autoOpen() { getCurrent( mode.read ); - if ( window.location.href.includes( "simpread_mode=read" ) || - ( storage.current.auto && util.Exclusion( puplugin.Plugin( "minimatch" ), storage.current )) || - ( !storage.current.auto && util.Whitelist( puplugin.Plugin( "minimatch" ), storage.current )) + const suffix = window.location.href.includes( "simpread_mode=read" ), + auto = storage.current.auto, + minimatch = puplugin.Plugin( "minimatch" ), + whitelist = util.Whitelist( minimatch, storage.current ), + exclusion = util.Exclusion( minimatch, storage.current ); + if ( + suffix || whitelist || ( auto && exclusion == false ) ) { switch ( storage.current.site.name ) { case "my.oschina.net": @@ -275,6 +265,7 @@ function autoOpen() { break; default: pr.state == "adapter" && readMode(); + pr.state == "temp" && pr.current.site.html != "" && whitelist && readMode(); break; } } diff --git a/src/focus/controlbar.jsx b/src/focus/controlbar.jsx index a6cdf1dd..41247f90 100644 --- a/src/focus/controlbar.jsx +++ b/src/focus/controlbar.jsx @@ -33,6 +33,13 @@ class FControl extends React.Component { }); } + onClose() { + setTimeout( ()=> { + $( "fab-bg" ).css({ width: '100px' }) + $( "fab" ).find( "ul[type=hori]" ).css({ opacity: 0, visibility: "hidden" }) + }, 200 ); + } + onAction( event, type ) { console.log( "fab type is =", type ) @@ -46,9 +53,11 @@ class FControl extends React.Component { break; case "setting": setting.Render( ()=>setTimeout( ()=>se.Render(), 500 )); + this.onClose(); break; case "siteeditor": se.Render(); + this.onClose(); break; case "remove": new Notify().Render( "移动鼠标选择不想显示的内容,只针对本次有效。" ); @@ -65,7 +74,7 @@ class FControl extends React.Component { break; default: if ( type.indexOf( "_" ) > 0 && type.startsWith( "share" ) || - [ "save", "markdown", "png", "epub", "pdf", "kindle", "temp", "html", "dropbox", "pocket", "instapaper", "linnk", "yinxiang","evernote", "onenote", "gdrive" ].includes( type )) { + [ "save", "markdown", "offlinemarkdown", "png", "epub", "pdf", "kindle", "temp", "bear", "ulysses", "html", "offlinehtml", "dropbox", "pocket", "instapaper", "linnk", "yinxiang","evernote", "onenote", "gdrive", "jianguo", "yuque", "notion", "youdao", "weizhi" ].includes( type )) { const [ title, desc, content ] = [ $( "head title" ).text().trim(), "", $( ".simpread-focus-highlight" ).html().trim() ]; output.Action( type, title, desc, content ); } diff --git a/src/focus/focus.js b/src/focus/focus.js index 06932f62..afffd518 100644 --- a/src/focus/focus.js +++ b/src/focus/focus.js @@ -6,6 +6,8 @@ var storage = require( "storage" ).storage, fcontrol = require( "controlbar" ), tooltip = require( "tooltip" ), waves = require( "waves" ), + browser = require( "browser" ).browser, + msg = require( "message" ), focus = ( function () { var $parent, @@ -67,6 +69,7 @@ var storage = require( "storage" ).storage, tooltip.Render( bgclsjq ); waves.Render({ root: bgclsjq }); storage.Statistics( "focus" ); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.track, { eventCategory: "mode", eventAction: "focusmode", eventValue: "focusmode" }) ); // click mask remove it $( bgclsjq ).on( "click", function( event, data ) { diff --git a/src/ga.js b/src/ga.js new file mode 100644 index 00000000..ac94924d --- /dev/null +++ b/src/ga.js @@ -0,0 +1,22 @@ + +/** + * Track using the asynchronous tracking API. + * + * See http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html + * for information on how to use the asynchronous tracking API. + * _gaq.push(['_trackEvent', e.target.id, 'clicked']); + */ + +var _AnalyticsCode = 'UA-405976-14'; +var _gaq = _gaq || []; +_gaq.push(['_setAccount', _AnalyticsCode]); +_gaq.push(['_trackPageview']); + +(function() { + var ga = document.createElement('script'); + ga.type = 'text/javascript'; + ga.async = true; + ga.src = 'https://ssl.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(ga, s); +})(); \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index 8e450155..3685d787 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "name" : "__MSG_extension_name__", "default_locale" : "en", - "version" : "1.1.3", + "version" : "1.1.4", "short_name" : "SimpRead", "description" : "__MSG_extension_desc__", "homepage_url" : "http://ksria.com/simpread", @@ -15,10 +15,12 @@ "contextMenus", "tabs", "storage", - "tts" + "tts", + "" ], + "optional_permissions": [ "cookies", "https://*.youdao.com/", "downloads" ], "background": { - "scripts" : [ "/bundle/common.js", "/bundle/background.js" ] + "scripts" : [ "/ga.js", "/bundle/common.js", "/bundle/background.js" ] }, "content_scripts" : [ { @@ -40,10 +42,11 @@ "options_page" : "options/options.html", "web_accessible_resources": [ "/assets/images/*", - "website_list.json" + "website_list.json", + "options/corb.html" ], "offline_enabled" : true, "update_url" : "https://clients2.google.com/service/update2/crx", - "content_security_policy" : "script-src 'self' 'unsafe-eval' https://www.google-analytics.com; object-src 'self'", + "content_security_policy" : "script-src 'self' 'unsafe-eval' https://ssl.google-analytics.com; object-src 'self'", "manifest_version": 2 } \ No newline at end of file diff --git a/src/module/about.jsx b/src/module/about.jsx index 6007968f..eeaaccc0 100644 --- a/src/module/about.jsx +++ b/src/module/about.jsx @@ -89,7 +89,7 @@ export default class About extends React.Component { -
帮助
+
帮助
@@ -117,12 +117,12 @@ export default class About extends React.Component {
-
其它平台的简悦
+
其它平台的简悦
@@ -131,7 +131,7 @@ export default class About extends React.Component {
-
反馈
+
反馈
如果有任何问题请提交 issues @@ -151,7 +151,7 @@ export default class About extends React.Component {
-
其它作品
+
其它作品
GNVM - 使用 Go 语言编写的 Node.js 多版本管理器 diff --git a/src/module/authorize.jsx b/src/module/authorize.jsx index 103f806b..20168fef 100644 --- a/src/module/authorize.jsx +++ b/src/module/authorize.jsx @@ -4,11 +4,14 @@ import {storage} from 'storage'; import * as exp from 'export'; import * as msg from 'message'; import {browser} from 'browser'; +import * as permission + from 'permission'; import Notify from 'notify'; import Switch from 'switch'; import TextField from 'textfield'; import Button from 'button'; +import Dropdown from 'dropdown'; export default class Auth extends React.Component { @@ -24,6 +27,10 @@ export default class Auth extends React.Component { jianguo: { username: "", password: "", + }, + weizhi: { + username: "", + password: "", } } @@ -32,11 +39,14 @@ export default class Auth extends React.Component { linnk : undefined, instapaper : undefined, jianguo: undefined, + weizhi : undefined, + notion : undefined, + youdao : undefined, } onChange( state, value, flag ) { let notify; - const { dropbox, pocket, instapaper, linnk, evernote, onenote, gdrive, jianguo, yuque } = exp, + const { dropbox, pocket, instapaper, linnk, evernote, onenote, gdrive, jianguo, yuque, notion, youdao, weizhi } = exp, clear = ( id, name ) => { Object.keys( storage.secret[id] ).forEach( item => storage.secret[id][item] = "" ); storage.Safe( ()=> { @@ -53,6 +63,9 @@ export default class Auth extends React.Component { id == "linnk" && this.setState({ secret: storage.secret, linnk: false }); id == "instapaper" && this.setState({ secret: storage.secret, instapaper: false }); id == "jianguo" && this.setState({ secret: storage.secret, jianguo: false }); + id == "weizhi" && this.setState({ secret: storage.secret, weizhi: false }); + id == "notion" && this.setState({ secret: storage.secret, notion: notion.blocks }); + id == "youdao" && this.setState({ secret: storage.secret, youdao: youdao.folders }); if ( location.hash.startsWith( "#labs?auth=" ) ) { new Notify().Render( "3 秒钟将会关闭此页面..." ); setTimeout( () => { @@ -64,6 +77,7 @@ export default class Auth extends React.Component { failed = ( error, id, name ) => { notify && notify.complete(); console.error( `${name} auth faild, error: ${error}` ) + id == "youdao" || id == "notion" ? new Notify().Render( 2, `获取 ${name} 授权失败,${error}` ) : new Notify().Render( 2, `获取 ${name} 授权失败,请重新获取。` ); storage.secret[state].access_token = ""; this.setState({ secret: storage.secret }); @@ -84,6 +98,11 @@ export default class Auth extends React.Component { return; } + if ( state == "weizhi" && !flag && !storage.secret.weizhi.username ) { + this.setState({ weizhi: !this.state.weizhi }); + return; + } + if ( !value ) { state == "pocket" && $( this.refs.pocket_tags ).velocity( value ? "slideDown" : "slideUp" ); if ( state == "linnk" ) { @@ -98,6 +117,14 @@ export default class Auth extends React.Component { this.props.jianguo.username = ""; this.props.jianguo.password = ""; } + if ( state == "weizhi" ) { + this.props.weizhi.username = ""; + this.props.weizhi.password = ""; + this.props.weizhi.access_token = ""; + } + if ( state == "youdao" ) { + permission.Remove( youdao.permissions, result => new Notify().Render( `已取消 cookies 权限。` )); + } clear( state, exp.Name( state )); return; } @@ -212,6 +239,27 @@ export default class Auth extends React.Component { }); }).fail( error => failed( error, yuque.id, yuque.name )); break; + case "notion": + notion.Auth( ( result, error ) => { + if ( error ) failed( error, notion.id, notion.name ); + else success( notion.id, notion.name, { access_token: notion.access_token, folder_id: notion.folder_id }); + }); + break; + case "youdao": + permission.Get( youdao.permissions, result => { + if ( !result ) { + new Notify().Render( 2, `此功能需要申请 cookies 权限后才能使用,授权成功后会自动取消。` ); + this.setState({ secret: storage.secret }); + return; + } + setTimeout( () => { + youdao.Auth( ( result, error ) => { + if ( error ) failed( error, youdao.id, youdao.name ); + else success( youdao.id, youdao.name, { access_token: youdao.access_token, folder_id: youdao.folder_id }); + }); + }, 500 ); + }); + break; case "jianguo": jianguo.Auth( this.props.jianguo.username, this.props.jianguo.password, result => { if ( result && result.status == 401 ) { @@ -219,12 +267,28 @@ export default class Auth extends React.Component { } else success( "jianguo", "坚果云", { username: this.props.jianguo.username, password: this.props.jianguo.password } ); }); break; + case "weizhi": + if ( location.hash.startsWith( "#labs?auth=" ) ) { + this.props.weizhi.username = storage.secret.weizhi.username; + this.props.weizhi.password = storage.secret.weizhi.password; + } + weizhi.Auth( this.props.weizhi.username, this.props.weizhi.password, result => { + if ( result && result.status == 401 ) { + failed( "授权错误,请重新授权。", weizhi.id, weizhi.name ); + } else { + if ( result && result.returnCode == 200 ) success( "weizhi", "为知笔记", { username: this.props.weizhi.username, password: this.props.weizhi.password, access_token: weizhi.access_token } ); + else failed( "授权错误,请重新授权。", weizhi.id, weizhi.name ); + } + }); + break; } } save( state, value ) { state == "pocket" && ( storage.secret.pocket.tags = value.trim() ); state == "linnk" && ( storage.secret.linnk.group_name = value.trim() ); + state == "notion" && ( storage.secret.notion.folder_id = value.trim() ); + state == "youdao" && ( storage.secret.youdao.folder_id = value.trim() ); storage.Safe( () => this.setState({ secret: storage.secret }), storage.secret ); } @@ -240,16 +304,42 @@ export default class Auth extends React.Component { this.props.jianguo[state] = value; } + weizhiOnChange( state, value ) { + this.props.weizhi[state] = value; + } + webdavOnChange() { this.state.secret.webdav = event.target.value.split("\n"); storage.Safe( () => this.setState({ secret: storage.secret }), storage.secret ); } + notionChange() { + exp.notion.Auth( ( result, error ) => { + this.setState({ secret: storage.secret, notion: exp.notion.blocks }); + }); + } + + youdaoChange() { + permission.Get( exp.youdao.permissions, result => { + if ( !result ) { + new Notify().Render( 2, `此功能需要申请 cookies 权限后才能使用,授权成功后会自动取消。` ); + this.setState({ secret: storage.secret }); + return; + } + setTimeout( () => { + exp.youdao.Auth( ( result, error ) => { + if ( result ) this.setState({ secret: storage.secret, youdao: exp.youdao.folders }); + else new Notify().Render( 2, `重新获取失败,${error}` ); + }); + }, 500 ); + }); + } + webdavAuth() { this.state.secret.webdav.forEach( ( item, idx ) => { try { item = JSON.parse( item ); - if ( Object.keys( item ).join( "" ).replace( /url|name|password|user/ig, "" ) != "" ) { + if ( Object.keys( item ).join( "" ).replace( /url|name|password|user|format/ig, "" ) != "" ) { throw "error"; } exp.webdav.Auth( item.url, item.user, item.password, result => { @@ -270,10 +360,12 @@ export default class Auth extends React.Component { } componentDidMount() { - storage.Safe( () => this.setState({ secret: storage.secret }) ); - if ( location.hash.startsWith( "#labs?auth=" ) ) { - this.onChange( location.hash.replace( "#labs?auth=", "" ), true ); - } + storage.Safe( () => { + this.setState({ secret: storage.secret }) + if ( location.hash.startsWith( "#labs?auth=" ) ) { + this.onChange( location.hash.replace( "#labs?auth=", "" ), true ); + } + }); } render() { @@ -418,7 +510,68 @@ export default class Auth extends React.Component { onChange={ (s)=>this.onChange( "yuque", s ) } />
-
+
+ this.onChange( "notion", s ) } /> + + { this.state.secret.notion.access_token && +
+ { this.state.notion ? this.save( "notion", v ) } /> + :
} +
+
+ this.onChange( "youdao", s ) } /> + + { this.state.secret.youdao.access_token && +
+ { this.state.youdao ? this.save( "youdao", v ) } /> + :
} +
+ +
+ this.onChange( "weizhi", s ) } /> +
+ { this.state.weizhi && +
+
+ this.weizhiOnChange( "username", evt.target.value ) } + /> + this.weizhiOnChange( "password", evt.target.value ) } + /> +
+ +
} + +
WebDAV
简悦支持任意 WebDAV 的服务,包括:Box · TeraCLOUD 等
{ + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.track, { eventCategory: "sync", eventAction: "sync", eventValue: storage.option.save_at }) ); if ( storage.option.save_at == "dropbox" ) { const sec_dbx = storage.secret.dropbox; !sec_dbx.access_token ? @@ -154,7 +155,8 @@ export default class CommonOpt extends React.Component { new Notify().Render({ type: 2, content: `上传版本太低,已自动转换为最新版本。`, state: "holdon" }); } menu.Refresh( json.option.menu ); - ver.Incompatible( json.version, json ); + ver.Incompatible( json.version, json ) && new Notify().Render({ type: 2, content: `检测到你曾经修改过第三方适配源,务必刷新后重新导入详细说明`, state: "holdon" }); + ver.VerifyPlugins( json.option ) && new Notify().Render({ type: 2, content: `已清理失效的插件,详细请看 失效插件`, state: "holdon" }); json.option.origins && json.option.origins.length > 0 && new Notify().Render({ content: `导入的配置文件包含了第三方源,刷新后请重新 手动导入。`, state: "holdon" }); json.option.plugins && json.option.plugins.length > 0 && diff --git a/src/module/common/theme.jsx b/src/module/common/theme.jsx index 5bbc6ca1..391bb4a5 100644 --- a/src/module/common/theme.jsx +++ b/src/module/common/theme.jsx @@ -25,7 +25,7 @@ export default class ThemeSel extends React.Component { render() { return ( this.changeBgColor(evt) }> - { this.props.themes.map( (theme,idx) => )} + { this.props.themes.map( (theme,idx) => )} ) } diff --git a/src/module/common/url.jsx b/src/module/common/url.jsx index eef5b3a5..b5a8416e 100644 --- a/src/module/common/url.jsx +++ b/src/module/common/url.jsx @@ -26,10 +26,12 @@ export default class URL extends React.Component { if ( url == "" ) { code = -2; this.setState({ error : "当前输入不能为空。" }); - } else if ( !/^http[s|*]?:\/\//.test( url ) ) { + } else if ( url.startsWith( "[[/" ) && url.endsWith( "/]]" ) && !new RegExp( url.replace( /^\[\[\/|\/\]\]/g, "" ) ).test( location.href )) { + location.protocol != "chrome-extension:" && this.setState({ error : "请输入与当前网址匹配的域名,正则表达式出现错误。" }); + } else if ( !url.startsWith( "[[/" ) && !/^http[s|*]?:\/\//.test( url ) ) { code = -1; this.setState({ error : "请输入有效的 url " }); - } else if ( location.protocol.startsWith( "http" ) && !minimatch( window.location.href, url ) && url != this.props.url ) { + } else if ( !url.startsWith( "[[/" ) && location.protocol.startsWith( "http" ) && !minimatch( window.location.href, url ) && url != this.props.url ) { code = -1; this.setState({ error : "请输入与当前网址匹配的域名,支持 minimatch " }); } else { diff --git a/src/module/feedback.jsx b/src/module/feedback.jsx new file mode 100644 index 00000000..7b88332c --- /dev/null +++ b/src/module/feedback.jsx @@ -0,0 +1,240 @@ +console.log( "===== simpread feedback load =====" ) + +import Switch from 'switch'; +import TextField from 'textfield'; +import Button from 'button'; + +import {browser} from 'browser'; +import * as msg from 'message'; + +export class Feedback extends React.Component { + + static defaultProps = { + user : {}, + url : "", + version : "", + anonymous: false, + rate : false, + product : "https://support.qq.com/product/" + 117464, + star : ``, + stared : ``, + } + + static propType = { + user : React.PropTypes.object, + url : React.PropTypes.string, + version : React.PropTypes.string, + anonymous: React.PropTypes.bool, + rate : React.PropTypes.bool, + product : React.PropTypes.string, + } + + state = { + mode: "github", + rate: this.props.rate, + stars: 0, + }; + + onStarClick( idx ) { + $( this.refs.stars ).find( "i" ).removeClass( "active" ); + for( let i = 0; i < 5; i++ ) { + const $target = $( $( this.refs.stars ).find( "i" )[i] ); + if ( i < idx ) $target.addClass( "active" ).html( this.props.stared ); + else $target.html( this.props.star ); + } + $( this.refs.emoji ).css({ 'transform': `translateY(-${idx}00px)` }); + this.setState({ stars: idx }); + } + + onStarHover( idx ) { + $( this.refs.emoji ).css({ 'transform': `translateY(-${idx}00px)` }); + } + + onRateClick() { + if ( this.state.stars < 4 ) { + this.setState({ rate: false }); + } else { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: "https://chrome.google.com/webstore/detail/simpread-reader-view/ijllcpnolfcooahcekpamkbidhejabll/reviews" })); + setTimeout( () => this.onClose(), 200 ); + } + } + + onURLChange( event ) { + this.props.url = event.target.value.trim(); + } + + onAnonymousChange( value ) { + this.props.anonymous = value; + } + + onChangeMode( mode ) { + this.setState({ mode }); + } + + onClose() { + $( this.refs.target ) + .addClass( "hide" )[0] + .addEventListener( 'animationend', () => { + ReactDOM.unmountComponentAtNode( $( ".simpread-feedback" )[0] ); + $( ".simpread-feedback" ).remove(); + }, false ); + } + + onSubmitClick() { + this.state.mode == "github" ? this.onGithubClick() : this.onTucaoClick(); + } + + onGithubClick() { + const content = `**小提示** + +> 简悦已经服务 70K+ 的用户,所以你的很多问题,或许已经被前人解决了,所以试着看看以下几个列表中的内容: + +- [用好 Github issues 能解决你大部分的疑问](https://github.com/Kenshin/simpread/issues/533) + +- [常见问题汇总](https://github.com/Kenshin/simpread/issues/618) + +- [代码段的专项整治](https://github.com/Kenshin/simpread/issues/500) + +*** + +> 如上述内容无法解决你的问题,那么请将上述内容删除,并按照下方的提示书写~ 😀 + +**请说明发生问题的环境** + +> 简悦包含了很多平台的版本,所以为了方便定位,建议告诉我一些必要信息 + +- 操作系统 **${window.navigator.platform}** + +- 浏览器版本 **e.g. Chrome 78.0.3904.108** + +- 简悦版本 **${ this.props.version }** + +- 发生问题的地址 <${ this.props.url }> + +**请描述你的问题** + +> 请使用可以 **准确定位到错误** 的语句来告诉我。😀 + +**截图** + +> 一图胜千言,所以方便的话,可以试着贴图。 +`, url = encodeURI( `https://github.com/Kenshin/simpread/issues/new?title=<请描述你的问题>&labels=to do&body=${content}` ) + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url })); + } + + onTucaoClick() { + const data = { + "nickname" : this.props.anonymous ? "简悦用户" : this.props.user.name || "简悦用户", + "avatar" : `https://api.adorable.io/avatars/285/${ this.props.user.name || this.props.user.uid.substr( 0,13 ) }.png`, + "openid" : this.props.user.uid.substr( 0,13 ), + "clientVersion": this.props.version, + "clientInfo" : window.navigator.userAgent, + "customInfo" : "https://github.com/erguotou520/tucao-dingtalk-webhook" + }; + $.ajax({ + url: this.props.product, + method: "POST", + data + }).done( ( result, textStatus, jqXHR ) => { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: this.props.product })); + }).fail( error => { + console.log( "count failed ", error ) + }); + } + + render() { + return ( + + { this.state.rate == false ? + + + 有了你们的帮助简悦才会变得更好 🙏 + + + 提交的站点,默认为当前页面的地址,可为空 + this.onURLChange(e) } /> + + + 支持两种提交方式 + +
-
第三方适配源
+
第三方适配源
- +
} + { !first && version == "1.1.4" && +
+
+ +

更强大,更易用的导出服务

+
+ 期待已久的 Notion · 有道云笔记 · 为知笔记 · Bear · Ulysses 来啦~
+ 原生的 离线 HTML / Markdown 下载功能,还有截取任意位置的 截图 功能
+ WebDAV 现已定制导出格式,包括: Markdown · HTML +
+
+
} + { (( !first && version == "1.1.3" ) || version == "all" ) &&
diff --git a/src/options/corb.html b/src/options/corb.html new file mode 100644 index 00000000..d70608eb --- /dev/null +++ b/src/options/corb.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/options/corb.js b/src/options/corb.js new file mode 100644 index 00000000..553cce9a --- /dev/null +++ b/src/options/corb.js @@ -0,0 +1,27 @@ + +import axios from 'axios'; + +import {browser} from 'browser'; +import * as msg from 'message'; + +/** + * Listen runtime message, include: `axios` + */ +browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) { + if ( request.type == msg.MESSAGE_ACTION.AXIOS ) { + if ( request.value.type == "post" ) { + if ( request.value.form ) { + request.value.data = new FormData(); + Object.keys( request.value.form ).forEach( key => request.value.data.append( key, request.value.form[key] ) ); + } + axios.post( request.value.url, request.value.data ) + .then( response => sendResponse({ done: response })) + .catch( error => sendResponse({ fail: error })); + } else if ( request.value.type == 'put' ) { + axios.put( request.value.url, request.value.content, request.value.data ) + .then( response => sendResponse({ done: response })) + .catch( error => sendResponse({ fail: error })); + } + } + return true; +}); diff --git a/src/options/custom.html b/src/options/custom.html index 319afafa..e5b8470a 100644 --- a/src/options/custom.html +++ b/src/options/custom.html @@ -82,8 +82,9 @@
- 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2019 ksria.com by Kenshin Wang + 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2020 ksria.com by Kenshin Wang
+ diff --git a/src/options/notice.html b/src/options/notice.html index 7700873e..175f13fc 100644 --- a/src/options/notice.html +++ b/src/options/notice.html @@ -9,8 +9,9 @@
消息中心
- 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2019 ksria.com by Kenshin Wang + 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2020 ksria.com by Kenshin Wang
+ diff --git a/src/options/options.html b/src/options/options.html index 20a8e74e..29e3b8bd 100644 --- a/src/options/options.html +++ b/src/options/options.html @@ -4,17 +4,23 @@ 选项页 - 简悦 SimpRead + +
+
-
- 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2019 ksria.com by Kenshin Wang +
+ 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2020 ksria.com by Kenshin Wang
+ diff --git a/src/options/options.js b/src/options/options.js index 2f4ecf41..1f66be17 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -2,6 +2,7 @@ console.log( "==== simpread options page load ====" ) import '../assets/css/options_page.css'; import '../assets/css/setting.css'; +import 'mduikit_css'; import 'notify_css'; import 'intro_css'; @@ -34,6 +35,7 @@ import About from 'about'; import Unrdist from 'unrdist'; import * as welc from 'welcome'; import * as guide from 'guide'; +import * as fb from 'feedback'; import PureRead from 'puread'; @@ -99,6 +101,7 @@ browser.runtime.onMessage.addListener( function( request, sender, sendResponse ) * @param {number} tab index */ function tabChange( idx ) { + if ( idx == -1 ) return; conf.tabsItem.forEach( ( item, index ) => item.active = idx == index ? true : false ); mainRender( idx ); } @@ -108,19 +111,36 @@ function tabChange( idx ) { */ storage.Read( first => { console.log( "simpread storage get success!", storage.focus, storage.read, first ); + loadingRender(); pRead(); hashnotify(); firstLoad( first ); sidebarRender(); navRender(); vernotify( first ); + //welcomeRender( false, "1.1.4" ); mainRender( tabsItemID ); setTimeout(() => noticeRender(), 500 ); helpRender(); + feedbackRender(); tt.Render( "body" ); waves.Render({ root: "body" }); }); +/** + * Loading Render + */ +function loadingRender() { + setTimeout( () => { + $( '.loadingbar' ).animate({ + opacity: 0, + }, () => { + $( '.loadingbar' ).remove(); + $( ".bottom" ).removeAttr( "style" ); + }); + }, 1000 ); +} + /** * Pure Read */ @@ -136,8 +156,10 @@ function pRead() { function updateData() { ver.Incompatible( storage.version, storage.simpread ) && storage.Write( () => { console.log( "current simpread is update ", storage.simpread ) + new Notify().Render({ type: 2, content: `检测到你曾经修改过第三方适配源,务必刷新后重新导入详细说明`, state: "holdon" }); watch.SendMessage( "option", true ); }, storage.simpread ); + ver.VerifyPlugins( storage.option ) && new Notify().Render({ type: 2, content: `有需要清理的已失效插件,详细请看 失效插件`, state: "holdon" }); } /** @@ -174,9 +196,9 @@ function vernotify( first ) { if ( hash.startsWith( "#firstload?ver=" ) || hash.startsWith( "#update?ver=" ) ) { const prefix = hash.match( /\w+/ )[0], version = hash.match( /[0-9\.]+/ )[0], - msg = ver.Notify( first, prefix, version ); + message = ver.Notify( first, prefix, version ); - new Notify().Render( "简悦 版本提示", msg ); + new Notify().Render( "简悦 版本提示", message ); loadState = { first: true }; if ( hash.startsWith( "#update?ver=" )) { @@ -186,7 +208,7 @@ function vernotify( first ) { updateData(); } // website_sync = true; when version is 1.1.3 website_list is newer - browser.runtime.sendMessage({ type: "track", value: { eventAction: hash.startsWith( "#firstload?ver=" ) ? "install" : "update" , eventCategory: "install", eventLabel: "install && update" } }); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.track, { eventCategory: "install", eventAction: hash.startsWith( "#firstload?ver=" ) ? "install" : "update", eventValue: hash.startsWith( "#firstload?ver=" ) ? "install" : "update" }) ); history.pushState( "", "", "/options/options.html" ); } else if ( hash.startsWith( "#update?patch=" ) ) { const patch = hash.match( /[0-9\.]+/ )[0]; @@ -277,17 +299,17 @@ function tabsRender( color ) {
save(s) } />
-
+
save(s) } />
-
{ return { ...item }} ) } />
+
{ return { ...item }} ) } onLoadMoreClick={ ()=> setTimeout( ()=> tt.Render( "list" ), 200 ) } />
-
welcomeRender(true,"all")}/>
+
welcomeRender(true,"all")}/>
, tabsOnChange = ( $prev, $target, event ) => { const idx = $target.attr( "id" ); @@ -314,6 +336,7 @@ function navRender() { }; const button =
- 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2019 ksria.com by Kenshin Wang + 简悦 SimpRead - 为你提供「如杂志般沉浸式阅读体验」的扩展  © 2017 - 2020 ksria.com by Kenshin Wang
+ diff --git a/src/read/controlbar.jsx b/src/read/controlbar.jsx index 9180e1d1..a2a2cc0b 100644 --- a/src/read/controlbar.jsx +++ b/src/read/controlbar.jsx @@ -109,7 +109,7 @@ export default class ReadCtlbar extends React.Component { break; default: if ( type.indexOf( "_" ) > 0 && type.startsWith( "share" ) || - [ "fullscreen", "save", "markdown", "png", "epub", "pdf", "kindle", "temp", "html", "dropbox", "pocket", "instapaper", "linnk", "yinxiang","evernote", "onenote", "gdrive", "jianguo", "yuque" ].includes( type )) { + [ "fullscreen", "save", "markdown", "offlinemarkdown", "png", "epub", "pdf", "kindle", "temp", "bear", "ulysses", "html", "offlinehtml", "snapshot", "dropbox", "pocket", "instapaper", "linnk", "yinxiang", "evernote", "onenote", "gdrive", "jianguo", "yuque", "notion", "youdao", "weizhi" ].includes( type )) { const [ title, desc, content ] = [ $( "sr-rd-title" ).text().trim(), $( "sr-rd-desc" ).text().trim(), $( "sr-rd-content" ).html().trim() ]; output.Action( type, title, desc, content ); } @@ -159,6 +159,10 @@ export default class ReadCtlbar extends React.Component { if ( this.props.type.startsWith( "metaread::" ) || this.props.type.startsWith( "txtread::" ) ) { delete readItems.option; } + if ( !/macintosh|mac os x/i.test(navigator.userAgent) ) { + delete readItems.send.items.bear; + delete readItems.send.items.ulysses; + } storage.Safe( () => { storage.secret.webdav.forEach( item => { item = JSON.parse( item ); diff --git a/src/read/read.jsx b/src/read/read.jsx index 92c991aa..526d7bee 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -7,6 +7,7 @@ import * as toc from 'toc'; import * as setting from 'setting'; import * as se from 'siteeditor'; import * as kbd from 'keyboard'; +import * as fb from 'feedback'; import { storage, Clone } from 'storage'; import th from 'theme'; @@ -15,6 +16,7 @@ import {browser} from 'browser'; import * as msg from 'message'; import * as highlight from 'highlight'; import * as run from 'runtime'; +import * as tips from 'tips'; import * as tooltip from 'tooltip'; import * as waves from 'waves'; @@ -31,12 +33,10 @@ let load_count = 0; const Footer = () => { const good_icon = '', bad_icon = '', - onClick = () => { - browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings: { url: storage.service + "/sites/service/pending", type: "POST", data:{url: location.href, site: storage.pr.current.site, uid: storage.user.uid, type: "failed"} }}), result => { - console.log( 'Add stat sites', result ) - }); - browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: "https://wj.qq.com/s2/3611463/7260/" })); - }; + onClick = ( rate = false ) => { + fb.Render( storage.version, storage.user, rate ); + setTimeout( () => tooltip.Render( ".simpread-feedback" ), 200 ); + }; return ( @@ -48,8 +48,8 @@ const Footer = () => {
本文由 简悦 SimpRead 优化,用以提升阅读体验
使用了 全新的简悦词法分析引擎beta点击查看详细说明
@@ -104,9 +104,9 @@ class Read extends React.Component { $( "body" ).addClass( "simpread-hidden" ); th.Change( this.props.read.theme ); if ( storage.current.fap ) { - $( "head" ).append( '' ); - $( "head" ).append( '' ); - $( "head" ).append( '' ); + $( "head" ).append( '' ); + $( "head" ).append( '' ); + $( "head" ).append( '' ); } } @@ -141,6 +141,7 @@ class Read extends React.Component { tooltip.Render( rdclsjq ); waves.Render({ root: rdclsjq }); storage.Statistics( "read" ); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.track, { eventCategory: "mode", eventAction: "readmode", eventValue: "readmode" }) ); !this.props.wrapper.avatar && this.props.read.toc && toc.Render( "sr-read", $( "sr-rd-content" ), this.props.read.theme, this.props.read.toc_hide ); @@ -151,6 +152,8 @@ class Read extends React.Component { setTimeout( ()=>{ this.verifyContent(); + tips.Render( storage.option.plugins ); + tips.Help( storage.statistics ); }, 50 ); } diff --git a/src/service/config.js b/src/service/config.js index 8dcbf47e..d4329f14 100644 --- a/src/service/config.js +++ b/src/service/config.js @@ -9,6 +9,11 @@ const keyboard = { "type" : "markdown", "desc" : "导出为 Markdown", }, + om: { + "kbd" : "om", + "type" : "offlinemarkdown", + "desc" : "导出为 离线 Markdown", + }, pg: { "kbd" : "pg", "type" : "png", @@ -28,7 +33,22 @@ const keyboard = { "kbd" : "hm", "type" : "html", "desc" : "导出为 HTML", - } + }, + oh: { + "kbd" : "oh", + "type" : "offlinehtml", + "desc" : "导出为 离线 HTML", + }, + tm: { + "kbd" : "tm", + "type" : "temp", + "desc" : "导出为 临时页面", + }, + cp: { + "kbd" : "cp", + "type" : "snapshot", + "desc" : "截图", + }, }, "控制栏 - 其它" : { ff: { @@ -93,6 +113,11 @@ const keyboard = { "type" : "yuque", "desc" : "保存到 语雀", }, + wz: { + "kbd" : "wz", + "type" : "weizhi", + "desc" : "保存到 为知笔记", + }, kd: { "kbd" : "kd", "type" : "kindle", @@ -118,10 +143,15 @@ const keyboard = { "type" : "save", "desc" : "保存到 稍后读", }, - tm: { - "kbd" : "tm", - "type" : "temp", - "desc" : "生成临时页面", + br: { + "kbd" : "br", + "type" : "bear", + "desc" : "保存到 Bear", + }, + ul: { + "kbd" : "ul", + "type" : "ulysses", + "desc" : "保存到 Ulysses", }, }, "控制栏 - 无障碍" : { @@ -286,11 +316,26 @@ const readItems = { "icon" : ss.IconPath("markdown_icon"), "color": "#D4237A", }, + "offlinemarkdown" : { + "name" : "导出为 离线 MD", + "icon" : ss.IconPath("offline_markdown_icon"), + "color": "#D4237A", + }, "html" : { "name" : "导出为 HTML", "icon" : ss.IconPath("html_icon"), "color": "#D4237A", }, + "offlinehtml" : { + "name" : "导出为 离线 HTML", + "icon" : ss.IconPath("offline_html_icon"), + "color": "#D4237A", + }, + "snapshot" : { + "name" : "截图", + "icon" : ss.IconPath("snapshot_icon"), + "color": "#D4237A", + }, }, }, "send" : { @@ -333,6 +378,21 @@ const readItems = { "icon" : ss.IconPath("yuque_icon"), "color": "#00BCD4", }, + "notion" : { + "name" : "保存到 Notion", + "icon" : ss.IconPath("notion_icon"), + "color": "#00BCD4", + }, + "youdao" : { + "name" : "保存到 有道云笔记", + "icon" : ss.IconPath("youdao_icon"), + "color": "#00BCD4", + }, + "weizhi" : { + "name" : "保存到 为知笔记", + "icon" : ss.IconPath("wiz_icon"), + "color": "#00BCD4", + }, "kindle" : { "name" : "保存到 Kindle", "icon" : ss.IconPath("kindle_icon"), @@ -343,6 +403,16 @@ const readItems = { "icon" : ss.IconPath("temp_icon"), "color": "#00BCD4", }, + "bear" : { + "name" : "保存到 Bear", + "icon" : ss.IconPath("bear_icon"), + "color": "#00BCD4", + }, + "ulysses" : { + "name" : "保存到 Ulysses", + "icon" : ss.IconPath("ulysses_icon"), + "color": "#00BCD4", + }, }, }, "dyslexia" : { @@ -586,6 +656,9 @@ const focusItems = ( items => { dels.forEach( del => delete news[ del ] ); delete news.option.items.fullscreen; delete news.option.items.tempread; + delete news.download.items.snapshot; + delete news.download.items.offlinehtml; + delete news.download.items.offlinemarkdown; news.top = { "name" : "返回顶部", "icon" : ss.IconPath("top_icon"), @@ -653,28 +726,28 @@ const tabsItem = [{ switch ( idx ) { case 0: delete menu.active; - menu.icon = ss.IconPath( "common_icon" ); + menu.fontIcon = ''; break; case 1: - menu.icon = ss.IconPath( "focus_mode_icon" ); + menu.fontIcon = ''; break; case 2: - menu.icon = ss.IconPath( "read_mode_icon" ); + menu.fontIcon = ''; break; case 3: - menu.icon = ss.IconPath( "labs_icon" ); + menu.fontIcon = ''; break; case 4: - menu.icon = ss.IconPath( "plugins_icon" ); + menu.fontIcon = ''; break; case 5: - menu.icon = ss.IconPath( "read_later_icon" ); + menu.fontIcon = ''; break; case 6: - menu.icon = ss.IconPath( "about_icon" ); + menu.fontIcon = ''; break; case 7: - menu.icon = ss.IconPath( "help_icon" ); + menu.fontIcon = ''; break; } return menu; diff --git a/src/service/export.js b/src/service/export.js index cd3ff5e0..0f731152 100644 --- a/src/service/export.js +++ b/src/service/export.js @@ -10,6 +10,7 @@ import Instapaper from 'instapaper'; import * as msg from 'message'; import {browser} from 'browser'; import * as puplugin from 'puplugin'; +import * as wiz from 'wiz'; /** * Create PNG @@ -130,6 +131,9 @@ function unlink( id ) { "onenote" : "https://account.live.com/consent/Manage", "gdrive" : "https://drive.google.com/drive/my-drive", "yuque" : "https://www.yuque.com/yuque/developer/delete-oauth-apps", + "notion" : "http://ksria.com/simpread/docs/#/授权服务?id=取消授权", + "youdao" : "http://ksria.com/simpread/docs/#/授权服务?id=取消授权", + "weizhi" : "http://ksria.com/simpread/docs/#/授权服务?id=取消授权", "jianguo" : "http://help.jianguoyun.com/?p=2064", "linnk" : "https://linnk.net/", } @@ -399,12 +403,10 @@ class Ins { this.ins.token_secret = this.token_secret; this.ins.consumer_key = this.consumer_key; this.ins.consumer_secret = this.consumer_secret; - this.ins.add( url, title, description ).done( result => { - if ( result && result.length > 0 ) callback( "success", undefined ); - else callback( undefined, "error" ); - }).fail( ( jqXHR, textStatus, error ) => { - console.error( jqXHR, textStatus, error ) - callback( undefined, textStatus ); + const settings = this.ins.add( url, title, description ); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings } ), result => { + if ( result.done ) { callback( "success", undefined ); } + else callback( undefined, result.fail ); }); } } @@ -463,33 +465,36 @@ class Linnk { targetURL: url, title, tagsStr : this.tags, - }; - - $.ajax({ + }, + settings = { url : "https://linnk.net/a/api/bookmark/new", type : "POST", headers : { Authorization: this.access_token }, data, - }).done( ( result, textStatus, jqXHR ) => { - const data = JSON.parse(result); - if ( data && data.code == 200 ) callback( "success", undefined ); - else callback( undefined, "error" ); - }).fail( ( jqXHR, textStatus, error ) => { - console.error( jqXHR, textStatus, error ) - callback( undefined, textStatus ); + }; + + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings } ), result => { + if ( result.done ) { + const data = JSON.parse( result.done ); + if ( data && data.code == 200 ) callback( "success", undefined ); + else callback( undefined, "error" ); + } else callback( undefined, result.fail ); }); } Groups( callback ) { - $.ajax({ + const settings = { url : "https://linnk.net/a/api/group/my", type : "GET", headers : { Authorization: this.access_token }, - }).done( ( result, textStatus, jqXHR ) => { - callback( JSON.parse(result), undefined ); - }).fail( ( jqXHR, textStatus, error ) => { - console.error( jqXHR, textStatus, error ) - callback( undefined, textStatus ); + }; + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings } ), result => { + if ( result.done ) { + const data = JSON.parse( result.done ); + if ( data.code != 200 ) { + callback( undefined, this.error_code[ data.code ] ); + } else callback( data, undefined ); + } else callback( undefined, "error" ); }); } @@ -500,27 +505,27 @@ class Linnk { } NewGroup( name, callback ) { - $.ajax({ + const settings = { url : "https://linnk.net/a/api/group/new", type : "POST", headers : { Authorization: this.access_token }, data : { groupName: name }, - }).done( ( result, textStatus, jqXHR ) => { - callback( JSON.parse(result), undefined ); - }).fail( ( jqXHR, textStatus, error ) => { - console.error( jqXHR, textStatus, error ) - callback( undefined, textStatus ); + }; + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings } ), result => { + if ( result.done ) { + callback( JSON.parse( result.done ), undefined ); + } else callback( undefined, result.fail ); }); } GetSafeGroup( name, callback ) { - this.Groups( result => { + this.Groups( ( result, error ) => { if ( result && result.code == 200 ) { const group = this.GetGroup( name, result.data ); !group && this.NewGroup( name, callback ); group && callback({ data: group, code: 200 }, undefined ); } else { - callback( undefined, "error" ); + callback( undefined, error == "error" ? "error" : error ); } }) } @@ -1229,6 +1234,366 @@ class Yuque { } } +/** + * Notion + * + * @class + */ +class Notion { + + get id() { return "notion"; } + get name() { return name( this.id ); } + + get url() { + return "https://www.notion.so/"; + } + + UUID() { + var __extends=void 0&&(void 0).__extends||function(){var _extendStatics=function extendStatics(d,b){_extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return _extendStatics(d,b)};return function(d,b){_extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __())}}();var ValueUUID=function(){function ValueUUID(_value){this._value=_value;this._value=_value}ValueUUID.prototype.asHex=function(){return this._value};return ValueUUID}();var V4UUID=function(_super){__extends(V4UUID,_super);function V4UUID(){return _super.call(this,[V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-','4',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._oneOf(V4UUID._timeHighBits),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex()].join(''))||this}V4UUID._oneOf=function(array){return array[Math.floor(array.length*Math.random())]};V4UUID._randomHex=function(){return V4UUID._oneOf(V4UUID._chars)};V4UUID._chars=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];V4UUID._timeHighBits=['8','9','a','b'];return V4UUID}(ValueUUID);function generateUuid(){return new V4UUID().asHex()} + return generateUuid(); + } + + Auth( callback ) { + $.ajax({ + url : this.url + "api/v3/loadUserContent", + type : "POST", + }).done( ( result, status, xhr ) => { + if ( result && status == "success" ) { + this.access_token = Object.values( result.recordMap.notion_user )[0].value.id; + this.folder_id = Object.values( result.recordMap.block )[0].value.id; + this.blocks = Object.values( result.recordMap.block ).map( item => { + return { name: item.value.properties ? item.value.properties.title[0][0] : "Undefined", value: item.value.id } + }); + callback( result, undefined ); + } + }).fail( ( xhr, status, error ) => { + console.error( error, status, xhr ) + callback( undefined, xhr.status == 401 ? `请先 登录 Notion ` : "请稍后再试" ); + }); + } + + Add( title, content, callback ) { + this.TempFile( this.folder_id, title, ( documentId, error ) => { + console.log( 'TempFile: ', documentId ) + if ( error ) { + callback( undefined, error ); + } else this.GetFileUrl( `${title}.md`, urls => { + console.log( 'GetFileUrl: ', urls ) + this.WriteFile( urls.signedPutUrl, content, result => { + console.log( 'WriteFile: ', result ) + this.ImportFile( urls.url, `${title}.md`, documentId, result => { + console.log( 'ImportFile: ', result ) + result.done && callback( result, undefined ); + result.fail && callback( undefined, "error" ); + }); + }); + }); + }); + } + + TempFile( parentId, title, callback ) { + const documentId = this.UUID(), + userId = this.access_token, + time = new Date().getDate(), + operations = { + operations: [ + { + id: documentId, + table: 'block', + path: [], + command: 'set', + args: { + type: 'page', + id: documentId, + version: 1, + }, + }, + { + id: documentId, + table: 'block', + path: [], + command: 'update', + args: { + parent_id: parentId, + parent_table: 'block', + alive: true, + }, + }, + { + table: 'block', + id: parentId, + path: ['content'], + command: 'listAfter', + args: { id: documentId }, + }, + { + id: documentId, + table: 'block', + path: [], + command: 'update', + args: { + created_by: userId, + created_time: time, + last_edited_time: time, + last_edited_by: userId, + }, + }, + { + id: parentId, + table: 'block', + path: [], + command: 'update', + args: { last_edited_time: time }, + }, + { + id: documentId, + table: 'block', + path: ['properties', 'title'], + command: 'set', + args: [[title]], + }, + { + id: documentId, + table: 'block', + path: [], + command: 'update', + args: { last_edited_time: time }, + }, + ], + }; + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.AXIOS, { + type: "post", + url: this.url + "api/v3/submitTransaction", + data: operations + }), result => { + result.done && callback( documentId, undefined ); + result.fail && callback( undefined, result.fail.message.includes( '401' ) ? `授权已过期,请重新授权。` : "请稍后再试" ); + }); + } + + GetFileUrl( name, callback ) { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.AXIOS, { + type: "post", + url: this.url + "api/v3/getUploadFileUrl", + data:{ + bucket: 'temporary', + name: name, + contentType: 'text/markdown', + } + }), result => { + if ( result && result.done ) { + callback( result.done.data ); + } + }); + } + + WriteFile( url, content, callback ) { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.AXIOS, { + type: "put", + url, + content, + data: { + headers: { + 'Content-Type': 'text/markdown' + } + } + }), result => { + if ( result && result.done ) { + callback( result.done ); + } + }); + } + + ImportFile( url, name, documentId, callback ) { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.AXIOS, { + type: "post", + url: this.url + "api/v3/enqueueTask", + data: { + task: { + eventName: 'importFile', + request: { + fileURL: url, + fileName: name, + importType: 'ReplaceBlock', + pageId: documentId, + }, + } + } + }), result => callback( result )); + } + +} + +/** + * Youdao + * + * @class + */ +class Youdao { + + get id() { return "youdao"; } + get name() { return name( this.id ); } + + get url() { + return "https://note.youdao.com"; + } + + get permissions() { + return { + permissions: [ 'cookies' ], + origins: [ 'https://*.youdao.com/' ] + }; + } + + UUID() { + var __extends=void 0&&(void 0).__extends||function(){var _extendStatics=function extendStatics(d,b){_extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return _extendStatics(d,b)};return function(d,b){_extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __())}}();var ValueUUID=function(){function ValueUUID(_value){this._value=_value;this._value=_value}ValueUUID.prototype.asHex=function(){return this._value};return ValueUUID}();var V4UUID=function(_super){__extends(V4UUID,_super);function V4UUID(){return _super.call(this,[V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-','4',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._oneOf(V4UUID._timeHighBits),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),'-',V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex(),V4UUID._randomHex()].join(''))||this}V4UUID._oneOf=function(array){return array[Math.floor(array.length*Math.random())]};V4UUID._randomHex=function(){return V4UUID._oneOf(V4UUID._chars)};V4UUID._chars=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];V4UUID._timeHighBits=['8','9','a','b'];return V4UUID}(ValueUUID);function generateUuid(){return new V4UUID().asHex()} + return generateUuid(); + } + + Cookies( callback ) { + browser.cookies.get({ + url: this.url, + name: 'YNOTE_CSTK', + }, cookie => { + callback( cookie ); + }) + } + + Auth( callback ) { + this.Cookies( token => { + if ( !token ) { + callback( undefined, `请先 登录有道云笔记 ` ); + return; + } + this.access_token = token.value; + const formData = new FormData(); + formData.append( 'path', '/' ); + formData.append( 'dirOnly', 'true' ); + formData.append( 'f', 'true'); + formData.append( 'cstk', this.access_token ); + $.ajax({ + url : this.url + `/yws/api/personal/file?method=listEntireByParentPath&keyfrom=web&cstk=${this.access_token}`, + type : "POST", + contentType: false, + processData: false, + data : formData + }).done( ( result, status, xhr ) => { + if ( result && result.length > 0 ) { + this.folder_id = result[0].fileEntry.id; + this.folders = result.map( item => { + return { name: item.fileEntry.name, value: item.fileEntry.id }; + }); + callback( result, undefined ); + } + }).fail( ( xhr, status, error ) => { + console.error( error, status, xhr ) + callback( undefined, xhr.status == 500 ? `请先 登录有道云笔记 ` : "请稍后再试" ); + }); + }); + } + + Add( title, content, callback ) { + const timestamp = String( Math.floor( Date.now() / 1000 )), + uuid = this.UUID().replace( /-/g, '' ), + fileId = `WEB${uuid}`; + let formData = {}; + formData[ 'fileId' ] = fileId; + formData[ 'parentId' ] = this.folder_id; + formData[ 'name' ] = `${title}.md`; + formData[ 'domain' ] = `1`; + formData[ 'rootVersion' ] = `-1`; + formData[ 'dir' ] = `false`; + formData[ 'sessionId' ] = ''; + formData[ 'createTime' ] = timestamp; + formData[ 'modifyTime' ] = timestamp; + formData[ 'transactionId' ] = fileId; + formData[ 'bodyString' ] = content; + formData[ 'transactionTime' ] = timestamp; + formData[ 'cstk' ] = this.access_token; + + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.AXIOS, { + type: "post", + url : this.url + `/yws/api/personal/sync?method=push&keyfrom=web&cstk=${this.access_token}`, + form: formData, + }), result => { + if ( result.fail ) callback( undefined, result.fail.message.includes( '500' ) ? `授权已过期,请重新授权。` : "请稍后再试" ); + else callback( result, undefined ); + }); + } + +} + +/** + * Wiz + * + * @class + */ +class Wiz { + + get id() { return "weizhi"; } + get name() { return name( this.id ); } + + get tag() { + return "SimpRead"; + } + + get category() { + return "/My Notes/"; + } + + Auth( user, password, callback ) { + const data = { + userId : user, + password : password, + autoLogin: true, + }; + + $.ajax({ + url : "https://note.wiz.cn/as/user/login?clientType=webclip_chrome&clientVersion=4.0.10&apiVersion=10&lang=zh-CN", + type : "POST", + dataType: "JSON", + contentType: "application/json; charset=utf-8", + data : JSON.stringify(data), + }).done( ( result, textStatus, jqXHR ) => { + result && result.returnCode == 200 && ( this.access_token = result.result.userGuid ); + callback( result, undefined ); + }).fail( ( jqXHR, textStatus, error ) => { + console.error( jqXHR, textStatus, error ) + callback( undefined, textStatus ); + }); + } + + Add( url, title, content, callback ) { + const info = { + title, + url, + category: this.category, + cmd : "save_content", + comment : "", + tag : this.tag, + userid : this.username, + params : wiz.getParams( url, title, content ), + }; + let data = wiz.getInfos( info, this.access_token ); + data = JSON.stringify( data ); + const options = { + url : "https://kshttps0.wiz.cn/ks/gather?clientType=webclip_chrome&clientVersion=4.0.10&apiVersion=10&lang=zh-CN", + type : "POST", + dataType: "JSON", + contentType: "application/json; charset=utf-8", + async: true, + cache: false, + data, + }; + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings: options }), result => { + if ( result && result.done && result.done.return_code == 200 ) callback( result, undefined ); + else if ( result && result.done ) callback( undefined, result.done.return_code == 301 ? `授权已过期,请重新授权。` : "请稍后再试" ); + else callback( undefined, result.fail ); + }); + } + +} + /** * Kindle * @@ -1246,7 +1611,7 @@ class Kindle { } get server() { - return "http://fivefilters.org/kindle-it/send.php"; + return "https://pushtokindle.fivefilters.org/send.php"; } Read( url, title, desc, content, style, callback ) { @@ -1292,7 +1657,7 @@ class Kindle { */ function name( type ) { type = type.toLowerCase(); - if ( [ "dropbox", "pocket", "instapaper", "linnk" , "evernote", "onenote" ].includes( type ) ) { + if ( [ "dropbox", "pocket", "instapaper", "linnk" , "evernote", "onenote", "notion" ].includes( type ) ) { return type.replace( /\S/i, $0=>$0.toUpperCase() ); } else if ( type == "yinxiang" ) { return "印象笔记"; @@ -1302,6 +1667,10 @@ function name( type ) { return "坚果云"; } else if ( type == "yuque" ) { return "语雀"; + } else if ( type == "youdao" ) { + return "有道云笔记"; + } else if ( type == "weizhi" ) { + return "为知笔记"; } return type; } @@ -1376,7 +1745,7 @@ function verifyService( storage, service, type, name, notify, auto = true ) { dtd.resolve( type ); } else { auto ? notify.Render( `请先获取 ${name} 的授权,才能使用此功能!`, "授权", ()=>{ - notify.Clone().Render( type == "linnk" ? "Linnk 无法自动授权 3 秒后请自行授权。" : "3 秒钟后将会自动重新授权,请勿关闭此页面..." ); + notify.Clone().Render( [ "linnk", "jianguo", "youdao", "weizhi" ].includes( type ) ? `${name} 无法自动授权 3 秒后请自行授权。` : "3 秒钟后将会自动重新授权,请勿关闭此页面..." ); setTimeout( ()=>browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.auth, { name: type } )), 3000 ); }) : notify.Render( `请先获取 ${name} 的授权,才能使用此功能!` ); dtd.reject( type ); @@ -1394,7 +1763,10 @@ const dropbox = new Dropbox(), gdrive = new GDrive(), yuque = new Yuque(), jianguo = new Jianguo(), + notion = new Notion(), + youdao = new Youdao(), webdav = new WebDAV(), + weizhi = new Wiz(), kindle = new Kindle(); export { @@ -1407,9 +1779,9 @@ export { md2HTML as MD2HTML, unlink as Unlink, name as Name, - dropbox, pocket, instapaper, linnk, evernote, onenote, gdrive,yuque, jianguo, webdav, + dropbox, pocket, instapaper, linnk, evernote, onenote, gdrive,yuque, jianguo, webdav, notion, youdao, weizhi, kindle, mdWrapper as MDWrapper, serviceCallback as svcCbWrapper, verifyService as VerifySvcWrapper, -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/service/menu.js b/src/service/menu.js index a83efc51..881781ca 100644 --- a/src/service/menu.js +++ b/src/service/menu.js @@ -16,6 +16,7 @@ const context = { exclusion : { id: "", menu: {} }, blacklist : { id: "", menu: {} }, unrdist : { id: "", menu: {} }, + lazyload : { id: "", menu: {} }, }, menu = { "type" : "normal", @@ -23,14 +24,17 @@ const context = { "documentUrlPatterns" : [ "http://*/*" , "https://*/*" ] }; -Object.assign( context.focus.menu, menu, { id: "focus", "title" : "聚焦模式" }); -Object.assign( context.read.menu, menu, { id: "read", "title" : "阅读模式" }); -Object.assign( context.list.menu, menu, { id: "list", "title" : "打开稍后读" }); -Object.assign( context.link.menu, menu, { id: "link", "title" : "使用阅读模式打开此链接", contexts: [ "link" ] }); +Object.assign( context.focus.menu, menu, { id: "focus", "title" : "聚焦模式" }); +Object.assign( context.read.menu, menu, { id: "read", "title" : "阅读模式" }); +Object.assign( context.link.menu, menu, { id: "link", "title" : "使用阅读模式打开此链接", contexts: [ "link" ] }); + +Object.assign( context.list.menu, menu, { id: "list", "title" : "打开稍后读" }); +Object.assign( context.unrdist.menu, menu, { id: "unrdist", "title" : "将当前页面加入稍后读" }); + Object.assign( context.whitelist.menu, menu, { id: "whitelist", "title" : "将当前页面加入到白名单" }); Object.assign( context.exclusion.menu, menu, { id: "exclusion", "title" : "将当前页面加入到排除列表" }); Object.assign( context.blacklist.menu, menu, { id: "blacklist", "title" : "将当前页面加入到黑名单" }); -Object.assign( context.unrdist.menu, menu, { id: "unrdist", "title" : "将当前页面加入稍后读" }); +Object.assign( context.lazyload.menu, menu, { id: "lazyload", "title" : "将当前页面加入到延迟加载" }); /** * Listen contextMenus message @@ -43,6 +47,8 @@ function onClicked( callback ) { * Create all context menu */ function createAll() { + browser.contextMenus.create({ "type": "separator" }); + storage.option.menu.focus && ( context.focus.id = browser.contextMenus.create( context.focus.menu )); @@ -52,9 +58,18 @@ function createAll() { storage.option.menu.link && ( context.link.id = browser.contextMenus.create( context.link.menu )); + browser.contextMenus.create({ "type": "separator" }); + browser.contextMenus.create({ "type": "separator" }); + storage.option.menu.list && ( context.list.id = browser.contextMenus.create( context.list.menu )); + storage.option.menu.unrdist && + ( context.unrdist.id = browser.contextMenus.create( context.unrdist.menu )); + + browser.contextMenus.create({ "type": "separator" }); + browser.contextMenus.create({ "type": "separator" }); + storage.option.menu.whitelist && ( context.whitelist.id = browser.contextMenus.create( context.whitelist.menu )); @@ -64,8 +79,10 @@ function createAll() { storage.option.menu.blacklist && ( context.blacklist.id = browser.contextMenus.create( context.blacklist.menu )); - storage.option.menu.unrdist && - ( context.unrdist.id = browser.contextMenus.create( context.unrdist.menu )); + storage.option.menu.lazyload && + ( context.lazyload.id = browser.contextMenus.create( context.lazyload.menu )); + + browser.contextMenus.create({ "type": "separator" }); } /** diff --git a/src/service/message.js b/src/service/message.js index 86017ec8..57f81c72 100644 --- a/src/service/message.js +++ b/src/service/message.js @@ -9,10 +9,12 @@ const action = { tab_selected : "tab_selected", new_tab : "new_tab", close_tab : "close_tab", + // menu menu : "menu", menu_whitelist : "menu_whitelist", menu_exclusion : "menu_exclusion", menu_blacklist : "menu_blacklist", + menu_lazyload : "menu_lazyload", menu_unrdist : "menu_unrdist", updated : "updated", save_verify : "save_verify", @@ -34,13 +36,23 @@ const action = { temp_site : "temp_site", // corb CORB : "corb", + AXIOS : "axios", // webdav jianguo : "jianguo", WebDAV : "webdav", // event turn_tab : "turn_tab", welcome_close : "welcome_close", - "controlbar" : "simpread-plugin_controlbar", + controlbar : "simpread-plugin_controlbar", + // offline + download : "download", + base64 : "base64", + permission : "permission", + // snapshot + snapshot : "snapshot", + // tips + tips : "tips", + tips_norepeat : "tips_norepeat", }; /** diff --git a/src/service/offline.js b/src/service/offline.js new file mode 100644 index 00000000..88e04307 --- /dev/null +++ b/src/service/offline.js @@ -0,0 +1,204 @@ +console.log( "=== simpread offline load ===" ) + +import {browser} from 'browser'; +import * as msg from 'message'; + +let currIdx = 0, maxCount = 0, urls = [], images, cb, type = "html", markdown; + +/** + * Offline HTML + * + * @param {string} title + * @param {string} desc + * @param {string} content + * @param {object} styles, include: simpread(global), common, theme, css + * + * @return {string} html + */ +function HTML( title, desc, content, styles ) { + const hightlight = () => { + if ( content.search( 'pre class="hljs' ) > -1 || content.search( 'code class="hljs' ) > -1 ) { + return `` + } else return ''; + }, + html = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + ${hightlight()} + 简悦 | ${title} + + + + ${title} + ${desc} + ${content} + + + + 全文完 + + + +
本文由 简悦 SimpRead 转码,用以提升阅读体验,原文地址
+
+
+
+ + `; + return html; +} + +/** + * Markdown offline e.g. ![img](http://xxx.png) → ![img][id] ... [id]:base54 + * + * @param {string} markdown str + * @param {func} callback + */ +function Markdown( content, callback ) { + type = "markdown"; + cb = callback; + markdown = content; + images = new Map(); + const arr = markdown.match( /!\[\]\(http\S+\)/ig ); + if ( arr && arr.length > 0 ) { + arr.forEach( ( item, idx ) => { + markdown = markdown.replace( item, `![][img-${idx}]` ); + item = item.replace( /[!\[\]\(]|[\)]/ig, "" ); + markdown = markdown + `\r\n\r\n` + `[img-${idx}]:${item}`; + images.set( item, `[img-${idx}]:${item}` ); + }); + urls = [...images.keys()]; + maxCount = urls.length; + currIdx = 0; + serialConvert( urls[0] ); + } else cb( markdown ); +} + +/** + * Get current page( readmode ) all images and convert to base64 + * + * @param {func} callback + */ +function getImages( callback ) { + type = "html"; + cb = callback; + images = new Map(); + $( "sr-rd-content" ).find( "img" ).map( ( idx, img ) => { + if ( !images.has( img.src ) ) { + images.set( img.src, img ); + } else { + //TO-DO + } + }); + urls = [...images.keys()]; + maxCount = urls.length; + currIdx = 0; + serialConvert( urls[0] ); +} + +/** + * Convert url to base64 + * + * @param {string} url + */ +function serialConvert( url ) { + // call contentscriptsa + //toBase64( url, result => { + // call background + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.base64, { url }), result => { + currIdx++; + if ( result && result.done ) { + setBase64( result.done.url, result.done.uri ); + } else { + // TO-DO + } + if ( currIdx < maxCount ) { + serialConvert( urls[currIdx] ); + } else { + console.log( "All images convert done" ) + cb && cb( markdown ); + } + }); +} + +/** + * Change img.src to base64 + * + * @param {string} url + * @param {string} uri + */ +function setBase64( url, uri ) { + const img = images.get( url ); + if ( type == "html" ) { + $(img).attr( "src", uri ).attr( "sr-org-src", url ); + } else { + const str = img.replace( url, uri ) + markdown = markdown.replace( img, str ); + } +} + +/** + * toBase64 usage FileReader + * + * @param {string} url + * @param {func} callback + */ +function toBase64( url, callback ) { + fetch( url ) + .then( response => response.blob() ) + .then( blob => new Promise(( resolve, reject ) => { + const reader = new FileReader() + reader.onloadend = event => { + callback({ done: { url, uri: event.target.result }}); + }; + reader.onerror = error => { + callback({ fail: { error, url } }); + }; + reader.readAsDataURL( blob ); + })) + .catch( error => { + callback({ fail: { error, url } }); + }); +} + +/** + * Restore base64 to url + */ +function restoreImg() { + $( "sr-rd-content" ).find( "img" ).map( ( idx, img ) => { + const src = $(img).attr( "sr-org-src" ); + $(img).attr( "src", src ).removeAttr( "sr-org-src" ); + }); +} + +export { + HTML, + Markdown, + getImages, + toBase64, + restoreImg, +} \ No newline at end of file diff --git a/src/service/output.js b/src/service/output.js index 39c167fe..80d104d2 100644 --- a/src/service/output.js +++ b/src/service/output.js @@ -7,6 +7,10 @@ import {browser} from 'browser'; import * as msg from 'message'; import * as highlight from 'highlight'; import * as share from 'sharecard'; +import * as offline from 'offline'; +import th from 'theme'; +import * as ss from 'stylesheet'; +import * as snap from 'snapshot'; /** * Controlbar common action, include: @@ -24,6 +28,21 @@ function action( type, title, desc, content ) { console.log( "output: Action is ", type ) + const styles = callback => { + ss.SpecialCSS( storage.pr.mathjax, special => { + th.GetAll(); + const theme = th.Get( storage.read.theme ), + global = th.Get( "global" ), + common = th.Get( "common" ), + mobile = th.Get( "mobile" ), + css = ss.GetCustomCSS(); + callback({ theme, global, common, css, mobile, special }); + }); + }, + toMarkdown = callback => { + exp.MDWrapper( util.ClearMD( content ), undefined, new Notify() ).done( result => callback( result )); + }; + if ( type.indexOf( "_" ) > 0 && type.startsWith( "share" ) ) { let url = ""; switch ( type.split("_")[1] ) { @@ -51,12 +70,13 @@ function action( type, title, desc, content ) { break; } type.split("_")[1] != "card" && browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url })); - } else if ( [ "save", "markdown", "png", "kindle", "pdf", "epub", "temp", "html" ].includes( type ) ) { + } else if ( [ "save", "markdown", "offlinemarkdown", "png", "kindle", "pdf", "epub", "temp", "html", "offlinehtml", "snapshot", "bear", "ulysses" ].includes( type ) ) { storage.Statistics( "service", type ); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.track, { eventCategory: "service", eventAction: "service", eventValue: type }) ); switch ( type ) { case "save": const url = window.location.href.replace( /(\?|&)simpread_mode=read/, "" ); - storage.UnRead( "add", { url, title, desc }, success => { + storage.UnRead( "add", util.GetPageInfo(), success => { success && new Notify().Render( 0, "成功加入未读列表。" ); !success && new Notify().Render( 0, "已加入未读列表,请勿重新加入。" ); }); @@ -66,6 +86,26 @@ function action( type, title, desc, content ) { storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); exp.MDWrapper( util.ClearMD( content ), md, new Notify() ); break; + case "offlinemarkdown": + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.permission ), result => { + if ( !result.done ) { + new Notify().Render( 2, `离线下载的文件体积较大,所以需要使用 Chrome 下载方案,请授权。` ); + return; + } else { + const notify2 = new Notify().Render({ content: "图片转换中吗,请稍等...", state: "loading" }); + const md = "simpread-" + title + ".md"; + storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); + toMarkdown( result => { + offline.Markdown( result, str => { + notify2.complete(); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.download, { data: str, name: md }), result => { + console.log( "Current download result: ", result ) + }); + }); + }); + } + }); + break; case "png": try { new Notify().Render( "下载已开始,请稍等..." ); @@ -88,7 +128,59 @@ function action( type, title, desc, content ) { !success && new Notify().Render( 2, `转换失败,这是一个实验性功能,不一定能导出成功,详细请看 epub.press` ); }); break; + case "offlinehtml": + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.permission ), result => { + if ( !result.done ) { + new Notify().Render( 2, `离线下载的文件体积较大,所以需要使用 Chrome 下载方案,请授权。` ); + return; + } else { + const notify2 = new Notify().Render({ content: "图片转换中吗,请稍等...", state: "loading" }); + offline.getImages( () => { + notify2.complete(); + new Notify().Render( 0, "全部图片已经转换完毕,马上开始下载,请稍等。" ); + styles( csses => { + const html = offline.HTML( title, desc, $( "sr-rd-content" ).html(), csses ); + offline.restoreImg(); + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.download, { data: html, name: `simpread-${title}.html` }), result => { + console.log( "Current download result: ", result ) + }); + }); + }); + } + }); + break; case "html": + styles( csses => { + const html = offline.HTML( title, desc, content, csses ); + exp.Download( "data:text/plain;charset=utf-8," + encodeURIComponent(html), `simpread-${title}.html` ); + }); + break; + case "snapshot": + new Notify().Render( "请移动鼠标,按住鼠标左键框选,框选后可再次框选。" ); + $("panel-bg").click(); + setTimeout( () => { + snap.Start().done( result => { + snap.End(); + setTimeout(() => { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.snapshot, result ), result => { + exp.Download( result.done, `simpread-${title}.png` ); + }); + }, 100 ); + }); + }, 500 ); + break; + case "bear": + storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); + toMarkdown( result => { + location.href = `bear://x-callback-url/create?title=${title}&text=${encodeURIComponent(result)}&tags=simpread`; + }); + break; + case "ulysses": + storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); + toMarkdown( result => { + location.href = `ulysses://x-callback-url/new-sheet?text=${encodeURIComponent(result)}`; + }); + break; case "temp": case "kindle": const notify = new Notify().Render({ state: "loading", content: "开始转码阅读模式并上传到服务器,请稍后。" }); @@ -113,15 +205,6 @@ function action( type, title, desc, content ) { new Notify().Render( "保存成功,3 秒钟后将跳转到临时页面。" ); setTimeout( ()=>{ exp.kindle.Temp(); }, 3000 ); break; - case "html": - new Notify().Render( "保存成功,开始下载..." ); - browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.CORB, { settings: { url: `${exp.kindle.host}/${exp.kindle.id}.html`, type: "GET" }}), result => { - if ( result && result.done != "" ) { - result = result.done.replace( / { switch( type ) { case "dropbox": storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); - exp.MDWrapper( util.ClearMD( content ), undefined, new Notify() ).done( result => { + toMarkdown( result => { dropbox.Write( `${ title }.md`, result, ( _, result, error ) => exp.svcCbWrapper( result, error, dropbox.name, type, new Notify() ), "md/" ); }); break; @@ -158,12 +242,13 @@ function action( type, title, desc, content ) { break; case "linnk": const notify = new Notify().Render({ content: `开始保存到 Linnk,请稍等...`, state: "loading" }); + linnk.access_token = storage.secret.linnk.access_token; linnk.GetSafeGroup( linnk.group_name, ( result, error ) => { notify.complete(); if ( !error ) { linnk.group_id = result.data.groupId; linnk.Add( window.location.href, title, ( result, error ) => exp.svcCbWrapper( result, error, linnk.name, type, new Notify() )); - } else new Notify().Render( 2, `${ linnk.name } 保存失败,请稍后重新再试。` ); + } else new Notify().Render( 2, error == "error" ? `${ linnk.name } 保存失败,请稍后重新再试。` : error ); }); break; case "evernote": @@ -205,12 +290,12 @@ function action( type, title, desc, content ) { break; case "gdrive": storage.pr.current.site.avatar[0].name != "" && ( content = util.MULTI2ENML( content ) ); - exp.MDWrapper( util.ClearMD( content ), undefined, new Notify() ).done( result => { + toMarkdown( result => { gdrive.Add( "file",( result, error ) => exp.svcCbWrapper( result, error, gdrive.name, type, new Notify() ), gdrive.CreateFile( `${title}.md`, result )); }); break; case "jianguo": - exp.MDWrapper( util.ClearMD( content ) , undefined, new Notify() ).done( markdown => { + toMarkdown( markdown => { title = title.replace( /[|@!#$%^&*()<>/,.+=\\]/ig, "-" ); jianguo.Add( storage.secret.jianguo.username, storage.secret.jianguo.password, `${jianguo.root}/${jianguo.folder}/${title}.md`, markdown, result => { let error = undefined; @@ -222,10 +307,42 @@ function action( type, title, desc, content ) { }); break; case "yuque": - exp.MDWrapper( util.ClearMD( content ), undefined, new Notify() ).done( result => { + toMarkdown( result => { yuque.Add( title, result,( result, error ) => exp.svcCbWrapper( result, error, yuque.name, type, new Notify() )); }); break; + case "notion": + toMarkdown( result => { + corbLoader( "load", () => { + notion.access_token = storage.secret.notion.access_token; + notion.folder_id = storage.secret.notion.folder_id; + notion.Add( title, result.replace( /.jpeg!720/ig, '.jpeg' ), ( result, error ) => { + exp.svcCbWrapper( result, error, notion.name, type, new Notify() ) + }); + }, 500 ); + }); + break; + case "youdao": + toMarkdown( result => { + corbLoader( "load", () => { + youdao.access_token = storage.secret.youdao.access_token; + youdao.folder_id = storage.secret.youdao.folder_id; + youdao.Add( title, result, ( result, error ) => { + exp.svcCbWrapper( result, error, youdao.name, type, new Notify() ) + }); + }); + }); + break; + case "weizhi": + styles( csses => { + const html = offline.HTML( title, desc, content, csses ); + weizhi.username = storage.secret.weizhi.username; + weizhi.access_token = storage.secret.weizhi.access_token; + weizhi.Add( window.location.href, title, html, ( result, error ) => { + exp.svcCbWrapper( result, error, weizhi.name, type, new Notify() ) + }); + }); + break; } }; @@ -241,15 +358,40 @@ function action( type, title, desc, content ) { } else if ( type.startsWith( "fullscreen" ) ) { document.documentElement.requestFullscreen(); } else if ( type.startsWith( "webdav_" ) ) { - const id = type.replace( "webdav_", "" ); + const id = type.replace( "webdav_", "" ), + covernt = ( type, callback ) => { + if ( type == "html" ) { + styles( csses => { + const html = offline.HTML( title, desc, content, csses ); + callback( html ); + }); + } else if ( type == "ofhtml" ) { + const notify2 = new Notify().Render({ content: "图片转换中吗,请稍等...", state: "loading" }); + offline.getImages( () => { + notify2.complete(); + new Notify().Render( 0, "全部图片已经转换完毕,开始发送,请稍等。" ); + styles( csses => { + const html = offline.HTML( title, desc, $( "sr-rd-content" ).html(), csses ); + offline.restoreImg(); + callback( html ); + }); + }); + } else { + toMarkdown( markdown => { + callback( markdown ); + }); + } + }; storage.Safe( () => { storage.secret.webdav.forEach( item => { item = JSON.parse( item ); + item.format == undefined && ( item.format = "md" ); if ( item.name == id ) { - exp.MDWrapper( util.ClearMD( content ) , undefined, new Notify() ).done( markdown => { - title = title.replace( /[|@!#$%^&*()<>/,.+=\\]/ig, "-" ); + covernt( item.format, str => { + title = title.replace( /[|@!#$%^&*()<>/,.+=\\]/ig, "-" ); + const suffix = item.format.endsWith( "html" ) ? ".html" : ".md"; new Notify().Render( `开始保存到 ${ item.name},请稍等...` ); - exp.webdav.Add( item.url, item.user, item.password, `${title}.md`, markdown, result => { + exp.webdav.Add( item.url, item.user, item.password, `${title}${suffix}`, str, result => { let error = undefined; if ( result && ( result.status != 201 && result.status != 204 )) { error = `导出到 ${item.name} 失败,请稍后再试。`; @@ -266,6 +408,20 @@ function action( type, title, desc, content ) { } } +/** + * Open and Remove CORB iframe + * + * @param {string} include: load & remove + */ +function corbLoader( state, callback ) { + if ( state == "load" ) { + if ( $( '#sr-corb' ).length == 0 ) { + $( 'html' ).append( `` ); + $( '#sr-corb' ).on( "load", event => callback()); + } else callback(); + } else $( '#sr-corb' ).remove(); +} + export { action as Action, } \ No newline at end of file diff --git a/src/service/permission.js b/src/service/permission.js new file mode 100644 index 00000000..4919ddd1 --- /dev/null +++ b/src/service/permission.js @@ -0,0 +1,21 @@ + +import {browser} from 'browser'; + +function Get( permissions, callback ) { + browser.permissions.contains({ permissions: permissions.permissions }, result => { + result == false ? chrome.permissions.request( permissions, granted => { + callback( granted ); + }): callback( result ); + }); +} + +function Remove( permissions, callback ) { + browser.permissions.remove( { permissions: permissions.permissions }, result => { + callback( result ) + }) +} + +export { + Get, + Remove +} \ No newline at end of file diff --git a/src/service/snapshot.js b/src/service/snapshot.js new file mode 100644 index 00000000..f7e5e913 --- /dev/null +++ b/src/service/snapshot.js @@ -0,0 +1,63 @@ +console.log( "=== simpread snapshot load ===" ) + +let dtd, startPos, endPos, dragStart = false, position; + +function start() { + dtd = $.Deferred(); + dragStart = false; + $( ".simpread-read-root" ).append( `` ); + $( "simpread-snapshot" ) + .on( "mousemove", event => { + if ( dragStart == false ) return; + endPos = { left: event.clientX, top: event.clientY }; + const width = endPos.left - startPos.left, + height = endPos.top - startPos.top; + position = { + left : width >= 0 ? startPos.left : endPos.left, + top : height >= 0 ? startPos.top : endPos.top, + width : Math.abs( width ), + height: Math.abs( height ), + } + $( event.currentTarget ).find( "sr-mask" ).css( position ); + }) + .on( "mousedown", event => { + startPos = { left: event.clientX, top: event.clientY }; + dragStart = true; + }) + .on( "mouseup", event =>{ + dragStart = false; + controlbar(); + }); + return dtd; +} + +function remove() { + $( ".simpread-read-root" ).find( "simpread-snapshot" ).remove(); +} + +function controlbar() { + if ( $( "simpread-snapshot sr-highlight-ctl" ).length > 0 ) return; + const html = ` + + + + `; + $( "simpread-snapshot" ).append( html ); + $( "simpread-snapshot" ).on( "click", "sr-highlight-ctl", event => { + const cls = $( event.currentTarget ).attr( "class" ); + if ( cls == "done" ) { + dtd.resolve( position ); + } else if ( cls == "none" ) { + remove(); + } else if ( cls == "help" ) { + const $a = $( `` ).appendTo( "body" ); + $a[0].click(); + $a.remove(); + } + }); +} + +export { + start as Start, + remove as End, +} \ No newline at end of file diff --git a/src/service/storage.js b/src/service/storage.js index 742accae..50ada933 100644 --- a/src/service/storage.js +++ b/src/service/storage.js @@ -128,6 +128,7 @@ const name = "simpread", whitelist: false, exclusion: false, blacklist: false, + lazyload: false, unrdist: false, }, origins : [], @@ -140,8 +141,9 @@ const name = "simpread", "simpread.ksria.cn" ], plugins : [], // plugin id, e.g. kw36BtjGu0 + urlscheme : true, }, - statistics = { + /*statistics = { remove by 1.1.4 "focus" : 0, "read" : 0, "service" : { @@ -163,8 +165,9 @@ const name = "simpread", "temp" : 0, "yuque" : 0, "jianguo" : 0, + "weizhi" : 0, } - }, + },*/ user = { uid : "", name : "", @@ -207,8 +210,14 @@ let current = {}, user, }, plugins = {}, + unrdist = [], + statistics= { + "focus" : 0, + "read" : 0, + "service" : {}, + }, secret = { - version : "2019-06-08", + version : "2019-12-20", "dropbox" : { "access_token": "" }, @@ -241,11 +250,24 @@ let current = {}, access_token : "", repos_id: "", }, + "notion" : { + access_token : "", + folder_id: "", + }, + "youdao" : { + access_token : "", + folder_id : "", + }, "jianguo" : { username : "", password : "", access_token : "", }, + "weizhi" : { + username : "", + password : "", + access_token : "", + }, "webdav" : [] }; //stcode = -1; @@ -305,7 +327,7 @@ class Storage { * @return {array} unread list */ get unrdist() { - return simpread[ mode.unrdist ]; + return unrdist; } /** @@ -350,7 +372,7 @@ class Storage { * @return {object} statistics object */ get statistics() { - return simpread.statistics; + return statistics; } /** @@ -458,14 +480,17 @@ class Storage { * @param {function} callback */ Read( callback ) { - browser.storage.local.get( [name], function( result ) { + browser.storage.local.get( [name], result => { let firstload = true; if ( result && !$.isEmptyObject( result )) { simpread = result[name]; firstload = false; } origin = clone( simpread ); - callback( firstload ); + this.Statistics( undefined, undefined, "read" ); + this.UnRead( undefined, undefined, () => { + callback( firstload ); + }, "read" ); console.log( "chrome storage read success!", simpread, origin, result ); }); } @@ -642,16 +667,46 @@ class Storage { * * @param {string} include: create, focus, read, service * @param {string} include: service type, e.g. pdf png onenote + * @param {boolean} include: read & write */ - Statistics( type, service ) { + Statistics( type, service, state = "write" ) { if ( type == "create" ) { simpread.option.create = now(); - } else { - service ? simpread.statistics.service[ service ]++ : simpread.statistics[ type ]++; + save( undefined, type == "create" ); + return; + } + + const write = () => { + browser.storage.local.set( { ["statistics"] : statistics }, () => { + console.log( "chrome storage statistics set success!", statistics ); + }); + }, + read = cb => { + browser.storage.local.get( ["statistics"], result => { + console.log( "chrome storage statistics get success!", result ); + result && !$.isEmptyObject( result ) && ( statistics = result["statistics"] ); + cb && cb(); + }); + }; + + if ( state == "read" ) { + if ( !$.isEmptyObject( simpread.statistics ) ) { + statistics = clone( simpread.statistics ); + simpread.statistics = {}; + write(); + } else read(); + } else { + read( () => { + if ( type == "create" ) { + simpread.option.create = now(); + } else { + service && statistics.service[ service ] == undefined && ( statistics.service[ service ] = 0 ); + service ? statistics.service[ service ]++ : statistics[ type ]++; + } + console.log( "current statistics is ",statistics ) + write(); + }); } - console.log( "current statistics is ", simpread.statistics ) - browser.runtime.sendMessage({ type: "track", value: { eventAction: type, eventCategory: "read mode", eventLabel: "click" } }); - save( undefined, type == "create" ); } /** @@ -660,25 +715,51 @@ class Storage { * @param {type} include: add remove * @param {any} include: object( @see unread ) or index * @param {function} callback + * @param {boolean} include: read & write */ - UnRead( type, args, callback ) { + UnRead( type, args, callback, state = "write" ) { let success = true; - switch ( type ) { - case "add": - const len = simpread.unrdist.length; - args.create = now(); - args.idx = len > 0 ? simpread.unrdist[0].idx + 1 : 0; - simpread.unrdist.findIndex( item => item.url == args.url ) == -1 ? - simpread.unrdist.splice( 0, 0, args ) : success = false; - break; - case "remove": - const idx = simpread.unrdist.findIndex( item => item.idx == args ); - idx != -1 && simpread.unrdist.splice( idx, 1 ); - idx == -1 && ( success = false ); - break; + const write = () => { + browser.storage.local.set( { ["unrdist"] : unrdist }, () => { + console.log( "chrome storage unrdist set success!", unrdist ); + callback && callback( success ); + }); + }, + read = cb => { + browser.storage.local.get( ["unrdist"], result => { + console.log( "chrome storage unrdist get success!", result ); + result && !$.isEmptyObject( result ) && ( unrdist = result["unrdist"] ); + cb && cb(); + !cb && callback && callback( success ); + }); + }; + + if ( state == "read" ) { + if ( simpread.unrdist.length > 0 ) { + unrdist = $.extend( true, [], simpread.unrdist ); + simpread.unrdist = []; + write(); + } else read(); + } else { + read( () => { + switch ( type ) { + case "add": + const len = unrdist.length; + args.create = now(); + args.idx = len > 0 ? unrdist[0].idx + 1 : 0; + unrdist.findIndex( item => item.url == args.url ) == -1 ? + unrdist.splice( 0, 0, args ) : success = false; + break; + case "remove": + const idx = unrdist.findIndex( item => item.idx == args ); + idx != -1 && unrdist.splice( idx, 1 ); + idx == -1 && ( success = false ); + break; + } + write(); + }); } - callback && save( callback( success ) ); - } + } /** * Verify simpread data structure diff --git a/src/service/stylesheet.js b/src/service/stylesheet.js index 8591c44c..a4722133 100644 --- a/src/service/stylesheet.js +++ b/src/service/stylesheet.js @@ -197,6 +197,39 @@ function vfyCustom( type, styles ) { } } +function getCustomCSS() { + let styles = $( "style#simpread-site-css" ).text() || ""; + $( "head" ).find( "style" ).map( (index, item) => { + item.id.startsWith( "simpread-custom-" ) && ( styles += item.innerHTML ); + }); + return styles; +} + +/** + * Get special style + * + * @param {boolean} mathjax + * @param {func} callback + */ +function specialCSS( mathjax, callback ) { + let css = ""; + if ( mathjax && location.hostname == "blog.csdn.net" ) { + $.get("https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css", result=> { + callback( result ); + }) + } else if ( mathjax ) { + $( "head" ).find( "style" ).map( (index, item) => { + const $target = $(item), + cls = $target.attr( "class" ), + html = $target.text(); + if ( cls == "simpread-offline-special" || html.search( ".MathJax" ) > -1 || html.search( ".mathjax" ) > -1 || html.search( ".MJX" ) > -1 ) { + css += html; + } + }); + callback( css ); + } else callback( css ); +} + export { iconPath as IconPath, getColor as GetColor, @@ -210,4 +243,6 @@ export { custom as Custom, css as CSS, vfyCustom as VerifyCustom, + getCustomCSS as GetCustomCSS, + specialCSS as SpecialCSS, } \ No newline at end of file diff --git a/src/service/theme.js b/src/service/theme.js index 7dffc8fd..80e99df0 100644 --- a/src/service/theme.js +++ b/src/service/theme.js @@ -66,9 +66,18 @@ class Theme { tocTheme( theme ); } + Get( theme ) { + return themes[theme]; + } + + GetAll() { + findThemeStyle(); + } + constructor() { require( `../assets/css/theme_common.css` ); names.forEach( name => require( `../assets/css/theme_${name}.css` ) ); + require( `../assets/css/theme_mobile.css` ); findThemeStyle( ( name, content ) => themes[name] = content ); } } @@ -85,7 +94,13 @@ function findThemeStyle( callback ) { if ( css.startsWith( flag ) ) { const arr = css.replace( flag, "" ).match( /\w+/ ), name = arr[ arr.length - 1 ]; - callback( name, css, $target ); + callback && callback( name, css, $target ); + } else if ( css.search( ".simpread-font" ) > -1 ) { + !themes["global"] && ( themes["global"] = css ); + } else if ( css.search( "(pointer:coarse)" ) == -1 && css.search( ".simpread-theme-root" ) > -1 ) { + !themes["common"] && ( themes["common"] = css ); + } else if ( css.search( "(pointer:coarse)" ) > -1 && css.search( "sr-read" ) > -1 ) { + !themes["mobile"] && ( themes["mobile"] = css ); } }); } diff --git a/src/service/tips.js b/src/service/tips.js new file mode 100644 index 00000000..6c2012b1 --- /dev/null +++ b/src/service/tips.js @@ -0,0 +1,87 @@ +console.log( "=== simpread tips load ===" ) + +import Notify from 'notify'; +import * as msg from 'message'; +import {browser} from 'browser'; + +/** + * Verify current page and some plugin exist + * + * @param {array} plugins ids + */ +function Render( plugins ) { + const notify = code => { + new Notify().Render( messages[code], "不再提示", () => { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.tips_norepeat, { code })); + }); + }, + pushMessage = code => { + browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.tips, { code }), result => { + if ( result ) { + notify( code ); + } + }); + }, + messages = { + "klGUASLasg": '检测到当前环境有代码段,请使用 代码增强插件 辅助阅读', + "VQOZdNET2d": '检测到当前环境有大量的图片,可以使用 点击查看大图 辅助阅读', + "DxlFcL52iy": '如果你想换个论坛类页面风格,可以使用 Materail Design 风格 辅助阅读', + } + // verify klGUASLasg + if ( $( "sr-read" ).find( "pre" ).length > 0 && plugins.findIndex( item => item == "klGUASLasg" ) == -1 ) { + pushMessage( "klGUASLasg" ); + } + // verify VQOZdNET2d + if ( $( "sr-read" ).find( "img" ).length > 5 && plugins.findIndex( item => item == "VQOZdNET2d" ) == -1 ) { + pushMessage( "VQOZdNET2d" ); + } + // verify DxlFcL52iy + if ( ( location.hostname == "www.zhihu.com" && location.pathname.startsWith( "/question/" ) ) && plugins.findIndex( item => item == "DxlFcL52iy" ) == -1 ) { + pushMessage( "DxlFcL52iy" ); + } +} + +/** + * Help + * + * @param {object} storage.statistics + */ +function Help( statistics ) { + if ( statistics.read == 1 ) { + new Notify().Render({ content: "嗨,很高兴第一次使用简悦的阅读模式,是否看看新手帮助?", action: "我要看", cancel: "老司机", callback: type => { + type == "action" && browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: "http://ksria.com/simpread/guide/#readmode" })); + type == "cancel" && browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.tips_norepeat, { code: "readmode" })); + }}); + } +} + +/** + * Background call + * + * @param {string} plugin id + * @param {func} callback true: tips; false: not tip + */ +function Verify( id, callback ) { + const tips = JSON.parse( localStorage[ "simpread-tips" ] || "{}" ); + if ( !tips[id] ) { + callback( true ); + } else callback( false ); +} + +/** + * Not repeat tips + * + * @param {string} tips id + */ +function Done( id ) { + const tips = JSON.parse( localStorage[ "simpread-tips" ] || "{}" ); + tips[id] = true; + localStorage.setItem( "simpread-tips", JSON.stringify( tips )); +} + +export { + Render, + Verify, + Done, + Help, +} \ No newline at end of file diff --git a/src/service/util.js b/src/service/util.js index 369ec8d5..20b73666 100644 --- a/src/service/util.js +++ b/src/service/util.js @@ -171,14 +171,17 @@ function clearHTML( str ) { * * @param {object} minimatch * @param {object} simpread.read - * @return {boolen} true: not exist; false: exist + * @return {boolen} true: exist; false: not exist */ function exclusion( minimatch, data ) { const url = window.location.origin + window.location.pathname; return data.exclusion.findIndex( item => { + item == null && ( item = "" ); item = item.trim(); - return item.startsWith( "http" ) ? minimatch( url, item ) : item == data.site.name; - }) == -1 ? true : false; + if ( item.startsWith( "[[/" ) && item.endsWith( "/]]" ) ) { + return location.href.replace( new RegExp( item.replace( /\[\[\/|\/\]\]/ig, "" ), "g" ), "" ) == "" ? true : false; + } else return item.startsWith( "http" ) ? minimatch( url, item ) : item == data.site.name; + }) != -1 ? true : false; } /** @@ -191,11 +194,62 @@ function exclusion( minimatch, data ) { function whitelist( minimatch, data ) { const url = window.location.origin + window.location.pathname; return data.whitelist.findIndex( item => { + item == null && ( item = "" ); item = item.trim(); - return item.startsWith( "http" ) ? minimatch( url, item ) : item == data.site.name; + if ( item.startsWith( "[[/" ) && item.endsWith( "/]]" ) ) { + return location.href.replace( new RegExp( item.replace( /\[\[\/|\/\]\]/ig, "" ), "g" ), "" ) == "" ? true : false; + } else return item.startsWith( "http" ) ? minimatch( url, item ) : item == data.site.name; }) != -1 ? true : false; } +/** + * Blacklist + * + * @param {object} minimatch + * @param {object} simpread.read + * @return {boolean} true: is blacklist; false: is't blacklist + */ +function blacklist( minimatch, data ) { + return data.blacklist.findIndex( item => { + item == null && ( item = "" ); + item = item.trim(); + if ( item.startsWith( "[[/" ) && item.endsWith( "/]]" ) ) { + return location.href.replace( new RegExp( item.replace( /\[\[\/|\/\]\]/ig, "" ), "g" ), "" ) == "" ? true : false; + } else return item.startsWith( "http" ) ? minimatch( location.href, item ) : location.hostname.includes( item ); + }) != -1 ? true : false; +} + +/** + * Lazyload + * + * @param {object} minimatch + * @param {object} simpread.read + * @return {boolean} true: is blacklist; false: is't blacklist + */ +function lazyload( minimatch, data ) { + return data.lazyload.findIndex( item => { + item == null && ( item = "" ); + item = item.trim(); + if ( item.startsWith( "[[/" ) && item.endsWith( "/]]" ) ) { + return location.href.replace( new RegExp( item.replace( /\[\[\/|\/\]\]/ig, "" ), "g" ), "" ) == "" ? true : false; + } else return item.startsWith( "http" ) ? minimatch( location.href, item ) : location.hostname.includes( item ); + }) != -1 ? true : false; +} + +/** + * Get page info + * + * @return {object} include: url, title, favicon, img, desc + */ +function getPageInfo() { + const url = location.href, + title = $( "sr-read" ).find( "sr-rd-title" ).text() || $( "head" ).find( "title" ).text() || "", + favicon = $( `head link[rel~=icon]` ).attr( "href" ) || "", + img = $( `head meta[property="og:image"]` ).attr( "content" ) || $( "sr-read" ).find( "img" ).attr( "src" ) || "", + desc = $( "sr-read" ).find( "sr-rd-desc" ).text() || $( `head meta[property="og:description"]` ).attr( "content" ) || $( 'meta[name=description]' ).attr( 'content' ) || ""; + return { url, title: title.trim(), favicon, img, desc: desc.trim() }; +} + export { verifyHtml as verifyHtml, html2enml as HTML2ENML, @@ -205,4 +259,7 @@ export { clearHTML as ClearHTML, exclusion as Exclusion, whitelist as Whitelist, + blacklist as Blacklist, + lazyload as Lazyload, + getPageInfo as GetPageInfo, } \ No newline at end of file diff --git a/src/service/version.js b/src/service/version.js index a10fd155..c3b28a1c 100644 --- a/src/service/version.js +++ b/src/service/version.js @@ -19,6 +19,7 @@ const version = browser.runtime.getManifest().version.replace( /.\d{2,}/, "" ), [ "1.1.1", "Mon Jun 11 2018 15:10:12 GMT+0800 (CST)" ], [ "1.1.2", "Tue Jun 19 2018 14:15:12 GMT+0800 (CST)" ], [ "1.1.3", "Thu Jun 06 2019 15:47:44 GMT+0800 (CST)" ], + [ "1.1.4", "Thu Jan 16 2020 14:24:53 GMT+0800 (CST)" ], ]), details = new Map([ [ "1.0.0", "" ], @@ -32,9 +33,44 @@ const version = browser.runtime.getManifest().version.replace( /.\d{2,}/, "" ), [ "1.1.1", "新增「黑名单,全新的控制栏面板,更丰富的中文定制化,无障碍阅读等」," ], [ "1.1.2", "新增「插件中心,站点集市等」," ], [ "1.1.3", "新增「消息中心,帮助中心,入门指引,支持导入语雀 / 坚果云,预加载机制,增强插件 API 等」," ], + [ "1.1.4", "新增「反馈中心,支持导入 Notion, 有道笔记,为知笔记,离线下载,截图 等」," ], ]), tips = { "root" : value => `.version-tips[data-hits='${value}']`, + "1.1.4" : { + target: 'labs', + idx: 2, + items: [ + { + id: '', + intro: '简悦 1.1.4 功能描述:
' + details.get( "1.1.4" ) + '详细说明 请看这里 。' , + }, + { + id: 'lazyload', + intro: '现在可通过右键菜单发送「延迟加载」了', + }, + { + id: 'urlscheme', + intro: '【黑名单 · 白名单 · 排除列表 · 延迟加载】加入 正则表达式 的方式,同时也新增加了 URL 编辑器。', + }, + { + id: 'notion', + intro: '简悦支持导出 Markdown 格式到 Notion,详细说明 请看这里', + }, + { + id: 'youdao', + intro: '简悦支持导出 Markdown 格式到 有道云笔记,详细说明 请看这里', + }, + { + id: 'weizhi', + intro: '简悦支持导出 HTML 格式到 为知笔记,详细说明 请看这里', + }, + { + id: 'webdav', + intro: 'WebDAV 增加了导出格式的定制化,包括 Markdown HTML,详细说明 请看这里', + } + ] + }, "1.1.3" : { target: 'labs', idx: 2, @@ -434,6 +470,12 @@ function Verify( curver, data ) { curver = "1.1.3"; } + if ( curver == "1.1.3" ) { + data.option.urlscheme = true; + data.option.menu.lazyload = false; + curver = "1.1.4"; + } + /* if ( curver == "1.0.1" ) { data.option.pocket = { "consumer": "", "access": "" }; @@ -455,15 +497,11 @@ function Verify( curver, data ) { */ function Incompatible( ver, data ) { let is_changed = false; - if ( ver == "1.1.3" ) { + if ( ver == "1.1.4" ) { data.option.origins = data.option.origins.filter( item => item != "http://sr.ksria.cn/origins/website_list_en.json" && item != "http://sr.ksria.cn/origins/website_list_tw.json" ) if ( data.option.origins.length > 0 ) { is_changed = true; - new Notify().Render({ type: 2, content: `检测到你曾经修改过第三方适配源,务必刷新后重新导入详细说明`, state: "holdon" }); - } - if ( VerifyPlugins( ver, data.option )) { - is_changed = true; - new Notify().Render({ type: 2, content: `已清理失效的插件,务必刷新后重新导入,详细请看 删除失效的插件`, state: "holdon" }); + new Notify(); // hack code } } return is_changed; @@ -526,20 +564,18 @@ function FixSubver( patch, target ) { /** * Verify current version plugins * - * @param {string} version * @param {object} option + * @return {boolean} */ -function VerifyPlugins( ver, option ) { +function VerifyPlugins( option ) { try { if ( option.plugins.length == 0 ) return false; const str = option.plugins.join( "," ); - if ( ver == "1.1.3" ) { - const newStr = str.replace( /(E0j1nYBmDD,?|SumEaxStWE,?|UsayAKSuwe,?)/g, "" ); - if ( str != newStr ) { - option.plugins = newStr.replace( /,$/, "" ).split( "," ); - return true; - } - } else return false; + const newStr = str.replace( /(E0j1nYBmDD,?|SumEaxStWE,?|EHLtCwBy6c,?|UsayAKSuwe,?)/g, "" ); + if ( str != newStr ) { + option.plugins = newStr.replace( /,$/, "" ).split( "," ); + return true; + } } catch( error ) { console.error( "version::VerifyPlugin catch", error ) return false; diff --git a/src/vender/axios.min.js b/src/vender/axios.min.js new file mode 100644 index 00000000..0f368163 --- /dev/null +++ b/src/vender/axios.min.js @@ -0,0 +1,9 @@ +/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=s(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(2),s=n(3),i=n(5),a=n(22),u=n(11),c=r(u);c.Axios=i,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(10),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===j.call(e)}function o(e){return"[object ArrayBuffer]"===j.call(e)}function s(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===j.call(e)}function d(e){return"[object File]"===j.call(e)}function l(e){return"[object Blob]"===j.call(e)}function h(e){return"[object Function]"===j.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function g(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n + * @license MIT + */ +e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(2),s=n(6),i=n(7),a=n(8),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=u(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(r(t)+"="+r(e))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),s=n(9),i=n(10),a=n(11),u=n(20),c=n(21);e.exports=function(e){r(e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return r(e),t.data=s(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";function r(e,t){!s.isUndefined(e)&&s.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)?e=n(13):"undefined"!=typeof XMLHttpRequest&&(e=n(13)),e}var s=n(2),i=n(12),a={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:o(),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),s.isFormData(e)||s.isArrayBuffer(e)||s.isBuffer(e)||s.isStream(e)||s.isFile(e)||s.isBlob(e)?e:s.isArrayBufferView(e)?e.buffer:s.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):s.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},s.forEach(["delete","get","head"],function(e){u.headers[e]={}}),s.forEach(["post","put","patch"],function(e){u.headers[e]=s.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(14),s=n(6),i=n(17),a=n(18),u=n(15);e.exports=function(e){return new Promise(function(t,c){var f=e.data,p=e.headers;r.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(d.open(e.method.toUpperCase(),s(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?d.response:d.responseText,s={data:r,status:d.status,statusText:d.statusText,headers:n,config:e,request:d};o(t,c,s),d=null}},d.onabort=function(){d&&(c(u("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){c(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},r.isStandardBrowserEnv()){var m=n(19),y=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in d&&r.forEach(p,function(e,t){"undefined"==typeof f&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)}),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){d&&(d.abort(),c(e),d=null)}),void 0===f&&(f=null),d.send(f)})}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";var r=n(16);e.exports=function(e,t,n,o,s){var i=new Error(e);return r(i,t,n,o,s)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,s,i={};return e?(r.forEach(e.split("\n"),function(e){if(s=e.indexOf(":"),t=r.trim(e.substr(0,s)).toLowerCase(),n=r.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?i[t]=(i[t]?i[t]:[]).concat([n]):i[t]=i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){t=t||{};var n={};return r.forEach(["url","method","params","data"],function(e){"undefined"!=typeof t[e]&&(n[e]=t[e])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):"undefined"!=typeof t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):"undefined"!=typeof e[o]&&(n[o]=e[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){"undefined"!=typeof t[r]?n[r]=t[r]:"undefined"!=typeof e[r]&&(n[r]=e[r])}),n}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])}); +//# sourceMappingURL=axios.min.map \ No newline at end of file diff --git a/src/vender/instapaper.js b/src/vender/instapaper.js index 8b8e8ac5..5d0c367d 100644 --- a/src/vender/instapaper.js +++ b/src/vender/instapaper.js @@ -110,13 +110,13 @@ Instapaper = (function() { // Creates new Ajax request // Always uses POST request(options) { - var auth, req; + var auth, req, settings; req = options.req || (options.req = this.makeRequestObject({ url: options.url, data: options.data })); auth = this.authTemplate(options.req); - return $.ajax({ + settings = { url: `${this.baseUrl}${options.url}`, dataType: (function() { return options.dataType || "json"; @@ -126,7 +126,11 @@ Instapaper = (function() { headers: { Authorization: auth } - }); + }; + if ( options.url == "bookmarks/add" ) { + return settings; + } + return $.ajax(settings); } // ## Specific API Methods diff --git a/src/vender/mduikit/button.jsx b/src/vender/mduikit/button.jsx index 5d356823..30517efe 100644 --- a/src/vender/mduikit/button.jsx +++ b/src/vender/mduikit/button.jsx @@ -1,8 +1,8 @@ /*! * React Material Design: Button * - * @version : 0.0.4 - * @update : 2018/06/21 + * @version : 0.0.4.1231 + * @update : 2019/12/31 * @homepage: https://github.com/kenshin/mduikit-ui * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE * @author : Kenshin Wang @@ -218,6 +218,7 @@ export default class Button extends React.Component { onMouseOut() { const [ style, $mask ] = [ { ...this.style }, $( this.refs.mask ) ]; + this.props.shape == "circle" && ( style.mask.borderRadius = "50%" ); $mask.css({ ...style.mask }); } @@ -278,13 +279,15 @@ export default class Button extends React.Component { }, tooltip = this.props.tooltip; + this.props.shape == "circle" && ( style.mask.borderRadius = "50%" ); + return ( - - + { this.props.text } diff --git a/src/vender/mduikit/fab.jsx b/src/vender/mduikit/fab.jsx index 306bf6ea..96edef73 100644 --- a/src/vender/mduikit/fab.jsx +++ b/src/vender/mduikit/fab.jsx @@ -1,8 +1,8 @@ /*! * React Material Design: FAB( Floating Action Button ) * - * @version : 0.0.3 - * @update : 2018/04/26 + * @version : 0.0.3.0109 + * @update : 2020/01/09 * @homepage: https://github.com/kenshin/mduikit * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE * @author : Kenshin Wang @@ -40,6 +40,7 @@ const cssinjs = () => { width: '100px', height: '100%', + zIndex: 2147483647, }, origin : { diff --git a/src/vender/mduikit/fap.jsx b/src/vender/mduikit/fap.jsx index 6e24b9ee..2a9e55b7 100644 --- a/src/vender/mduikit/fap.jsx +++ b/src/vender/mduikit/fap.jsx @@ -1,7 +1,7 @@ /*! * React Material Design: FAP( Floating Action Panel ) * - * @version : 0.0.1 + * @version : 0.0.1.1231 * @update : 2018/04/19 * @homepage: https://github.com/kenshin/mduikit * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE @@ -193,6 +193,7 @@ const cssinjs_panel = () => { groups: { display: 'block', width: '100%', + overflowX: 'hidden', overflowY: 'auto', }, diff --git a/src/vender/mduikit/list.jsx b/src/vender/mduikit/list.jsx index 061650ee..ab96346a 100644 --- a/src/vender/mduikit/list.jsx +++ b/src/vender/mduikit/list.jsx @@ -1,8 +1,8 @@ /*! * React Material Design: List * - * @version : 0.0.3 - * @update : 2018/04/26 + * @version : 0.0.3.0116 + * @update : 2020/01/16 * @homepage: https://github.com/kenshin/mduikit * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE * @author : Kenshin Wang @@ -251,7 +251,8 @@ const cssinjs = () => { height: '32px', color, - fontSize: '1.6rem', + fontSize: '1.2rem', + fontWeight: 400, overflow: 'hidden', textOverflow: 'ellipsis', @@ -351,7 +352,7 @@ const ListItem = props => { return ( events.priOnClick( e, props ) }>{ pri_value } - + { true_title } { desc } diff --git a/src/vender/mduikit/mduikit.css b/src/vender/mduikit/mduikit.css new file mode 100644 index 00000000..c16ca443 --- /dev/null +++ b/src/vender/mduikit/mduikit.css @@ -0,0 +1,147 @@ +/*! + * React Material Design Style + * + * @version : 0.0.1 + * @update : 2019/12/29 + * @homepage: https://github.com/kenshin/mduikit + * @author : Kenshin Wang + * + * @copyright 2019 + */ + +/** + * Sidebar + */ + +sidebar side content a { + transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; +} + +sidebar side content a:hover { + background-color: rgba(0,0,0,.04); +} + +sidebar side content a.active { + font-weight: bold; +} + +sidebar side toc { + position: relative; + width: 100%; +} + +sidebar side toc i { + position: absolute; + left: 35px; + top: 0; + bottom: 0; + + display: block; + + width: 2px; + background: rgba(189,189,189,.4); +} + +sidebar side toc outline { + position: relative; + display: -webkit-box!important; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + + padding: 12px 0 12px 60px; + min-height: 21px; + + line-height: 21px; + text-align: left; + + cursor: pointer; +} + +sidebar side toc outline:hover { + background-color: rgba(0,0,0,.04)!important; +} + +sidebar side .toc-level-h1 { + padding-left: 60px; +} +sidebar side .toc-level-h2 { + padding-left: 70px; +} +sidebar side .toc-level-h3 { + padding-left: 75px; +} +sidebar side .toc-level-h4 { + padding-left: 80px; +} + +/** + * Source from https://jonsuh.com/hamburgers/ + */ +.hamburger { + font: inherit; + display: inline-block; + overflow: visible; + margin: 0; + padding: 15px; + cursor: pointer; + transition-timing-function: linear; + transition-duration: .15s; + transition-property: opacity,filter; + text-transform: none; + color: inherit; + border: 0; + background-color: transparent; + transform: scale(.5); +} + +.hamburger-box { + position: relative; + display: inline-block; + width: 40px; + height: 24px; +} + +.hamburger-inner { + top: 50%; + display: block; + margin-top: -2px; +} + +.hamburger-inner, .hamburger-inner:after, .hamburger-inner:before { + position: absolute; + width: 40px; + height: 4px; + transition-timing-function: ease; + transition-duration: .15s; + transition-property: transform; + border-radius: 4px; + background-color: #9E9E9E; +} + +.hamburger-inner:after, .hamburger-inner:before { + content: ""; + display: block; +} + +.hamburger-inner:before { + top: -10px; +} + +.hamburger-inner:after { + bottom: -10px; +} + +.hamburger:hover .hamburger-inner, .hamburger:hover .hamburger-inner:after, .hamburger:hover .hamburger-inner:before { + background-color: #9E9E9E; + transform: scale(.7); +} + +.hamburger--arrow:hover .hamburger-inner:before { + transform: translate3d(-8px,0,0) rotate(-45deg) scaleX(.7); +} + +.hamburger--arrow:hover .hamburger-inner:after { + transform: translate3d(-8px,0,0) rotate(45deg) scaleX(.7); +} \ No newline at end of file diff --git a/src/vender/mduikit/mintooltip.css b/src/vender/mduikit/mintooltip.css index f72b5d45..91d9761c 100644 --- a/src/vender/mduikit/mintooltip.css +++ b/src/vender/mduikit/mintooltip.css @@ -1,4 +1,14 @@ /** - * From https://codepen.io/joshuaward/pen/NprxPE + * From https://kazzkiq.github.io/balloon.css/ */ -a[data-sr-mini-tooltip].sr-top:before,a[data-sr-mini-tooltip].sr-top:after{transform:translateY(10px)}a[data-sr-mini-tooltip].sr-top:hover:after,a[data-sr-mini-tooltip].sr-top:hover:before{transform:translateY(0px)}a[data-sr-mini-tooltip].right:before,a[data-sr-mini-tooltip].right:after{transform:translateX(0px)}a[data-sr-mini-tooltip].right:hover:after,a[data-sr-mini-tooltip].right:hover:before{transform:translateX(10px)}a[data-sr-mini-tooltip].bottom:before,a[data-sr-mini-tooltip].bottom:after{transform:translateY(-10px)}a[data-sr-mini-tooltip].bottom:hover:after,a[data-sr-mini-tooltip].bottom:hover:before{transform:translateY(0px)}a[data-sr-mini-tooltip].left:before,a[data-sr-mini-tooltip].left:after{transform:translateX(0px)}a[data-sr-mini-tooltip].left:hover:after,a[data-sr-mini-tooltip].left:hover:before{transform:translateX(-10px)}a[data-sr-mini-tooltip]{position:relative}a[data-sr-mini-tooltip]:after,a[data-sr-mini-tooltip]:before{position:absolute;bottom:40px;visibility:hidden;opacity:0;transition:transform 200ms ease,opacity 200ms;box-shadow:0 0 10px rgba(0,0,0,0.3);z-index:99}a[data-sr-mini-tooltip]:before{content:attr(data-sr-mini-tooltip);background:#000;color:#fff;font-size:10px;font-weight:bold;padding:10px 15px;border-radius:5px;white-space:nowrap;text-decoration:none;text-transform:uppercase;letter-spacing:1px}a[data-sr-mini-tooltip]:after{width:0;height:0;border:6px solid transparent;content:''}a[data-sr-mini-tooltip]:hover:after,a[data-sr-mini-tooltip]:hover:before{visibility:visible;opacity:.85;transform:translateY(0px)}a[data-sr-mini-tooltip][data-position="top"]:before{bottom:100%;left:-130%;margin-bottom:10px}a[data-sr-mini-tooltip][data-position="top"]:after{border-top-color:#000;border-bottom:0;bottom:101%;left:calc(50% - 6px);margin-bottom:4px}a[data-sr-mini-tooltip][data-position="left"]:before{top:-12%;right:100%;margin-right:10px}a[data-sr-mini-tooltip][data-position="left"]:after{border-left-color:#000;border-right:0;top:calc(50% - 3px);right:100%;margin-top:-6px;margin-right:4px}a[data-sr-mini-tooltip][data-position="right"]:before{top:-5%;left:100%;margin-left:10px}a[data-sr-mini-tooltip][data-position="right"]:after{border-right-color:#000;border-left:none;top:calc(50% - 6px);left:calc(100%+4px)}a[data-sr-mini-tooltip][data-position="bottom"]:before{top:100%;left:-130%;margin-top:10px}a[data-sr-mini-tooltip][data-position="bottom"]:after{border-bottom-color:#000;border-top:0;top:100%;left:5px;margin-top:4px} \ No newline at end of file +:root{--balloon-color: rgba(16,16,16,0.95);--balloon-font-size: 12px;--balloon-move: 4px}button[aria-label][data-balloon-pos]{overflow:visible}[aria-label][data-balloon-pos]{position:relative;cursor:pointer}[aria-label][data-balloon-pos]:after{opacity:0;pointer-events:none;transition:all .18s ease-out .18s;text-indent:0;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;font-weight:normal;font-style:normal;text-shadow:none;font-size:var(--balloon-font-size);background:var(--balloon-color);border-radius:2px;color:#fff;content:attr(aria-label);padding:.5em 1em;position:absolute;white-space:nowrap;z-index:10}[aria-label][data-balloon-pos]:before{width:0;height:0;border:5px solid transparent;border-top-color:var(--balloon-color);opacity:0;pointer-events:none;transition:all .18s ease-out .18s;content:"";position:absolute;z-index:10}[aria-label][data-balloon-pos]:hover:before,[aria-label][data-balloon-pos]:hover:after,[aria-label][data-balloon-pos][data-balloon-visible]:before,[aria-label][data-balloon-pos][data-balloon-visible]:after,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:before,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:after{opacity:1;pointer-events:none}[aria-label][data-balloon-pos].font-awesome:after{font-family:FontAwesome, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif}[aria-label][data-balloon-pos][data-balloon-break]:after{white-space:pre}[aria-label][data-balloon-pos][data-balloon-break][data-balloon-length]:after{white-space:pre-line;word-break:break-word}[aria-label][data-balloon-pos][data-balloon-blunt]:before,[aria-label][data-balloon-pos][data-balloon-blunt]:after{transition:none}[aria-label][data-balloon-pos][data-balloon-pos="up"]:after{bottom:100%;left:50%;margin-bottom:10px;transform:translate(-50%, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up"]:before{bottom:100%;left:50%;transform:translate(-50%, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:after{transform:translate(-50%, 0)}[aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:before{transform:translate(-50%, 0)}[aria-label][data-balloon-pos][data-balloon-pos="up-left"]:after{bottom:100%;left:0;margin-bottom:10px;transform:translate(0, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up-left"]:before{bottom:100%;left:5px;transform:translate(0, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up-left"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="up-left"][data-balloon-visible]:after{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="up-left"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="up-left"][data-balloon-visible]:before{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="up-right"]:after{bottom:100%;right:0;margin-bottom:10px;transform:translate(0, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up-right"]:before{bottom:100%;right:5px;transform:translate(0, var(--balloon-move));transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos="up-right"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="up-right"][data-balloon-visible]:after{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="up-right"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="up-right"][data-balloon-visible]:before{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down"]:after{left:50%;margin-top:10px;top:100%;transform:translate(-50%, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down"]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:var(--balloon-color);left:50%;top:100%;transform:translate(-50%, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:after{transform:translate(-50%, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:before{transform:translate(-50%, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down-left"]:after{left:0;margin-top:10px;top:100%;transform:translate(0, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down-left"]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:var(--balloon-color);left:5px;top:100%;transform:translate(0, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down-left"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="down-left"][data-balloon-visible]:after{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down-left"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="down-left"][data-balloon-visible]:before{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down-right"]:after{right:0;margin-top:10px;top:100%;transform:translate(0, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down-right"]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:var(--balloon-color);right:5px;top:100%;transform:translate(0, calc(var(--balloon-move) * -1))}[aria-label][data-balloon-pos][data-balloon-pos="down-right"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="down-right"][data-balloon-visible]:after{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="down-right"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="down-right"][data-balloon-visible]:before{transform:translate(0, 0)}[aria-label][data-balloon-pos][data-balloon-pos="left"]:after{margin-right:10px;right:100%;top:50%;transform:translate(var(--balloon-move), -50%)}[aria-label][data-balloon-pos][data-balloon-pos="left"]:before{width:0;height:0;border:5px solid transparent;border-left-color:var(--balloon-color);right:100%;top:50%;transform:translate(var(--balloon-move), -50%)}[aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:after{transform:translate(0, -50%)}[aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:before{transform:translate(0, -50%)}[aria-label][data-balloon-pos][data-balloon-pos="right"]:after{left:100%;margin-left:10px;top:50%;transform:translate(calc(var(--balloon-move) * -1), -50%)}[aria-label][data-balloon-pos][data-balloon-pos="right"]:before{width:0;height:0;border:5px solid transparent;border-right-color:var(--balloon-color);left:100%;top:50%;transform:translate(calc(var(--balloon-move) * -1), -50%)}[aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:after{transform:translate(0, -50%)}[aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:before{transform:translate(0, -50%)}[aria-label][data-balloon-pos][data-balloon-length="small"]:after{white-space:normal;width:80px}[aria-label][data-balloon-pos][data-balloon-length="medium"]:after{white-space:normal;width:150px}[aria-label][data-balloon-pos][data-balloon-length="large"]:after{white-space:normal;width:260px}[aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after{white-space:normal;width:380px}@media screen and (max-width: 768px){[aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after{white-space:normal;width:90vw}} +[aria-label][data-balloon-pos]:before { + display: none; +} + +[aria-label][data-balloon-pos]:after { + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + border-radius: 5px; + font-weight: bold; + font-size: 10px; +} \ No newline at end of file diff --git a/src/vender/mduikit/sidebar.jsx b/src/vender/mduikit/sidebar.jsx index cee70340..0f7c0dae 100644 --- a/src/vender/mduikit/sidebar.jsx +++ b/src/vender/mduikit/sidebar.jsx @@ -1,8 +1,8 @@ /*! * React Material Design: Sidebar * - * @version : 0.0.3 - * @update : 2018/04/26 + * @version : 0.0.4.0104 + * @update : 2019/12/30 * @homepage: https://github.com/kenshin/mduikit * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE * @author : Kenshin Wang @@ -69,14 +69,11 @@ const cssinjs = () => { display: 'block', position: 'relative', - marginTop: '8px', - paddingRight: paddingLeft, - paddingLeft, - width: '100%', height: '100%', fontSize: '1.3rem', + overflowY: 'auto', }, footer: { @@ -84,8 +81,6 @@ const cssinjs = () => { alignItems: 'center', marginTop: '8px', - paddingLeft, - paddingRight: paddingLeft, width: '100%', height, @@ -148,12 +143,18 @@ const cssinjs = () => { alignItems: 'center', margin: 0, - padding: 0, + padding: '12px 48px 12px 24px', width: '100%', minHeight: itemHeight, color, + fontSize: '1.4rem', + }, + + large_link: { + paddingLeft: 0, + fontSize: '2.2rem', }, icon: { @@ -191,6 +192,46 @@ const cssinjs = () => { zIndex: 2000, }, + font_icon: { + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + + marginRight: '12px', + + fontSize: '18px', + color: '#9E9E9E', + + order: -1, + display: 'block', + + width: '24px', + height: '24px', + + fontSize: '14px', + border: 'none', + }, + + close_icon: { + position: 'absolute', + top: '0', + left: '-256px', + + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + + width: '48px', + height: '48px', + + color: '#9E9E9E', + backgroundColor: '#fff', + + fontSize: '2rem', + border: 'none', + cursor: 'pointer', + }, + }; return styles; @@ -200,29 +241,39 @@ const cssinjs = () => { * React stateless component * * @param {object} react props, include: + * - large : [PropTypes.boolean] * - name : [PropTypes.string] text * - value : [PropTypes.string] value * - route : [PropTypes.string] href * - icon : [PropTypes.string] icon + * - fontIcon : [PropTypes.string] icon * - style : [PropTypes.object] include: icon link text * - tooltip : [PropTypes.string] tooltip * - waves : [PropTypes.string] waves * - onClick : [PropTypes.func] event handler */ const Item = ( props ) => { - if ( props.icon ) { - props.style.icon.display = "block"; - props.style.icon.backgroundImage = `url(${props.icon })`; + let icon_style = {}, link_style = { ...props.style.link }; + if ( props.fontIcon ) { + icon_style = { ...props.style.font_icon }; + icon_style.display = "flex"; + } else if ( props.icon ) { + icon_style = { ...props.style.icon }; + icon_style.display = "block"; + icon_style.backgroundImage = `url(${props.icon })`; } else { - props.style.icon.display = "none"; + icon_style.display = "none"; + } + if ( props.large ) { + link_style = { ...props.style.link, ...props.style.large_link }; } const tooltip = props.tooltip; return ( - props.onClick(evt)) } > - + { props.name } ); @@ -253,6 +304,8 @@ class Sidebar extends React.Component { footerStyle: undefined, maskStyle : undefined, waves : "", + autoClose : true, + showClose : false, tooltip : {}, }; @@ -269,6 +322,8 @@ class Sidebar extends React.Component { contentStyle: React.PropTypes.object, footerStyle: React.PropTypes.object, maskStyle : React.PropTypes.object, + autoClose : React.PropTypes.bool, + showClose : React.PropTypes.bool, waves : React.PropTypes.string, tooltip : React.PropTypes.object, onClick : React.PropTypes.func, @@ -281,8 +336,10 @@ class Sidebar extends React.Component { let $target = $( event.target ); while ( !$target.is( "a" ) ) { $target = $target.parent(); } const [ name, value, href ] = [ $target.text(), $target.attr( "value" ), $target.attr( "href" ) ]; + $target.parent().parent().find( "a" ).removeClass( "active" ); + $target.addClass( "active" ); this.props.onClick && this.props.onClick( $target, { name, value, href } ); - this.maskOnClick(); + this.props.autoClose && this.maskOnClick(); } liOnClick( event ) { @@ -327,6 +384,7 @@ class Sidebar extends React.Component { complete: () => { $( "sidebar" ).css( "left", 0 - Number.parseInt( $( "side" ).width() )); $( "mask" ).css( "display", "none" ); + $( "side close" ).velocity({ left: 0 - Number.parseInt( $( "side" ).width() ) }); this.props.onExit && this.props.onExit(); } }); @@ -336,7 +394,7 @@ class Sidebar extends React.Component { let menu = []; const style = { ...this.style }, { items, width, - header, icon, footer, + header, icon, footer, showClose, color, bgColor, headerStyle, contentStyle, footerStyle, maskStyle } = this.props; @@ -358,7 +416,8 @@ class Sidebar extends React.Component {
  • this.liOnClick(evt) ) } > this.onClick(evt) ) } /> { item.items && item.items.length > 0 && @@ -377,7 +436,7 @@ class Sidebar extends React.Component { { header &&
    - this.onClick(evt) }/>
    @@ -390,7 +449,16 @@ class Sidebar extends React.Component { this.onClick(evt) }/> - + } + { + showClose && + this.maskOnClick() }> +
    +
    +
    +
    +
    +
    }
    this.maskOnClick(evt) }> @@ -410,6 +478,64 @@ function Open() { $( "mask" ).css( "opacity", complete ).css( "display", "block" ); } }); + $( "side close" ).velocity( { left: 256 }); + tocRender(); + activeRender(); +} + +/** + * TocRender + */ +function tocRender() { + if ( $( "sidebar content toc" ).length > 0 ) return; + const ids = [], tocs = new Map(); + $( "tabs" ).find( "tab-label a" ).map( ( idx, item ) => ids.push( $(item).attr("value") )); + ids.forEach( ( id, idx ) => { + const levels = []; + $($( "tabs tab-group" )[idx]).find( "[data-head-level]" ).map( ( idx, item ) => { + const $item = $( item ), + id = "sr-toc-" + idx, + level = $item.attr( "data-head-level" ), + text = $item.attr( "data-head-title" ) || $item.text(); + levels.push({ id, level, text }); + $item.attr( "id", id ); + }); + tocs.set( id, levels ); + }); + $( "sidebar content" ).find( "a" ).map( ( idx, item ) => { + let html = ""; + const $item = $( item ), + id = $item.attr( "value" ), + levels = tocs.get( id ); + ids[idx] && levels.forEach( value => { + html += `${value.text}`; + }); + html.length > 0 && $item.after( `${html}` ); + }); + $( "sidebar content toc outline" ).on( "click", event => { + const id = $( event.currentTarget ).attr( "data-id" ), + trigger = $( event.currentTarget ).attr( "data-trigger" ); + if ( !location.hash.endsWith( trigger ) ) { + $( "tabs" ).find( `tab-label a[value=${trigger}]` )[0].click(); + } + // hack code + $( "tabs" ).find( "tab-group[active=true]" ).find( "#" + id )[0].scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'start' }); + }); +} + +/** + * Active Render + */ +function activeRender() { + $( "sidebar content" ).find( "a" ).map( ( idx, item ) => { + const $item = $( item ), + id = $item.attr( "value" ); + if ( location.hash.endsWith( id ) ) { + $item.addClass( "active" ); + } else { + $item.removeClass( "active" ); + } + }); } export { diff --git a/src/vender/mduikit/tooltip.jsx b/src/vender/mduikit/tooltip.jsx index 9152548f..596769a9 100644 --- a/src/vender/mduikit/tooltip.jsx +++ b/src/vender/mduikit/tooltip.jsx @@ -1,8 +1,8 @@ /*! * React Material Design: Tooltip * - * @version : 0.0.2 - * @update : 2018/05/01 + * @version : 0.0.3 + * @update : 2019/12/31 * @homepage: https://github.com/kenshin/mduikit * @license : MIT https://github.com/kenshin/mduikit/blob/master/LICENSE * @author : Kenshin Wang @@ -10,12 +10,15 @@ * @reference: * - https://material.io/guidelines/components/tooltips.html * - http://materializecss.com/dialogs.html + * - https://kazzkiq.github.io/balloon.css/ * * @copyright 2017 */ console.log( "==== simpread component: ToolTip ====" ) +import 'mintooltip'; + let started = false, timeout, $target, $back, style, styles = new Map(); const cssinjs = () => { const styles = { @@ -245,17 +248,27 @@ class ToolTip extends React.Component { * * @param {string} element, e.g. class: .xxx; id: #xxxx; tag: xxx * @param {string} id + * @param {boolean} usage mintooltip default */ -function Render( root, id ) { +function Render( root, id, is_mini = true ) { setTimeout( () => { const $root = !id ? $(root) : $(id); - $root.find( "[data-tooltip]" ).map( ( idx, item )=>{ + $root.find( "[data-tooltip]" ).map( ( idx, item ) => { const $item = $(item), position = $item.attr( "data-tooltip-position" ), delay = $item.attr( "data-tooltip-delay" ), text = $item.attr( "data-tooltip" ); - text && text != "" && + if ( is_mini ) { + $item + .removeAttr( "data-tooltip-position" ) + .removeAttr( "data-tooltip-delay" ) + .removeAttr( "data-tooltip" ) + .attr( "aria-label", text ) + .attr( "data-balloon-pos", position || "up" ); + } else { + text && text != "" && ReactDOM.render( , getTooltipRoot( $(root), id ) ); + } }); }, 500 ); } diff --git a/src/vender/notify/notify.css b/src/vender/notify/notify.css index 449bb4a6..50be1544 100644 --- a/src/vender/notify/notify.css +++ b/src/vender/notify/notify.css @@ -36,11 +36,12 @@ notify-gp notify { min-width: 288px; max-width: 568px; - height: 48px; - max-height: 48px; + /*height: 48px; + max-height: 48px;*/ + min-height: 48px; - color: rgba(255, 255, 255, .7); - background-color: rgba(50, 50, 50, 1); + color: rgba(255, 255, 255, 0.9); + background-color: #000; box-sizing: border-box; border-radius: 4px; @@ -50,9 +51,9 @@ notify-gp notify { opacity: 0; transform: scaleY(0); transform-origin: left top 0px; - transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms, opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0ms; + transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms, opacity 1s cubic-bezier(0.23, 1, 0.32, 1) 0ms; - box-shadow: 0 1px 3px 0 rgba(60,64,67,0.302), 0 4px 8px 3px rgba(60,64,67,0.149); + box-shadow: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12); } notify-gp notify-title { @@ -64,11 +65,12 @@ notify-gp notify-content { display: block; font-size: 14px; + font-weight: 400; text-align: left; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; + /*text-overflow: ellipsis; + white-space: nowrap;*/ } notify-gp notify-content a, @@ -98,6 +100,8 @@ notify-gp notify-content a:hover { notify-gp notify-i { display: none; + justify-content: center; + align-items: center; margin: 0 10px 0 0; @@ -112,25 +116,34 @@ notify-gp notify-action, notify-gp notify-cancel { display: none; - margin: 0 0 0 24px; + margin: 0 8px; max-width: 80px; min-width: 56px; + height: 36px; + line-height: 34px; - color: #8ab4f8; + color: #bb86fc; font-weight: 500; font-size: inherit; text-transform: uppercase; - text-align: right; + text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + transition: all 500ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; cursor: pointer; } +notify-gp notify-action:active, +notify-gp notify-cancel:active { + border-radius: 4px; + background-color: rgba(98, 0, 238, .3); +} + notify-gp notify-cancel { margin: 0; } @@ -145,11 +158,39 @@ notify-gp notify-a { cursor: pointer; } +notify-gp notify-exit { + display: none; + justify-content: center; + align-items: center; + + margin-left: 5px; + + width: 36px; + height: 36px; + min-width: 36px; + min-height: 36px; + + background-color: transparent; + + border-radius: 50%; + transition: all 500ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; + cursor: pointer; +} + +notify-gp notify-exit:hover { + background-color: rgba(255, 255, 255, 0.4); +} + +notify-gp notify-exit:active { + background-color: rgba(255, 255, 255, 0.2); +} + notify-gp notify-a notify-span { display: block; width: 16px; height: 16px; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABpFBMVEUAAADl5eXj4+NSVFRTVVVaXFxLTU1hY2NdX18pLCwhJCSdnp5sbm6HiYmjpKSDhYX///+rrKytrq6XmJgzNTUoKyt3eXlydHRlZ2dbXV1ucHB4enrv7++KjIyIiort7e1oamosLy8aHR0VGBgUFxcbHh4rLi5oamprbGwgIyMKDQ0KDQ0iJSVjZWWfoaEkJiYICwsLDg4KDQ0MDw8iJSWMjo41ODgMDw8JDAw2OTkvMTELDg4LDg4xMzM1NzcJDAwLDg40NjYeISEHCgoeISFkZmYtLy8yNDRvcXEWGRkHCgoaHR3///8RFBQHCgohJCShoqLIyMgaHR0HCgoZGxv4+PgRFBQLDg4xMzOWl5eam5ssLi4bHh7///8fIiIJDAwwMzNzdHQXGhoeISFlZmYsLi4KDQ0gIiI6PDwOEREuMDAXGhoHCgodHx8pLCwNEBA1ODj///8nKSkICwsICwsJDAwnKSnZ2dl9fn4pKysNDw8OEREpLCxyc3ORkpIzNTUjJSUVGBgUFxcgIyM5PDyanJwEBwcDBwcDBgYFCAgGCQn///+5RDDmAAAAhnRSTlMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQUFAQU+i7S0jkAGEYrw8Y8SBIn++Pr3jQQ67fx8dvX6iWr27z+B/YsOcoMPdPiEAaL7iAgEcfWsA6D7iAkGcawDef2LDnOFD3T4gTLnfHb6iWrqNQJ4+ff7fQILd+ToewsCLHWZmXUwAyFsKwcAAAABYktHRBCVsg0sAAAAzElEQVQY02NgwAoYZWTl5JngXGYFRSVlFVU1dRYIn1VDU6sNCLR1dNlAfHY9fQNDw/YOI2MDE1MOoACnmbmFpZW1ja2dvYMjFwMDN4NTp7OLq5u7h6dXpzcDDwOvj29bm59/QGBQcFtbSCgfA79AWFtHeERkVLR1W1tMrCCDEENcZ3xCYlJySmpaZzqDMAODSEamRVZ2cE5unn1+gSjQFrHCIqNir7a2nJLSsnJxkEMkKiqrutrauqpraiUhTpWqq29obGpuaZVmIAYAAO06McffKEk8AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEzLTA0LTAzVDE3OjE4OjAzKzA4OjAwRdgB9wAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMS0wNS0xOFQyMDowMTowMCswODowMB0r3XkAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOC44LTcgUTE2IHg4Nl82NCAyMDE0LTAyLTI4IGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3JnWaRffwAAABh0RVh0VGh1bWI6OkRvY3VtZW50OjpQYWdlcwAxp/+7LwAAABh0RVh0VGh1bWI6OkltYWdlOjpIZWlnaHQAMTI4Q3xBgAAAABd0RVh0VGh1bWI6OkltYWdlOjpXaWR0aAAxMjjQjRHdAAAAGXRFWHRUaHVtYjo6TWltZXR5cGUAaW1hZ2UvcG5nP7JWTgAAABd0RVh0VGh1bWI6Ok1UaW1lADEzMDU3MjAwNjArP9HVAAAAE3RFWHRUaHVtYjo6U2l6ZQAxLjAzS0JCZtQvXwAAAFx0RVh0VGh1bWI6OlVSSQBmaWxlOi8vL2hvbWUvZnRwLzE1MjAvZWFzeWljb24uY24vZWFzeWljb24uY24vY2RuLWltZy5lYXN5aWNvbi5jbi9wbmcvMTcvMTc4Ni5wbmcRsze7AAAAAElFTkSuQmCC); + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABDklEQVQ4T6VT0VFCQQzcrQA7ECoRK1AqEDugA6ECsQPsADvgVSAlaAlWEGdvkjchczI45Osud9nc7m2IEmY2BfAEYA5A6xsARwAHAB8ktR6DeWNmKwAvXlSxY78i+RabEcDM9gAe/qoq+T3JhXINwDu/Xlgc1zYk13TOn+XZA4C7AvgN4LbkZgJYO+84O5C8N7Odi6n8O8llh+ZGAD3uO5LPDgIvzoDRbBDAV+dputBAXKNecQM5B9CefQlAj0JwVmdLdGSwHI1CFXEgOS8ihia1WRNRdpU9JwlatpWVc0gr3c0xu95IAfdPK2uoHkcrJxANkzTJdPKTf3ROchvJk2n0LxNPfV9vnDVEJ+P8C6jMhLeGEqMKAAAAAElFTkSuQmCC); + opacity: .9; } notify-gp notify-i.holdon { @@ -165,24 +206,29 @@ notify-gp notify-i.holdon { notify-gp .notify-show { opacity: 1; - transform: scaleY(1); + transform: scaleY(1)!important; } notify-gp .notify-hide { - opacity: 0; - transform: scaleY(0); + animation-name: fadeOutUp; + animation-duration: 450ms; + animation-fill-mode: both; } notify-gp .notify-success { - color: rgba(118, 255, 3, .8); + background-color: rgb(76, 175, 80); } notify-gp .notify-warning { - color: rgba(255, 238, 88, 1); + background-color: rgb(255, 160, 0); } notify-gp .notify-error { - color: rgba(239, 83, 80, 1); + background-color: rgba(239, 83, 80, 1); +} + +notify-gp .notify-info { + background-color: rgb(25, 118, 210); } notify-gp .notify-modal { @@ -261,3 +307,42 @@ notify-gp .notify-snackbar { bottom: 0; right: 0; } + +@keyframes fadeOutUp { + from { + opacity: 1; + } + + to { + margin-top: 0; + padding: 0; + height: 0; + min-height: 0; + opacity: 0; + transform: scaleY(0); + } +} + +@media (pointer: coarse) { + notify-gp { + top: initial; + bottom: 0; + left: 0; + + margin: 0 10px 10px 10px; + } + + notify-gp notify { + width: 100%; + max-width: 600px; + } + + notify-gp .notify-show, + notify-gp .notify-hide { + transform-origin: bottom!important; + } + + notify-gp .notify-snackbar { + position: initial; + } +} \ No newline at end of file diff --git a/src/vender/notify/notify.js b/src/vender/notify/notify.js index 2a9d0910..9fe49119 100644 --- a/src/vender/notify/notify.js +++ b/src/vender/notify/notify.js @@ -6,7 +6,7 @@ * * - content ( string, required) * -* - type ( int, NORMAL/SUCCESS/WARING/ERROR) +* - type ( int, NORMAL/SUCCESS/WARING/ERROR/INFO) * ( optional, default is NORMAL ) * * - mode ( string, toast/modal/snackbar) @@ -58,7 +58,7 @@ * */ var Notify = ( function () { - var VERSION = "2.0.1", + var VERSION = "2.0.2.0105", name = "notify", root = "notify-gp", roottmpl= "<" + root + ">", @@ -67,6 +67,7 @@ var Notify = ( function () { SUCCESS = 1, WARNING = 2, ERROR = 3, + INFO = 4, MODE = { toast : "toast", modal : "modal", @@ -93,6 +94,7 @@ var Notify = ( function () { icon : "", action : "", cancel : "", + exit : undefined, callback: undefined, complete: undefined, }, @@ -106,7 +108,9 @@ var Notify = ( function () { \ \ \ + \ ', + exit = '', loading = '\ \ \ @@ -139,10 +143,11 @@ var Notify = ( function () { hidden( this ); }, hidden = function( target ) { - target.addClass( "notify-hide" ).slideUp( 500, function() { + target[0].addEventListener( 'animationend', function(e) { target.remove(); if ($root.children().length === 0 ) $root.css( "z-index", 0 ); - }); + }, false ); + target.css({ width: target[0].offsetWidth }).addClass( 'notify-hide' ); }, render = function() { var $target = $( TMPL ), @@ -152,8 +157,29 @@ var Notify = ( function () { $icon = $target.find(prefix( "i" )), $action = $target.find(prefix( "action" )), $cancel = $target.find(prefix( "cancel" )), + $exit = $target.find(prefix( "exit" )), item = "notify-item-" + num++, - position = this.constructor.Position; + position = this.constructor.Position, + isMobile = { + Android: function() { + return navigator.userAgent.match(/Android/i); + }, + BlackBerry: function() { + return navigator.userAgent.match(/BlackBerry/i); + }, + iOS: function() { + return navigator.userAgent.match(/iPhone|iPad|iPod/i); + }, + Opera: function() { + return navigator.userAgent.match(/Opera Mini/i); + }, + Windows: function() { + return navigator.userAgent.match(/IEMobile/i); + }, + verify: function() { + return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()) == null ? false : true; + } + }; this.title ? $title.text( this.title ) : $title.hide(); this.content ? $content.html( this.content ) : $content.hide(); @@ -167,18 +193,28 @@ var Notify = ( function () { this.mode == MODE.snackbar && $target.addClass( "notify-snackbar" ); } - this.mode !== MODE.modal && this.icon !== "" && - $icon.css({ "background-image": "url(" + this.icon + ")", "display": "block" }); + if ( this.mode !== MODE.modal && this.icon !== "" ) { + if ( this.icon.indexOf( ' -1 ) { + $icon.html( this.icon ).css({ display: 'flex' }); + } else $icon.css({ "background-image": "url(" + this.icon + ")", "display": "block" }); + } switch( this.type ) { case 1: - $content.addClass( "notify-success" ); + this.state != STATE.holdon && this.icon == "" && $icon.html( '' ).css({ display: 'flex' }); + $target.addClass( "notify-success" ); break; case 2: - $content.addClass( "notify-warning" ); + this.state != STATE.holdon && this.icon == "" && $icon.html( '' ).css({ display: 'flex' }); + $target.addClass( "notify-warning" ); break; case 3: - $content.addClass( "notify-error" ); + this.state != STATE.holdon && this.icon == "" && $icon.html( '' ).css({ display: 'flex' }); + $target.addClass( "notify-error" ); + break; + case 4: + this.state != STATE.holdon && this.icon == "" && $icon.html( '' ).css({ display: 'flex' }); + $target.addClass( "notify-info" ); break; } @@ -194,6 +230,15 @@ var Notify = ( function () { $root.on( "click", "." + item + " notify-cancel", [ item, this.callback, "cancel" ], callbackHander ); } + if ( this.type != 0 && this.icon.indexOf( ' -1 ) { + var css = function( element, property ) { + return window.getComputedStyle( element, null ).getPropertyValue( property ).toLowerCase().replace( / /g, "" ); + }, $span = $( '' ) + $( 'body' ).append( $span ); + !/fontawesome/.test( css( $span[0], 'font-family' ) ) && $icon.remove(); + $span.remove(); + } + this.mode !== MODE.modal && this.state !== STATE.loading && this.state !== STATE.holdon && ( this.action == "" || !this.callback || typeof this.callback != "function" ) && ( timer[item] = setTimeout( delayHandler.bind( $target, item ), this.delay ) ); @@ -223,8 +268,16 @@ var Notify = ( function () { } $target.addClass( item ); - $root.append( $target ).css( "z-index", 2147483647 ); - this.mode == MODE.snackbar && $target.css( "margin-left", "-" + $target.width()/2 + "px" ); + $root.css( "z-index", 2147483647 ); + isMobile.verify() ? $root.prepend( $target ) : $root.append( $target ); + + if ( this.mode == MODE.snackbar || this.exit ) { + $target.css( "margin-left", "-" + $target.width()/2 + "px" ); + if ( this.cancel == "" ) { + $exit.html( exit ).css( "display", "flex" ); + $root.on( "click", "." + item + " notify-exit", closeHandle ); + } + } setTimeout( function() { $target.addClass( "notify-show" ); }, 200 ); }; @@ -284,6 +337,7 @@ var Notify = ( function () { this.content = arguments[0]; this.action = arguments[1]; this.callback = arguments[2]; + this.exit = true; break; case 4: if ( arguments[0] == MODE.snackbar ) { diff --git a/src/vender/puread/puplugin.min.js b/src/vender/puread/puplugin.min.js index 542b15a8..a297f030 100644 --- a/src/vender/puread/puplugin.min.js +++ b/src/vender/puread/puplugin.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(function(e,t){e.exports=function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var n=function(){function e(e,t){for(var r=0;r=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,a=0;a-1;a--){var n=r[a];if(8!==n.nodeType&&n.textContent)return n===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=void 0,n=void 0,i=r.snapshotLength-1;i>-1;--i)if(a=r.snapshotItem(i),this.canIgnoreNode(a))n=a;else{var o=this.spacing(a.data);if(a.data!==o&&(a.data=o),n){if(a.nextSibling&&a.nextSibling.nodeName.search(this.spaceLikeTags)>=0){n=a;continue}var s=a.data.toString().substr(-1)+n.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=n;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=a;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){n=a;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(n.previousSibling?-1===n.previousSibling.nodeName.search(this.spaceLikeTags)&&(n.data=" "+n.data):this.canIgnoreNode(n)||(n.data=" "+n.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))a.data=a.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}n=a}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,v=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(a,"$1 $2")).replace(n,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),v=t.replace(h,"$1 $2 $4");return t=v,r===v&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),w=new v;(e.exports=w).Pangu=v}])});n.pangu;function i(e,t){for(var r=0,a=e.length-1;a>=0;a--){var n=e[a];"."===n?e.splice(a,1):".."===n?(e.splice(a,1),r++):r&&(e.splice(a,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var a=r>=0?arguments[r]:"/";if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,t="/"===a.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var a=r(e.split("/")),n=r(t.split("/")),i=Math.min(a.length,n.length),o=i,s=0;s=0&&c>0){for(a=[],i=r.length;u>=0&&!s;)u==l?(a.push(u),l=r.indexOf(e,u+1)):1==a.length?s=[a.pop(),c]:((n=a.pop())=0?l:c;a.length&&(s=[i,o])}return s}E.range=x;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var a=[];var n=k("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body);var s=i||o;var l=n.body.indexOf(",")>=0;if(!s&&!l)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+C+n.post,e(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var a=k("{","}",t);if(!a)return t.split(",");var n=a.pre;var i=a.body;var o=a.post;var s=n.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(n.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=n.post.length?e(n.post,!1):[""];return u.map(function(e){return n.pre+c[0]+e})}var d=n.pre;var u=n.post.length?e(n.post,!1):[""];var h;if(s){var f=j(c[0]),p=j(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(j(c[2])):1,_=I,b=p0){var x=new Array(T+1).join("0");E=y<0?"-"+x+E.slice(1):x+E}}h.push(E)}}else h=w(c,function(t){return e(t,!1)});for(var N=0;N=t}var R=v&&m||v,H=Y;Y.Minimatch=Q;var D={sep:"/"};try{D=R}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},U={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},q="[^/]",F=q+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==D.sep&&(e=e.split(D.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,a,n){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,a,n){return t.minimatch(r,a,K(e,n))};return r.Minimatch=function(r,a){return new t.Minimatch(r,K(e,a))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var a=0,n=e.length;a65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var a,n="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(a){switch(a){case"*":n+=F,i=!0;break;case"?":n+=q,i=!0;break;default:n+="\\"+a}f.debug("clearStateChar %j %j",a,n),a=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,n,g),o&&X[g])n+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,n,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),n+=g;continue}f.debug("call clearStateChar %j",a),p(),a=g,r.noext&&p();continue;case"(":if(c){n+="(";continue}if(!a){n+="\\(";continue}s.push({type:a,start:m-1,reStart:n.length,open:U[a].open,close:U[a].close}),n+="!"===a?"(?:(?!(?:":"(?:",this.debug("plType %j %j",a,n),a=!1;continue;case")":if(c||!s.length){n+="\\)";continue}p(),i=!0;var b=s.pop();n+=b.close,"!"===b.type&&l.push(b),b.reEnd=n.length;continue;case"|":if(c||!s.length||o){n+="\\|",o=!1;continue}p(),n+="|";continue;case"[":if(p(),c){n+="\\"+g;continue}c=!0,d=m,u=n.length,n+=g;continue;case"]":if(m===d+1||!c){n+="\\"+g,o=!1;continue}if(c)var v,w=e.substring(d+1,m);i=!0,c=!1,n+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(n+="\\"),n+=g}c&&(w=e.substr(d+1),v=this.parse(w,ee),n=n.substr(0,u)+"\\["+v[0],i=i||v[1]);for(b=s.pop();b;b=s.pop()){var y=n.slice(b.reStart+b.open.length);this.debug("setting tail",n,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,n);var k="*"===b.type?F:"?"===b.type?q:"\\"+b.type;i=!0,n=n.slice(0,b.reStart)+k+"\\("+y}p(),o&&(n+="\\\\");var E=!1;switch(n.charAt(0)){case".":case"[":case"(":E=!0}for(var T=l.length-1;T>-1;T--){var x=l[T],N=n.slice(0,x.reStart),A=n.slice(x.reStart,x.reEnd-8),S=n.slice(x.reEnd-8,x.reEnd),C=n.slice(x.reEnd);S+=C;var P=N.split("(").length-1,L=C;for(m=0;m=0&&!(a=e[n]);n--);for(n=0;n>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=a.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(n===o&&i===s)return!0;if(n===o)return r;if(i===s)return n===o-1&&""===e[n];throw new Error("wtf?")};var te=Object.freeze({specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),a=r.find("img").map(function(e,t){return"
    "+t.outerHTML+"
    "}).get().join("");r.empty().removeAttr("class").append(a)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),a=r.find("img"),n=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(a).append(n)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),a=r.attr("src");a&&a.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),a=r.attr("data-tb-lazyload"),n=r.attr("username");a&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==n&&r.parent().find("img").attr("src",a)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),a=r.attr("data-src");r.replaceWith('')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),a=r.parent(),n=r.attr("src"),i=r.attr("smilieid");a.is("ignore_js_op")&&r.unwrap(),i&&n&&n.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),a=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",a)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),a=r.find("pre"),n=r.find("table");r.html(a[1]),n.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),a=r.find("pre");r.html(a[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),a=r.attr("data-src");r.replaceWith('
    ')}),$("body img").each(function(e,t){var r=$(t),a=r.parent();if("column-gif"==r.attr("class")&&"GifPlayer"==a.attr("class")){var n=a.parent().prev();if(n.is("noscript")){var i=n.html(),o=$(i),s=o.attr("src"),l=o.attr("data-thumbnail");$('sr-read img[src="'+l+'"]').attr("src",s)}}}),setTimeout(function(){t.find("img").each(function(e,t){$(t).attr("src").endsWith(".gif")&&$(t).parent().next().is("svg")&&$(t).parent().next().remove()})},500);break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),a=r.find("img");r.html(a)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),a=r.find("img");r.replaceWith('
    ')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,a="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,a="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,a="div"):["chiphell.com"].includes(e)&&(r=!0,a="font"),r&&t.find(a).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"\n?
    (\n?
    )*/g,"
    ").replace(/\/(div|p)>\n*(
    \n)+/g,function(e){return e.replace("
    ","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),a=(r.parent(),$("")),n=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("real_src"),u=function(){a.removeClass("sr-rd-content-img-load"),a[0].clientWidth<300&&a[0].clientHeight<300?a.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):a[0].clientWidth>1e3?a.css("zoom","0.6"):a[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(a.attr("height",620),a[0].clientWidth<$("sr-rd-content").width()&&a.css({width:"auto"})),a[0].clientWidth>$("sr-rd-content").width()&&a.addClass("sr-rd-content-img")},d=function(){a.addClass("simpread-hidden"),a.parent().hasClass("sr-rd-content-center")&&a.parent().removeAttr("class").addClass("simpread-hidden")},h=void 0;r.parent()[0].tagName.toLowerCase(),h=s||n,h=i||h,h=o||h,h=l||h,!(h=c||h)||h.startsWith("http")||h.startsWith("data")||(h=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var a;if("string"!=typeof r)return(a=document.createElement("a")).href=t,a.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(a=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=a.pathname.split("/")).pop(),t=t.split("/");for(var n=0;n
  • "),/win|mac/i.test(navigator.platform)?a.one("load",function(){return u()}).one("error",function(){return d()}):a.on("load",function(){return u()}).on("error",function(){return d()})}),t.find("sr-blockquote").map(function(t,r){var a=$(r),n=a.parent();a.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&n.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("
    ")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style")},cleanHTML:function(e,t,r){t&&e.find("pre").each(function(e,t){var r="",a=!1,n=!1;$(t).find("li").each(function(e,t){$(t).find("code").length>0&&(a=!0),""!=t.outerText.trim()&&(r+=t.outerText.replace(/\n/gi,"").replace(//gi,">")+"\n")}),0==a&&$(t).find("code").each(function(e,t){n=!0,""!=t.outerText.trim()&&(r+=t.outerText.replace(//gi,">")+"\n")}),a||n||(r+=t.outerText.replace(//gi,">")+"\n"),$(t).removeAttr("style").removeAttr("class").removeAttr("id").html(r)});var a,n,i=e.html();"readability-page-1"==$(e.children()).attr("id")&&1==e.children().children().length?i=e.children().children().html():1==e.children().length&&(i=e.children().html()),i=i.replace(//gi,""),e.html((a=i,n="",$.parseHTML(a).forEach(function(e,a){var i=e.tagName,o=e.outerText,s=e.outerHTML;void 0==i?n+="

    "+e.textContent.replace(//gi,">").replace(/^\n|\n$/gi,"").trim()+"

    ":"PRE"==i?n+=s:(""!=o||s.includes("0?t.join("").replace(/, $/,""):null}function oe(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var a=$("head").find("style#simpread-custom-"+e);0==a.length?$("head").append('"):a.html(r)}function se(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('"):r.html(t)}var le=Object.freeze({GetColor:ie,BgColor:function(e,t){var r="rgba("+ie(e)+", "+t/100+")";return $(ae).css(re,r),r},Opacity:function(e){var t=ie($(ae).css(re)),r="rgba("+t+", "+e/100+")";return t?($(ae).css(re,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ne&&void 0==(ne=$("html").attr("style"))&&(ne=""),e?$("html").attr("style","font-size: "+e+"!important;"+ne):$("html").attr("style",ne)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&oe(t,e[t])}),se("css",e.css)},Custom:oe,CSS:se,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ce(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._wrap=null,this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t=e.nodeName+" ";if(e.nodeType==e.TEXT_NODE)return t+'("'+e.textContent+'")';var r=e.className&&"."+e.className.replace(/ /g,"."),a="";return e.id?a="(#"+e.id+r+")":r&&(a="("+r+")"),t+a},this.log=function(){if("undefined"!=typeof dump){var e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" ");dump("Reader: (Readability) "+e+"\n")}else if("undefined"!=typeof console)["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ce.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){for(var r=e.length-1;r>=0;r--){var a=e[r],n=a.parentNode;n&&(t&&!t.call(this,a,r,e)||n.removeChild(a))}},_replaceNodeTags:function(e,t){for(var r=e.length-1;r>=0;r--){var a=e[r];this._setNodeTag(a,t)}},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,r=this._doc.documentURI;function a(e){if(t==r&&"#"==e.charAt(0))return e;try{return new URL(e,t).href}catch(e){}return e}var n=this._getAllNodesWithTag(e,["a"]);this._forEachNode(n,function(e){var t=e.getAttribute("href");if(t)if(0===t.indexOf("javascript:")){var r=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",a(t))});var i=this._getAllNodesWithTag(e,["img"]);this._forEachNode(i,function(e){var t=e.getAttribute("src");t&&e.setAttribute("src",a(t))})},_getArticleTitle:function(){var e=this._doc,t="",r="";try{"string"!=typeof(t=r=e.title.trim())&&(t=r=this._getInnerText(e.getElementsByTagName("title")[0]))}catch(e){}var a=!1;function n(e){return e.split(/\s+/).length}if(/ [\|\-\\\/>»] /.test(t))a=/ [\\\/>»] /.test(t),n(t=r.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))<3&&(t=r.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var i=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),o=t.trim();this._someNode(i,function(e){return e.textContent.trim()===o})||(n(t=r.substring(r.lastIndexOf(":")+1))<3?t=r.substring(r.indexOf(":")+1):n(r.substr(0,r.indexOf(":")))>5&&(t=r))}else if(t.length>150||t.length<15){var s=e.getElementsByTagName("h1");1===s.length&&(t=this._getInnerText(s[0]))}var l=n(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!a||l!=n(r.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=r),t},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t=e.nextSibling,r=!1;(t=this._nextElement(t))&&"BR"==t.tagName;){r=!0;var a=t.nextSibling;t.parentNode.removeChild(t),t=a}if(r){var n=this._doc.createElement("p");for(e.parentNode.replaceChild(n,e),t=n.nextSibling;t;){if("BR"==t.tagName){var i=this._nextElement(t.nextSibling);if(i&&"BR"==i.tagName)break}if(!this._isPhrasingContent(t))break;var o=t.nextSibling;n.appendChild(t),t=o}for(;n.lastChild&&this._isWhitespace(n.lastChild);)n.removeChild(n.lastChild);"P"===n.parentNode.tagName&&this._setNodeTag(n.parentNode,"DIV")}})},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability);for(var a=0;a0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2")}}this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;if(this._hasSingleTagInsideElement(t,"TR")){var r=t.firstElementChild;if(this._hasSingleTagInsideElement(r,"TD")){var a=r.firstElementChild;a=this._setNodeTag(a,this._everyNode(a.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(a,e)}}})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var r=e.getAttribute("rel"),a=e.getAttribute("itemprop");return!(!("author"===r||a&&-1!==a.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0)},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,a=[];e.parentNode&&(a.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return a},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,r=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var a=e.innerHTML;;){for(var n=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;){var s=o.className+" "+o.id;if(this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!n||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(var l=null,c=o.firstChild;c;){var u=c.nextSibling;if(this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}if(this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25){var d=o.children[0];o.parentNode.replaceChild(d,o),o=d,i.push(o)}else this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o)}var h=[];this._forEachNode(i,function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t=this._getInnerText(e);if(!(t.length<25)){var r=this._getNodeAncestors(e,3);if(0!==r.length){var a=0;a+=1,a+=t.split(",").length,a+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=a/r}})}}}});for(var f=[],p=0,g=h.length;pv.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}}}var w,y=f[0]||null,k=!1;if(null===y||"BODY"===y.tagName){y=t.createElement("DIV"),k=!0;for(var E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),y.appendChild(E[0]);e.appendChild(y),this._initializeNode(y)}else if(y){for(var T=[],x=1;x=.75&&T.push(this._getNodeAncestors(f[x]));if(T.length>=3)for(w=y.parentNode;"BODY"!==w.tagName;){for(var N=0,A=0;A=3){y=w;break}w=w.parentNode}y.readability||this._initializeNode(y),w=y.parentNode;for(var S=y.readability.contentScore,C=S/3;"BODY"!==w.tagName;)if(w.readability){var P=w.readability.contentScore;if(PS){y=w;break}S=w.readability.contentScore,w=w.parentNode}else w=w.parentNode;for(w=y.parentNode;"BODY"!=w.tagName&&1==w.children.length;)w=(y=w).parentNode;y.readability||this._initializeNode(y)}var L=t.createElement("DIV");r&&(L.id="readability-content");for(var j=Math.max(10,.2*y.readability.contentScore),z=(w=y.parentNode).children,M=0,$=z.length;M<$;M++){var B=z[M],I=!1;if(this.log("Looking at sibling node:",B,B.readability?"with score "+B.readability.contentScore:""),this.log("Sibling has score",B.readability?B.readability.contentScore:"Unknown"),B===y)I=!0;else{var O=0;if(B.className===y.className&&""!==y.className&&(O+=.2*y.readability.contentScore),B.readability&&B.readability.contentScore+O>=j)I=!0;else if("P"===B.nodeName){var R=this._getLinkDensity(B),H=this._getInnerText(B),D=H.length;D>80&&R<.25?I=!0:D<80&&D>0&&0===R&&-1!==H.search(/\.( |$)/)&&(I=!0)}}I&&(this.log("Appending node:",B),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(B.nodeName)&&(this.log("Altering sibling:",B,"to div."),B=this._setNodeTag(B,"DIV")),L.appendChild(B),M-=1,$-=1)}if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),k)y.id="readability-page-1",y.className="page";else{var G=t.createElement("DIV");G.id="readability-page-1",G.className="page";var U=L.childNodes;for(this._wrap=L.childNodes[0].outerHTML.replace(L.childNodes[0].innerHTML,"");U.length;)G.appendChild(U[0]);L.appendChild(G)}this._debug&&this.log("Article content after paging: "+L.innerHTML);var q=!0,F=this._getInnerText(L,!0).length;if(F0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),a=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,n=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r=e.getAttribute("name"),i=e.getAttribute("property"),o=e.getAttribute("content");if(o){var s=null,l=null;if(i&&(s=i.match(a)))for(var c=s.length-1;c>=0;c--)l=s[c].toLowerCase().replace(/\s/g,""),t[l]=o.trim();!s&&r&&n.test(r)&&(l=r,o&&(l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[l]=o.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){if(e&&"svg"!==e.tagName.toLowerCase()){for(var t=0;t0&&n>r)return!1;if(e.parentNode.tagName===t&&(!a||a(e.parentNode)))return!0;e=e.parentNode,n++}return!1},_getRowAndColumnCount:function(e){for(var t=0,r=0,a=e.getElementsByTagName("tr"),n=0;n0)a._readabilityDataTable=!0;else{if(["col","colgroup","tfoot","thead","th"].some(function(e){return!!a.getElementsByTagName(e)[0]}))this.log("Data table because found data-y descendant"),a._readabilityDataTable=!0;else if(a.getElementsByTagName("table")[0])a._readabilityDataTable=!1;else{var i=this._getRowAndColumnCount(a);i.rows>=10||i.columns>4?a._readabilityDataTable=!0:a._readabilityDataTable=i.rows*i.columns>10}}}else a._readabilityDataTable=!1;else a._readabilityDataTable=!1}},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var a=function(e){return e._readabilityDataTable};if("table"===t&&a(e))return!1;if(this._hasAncestorTag(e,"table",-1,a))return!1;var n=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),n+0<0)return!0;if(this._getCharCount(e,",")<10){for(var i=e.getElementsByTagName("p").length,o=e.getElementsByTagName("img").length,s=e.getElementsByTagName("li").length-100,l=e.getElementsByTagName("input").length,c=0,u=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),d=0;d1&&i/o<.5&&!this._hasAncestorTag(e,"figure")||!r&&s>i||l>Math.floor(i/3)||!r&&p<25&&(0===o||o>2)&&!this._hasAncestorTag(e,"figure")||!r&&n<25&&f>.2||n>=25&&f>.5||1===c&&p<75||c>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),a=this._getNextNode(e);a&&a!=r;)a=t(a,a.className+" "+a.id)?this._removeAndGetNext(a):this._getNextNode(a)},_cleanHeaders:function(e){for(var t=1;t<3;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._removeScripts(this._doc),this._prepDocument();var t=this._getArticleMetadata();this._articleTitle=t.title;var r=this._grabArticle();if(!r)return null;if(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),!t.excerpt){var a=r.getElementsByTagName("p");a.length>0&&(t.excerpt=a[0].textContent.trim())}var n=r.textContent;return{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,wrap:this._wrap,textContent:n,length:n.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}}};var ue=Object.freeze({Readability:ce}),de=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
    (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
    foo
    ",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var a in t)t.hasOwnProperty(a)&&(r[a]=t[a].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",n={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o").replace(/&/g,"&")};var d=function(e,t,r,a){var n,i,o,s,l,c=a||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(n=0;o=d.exec(e);)if(h.test(o[0]))n++||(s=(i=d.lastIndex)-o[0].length);else if(n&&!--n){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(n&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,a){for(var n=d(e,t,r,a),i=[],o=0;o0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h=0?a+(r||0):a},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var a=r(e,t);if(!a.valid)throw Error(a.error);for(var n=0;n[ \t]+¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var a={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],a=0;a'}else r.push(t[a].innerHTML),t[a].innerHTML="",t[a].setAttribute("prenum",a.toString());return r}(r)};!function e(t){for(var r=0;r? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(n||(n=a.toLowerCase().replace(/ ?\n/g," ")),o="#"+n,i.helper.isUndefined(r.gUrls[n]))return e;o=r.gUrls[n],i.helper.isUndefined(r.gTitles[n])||(c=r.gTitles[n])}var u='"+a+""};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,a)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,a)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,a)).replace(/\[([^\[\]]+)]()()()()()/g,a),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,a,n,o){if("\\"===a)return r+n;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'"+n+""})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,a,n,o,s,l){var c=a=a.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(a)&&(a=a.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'"+c+""+u+f}},b=function(e,t){return function(r,a,n){var o="mailto:";return a=a||"",n=i.subParser("unescapeSpecialChars")(n,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+n),n=i.helper.encodeEmailAddress(n)):o+=n,a+''+n+""}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var a=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(a=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(a,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^  /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("
    \n"+e+"\n
    ",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,a,n){var o=a,s=n,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="
    "+o+l+"
    ",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,a,n,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=a+""+(s=i.subParser("encodeCode")(s,t,r))+"",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var a="html",n="\n",i="",o='\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(n="\n","html"!==(a=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==a||(o='')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i=""+r.metadata.parsed.title+"\n";break;case"charset":o="html"===a||"html5"===a?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=n+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,a=4-r.length%4,n=0;n/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,a,n,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
    "+o+s+"
    ",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,a,n,o){var s=n+i.subParser("encodeCode")(a,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var a=t;return a=(a=(a=a.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(a)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var a=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],n=function(e,t,a,n){var i=e;return-1!==a.search(/\bmarkdown\b/)&&(i=a+r.converter.makeHtml(t)+n),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+a[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],n,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function a(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return a(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return a(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return a(e)})).replace(/<[^>]+?>/gi,function(e){return a(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var a=0;a]*>\\s*]*>","^ {0,3}\\s*
    ","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function a(e){var a,n;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return a=e,n=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(a=n+a),a=t.ghCompatibleHeaderId?a.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?a.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():a.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(a=n+a),r.hashLinkCounts[a]?a=a+"-"+r.hashLinkCounts[a]++:r.hashLinkCounts[a]=1,a}e=r.converter._dispatch("headers.before",e,t,r);var n=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+a(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+a(o)+'"',c=n+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+a(s)+'"',d=n-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var a=i.subParser("hashBlock")("
    ",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,a)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,a)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,a),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function a(e,t,a,n,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(a=a.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)n="";else if(""===n||null===n){if(""!==a&&null!==a||(a=t.toLowerCase().replace(/ ?\n/g," ")),n="#"+a,i.helper.isUndefined(u[a]))return e;n=u[a],i.helper.isUndefined(d[a])||(c=d[a]),i.helper.isUndefined(h[a])||(o=h[a].width,s=h[a].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,a)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,n,i,o,s,l){return a(e,t,r,n=n.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,a)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,a)).replace(/!\[([^\[\]]+)]()()()()()/g,a),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function a(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return a(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return a(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return a(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function a(e,a){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(n,function(e,a,n,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),a||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,a&&(e=e.replace(/\s+$/,"")),e}function n(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=n(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+a(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+a(u,!!i)+"\n"}(e);else{var u=n(e,r);c="\n\n<"+r+u+">\n"+a(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,a){return o(r,a.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function a(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,a){return r.metadata.parsed[t]=a,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return a(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,n){return t&&(r.metadata.format=t),a(n),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var a=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),n=[],o=a.length,s=0;s=0?n.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

    "),l+="

    ",n.push(l))}for(o=n.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}n[s]=u}return e=(e=(e=n.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,a){if(e.filter)t=e.filter(t,a.converter,r);else if(e.regex){var n=e.regex;n instanceof RegExp||(n=new RegExp(n,"g")),t=t.replace(n,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
    \n")):e=e.replace(/ +\n/g,"
    \n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,a){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(a)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var a=function(e,a,n,o,s,l,c){return a=a.toLowerCase(),n.match(/^data:.+?\/.+?;base64,/)?r.gUrls[a]=n.replace(/\s/g,""):r.gUrls[a]=i.subParser("encodeAmpsAndAngles")(n,t,r),l?l+c:(c&&(r.gTitles[a]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[a]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,a)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,a)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function a(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function n(e,a){var n="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(n=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,a){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",n=0;n\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var a=e.childNodes,n=a.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),a=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[a]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var a=e.childNodes,n=a.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var a=e.childNodes,n=a.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var a="";if(!e.hasChildNodes())return"";for(var n=e.childNodes,o=n.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var a=e.childNodes,n=a.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),he={pangu:n,minimatch:H,beautify:te,style:le,rdability:ue,markdown:Object.freeze({default:de,__moduleExports:de})};e.Plugin=function(e){return void 0==e?he:he[e]},Object.defineProperty(e,"__esModule",{value:!0})}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.puplugin={})}(this,function(e){"use strict";var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e,t){return e(t={exports:{}},t.exports),t.exports}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(function(e,t){e.exports=function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){var n=function(){function e(e,t){for(var r=0;r=0||t.isContentEditable||"true"===t.getAttribute("g_editable"))return!0;t=t.parentNode}return!1}},{key:"isFirstTextChild",value:function(e,t){for(var r=e.childNodes,a=0;a-1;a--){var n=r[a];if(8!==n.nodeType&&n.textContent)return n===t}return!1}},{key:"spacingNodeByXPath",value:function(e,t){for(var r=document.evaluate(e,t,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=void 0,n=void 0,i=r.snapshotLength-1;i>-1;--i)if(a=r.snapshotItem(i),this.canIgnoreNode(a))n=a;else{var o=this.spacing(a.data);if(a.data!==o&&(a.data=o),n){if(a.nextSibling&&a.nextSibling.nodeName.search(this.spaceLikeTags)>=0){n=a;continue}var s=a.data.toString().substr(-1)+n.data.toString().substr(0,1),l=this.spacing(s);if(l!==s){for(var c=n;c.parentNode&&-1===c.nodeName.search(this.spaceSensitiveTags)&&this.isFirstTextChild(c.parentNode,c);)c=c.parentNode;for(var u=a;u.parentNode&&-1===u.nodeName.search(this.spaceSensitiveTags)&&this.isLastTextChild(u.parentNode,u);)u=u.parentNode;if(u.nextSibling&&u.nextSibling.nodeName.search(this.spaceLikeTags)>=0){n=a;continue}if(-1===u.nodeName.search(this.blockTags))if(-1===c.nodeName.search(this.spaceSensitiveTags))-1===c.nodeName.search(this.ignoreTags)&&-1===c.nodeName.search(this.blockTags)&&(n.previousSibling?-1===n.previousSibling.nodeName.search(this.spaceLikeTags)&&(n.data=" "+n.data):this.canIgnoreNode(n)||(n.data=" "+n.data));else if(-1===u.nodeName.search(this.spaceSensitiveTags))a.data=a.data+" ";else{var d=document.createElement("pangu");d.innerHTML=" ",c.previousSibling?-1===c.previousSibling.nodeName.search(this.spaceLikeTags)&&c.parentNode.insertBefore(d,c):c.parentNode.insertBefore(d,c),d.previousElementSibling||d.parentNode&&d.parentNode.removeChild(d)}}}n=a}}},{key:"spacingNode",value:function(e){this.spacingNodeByXPath(".//*/text()[normalize-space(.)]",e)}},{key:"spacingElementById",value:function(e){var t='id("'+e+'")//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByClassName",value:function(e){var t='//*[contains(concat(" ", normalize-space(@class), " "), "'+e+'")]//text()';this.spacingNodeByXPath(t,document)}},{key:"spacingElementByTagName",value:function(e){var t="//"+e+"//text()";this.spacingNodeByXPath(t,document)}},{key:"spacingPageTitle",value:function(){this.spacingNodeByXPath("/html/head/title/text()",document)}},{key:"spacingPageBody",value:function(){for(var e="/html/body//*/text()[normalize-space(.)]",t=["script","style","textarea"],r=0;r])([A-Za-z0-9])/g,d=/([A-Za-z0-9])([\+\-\*\/=&\\|<>])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,h=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c]+(.*?)[\)\]\}>\u201d]+)([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,f=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([\(\[\{<\u201c>])/g,p=/([\)\]\}>\u201d<])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,g=/([\(\[\{<\u201c]+)(\s*)(.+?)(\s*)([\)\]\}>\u201d]+)/,m=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([~!;:,\.\?\u2026])([A-Za-z0-9])/g,_=/([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])([A-Za-z0-9`\$%\^&\*\-=\+\\\|\/@\u00a1-\u00ff\u2022\u2027\u2150-\u218f])/g,b=/([A-Za-z0-9`~\$%\^&\*\-=\+\\\|\/!;:,\.\?\u00a1-\u00ff\u2022\u2026\u2027\u2150-\u218f])([\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/g,v=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"spacing",value:function(e){var t=e,r=t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(a,"$1 $2")).replace(n,"$1 $2")).replace(i,"$1$3$5")).replace(o,"$1$3$4")).replace(s,"$1 $2$3$4 $5")).replace(l,"$1 $2")).replace(c,"$1 $3")).replace(u,"$1 $2 $3")).replace(d,"$1 $2 $3"),v=t.replace(h,"$1 $2 $4");return t=v,r===v&&(t=(t=t.replace(f,"$1 $2")).replace(p,"$1 $2")),t=(t=(t=(t=t.replace(g,"$1$3$5")).replace(m,"$1$2 $3")).replace(_,"$1 $2")).replace(b,"$1 $2")}},{key:"spacingText",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){}:arguments[1];try{var r=this.spacing(e);t(null,r)}catch(e){t(e)}}}]),e}(),w=new v;(e.exports=w).Pangu=v}])});n.pangu;function i(e,t){for(var r=0,a=e.length-1;a>=0;a--){var n=e[a];"."===n?e.splice(a,1):".."===n?(e.splice(a,1),r++):r&&(e.splice(a,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(e){return o.exec(e).slice(1)};function l(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var a=r>=0?arguments[r]:"/";if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(e=a+"/"+e,t="/"===a.charAt(0))}return e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."}function c(e){var t=u(e),r="/"===b(e,-1);return(e=i(_(e.split("/"),function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function u(e){return"/"===e.charAt(0)}function d(){return c(_(Array.prototype.slice.call(arguments,0),function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function h(e,t){function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=l(e).substr(1),t=l(t).substr(1);for(var a=r(e.split("/")),n=r(t.split("/")),i=Math.min(a.length,n.length),o=i,s=0;s=0&&c>0){for(a=[],i=r.length;u>=0&&!s;)u==l?(a.push(u),l=r.indexOf(e,u+1)):1==a.length?s=[a.pop(),c]:((n=a.pop())=0?l:c;a.length&&(s=[i,o])}return s}E.range=x;var N=function(e){if(!e)return[];"{}"===e.substr(0,2)&&(e="\\{\\}"+e.substr(2));return function e(t,r){var a=[];var n=k("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body);var o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body);var s=i||o;var l=n.body.indexOf(",")>=0;if(!s&&!l)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+S+n.post,e(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=function e(t){if(!t)return[""];var r=[];var a=k("{","}",t);if(!a)return t.split(",");var n=a.pre;var i=a.body;var o=a.post;var s=n.split(",");s[s.length-1]+="{"+i+"}";var l=e(o);o.length&&(s[s.length-1]+=l.shift(),s.push.apply(s,l));r.push.apply(r,s);return r}(n.body)).length&&1===(c=e(c[0],!1).map(M)).length){var u=n.post.length?e(n.post,!1):[""];return u.map(function(e){return n.pre+c[0]+e})}var d=n.pre;var u=n.post.length?e(n.post,!1):[""];var h;if(s){var f=j(c[0]),p=j(c[1]),g=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(j(c[2])):1,_=I,b=p0){var x=new Array(T+1).join("0");E=y<0?"-"+x+E.slice(1):x+E}}h.push(E)}}else h=w(c,function(t){return e(t,!1)});for(var N=0;N=t}var H=v&&m||v,R=Y;Y.Minimatch=Q;var D={sep:"/"};try{D=H}catch(e){}var G=Y.GLOBSTAR=Q.GLOBSTAR={},q={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},U="[^/]",F=U+"*?",V="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",W="(?:(?!(?:\\/|^)\\.).)*?",X="().*{}+?[]^$\\!".split("").reduce(function(e,t){return e[t]=!0,e},{});var Z=/\/+/;function K(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function Y(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),!(!r.nocomment&&"#"===t.charAt(0))&&(""===t.trim()?""===e:new Q(t,r).match(e))}function Q(e,t){if(!(this instanceof Q))return new Q(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==D.sep&&(e=e.split(D.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function J(e,t){if(t||(t=this instanceof Q?this.options:{}),void 0===(e=void 0===e?this.pattern:e))throw new TypeError("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:N(e)}Y.filter=function(e,t){return t=t||{},function(r,a,n){return Y(r,e,t)}},Y.defaults=function(e){if(!e||!Object.keys(e).length)return Y;var t=Y,r=function(r,a,n){return t.minimatch(r,a,K(e,n))};return r.Minimatch=function(r,a){return new t.Minimatch(r,K(e,a))},r},Q.defaults=function(e){return e&&Object.keys(e).length?Y.defaults(e).Minimatch:Q},Q.prototype.debug=function(){},Q.prototype.make=function(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error);this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(Z)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r},Q.prototype.parseNegate=function(){var e=this.pattern,t=!1,r=0;if(this.options.nonegate)return;for(var a=0,n=e.length;a65536)throw new TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&"**"===e)return G;if(""===e)return"";var a,n="",i=!!r.nocase,o=!1,s=[],l=[],c=!1,u=-1,d=-1,h="."===e.charAt(0)?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",f=this;function p(){if(a){switch(a){case"*":n+=F,i=!0;break;case"?":n+=U,i=!0;break;default:n+="\\"+a}f.debug("clearStateChar %j %j",a,n),a=!1}}for(var g,m=0,_=e.length;m<_&&(g=e.charAt(m));m++)if(this.debug("%s\t%s %s %j",e,m,n,g),o&&X[g])n+="\\"+g,o=!1;else switch(g){case"/":return!1;case"\\":p(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,m,n,g),c){this.debug(" in class"),"!"===g&&m===d+1&&(g="^"),n+=g;continue}f.debug("call clearStateChar %j",a),p(),a=g,r.noext&&p();continue;case"(":if(c){n+="(";continue}if(!a){n+="\\(";continue}s.push({type:a,start:m-1,reStart:n.length,open:q[a].open,close:q[a].close}),n+="!"===a?"(?:(?!(?:":"(?:",this.debug("plType %j %j",a,n),a=!1;continue;case")":if(c||!s.length){n+="\\)";continue}p(),i=!0;var b=s.pop();n+=b.close,"!"===b.type&&l.push(b),b.reEnd=n.length;continue;case"|":if(c||!s.length||o){n+="\\|",o=!1;continue}p(),n+="|";continue;case"[":if(p(),c){n+="\\"+g;continue}c=!0,d=m,u=n.length,n+=g;continue;case"]":if(m===d+1||!c){n+="\\"+g,o=!1;continue}if(c)var v,w=e.substring(d+1,m);i=!0,c=!1,n+=g;continue;default:p(),o?o=!1:!X[g]||"^"===g&&c||(n+="\\"),n+=g}c&&(w=e.substr(d+1),v=this.parse(w,ee),n=n.substr(0,u)+"\\["+v[0],i=i||v[1]);for(b=s.pop();b;b=s.pop()){var y=n.slice(b.reStart+b.open.length);this.debug("setting tail",n,b),y=y.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",y,y,b,n);var k="*"===b.type?F:"?"===b.type?U:"\\"+b.type;i=!0,n=n.slice(0,b.reStart)+k+"\\("+y}p(),o&&(n+="\\\\");var E=!1;switch(n.charAt(0)){case".":case"[":case"(":E=!0}for(var T=l.length-1;T>-1;T--){var x=l[T],N=n.slice(0,x.reStart),C=n.slice(x.reStart,x.reEnd-8),A=n.slice(x.reEnd-8,x.reEnd),S=n.slice(x.reEnd);A+=S;var P=N.split("(").length-1,L=S;for(m=0;m=0&&!(a=e[n]);n--);for(n=0;n>> no match, partial?",e,d,t,h),d!==o))}if("string"==typeof c?(l=a.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,l)):(l=u.match(c),this.debug("pattern match",c,u,l)),!l)return!1}if(n===o&&i===s)return!0;if(n===o)return r;if(i===s)return n===o-1&&""===e[n];throw new Error("wtf?")};var te=[];var re=Object.freeze({before:function(e,t){te=[],"zhuanlan.zhihu.com"==e&&t.find("a[data-draft-type]").map(function(e,t){var r=$(t.outerHTML);r.find(".LinkCard-meta svg").remove(),te[e]=r[0].outerHTML,$(t).replaceWith("")}),"sspai.com"==e&&t.find(".ssApp").map(function(e,t){var r=$($("body").find(".ss-app-card")[e].outerHTML);r.find(".code_box").remove(),te[e]=r[0].outerHTML,$(t).replaceWith("")}),"question.zhihu.com"==e&&t.find(".RichText-MCNLinkCardContainer").map(function(e,t){var r=$($("body").find(".RichText-MCNLinkCardContainer")[e].outerHTML);te[e]=r[0].outerHTML,$(t).replaceWith("")}),"post.smzdm.com"==e&&t.find(".embed-card").map(function(e,t){var r=$($("body").find(".embed-card")[e].outerHTML);te[e]=r[0].outerHTML,$(t).parent().replaceWith("")})},specbeautify:function(e,t){switch(e){case"sspai.com":t.find(".relation-apps").remove(),t.find(".ss-app-card").remove();break;case"post.smzdm.com":t.find("img.face").addClass("sr-rd-content-nobeautify"),t.find(".insert-outer img").addClass("sr-rd-content-nobeautify");break;case"infoq.com":t.find("img").map(function(e,t){"left"==$(t).css("float")&&$(t).addClass("sr-rd-content-nobeautify")}),t.find("script").remove();break;case"appinn.com":case"hacpai.com":t.find(".emoji").addClass("sr-rd-content-nobeautify");break;case"douban.com":t.find(".review-content").children().unwrap(),t.find("table").addClass("sr-rd-content-center"),t.find("p").css({"white-space":"pre-wrap"}),t.find(".cc").removeClass();break;case"qdaily.com":t.find("img").map(function(e,t){var r=$(t);0==Number.parseInt(r.css("height"))&&r.remove()}),t.find(".com-insert-images").map(function(e,t){var r=$(t),a=r.find("img").map(function(e,t){return"
    "+t.outerHTML+"
    "}).get().join("");r.empty().removeAttr("class").append(a)}),t.find(".com-insert-embed").remove();break;case"news.mtime.com":t.find(".newspictool").map(function(e,t){var r=$(t),a=r.find("img"),n=r.find("p:last");r.removeAttr("class").addClass("sr-rd-content-center").empty().append(a).append(n)});break;case"blog.csdn.net":t.find(".save_code").remove(),t.find(".pre-numbering").remove(),t.find("pre").removeAttr("style").removeAttr("class"),t.find("code").removeAttr("style"),t.find(".dp-highlighter").map(function(e,t){$(t).find(".bar .tools").remove(),$(t).next().is("pre")&&$(t).next().remove()});break;case"news.sohu.com":t.find(".conserve-photo").remove(),t.find("table").addClass("sr-rd-content-center");break;case"qq.com":t.find(".rv-root-v2, #backqqcom").remove();break;case"azofreeware.com":t.find("iframe").remove();break;case"apprcn.com":t.find("img").map(function(e,t){var r=$(t),a=r.attr("src");a&&a.includes("Apprcn_Wechat_Small.jpeg")&&r.parent().remove()}),t.find("a").map(function(e,t){var r=$(t);"来自反斗软件"==r.text()&&r.parent().remove()});break;case"tieba.baidu.com":t.find(".BDE_Smiley").addClass("sr-rd-content-nobeautify"),t.find(".replace_div").removeAttr("class").removeAttr("style"),t.find(".replace_tip").remove(),t.find(".d_post_content, .j_d_post_content, .post_bubble_top, .post_bubble_middle, .post_bubble_bottom").map(function(e,t){$(t).removeAttr("class").removeAttr("style")}),$("body").find(".p_author_face").map(function(e,t){var r=$(t).find("img"),a=r.attr("data-tb-lazyload"),n=r.attr("username");a&&$("sr-rd-mult-avatar").find("span").map(function(e,t){var r=$(t);r.text()==n&&r.parent().find("img").attr("src",a)})});break;case"jingyan.baidu.com":t.find(".exp-image-wraper").removeAttr("class").removeAttr("href");break;case"question.zhihu.com":t.find(".zu-edit-button").remove(),t.find("a.external").map(function(e,t){$(t).removeAttr("class").attr("style","border: none;")}),t.find(".VagueImage").map(function(e,t){var r=$(t),a=r.attr("data-src");r.replaceWith('')});break;case"chiphell.com":t.find("img").map(function(e,t){var r=$(t),a=r.parent(),n=r.attr("src"),i=r.attr("smilieid");a.is("ignore_js_op")&&r.unwrap(),i&&n&&n.includes("static/image/smiley")&&r.addClass("sr-rd-content-nobeautify").attr("style","width: 50px;")}),t.find(".quote").remove();break;case"jiemian.com":t.find("script").remove();break;case"36kr.com":t.find(".load-html-img").removeAttr("class");break;case"cnblogs.com":t.find(".cnblogs_code").removeClass(),t.find(".cnblogs_code_hide").removeClass().removeAttr("style"),t.find(".cnblogs_code_toolbar").remove(),t.find(".code_img_opened").remove(),t.find(".code_img_closed").remove();break;case"news.cnblogs.com":t.find(".topic_img").remove();break;case"g-cores.com":t.find(".swiper-slide-active").find("img").map(function(e,t){var r=$(t);r.parent().parent().parent().parent().parent().parent().removeAttr("class").removeAttr("style").html(r)});break;case"feng.com":case"young.ifeng.com":t.find("span").removeAttr("style");break;case"ftchinese.com":t.find("script").remove();break;case"segmentfault.com":t.find(".widget-codetool").remove();break;case"mp.weixin.qq.com":t.find('section[powered-by="xiumi.us"]').find("img").map(function(e,t){var r=$(t),a=r.attr("data-src");r.addClass("sr-rd-content-nobeautify").attr("src",a)});break;case"ruby-china.org":t.find(".twemoji").remove();break;case"w3cplus.com":t.find("iframe").addClass("sr-rd-content-nobeautify");break;case"zuojj.com":t.find(".syntaxhighlighter .Brush").attr("style","font-size: .7em !important;");break;case"aotu.io":t.find(".highlight table").map(function(e,t){var r=$(t),a=r.find("pre"),n=r.find("table");r.html(a[1]),n.unwrap()}),t.find("table").addClass("sr-rd-content-center");break;case"colobu.com":t.find(".highlight table").map(function(e,t){var r=$(t),a=r.find("pre");r.html(a[1]),r.unwrap()});break;case"hao.caibaojian.com":t.find(".tlink").map(function(e,t){$(t).html("")});break;case"wkee.net":t.find("script").remove();break;case"linux.cn":t.find("pre").attr("style","background-color: #161b20; background-image: none;"),t.find("code").attr("style","background-color: transparent; background-image: none;");break;case"zhuanlan.zhihu.com":t.find("div[data-src]").map(function(e,t){var r=$(t),a=r.attr("data-src");r.replaceWith('
    ')}),$("body img").each(function(e,t){var r=$(t),a=r.parent();if("column-gif"==r.attr("class")&&"GifPlayer"==a.attr("class")){var n=a.parent().prev();if(n.is("noscript")){var i=n.html(),o=$(i),s=o.attr("src"),l=o.attr("data-thumbnail");$('sr-read img[src="'+l+'"]').attr("src",s)}}}),setTimeout(function(){t.find("img").each(function(e,t){$(t).attr("src").endsWith(".gif")&&$(t).parent().next().is("svg")&&$(t).parent().next().remove()})},500);break;case"jianshu.com":t.find(".image-package").map(function(e,t){var r=$(t),a=r.find("img");r.html(a)});break;case"medium.com":t.find("figure").map(function(e,t){var r=$(t),a=r.find("img");r.replaceWith('
    ')});break;case"worldcup.fifa.com":t.find("iframe").css({width:"790px",height:"450px"}),t.find("div").removeClass()}},removeSpareTag:function(e,t){var r=!1,a="";["lib.csdn.net","huxiu.com","my.oschina.net","caixin.com","163.com","steachs.com","hacpai.com","apprcn.com","mp.weixin.qq.com"].includes(e)?(r=!0,a="p"):["nationalgeographic.com.cn","dgtle.com","news.mtime.com"].includes(e)?(r=!0,a="div"):["chiphell.com"].includes(e)&&(r=!0,a="font"),r&&t.find(a).map(function(e,t){var r=$(t).text().toLowerCase().trim();0==$(t).find("img").length&&""==r&&$(t).remove()})},htmlbeautify:function(e){try{e.html(function(e,t){return t.trim().replace(/<\/?blockquote/g,function(e){return"/"==e[1]?"\n?
    (\n?
    )*/g,"
    ").replace(/\/(div|p)>\n*(
    \n)+/g,function(e){return e.replace("
    ","")})})}catch(t){return e.html()}},commbeautify:function(e,t){t.find("img:not(.sr-rd-content-nobeautify)").map(function(e,t){var r=$(t),a=(r.parent(),$("")),n=r.attr("src"),i=r.attr("data-src"),o=r.attr("data-original"),s=r.attr("original"),l=r.attr("data-original-src"),c=r.attr("data-lazy-src"),u=r.attr("real_src"),d=function(){a.removeClass("sr-rd-content-img-load"),a[0].clientWidth<300&&a[0].clientHeight<300?a.parent().removeClass("sr-rd-content-center").addClass("sr-rd-content-center-small"):a[0].clientWidth>1e3?a.css("zoom","0.6"):a[0].clientHeight>620&&/win|mac/i.test(navigator.platform)&&(a.attr("height",620),a[0].clientWidth<$("sr-rd-content").width()&&a.css({width:"auto"})),a[0].clientWidth>$("sr-rd-content").width()&&a.addClass("sr-rd-content-img")},h=function(){a.addClass("simpread-hidden"),a.parent().hasClass("sr-rd-content-center")&&a.parent().removeAttr("class").addClass("simpread-hidden")},f=void 0;r.parent()[0].tagName.toLowerCase(),f=s||n,f=i||f,f=o||f,f=l||f,f=u||f,!(f=c||f)||f.startsWith("http")||f.startsWith("data")||(f=function e(t,r){if("string"!=typeof t||!t)return null;if(t.match(/^[a-z]+\:\/\//i))return t;if(t.match(/^\/\//))return"http:"+t;if(t.match(/^[a-z]+\:/i))return t;var a;if("string"!=typeof r)return(a=document.createElement("a")).href=t,a.pathname?"http://"+t:null;if(null===(r=e(r)))return null;(a=document.createElement("a")).href=r,"/"===t[0]?r=[]:(r=a.pathname.split("/")).pop(),t=t.split("/");for(var n=0;n
    "),/win|mac/i.test(navigator.platform)?a.one("load",function(){return d()}).one("error",function(){return h()}):a.on("load",function(){return d()}).on("error",function(){return h()})}),t.find("sr-blockquote").map(function(t,r){var a=$(r),n=a.parent();a.removeAttr("style").removeAttr("class"),"dgtle.com"==e&&n.removeClass("quote")}),t.find("iframe:not(.sr-rd-content-nobeautify), embed:not(.sr-rd-content-nobeautify)").map(function(e,t){$(t).wrap("
    ")}),t.find("hr").map(function(e,t){$(t).addClass("simpread-hidden")}),t.find("pre").map(function(e,t){$(t).find("code").removeAttr("class")}),t.find("pre").removeAttr("class"),t.find("a").removeAttr("style"),t.find("sr-blocks").map(function(e,t){t.outerHTML=$(te[e]).addClass("simpread-blocks")[0].outerHTML})},cleanHTML:function(e,t,r){t&&e.find(".crayon-syntax .crayon-plain-wrap textarea").map(function(e,t){$(t).parent().parent().replaceWith('
    '+t.innerHTML+"
    ")}),t&&e.find(".syntaxhighlighter").map(function(e,t){var r="";$(t).find(".container div").map(function(e,t){r+=t.innerText+"\n"}),$(t).replaceWith('
    '+r+"
    ")}),t&&e.find("table pre").length>0&&e.find("table").map(function(e,t){var r=$(t);if(2==r.find("pre").length){var a=r.find("td pre")[1].outerText.replace(//gi,">").trim();r.replaceWith('
    '+a+"
    ")}}),t&&e.find("pre:not(.sr-rd-content-nobeautify)").each(function(e,t){var r="",a=!1,n=!1;1==$(t).find("code").length&&$(t).find("li").length>0&&$(t).find("code").each(function(e,t){a=!0,n=!0,r+=t.outerText.replace(//gi,">")}),0==a&&0==n&&$(t).find("li").each(function(e,n){$(t).find("code").length>0&&(a=!0),""!=n.outerText.trim()&&(r+=n.outerText.replace(/\n/gi,"").replace(//gi,">")+"\n")}),0==a&&$(t).find("code").each(function(e,t){n=!0,""!=t.outerText.trim()&&(r+=t.outerText.replace(//gi,">")+"\n")}),a||n||(r=t.outerText.replace(//gi,">")+"\n"),$(t).removeAttr("style").removeAttr("class").removeAttr("id").html(r)});var a,n,i=e.html();"readability-page-1"==$(e.children()).attr("id")&&1==e.children().children().length?i=e.children().children().html():1==e.children().length&&(i=e.children().html()),i=i.replace(//gi,""),e.html((a=i,n="",$.parseHTML(a).forEach(function(e,a){var i=e.tagName,o=e.outerText,s=e.outerHTML;void 0==i?n+="

    "+e.textContent.replace(//gi,">").replace(/^\n|\n$/gi,"").trim()+"

    ":"PRE"==i?n+=s:"sr-blocks"==i.toLowerCase()?n+=s:(""!=o||s.includes("0?t.join("").replace(/, $/,""):null}function se(e,t){var r=Object.keys(t).map(function(e){return t[e]&&e.replace(/[A-Z]/,function(e){return"-"+e.toLowerCase()})+": "+t[e]+";"}).join("");switch(e){case"title":r="sr-rd-title {"+r+"}";break;case"desc":r="sr-rd-desc {"+r+"}";break;case"art":r="sr-rd-content *, sr-rd-content p, sr-rd-content div {"+r+"}";break;case"pre":r="sr-rd-content pre {"+r+"}";break;case"code":r="sr-rd-content pre code, sr-rd-content pre code * {"+r+"}"}var a=$("head").find("style#simpread-custom-"+e);0==a.length?$("head").append('"):a.html(r)}function le(e,t){var r=$("head").find("style#simpread-custom-"+e);0==r.length?$("head").append('"):r.html(t)}var ce=Object.freeze({GetColor:oe,BgColor:function(e,t){var r="rgba("+oe(e)+", "+t/100+")";return $(ne).css(ae,r),r},Opacity:function(e){var t=oe($(ne).css(ae)),r="rgba("+t+", "+e/100+")";return t?($(ne).css(ae,r),r):null},FontFamily:function(e){$("sr-read").css("font-family","default"==e?"":e)},FontSize:function(e){"-1"==ie&&void 0==(ie=$("html").attr("style"))&&(ie=""),e?$("html").attr("style","font-size: "+e+"!important;"+ie):$("html").attr("style",ie)},Layout:function(e){$("sr-read").css("margin",e?"20px "+e:"")},SiteCSS:function(e){e?$("head").append('"):$("#simpread-site-css").remove()},Preview:function(e){Object.keys(e).forEach(function(t){"css"!=t&&se(t,e[t])}),le("css",e.css)},Custom:se,CSS:le,VerifyCustom:function(e,t){switch(e){case"layout":case"margin":case"fontfamily":case"custom":return""!=t.css;case"fontsize":return""!=t.title.fontSize||""!=t.desc.fontSize||""!=t.art.fontSize||""!=t.css;case"theme":return-1!=t.css.search("simpread-theme-root")}}});function ue(e,t){if(t&&t.documentElement)e=t,t=arguments[2];else if(!e||!e.documentElement)throw new Error("First argument to Readability constructor should be a document object.");var r;t=t||{},this._doc=e,this._articleTitle=null,this._articleByline=null,this._articleDir=null,this._articleSiteName=null,this._attempts=[],this._wrap=null,this._debug=!!t.debug,this._maxElemsToParse=t.maxElemsToParse||this.DEFAULT_MAX_ELEMS_TO_PARSE,this._nbTopCandidates=t.nbTopCandidates||this.DEFAULT_N_TOP_CANDIDATES,this._charThreshold=t.charThreshold||this.DEFAULT_CHAR_THRESHOLD,this._classesToPreserve=this.CLASSES_TO_PRESERVE.concat(t.classesToPreserve||[]),this._flags=this.FLAG_STRIP_UNLIKELYS|this.FLAG_WEIGHT_CLASSES|this.FLAG_CLEAN_CONDITIONALLY,this._debug?(r=function(e){var t=e.nodeName+" ";if(e.nodeType==e.TEXT_NODE)return t+'("'+e.textContent+'")';var r=e.className&&"."+e.className.replace(/ /g,"."),a="";return e.id?a="(#"+e.id+r+")":r&&(a="("+r+")"),t+a},this.log=function(){if("undefined"!=typeof dump){var e=Array.prototype.map.call(arguments,function(e){return e&&e.nodeName?r(e):e}).join(" ");dump("Reader: (Readability) "+e+"\n")}else if("undefined"!=typeof console)["Reader: (Readability) "].concat(arguments)}):this.log=function(){}}ue.prototype={FLAG_STRIP_UNLIKELYS:1,FLAG_WEIGHT_CLASSES:2,FLAG_CLEAN_CONDITIONALLY:4,ELEMENT_NODE:1,TEXT_NODE:3,DEFAULT_MAX_ELEMS_TO_PARSE:0,DEFAULT_N_TOP_CANDIDATES:5,DEFAULT_TAGS_TO_SCORE:"section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","),DEFAULT_CHAR_THRESHOLD:500,REGEXPS:{unlikelyCandidates:/-ad-|ai2html|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|gdpr|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i,okMaybeItsACandidate:/and|article|body|column|main|shadow/i,positive:/article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i,negative:/hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|gdpr|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i,extraneous:/print|archive|comment|discuss|e[\-]?mail|share|reply|all|login|sign|single|utility/i,byline:/byline|author|dateline|writtenby|p-author/i,replaceFonts:/<(\/?)font[^>]*>/gi,normalize:/\s{2,}/g,videos:/\/\/(www\.)?((dailymotion|youtube|youtube-nocookie|player\.vimeo|v\.qq)\.com|(archive|upload\.wikimedia)\.org|player\.twitch\.tv)/i,nextLink:/(next|weiter|continue|>([^\|]|$)|»([^\|]|$))/i,prevLink:/(prev|earl|old|new|<|«)/i,whitespace:/^\s*$/,hasContent:/\S$/},DIV_TO_P_ELEMS:["A","BLOCKQUOTE","DL","DIV","IMG","OL","P","PRE","TABLE","UL","SELECT"],ALTER_TO_DIV_EXCEPTIONS:["DIV","ARTICLE","SECTION","P"],PRESENTATIONAL_ATTRIBUTES:["align","background","bgcolor","border","cellpadding","cellspacing","frame","hspace","rules","style","valign","vspace"],DEPRECATED_SIZE_ATTRIBUTE_ELEMS:["TABLE","TH","TD","HR","PRE"],PHRASING_ELEMS:["ABBR","AUDIO","B","BDO","BR","BUTTON","CITE","CODE","DATA","DATALIST","DFN","EM","EMBED","I","IMG","INPUT","KBD","LABEL","MARK","MATH","METER","NOSCRIPT","OBJECT","OUTPUT","PROGRESS","Q","RUBY","SAMP","SCRIPT","SELECT","SMALL","SPAN","STRONG","SUB","SUP","TEXTAREA","TIME","VAR","WBR"],CLASSES_TO_PRESERVE:["page"],_postProcessContent:function(e){this._fixRelativeUris(e),this._cleanClasses(e)},_removeNodes:function(e,t){for(var r=e.length-1;r>=0;r--){var a=e[r],n=a.parentNode;n&&(t&&!t.call(this,a,r,e)||n.removeChild(a))}},_replaceNodeTags:function(e,t){for(var r=e.length-1;r>=0;r--){var a=e[r];this._setNodeTag(a,t)}},_forEachNode:function(e,t){Array.prototype.forEach.call(e,t,this)},_someNode:function(e,t){return Array.prototype.some.call(e,t,this)},_everyNode:function(e,t){return Array.prototype.every.call(e,t,this)},_concatNodeLists:function(){var e=Array.prototype.slice,t=e.call(arguments).map(function(t){return e.call(t)});return Array.prototype.concat.apply([],t)},_getAllNodesWithTag:function(e,t){return e.querySelectorAll?e.querySelectorAll(t.join(",")):[].concat.apply([],t.map(function(t){var r=e.getElementsByTagName(t);return Array.isArray(r)?r:Array.from(r)}))},_cleanClasses:function(e){var t=this._classesToPreserve,r=(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return-1!=t.indexOf(e)}).join(" ");for(r?e.setAttribute("class",r):e.removeAttribute("class"),e=e.firstElementChild;e;e=e.nextElementSibling)this._cleanClasses(e)},_fixRelativeUris:function(e){var t=this._doc.baseURI,r=this._doc.documentURI;function a(e){if(t==r&&"#"==e.charAt(0))return e;try{return new URL(e,t).href}catch(e){}return e}var n=this._getAllNodesWithTag(e,["a"]);this._forEachNode(n,function(e){var t=e.getAttribute("href");if(t)if(0===t.indexOf("javascript:")){var r=this._doc.createTextNode(e.textContent);e.parentNode.replaceChild(r,e)}else e.setAttribute("href",a(t))});var i=this._getAllNodesWithTag(e,["img"]);this._forEachNode(i,function(e){var t=e.getAttribute("src");t&&e.setAttribute("src",a(t))})},_getArticleTitle:function(){var e=this._doc,t="",r="";try{"string"!=typeof(t=r=e.title.trim())&&(t=r=this._getInnerText(e.getElementsByTagName("title")[0]))}catch(e){}var a=!1;function n(e){return e.split(/\s+/).length}if(/ [\|\-\\\/>»] /.test(t))a=/ [\\\/>»] /.test(t),n(t=r.replace(/(.*)[\|\-\\\/>»] .*/gi,"$1"))<3&&(t=r.replace(/[^\|\-\\\/>»]*[\|\-\\\/>»](.*)/gi,"$1"));else if(-1!==t.indexOf(": ")){var i=this._concatNodeLists(e.getElementsByTagName("h1"),e.getElementsByTagName("h2")),o=t.trim();this._someNode(i,function(e){return e.textContent.trim()===o})||(n(t=r.substring(r.lastIndexOf(":")+1))<3?t=r.substring(r.indexOf(":")+1):n(r.substr(0,r.indexOf(":")))>5&&(t=r))}else if(t.length>150||t.length<15){var s=e.getElementsByTagName("h1");1===s.length&&(t=this._getInnerText(s[0]))}var l=n(t=t.trim().replace(this.REGEXPS.normalize," "));return l<=4&&(!a||l!=n(r.replace(/[\|\-\\\/>»]+/g,""))-1)&&(t=r),t},_prepDocument:function(){var e=this._doc;this._removeNodes(e.getElementsByTagName("style")),e.body&&this._replaceBrs(e.body),this._replaceNodeTags(e.getElementsByTagName("font"),"SPAN")},_nextElement:function(e){for(var t=e;t&&t.nodeType!=this.ELEMENT_NODE&&this.REGEXPS.whitespace.test(t.textContent);)t=t.nextSibling;return t},_replaceBrs:function(e){this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){for(var t=e.nextSibling,r=!1;(t=this._nextElement(t))&&"BR"==t.tagName;){r=!0;var a=t.nextSibling;t.parentNode.removeChild(t),t=a}if(r){var n=this._doc.createElement("p");for(e.parentNode.replaceChild(n,e),t=n.nextSibling;t;){if("BR"==t.tagName){var i=this._nextElement(t.nextSibling);if(i&&"BR"==i.tagName)break}if(!this._isPhrasingContent(t))break;var o=t.nextSibling;n.appendChild(t),t=o}for(;n.lastChild&&this._isWhitespace(n.lastChild);)n.removeChild(n.lastChild);"P"===n.parentNode.tagName&&this._setNodeTag(n.parentNode,"DIV")}})},_setNodeTag:function(e,t){if(this.log("_setNodeTag",e,t),e.__JSDOMParser__)return e.localName=t.toLowerCase(),e.tagName=t.toUpperCase(),e;for(var r=e.ownerDocument.createElement(t);e.firstChild;)r.appendChild(e.firstChild);e.parentNode.replaceChild(r,e),e.readability&&(r.readability=e.readability);for(var a=0;a0?r[0].textContent.includes(this._articleTitle):this._articleTitle.includes(r[0].textContent))&&this._clean(e,"h2")}}this._clean(e,"iframe"),this._clean(e,"input"),this._clean(e,"textarea"),this._clean(e,"select"),this._clean(e,"button"),this._cleanHeaders(e),this._cleanConditionally(e,"table"),this._cleanConditionally(e,"ul"),this._cleanConditionally(e,"div"),this._removeNodes(e.getElementsByTagName("p"),function(e){return 0===e.getElementsByTagName("img").length+e.getElementsByTagName("embed").length+e.getElementsByTagName("object").length+e.getElementsByTagName("iframe").length&&!this._getInnerText(e,!1)}),this._forEachNode(this._getAllNodesWithTag(e,["br"]),function(e){var t=this._nextElement(e.nextSibling);t&&"P"==t.tagName&&e.parentNode.removeChild(e)}),this._forEachNode(this._getAllNodesWithTag(e,["table"]),function(e){var t=this._hasSingleTagInsideElement(e,"TBODY")?e.firstElementChild:e;if(this._hasSingleTagInsideElement(t,"TR")){var r=t.firstElementChild;if(this._hasSingleTagInsideElement(r,"TD")){var a=r.firstElementChild;a=this._setNodeTag(a,this._everyNode(a.childNodes,this._isPhrasingContent)?"P":"DIV"),e.parentNode.replaceChild(a,e)}}})},_initializeNode:function(e){switch(e.readability={contentScore:0},e.tagName){case"DIV":e.readability.contentScore+=5;break;case"PRE":case"TD":case"BLOCKQUOTE":e.readability.contentScore+=3;break;case"ADDRESS":case"OL":case"UL":case"DL":case"DD":case"DT":case"LI":case"FORM":e.readability.contentScore-=3;break;case"H1":case"H2":case"H3":case"H4":case"H5":case"H6":case"TH":e.readability.contentScore-=5}e.readability.contentScore+=this._getClassWeight(e)},_removeAndGetNext:function(e){var t=this._getNextNode(e,!0);return e.parentNode.removeChild(e),t},_getNextNode:function(e,t){if(!t&&e.firstElementChild)return e.firstElementChild;if(e.nextElementSibling)return e.nextElementSibling;do{e=e.parentNode}while(e&&!e.nextElementSibling);return e&&e.nextElementSibling},_checkByline:function(e,t){if(this._articleByline)return!1;if(void 0!==e.getAttribute)var r=e.getAttribute("rel"),a=e.getAttribute("itemprop");return!(!("author"===r||a&&-1!==a.indexOf("author")||this.REGEXPS.byline.test(t))||!this._isValidByline(e.textContent))&&(this._articleByline=e.textContent.trim(),!0)},_getNodeAncestors:function(e,t){t=t||0;for(var r=0,a=[];e.parentNode&&(a.push(e.parentNode),!t||++r!==t);)e=e.parentNode;return a},_grabArticle:function(e){this.log("**** grabArticle ****");var t=this._doc,r=null!==e;if(!(e=e||this._doc.body))return this.log("No body found in document. Abort."),null;for(var a=e.innerHTML;;){for(var n=this._flagIsActive(this.FLAG_STRIP_UNLIKELYS),i=[],o=this._doc.documentElement;o;){var s=o.className+" "+o.id;if(this._isProbablyVisible(o))if(this._checkByline(o,s))o=this._removeAndGetNext(o);else if(!n||!this.REGEXPS.unlikelyCandidates.test(s)||this.REGEXPS.okMaybeItsACandidate.test(s)||this._hasAncestorTag(o,"table")||"BODY"===o.tagName||"A"===o.tagName)if("DIV"!==o.tagName&&"SECTION"!==o.tagName&&"HEADER"!==o.tagName&&"H1"!==o.tagName&&"H2"!==o.tagName&&"H3"!==o.tagName&&"H4"!==o.tagName&&"H5"!==o.tagName&&"H6"!==o.tagName||!this._isElementWithoutContent(o)){if(-1!==this.DEFAULT_TAGS_TO_SCORE.indexOf(o.tagName)&&i.push(o),"DIV"===o.tagName){for(var l=null,c=o.firstChild;c;){var u=c.nextSibling;if(this._isPhrasingContent(c))null!==l?l.appendChild(c):this._isWhitespace(c)||(l=t.createElement("p"),o.replaceChild(l,c),l.appendChild(c));else if(null!==l){for(;l.lastChild&&this._isWhitespace(l.lastChild);)l.removeChild(l.lastChild);l=null}c=u}if(this._hasSingleTagInsideElement(o,"P")&&this._getLinkDensity(o)<.25){var d=o.children[0];o.parentNode.replaceChild(d,o),o=d,i.push(o)}else this._hasChildBlockElement(o)||(o=this._setNodeTag(o,"P"),i.push(o))}o=this._getNextNode(o)}else o=this._removeAndGetNext(o);else this.log("Removing unlikely candidate - "+s),o=this._removeAndGetNext(o);else this.log("Removing hidden node - "+s),o=this._removeAndGetNext(o)}var h=[];this._forEachNode(i,function(e){if(e.parentNode&&void 0!==e.parentNode.tagName){var t=this._getInnerText(e);if(!(t.length<25)){var r=this._getNodeAncestors(e,3);if(0!==r.length){var a=0;a+=1,a+=t.split(",").length,a+=Math.min(Math.floor(t.length/100),3),this._forEachNode(r,function(e,t){if(e.tagName&&e.parentNode&&void 0!==e.parentNode.tagName){if(void 0===e.readability&&(this._initializeNode(e),h.push(e)),0===t)var r=1;else r=1===t?2:3*t;e.readability.contentScore+=a/r}})}}}});for(var f=[],p=0,g=h.length;pv.readability.contentScore){f.splice(b,0,m),f.length>this._nbTopCandidates&&f.pop();break}}}var w,y=f[0]||null,k=!1;if(null===y||"BODY"===y.tagName){y=t.createElement("DIV"),k=!0;for(var E=e.childNodes;E.length;)this.log("Moving child out:",E[0]),y.appendChild(E[0]);e.appendChild(y),this._initializeNode(y)}else if(y){for(var T=[],x=1;x=.75&&T.push(this._getNodeAncestors(f[x]));if(T.length>=3)for(w=y.parentNode;"BODY"!==w.tagName;){for(var N=0,C=0;C=3){y=w;break}w=w.parentNode}y.readability||this._initializeNode(y),w=y.parentNode;for(var A=y.readability.contentScore,S=A/3;"BODY"!==w.tagName;)if(w.readability){var P=w.readability.contentScore;if(PA){y=w;break}A=w.readability.contentScore,w=w.parentNode}else w=w.parentNode;for(w=y.parentNode;"BODY"!=w.tagName&&1==w.children.length;)w=(y=w).parentNode;y.readability||this._initializeNode(y)}var L=t.createElement("DIV");r&&(L.id="readability-content");for(var j=Math.max(10,.2*y.readability.contentScore),z=(w=y.parentNode).children,$=0,M=z.length;$=j)I=!0;else if("P"===B.nodeName){var H=this._getLinkDensity(B),R=this._getInnerText(B),D=R.length;D>80&&H<.25?I=!0:D<80&&D>0&&0===H&&-1!==R.search(/\.( |$)/)&&(I=!0)}}I&&(this.log("Appending node:",B),-1===this.ALTER_TO_DIV_EXCEPTIONS.indexOf(B.nodeName)&&(this.log("Altering sibling:",B,"to div."),B=this._setNodeTag(B,"DIV")),L.appendChild(B),$-=1,M-=1)}if(this._debug&&this.log("Article content pre-prep: "+L.innerHTML),this._prepArticle(L),this._debug&&this.log("Article content post-prep: "+L.innerHTML),k)y.id="readability-page-1",y.className="page";else{var G=t.createElement("DIV");G.id="readability-page-1",G.className="page";var q=L.childNodes;for(this._wrap=L.childNodes[0].outerHTML.replace(L.childNodes[0].innerHTML,"");q.length;)G.appendChild(q[0]);L.appendChild(G)}this._debug&&this.log("Article content after paging: "+L.innerHTML);var U=!0,F=this._getInnerText(L,!0).length;if(F0&&e.length<100)},_getArticleMetadata:function(){var e={},t={},r=this._doc.getElementsByTagName("meta"),a=/\s*(dc|dcterm|og|twitter)\s*:\s*(author|creator|description|title|site_name)\s*/gi,n=/^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name)\s*$/i;return this._forEachNode(r,function(e){var r=e.getAttribute("name"),i=e.getAttribute("property"),o=e.getAttribute("content");if(o){var s=null,l=null;if(i&&(s=i.match(a)))for(var c=s.length-1;c>=0;c--)l=s[c].toLowerCase().replace(/\s/g,""),t[l]=o.trim();!s&&r&&n.test(r)&&(l=r,o&&(l=l.toLowerCase().replace(/\s/g,"").replace(/\./g,":"),t[l]=o.trim()))}}),e.title=t["dc:title"]||t["dcterm:title"]||t["og:title"]||t["weibo:article:title"]||t["weibo:webpage:title"]||t.title||t["twitter:title"],e.title||(e.title=this._getArticleTitle()),e.byline=t["dc:creator"]||t["dcterm:creator"]||t.author,e.excerpt=t["dc:description"]||t["dcterm:description"]||t["og:description"]||t["weibo:article:description"]||t["weibo:webpage:description"]||t.description||t["twitter:description"],e.siteName=t["og:site_name"],e},_removeScripts:function(e){this._removeNodes(e.getElementsByTagName("script"),function(e){return e.nodeValue="",e.removeAttribute("src"),!0}),this._removeNodes(e.getElementsByTagName("noscript"))},_hasSingleTagInsideElement:function(e,t){return 1==e.children.length&&e.children[0].tagName===t&&!this._someNode(e.childNodes,function(e){return e.nodeType===this.TEXT_NODE&&this.REGEXPS.hasContent.test(e.textContent)})},_isElementWithoutContent:function(e){return e.nodeType===this.ELEMENT_NODE&&0==e.textContent.trim().length&&(0==e.children.length||e.children.length==e.getElementsByTagName("br").length+e.getElementsByTagName("hr").length)},_hasChildBlockElement:function(e){return this._someNode(e.childNodes,function(e){return-1!==this.DIV_TO_P_ELEMS.indexOf(e.tagName)||this._hasChildBlockElement(e)})},_isPhrasingContent:function(e){return e.nodeType===this.TEXT_NODE||-1!==this.PHRASING_ELEMS.indexOf(e.tagName)||("A"===e.tagName||"DEL"===e.tagName||"INS"===e.tagName)&&this._everyNode(e.childNodes,this._isPhrasingContent)},_isWhitespace:function(e){return e.nodeType===this.TEXT_NODE&&0===e.textContent.trim().length||e.nodeType===this.ELEMENT_NODE&&"BR"===e.tagName},_getInnerText:function(e,t){t=void 0===t||t;var r=e.textContent.trim();return t?r.replace(this.REGEXPS.normalize," "):r},_getCharCount:function(e,t){return t=t||",",this._getInnerText(e).split(t).length-1},_cleanStyles:function(e){if(e&&"svg"!==e.tagName.toLowerCase()){for(var t=0;t0&&n>r)return!1;if(e.parentNode.tagName===t&&(!a||a(e.parentNode)))return!0;e=e.parentNode,n++}return!1},_getRowAndColumnCount:function(e){for(var t=0,r=0,a=e.getElementsByTagName("tr"),n=0;n0)a._readabilityDataTable=!0;else{if(["col","colgroup","tfoot","thead","th"].some(function(e){return!!a.getElementsByTagName(e)[0]}))this.log("Data table because found data-y descendant"),a._readabilityDataTable=!0;else if(a.getElementsByTagName("table")[0])a._readabilityDataTable=!1;else{var i=this._getRowAndColumnCount(a);i.rows>=10||i.columns>4?a._readabilityDataTable=!0:a._readabilityDataTable=i.rows*i.columns>10}}}else a._readabilityDataTable=!1;else a._readabilityDataTable=!1}},_cleanConditionally:function(e,t){if(this._flagIsActive(this.FLAG_CLEAN_CONDITIONALLY)){var r="ul"===t||"ol"===t;this._removeNodes(e.getElementsByTagName(t),function(e){var a=function(e){return e._readabilityDataTable};if("table"===t&&a(e))return!1;if(this._hasAncestorTag(e,"table",-1,a))return!1;var n=this._getClassWeight(e);if(this.log("Cleaning Conditionally",e),n+0<0)return!0;if(this._getCharCount(e,",")<10){for(var i=e.getElementsByTagName("p").length,o=e.getElementsByTagName("img").length,s=e.getElementsByTagName("li").length-100,l=e.getElementsByTagName("input").length,c=0,u=this._concatNodeLists(e.getElementsByTagName("object"),e.getElementsByTagName("embed"),e.getElementsByTagName("iframe")),d=0;d1&&i/o<.5&&!this._hasAncestorTag(e,"figure")||!r&&s>i||l>Math.floor(i/3)||!r&&p<25&&(0===o||o>2)&&!this._hasAncestorTag(e,"figure")||!r&&n<25&&f>.2||n>=25&&f>.5||1===c&&p<75||c>1}return!1})}},_cleanMatchedNodes:function(e,t){for(var r=this._getNextNode(e,!0),a=this._getNextNode(e);a&&a!=r;)a=t(a,a.className+" "+a.id)?this._removeAndGetNext(a):this._getNextNode(a)},_cleanHeaders:function(e){for(var t=1;t<3;t+=1)this._removeNodes(e.getElementsByTagName("h"+t),function(e){return this._getClassWeight(e)<0})},_flagIsActive:function(e){return(this._flags&e)>0},_removeFlag:function(e){this._flags=this._flags&~e},_isProbablyVisible:function(e){return!(e.style&&"none"==e.style.display||e.hasAttribute("hidden"))},parse:function(){if(this._maxElemsToParse>0){var e=this._doc.getElementsByTagName("*").length;if(e>this._maxElemsToParse)throw new Error("Aborting parsing document; "+e+" elements found")}this._removeScripts(this._doc),this._prepDocument();var t=this._getArticleMetadata();this._articleTitle=t.title;var r=this._grabArticle();if(!r)return null;if(this.log("Grabbed: "+r.innerHTML),this._postProcessContent(r),!t.excerpt){var a=r.getElementsByTagName("p");a.length>0&&(t.excerpt=a[0].textContent.trim())}var n=r.textContent;return{title:this._articleTitle,byline:t.byline||this._articleByline,dir:this._articleDir,content:r.innerHTML,wrap:this._wrap,textContent:n,length:n.length,excerpt:t.excerpt,siteName:t.siteName||this._articleSiteName}}};var de=Object.freeze({Readability:ue}),he=r(function(e){(function(){function t(e){var t={omitExtraWLInCodeBlocks:{defaultValue:!1,describe:"Omit the default extra whiteline added to code blocks",type:"boolean"},noHeaderId:{defaultValue:!1,describe:"Turn on/off generated header id",type:"boolean"},prefixHeaderId:{defaultValue:!1,describe:"Add a prefix to the generated header ids. Passing a string will prefix that string to the header id. Setting to true will add a generic 'section-' prefix",type:"string"},rawPrefixHeaderId:{defaultValue:!1,describe:'Setting this option to true will prevent showdown from modifying the prefix. This might result in malformed IDs (if, for instance, the " char is used in the prefix)',type:"boolean"},ghCompatibleHeaderId:{defaultValue:!1,describe:"Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",type:"boolean"},rawHeaderId:{defaultValue:!1,describe:"Remove only spaces, ' and \" from generated header ids (including prefixes), replacing them with dashes (-). WARNING: This might result in malformed ids",type:"boolean"},headerLevelStart:{defaultValue:!1,describe:"The header blocks level start",type:"integer"},parseImgDimensions:{defaultValue:!1,describe:"Turn on/off image dimension parsing",type:"boolean"},simplifiedAutoLink:{defaultValue:!1,describe:"Turn on/off GFM autolink style",type:"boolean"},excludeTrailingPunctuationFromURLs:{defaultValue:!1,describe:"Excludes trailing punctuation from links generated with autoLinking",type:"boolean"},literalMidWordUnderscores:{defaultValue:!1,describe:"Parse midword underscores as literal underscores",type:"boolean"},literalMidWordAsterisks:{defaultValue:!1,describe:"Parse midword asterisks as literal asterisks",type:"boolean"},strikethrough:{defaultValue:!1,describe:"Turn on/off strikethrough support",type:"boolean"},tables:{defaultValue:!1,describe:"Turn on/off tables support",type:"boolean"},tablesHeaderId:{defaultValue:!1,describe:"Add an id to table headers",type:"boolean"},ghCodeBlocks:{defaultValue:!0,describe:"Turn on/off GFM fenced code blocks support",type:"boolean"},tasklists:{defaultValue:!1,describe:"Turn on/off GFM tasklist support",type:"boolean"},smoothLivePreview:{defaultValue:!1,describe:"Prevents weird effects in live previews due to incomplete input",type:"boolean"},smartIndentationFix:{defaultValue:!1,description:"Tries to smartly fix indentation in es6 strings",type:"boolean"},disableForced4SpacesIndentedSublists:{defaultValue:!1,description:"Disables the requirement of indenting nested sublists by 4 spaces",type:"boolean"},simpleLineBreaks:{defaultValue:!1,description:"Parses simple line breaks as
    (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,description:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,description:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",description:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,description:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,description:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,description:"Support for HTML Tag escaping. ex:
    foo
    ",type:"boolean"},emoji:{defaultValue:!1,description:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,description:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},completeHTMLDocument:{defaultValue:!1,description:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,description:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,description:"Split adjacent blockquote blocks",type:"boolean"}};if(!1===e)return JSON.parse(JSON.stringify(t));var r={};for(var a in t)t.hasOwnProperty(a)&&(r[a]=t[a].defaultValue);return r}function r(e,t){var r=t?"Error in "+t+" extension->":"Error in unnamed extension",n={valid:!0,error:""};i.helper.isArray(e)||(e=[e]);for(var o=0;o").replace(/&/g,"&")};var d=function(e,t,r,a){var n,i,o,s,l,c=a||"",u=c.indexOf("g")>-1,d=new RegExp(t+"|"+r,"g"+c.replace(/g/g,"")),h=new RegExp(t,c.replace(/g/g,"")),f=[];do{for(n=0;o=d.exec(e);)if(h.test(o[0]))n++||(s=(i=d.lastIndex)-o[0].length);else if(n&&!--n){l=o.index+o[0].length;var p={left:{start:s,end:i},match:{start:i,end:o.index},right:{start:o.index,end:l},wholeMatch:{start:s,end:l}};if(f.push(p),!u)return f}}while(n&&(d.lastIndex=i));return f};i.helper.matchRecursiveRegExp=function(e,t,r,a){for(var n=d(e,t,r,a),i=[],o=0;o0){var u=[];0!==s[0].wholeMatch.start&&u.push(e.slice(0,s[0].wholeMatch.start));for(var h=0;h=0?a+(r||0):a},i.helper.splitAtIndex=function(e,t){if(!i.helper.isString(e))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[e.substring(0,t),e.substring(t)]},i.helper.encodeEmailAddress=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e.replace(/./g,function(e){if("@"===e)e=t[Math.floor(2*Math.random())](e);else{var r=Math.random();e=r>.9?t[2](e):r>.45?t[1](e):t[0](e)}return e})},i.helper.padEnd=function(e,t,r){return t>>=0,r=String(r||" "),e.length>t?String(e):((t-=e.length)>r.length&&(r+=r.repeat(t/r.length)),String(e)+r.slice(0,t))},"undefined"==typeof console&&(console={warn:function(e){alert(e)},log:function(e){alert(e)},error:function(e){throw e}}),i.helper.regexes={asteriskDashAndColon:/([*_:~])/g},i.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:"S"},i.Converter=function(e){function t(e,t){if(t=t||null,i.helper.isString(e)){if(t=e=i.helper.stdExtName(e),i.extensions[e])return void function(e,t){"function"==typeof e&&(e=e(new i.Converter)),i.helper.isArray(e)||(e=[e]);var a=r(e,t);if(!a.valid)throw Error(a.error);for(var n=0;n[ \t]+¨NBSP;<"),!t){if(!window||!window.document)throw new Error("HTMLParser is undefined. If in a webworker or nodejs environment, you need to provide a WHATWG DOM and HTML such as JSDOM");t=window.document}var r=t.createElement("div");r.innerHTML=e;var a={preList:function(e){for(var t=e.querySelectorAll("pre"),r=[],a=0;a'}else r.push(t[a].innerHTML),t[a].innerHTML="",t[a].setAttribute("prenum",a.toString());return r}(r)};!function e(t){for(var r=0;r? ?(['"].*['"])?\)$/m)>-1)o="";else if(!o){if(n||(n=a.toLowerCase().replace(/ ?\n/g," ")),o="#"+n,i.helper.isUndefined(r.gUrls[n]))return e;o=r.gUrls[n],i.helper.isUndefined(r.gTitles[n])||(c=r.gTitles[n])}var u='"+a+""};return e=(e=(e=(e=(e=r.converter._dispatch("anchors.before",e,t,r)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,a)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,a)).replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]??(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,a)).replace(/\[([^\[\]]+)]()()()()()/g,a),t.ghMentions&&(e=e.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gim,function(e,r,a,n,o){if("\\"===a)return r+n;if(!i.helper.isString(t.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var s=t.ghMentionsLink.replace(/\{u}/g,o),l="";return t.openLinksInNewWindow&&(l=' target="¨E95Eblank"'),r+'"+n+""})),r.converter._dispatch("anchors.after",e,t,r)});var h=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,f=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,p=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,g=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gim,m=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,_=function(e){return function(t,r,a,n,o,s,l){var c=a=a.replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback),u="",d="",h=r||"",f=l||"";return/^www\./i.test(a)&&(a=a.replace(/^www\./i,"http://www.")),e.excludeTrailingPunctuationFromURLs&&s&&(u=s),e.openLinksInNewWindow&&(d=' target="¨E95Eblank"'),h+'"+c+""+u+f}},b=function(e,t){return function(r,a,n){var o="mailto:";return a=a||"",n=i.subParser("unescapeSpecialChars")(n,e,t),e.encodeEmails?(o=i.helper.encodeEmailAddress(o+n),n=i.helper.encodeEmailAddress(n)):o+=n,a+''+n+""}};i.subParser("autoLinks",function(e,t,r){return e=(e=(e=r.converter._dispatch("autoLinks.before",e,t,r)).replace(p,_(t))).replace(m,b(t,r)),r.converter._dispatch("autoLinks.after",e,t,r)}),i.subParser("simplifiedAutoLinks",function(e,t,r){return t.simplifiedAutoLink?(e=r.converter._dispatch("simplifiedAutoLinks.before",e,t,r),e=(e=t.excludeTrailingPunctuationFromURLs?e.replace(f,_(t)):e.replace(h,_(t))).replace(g,b(t,r)),e=r.converter._dispatch("simplifiedAutoLinks.after",e,t,r)):e}),i.subParser("blockGamut",function(e,t,r){return e=r.converter._dispatch("blockGamut.before",e,t,r),e=i.subParser("blockQuotes")(e,t,r),e=i.subParser("headers")(e,t,r),e=i.subParser("horizontalRule")(e,t,r),e=i.subParser("lists")(e,t,r),e=i.subParser("codeBlocks")(e,t,r),e=i.subParser("tables")(e,t,r),e=i.subParser("hashHTMLBlocks")(e,t,r),e=i.subParser("paragraphs")(e,t,r),r.converter._dispatch("blockGamut.after",e,t,r)}),i.subParser("blockQuotes",function(e,t,r){e=r.converter._dispatch("blockQuotes.before",e,t,r),e+="\n\n";var a=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return t.splitAdjacentBlockquotes&&(a=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),e=e.replace(a,function(e){return e=(e=(e=e.replace(/^[ \t]*>[ \t]?/gm,"")).replace(/¨0/g,"")).replace(/^[ \t]+$/gm,""),e=i.subParser("githubCodeBlocks")(e,t,r),e=(e=(e=i.subParser("blockGamut")(e,t,r)).replace(/(^|\n)/g,"$1 ")).replace(/(\s*
    [^\r]+?<\/pre>)/gm,function(e,t){var r=t;return(r=r.replace(/^  /gm,"¨0")).replace(/¨0/g,"")}),i.subParser("hashBlock")("
    \n"+e+"\n
    ",t,r)}),r.converter._dispatch("blockQuotes.after",e,t,r)}),i.subParser("codeBlocks",function(e,t,r){return e=r.converter._dispatch("codeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g,function(e,a,n){var o=a,s=n,l="\n";return o=i.subParser("outdent")(o,t,r),o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),t.omitExtraWLInCodeBlocks&&(l=""),o="
    "+o+l+"
    ",i.subParser("hashBlock")(o,t,r)+s})).replace(/¨0/,""),r.converter._dispatch("codeBlocks.after",e,t,r)}),i.subParser("codeSpans",function(e,t,r){return void 0===(e=r.converter._dispatch("codeSpans.before",e,t,r))&&(e=""),e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,a,n,o){var s=o;return s=(s=s.replace(/^([ \t]*)/g,"")).replace(/[ \t]*$/g,""),s=a+""+(s=i.subParser("encodeCode")(s,t,r))+"",i.subParser("hashHTMLSpans")(s,t,r)}),r.converter._dispatch("codeSpans.after",e,t,r)}),i.subParser("completeHTMLDocument",function(e,t,r){if(!t.completeHTMLDocument)return e;e=r.converter._dispatch("completeHTMLDocument.before",e,t,r);var a="html",n="\n",i="",o='\n',s="",l="";for(var c in void 0!==r.metadata.parsed.doctype&&(n="\n","html"!==(a=r.metadata.parsed.doctype.toString().toLowerCase())&&"html5"!==a||(o='')),r.metadata.parsed)if(r.metadata.parsed.hasOwnProperty(c))switch(c.toLowerCase()){case"doctype":break;case"title":i=""+r.metadata.parsed.title+"\n";break;case"charset":o="html"===a||"html5"===a?'\n':'\n';break;case"language":case"lang":s=' lang="'+r.metadata.parsed[c]+'"',l+='\n';break;default:l+='\n'}return e=n+"\n\n"+i+o+l+"\n\n"+e.trim()+"\n\n",r.converter._dispatch("completeHTMLDocument.after",e,t,r)}),i.subParser("detab",function(e,t,r){return e=(e=(e=(e=(e=(e=r.converter._dispatch("detab.before",e,t,r)).replace(/\t(?=\t)/g," ")).replace(/\t/g,"¨A¨B")).replace(/¨B(.+?)¨A/g,function(e,t){for(var r=t,a=4-r.length%4,n=0;n/g,">"),r.converter._dispatch("encodeAmpsAndAngles.after",e,t,r)}),i.subParser("encodeBackslashEscapes",function(e,t,r){return e=(e=(e=r.converter._dispatch("encodeBackslashEscapes.before",e,t,r)).replace(/\\(\\)/g,i.helper.escapeCharactersCallback)).replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeBackslashEscapes.after",e,t,r)}),i.subParser("encodeCode",function(e,t,r){return e=(e=r.converter._dispatch("encodeCode.before",e,t,r)).replace(/&/g,"&").replace(//g,">").replace(/([*_{}\[\]\\=~-])/g,i.helper.escapeCharactersCallback),r.converter._dispatch("encodeCode.after",e,t,r)}),i.subParser("escapeSpecialCharsWithinTagAttributes",function(e,t,r){return e=(e=(e=r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",e,t,r)).replace(/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,function(e){return e.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)})).replace(/-]|-[^>])(?:[^-]|-[^-])*)--)>/gi,function(e){return e.replace(/([\\`*_~=|])/g,i.helper.escapeCharactersCallback)}),r.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",e,t,r)}),i.subParser("githubCodeBlocks",function(e,t,r){return t.ghCodeBlocks?(e=r.converter._dispatch("githubCodeBlocks.before",e,t,r),e=(e=(e+="¨0").replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(e,a,n,o){var s=t.omitExtraWLInCodeBlocks?"":"\n";return o=i.subParser("encodeCode")(o,t,r),o=(o=(o=i.subParser("detab")(o,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,""),o="
    "+o+s+"
    ",o=i.subParser("hashBlock")(o,t,r),"\n\n¨G"+(r.ghCodeBlocks.push({text:e,codeblock:o})-1)+"G\n\n"})).replace(/¨0/,""),r.converter._dispatch("githubCodeBlocks.after",e,t,r)):e}),i.subParser("hashBlock",function(e,t,r){return e=(e=r.converter._dispatch("hashBlock.before",e,t,r)).replace(/(^\n+|\n+$)/g,""),e="\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n",r.converter._dispatch("hashBlock.after",e,t,r)}),i.subParser("hashCodeTags",function(e,t,r){return e=r.converter._dispatch("hashCodeTags.before",e,t,r),e=i.helper.replaceRecursiveRegExp(e,function(e,a,n,o){var s=n+i.subParser("encodeCode")(a,t,r)+o;return"¨C"+(r.gHtmlSpans.push(s)-1)+"C"},"]*>","","gim"),r.converter._dispatch("hashCodeTags.after",e,t,r)}),i.subParser("hashElement",function(e,t,r){return function(e,t){var a=t;return a=(a=(a=a.replace(/\n\n/g,"\n")).replace(/^\n/,"")).replace(/\n+$/g,""),"\n\n¨K"+(r.gHtmlBlocks.push(a)-1)+"K\n\n"}}),i.subParser("hashHTMLBlocks",function(e,t,r){e=r.converter._dispatch("hashHTMLBlocks.before",e,t,r);var a=["pre","div","h1","h2","h3","h4","h5","h6","blockquote","table","dl","ol","ul","script","noscript","form","fieldset","iframe","math","style","section","header","footer","nav","article","aside","address","audio","canvas","figure","hgroup","output","video","p"],n=function(e,t,a,n){var i=e;return-1!==a.search(/\bmarkdown\b/)&&(i=a+r.converter.makeHtml(t)+n),"\n\n¨K"+(r.gHtmlBlocks.push(i)-1)+"K\n\n"};t.backslashEscapesHTMLTags&&(e=e.replace(/\\<(\/?[^>]+?)>/g,function(e,t){return"<"+t+">"}));for(var o=0;o]*>)","im"),c="<"+a[o]+"\\b[^>]*>",u="";-1!==(s=i.helper.regexIndexOf(e,l));){var d=i.helper.splitAtIndex(e,s),h=i.helper.replaceRecursiveRegExp(d[1],n,c,u,"im");if(h===d[1])break;e=d[0].concat(h)}return e=e.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),e=(e=i.helper.replaceRecursiveRegExp(e,function(e){return"\n\n¨K"+(r.gHtmlBlocks.push(e)-1)+"K\n\n"},"^ {0,3}\x3c!--","--\x3e","gm")).replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,i.subParser("hashElement")(e,t,r)),r.converter._dispatch("hashHTMLBlocks.after",e,t,r)}),i.subParser("hashHTMLSpans",function(e,t,r){function a(e){return"¨C"+(r.gHtmlSpans.push(e)-1)+"C"}return e=(e=(e=(e=(e=r.converter._dispatch("hashHTMLSpans.before",e,t,r)).replace(/<[^>]+?\/>/gi,function(e){return a(e)})).replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(e){return a(e)})).replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(e){return a(e)})).replace(/<[^>]+?>/gi,function(e){return a(e)}),r.converter._dispatch("hashHTMLSpans.after",e,t,r)}),i.subParser("unhashHTMLSpans",function(e,t,r){e=r.converter._dispatch("unhashHTMLSpans.before",e,t,r);for(var a=0;a]*>\\s*]*>","^ {0,3}\\s*
    ","gim"),r.converter._dispatch("hashPreCodeTags.after",e,t,r)}),i.subParser("headers",function(e,t,r){function a(e){var a,n;if(t.customizedHeaderId){var o=e.match(/\{([^{]+?)}\s*$/);o&&o[1]&&(e=o[1])}return a=e,n=i.helper.isString(t.prefixHeaderId)?t.prefixHeaderId:!0===t.prefixHeaderId?"section-":"",t.rawPrefixHeaderId||(a=n+a),a=t.ghCompatibleHeaderId?a.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():t.rawHeaderId?a.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"¨").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():a.replace(/[^\w]/g,"").toLowerCase(),t.rawPrefixHeaderId&&(a=n+a),r.hashLinkCounts[a]?a=a+"-"+r.hashLinkCounts[a]++:r.hashLinkCounts[a]=1,a}e=r.converter._dispatch("headers.before",e,t,r);var n=isNaN(parseInt(t.headerLevelStart))?1:parseInt(t.headerLevelStart),o=t.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,s=t.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;e=(e=e.replace(o,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+a(o)+'"',c=""+s+"";return i.subParser("hashBlock")(c,t,r)})).replace(s,function(e,o){var s=i.subParser("spanGamut")(o,t,r),l=t.noHeaderId?"":' id="'+a(o)+'"',c=n+1,u=""+s+"";return i.subParser("hashBlock")(u,t,r)});var l=t.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;return e=e.replace(l,function(e,o,s){var l=s;t.customizedHeaderId&&(l=s.replace(/\s?\{([^{]+?)}\s*$/,""));var c=i.subParser("spanGamut")(l,t,r),u=t.noHeaderId?"":' id="'+a(s)+'"',d=n-1+o.length,h=""+c+"";return i.subParser("hashBlock")(h,t,r)}),r.converter._dispatch("headers.after",e,t,r)}),i.subParser("horizontalRule",function(e,t,r){e=r.converter._dispatch("horizontalRule.before",e,t,r);var a=i.subParser("hashBlock")("
    ",t,r);return e=(e=(e=e.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,a)).replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,a)).replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,a),r.converter._dispatch("horizontalRule.after",e,t,r)}),i.subParser("images",function(e,t,r){function a(e,t,a,n,o,s,l,c){var u=r.gUrls,d=r.gTitles,h=r.gDimensions;if(a=a.toLowerCase(),c||(c=""),e.search(/\(? ?(['"].*['"])?\)$/m)>-1)n="";else if(""===n||null===n){if(""!==a&&null!==a||(a=t.toLowerCase().replace(/ ?\n/g," ")),n="#"+a,i.helper.isUndefined(u[a]))return e;n=u[a],i.helper.isUndefined(d[a])||(c=d[a]),i.helper.isUndefined(h[a])||(o=h[a].width,s=h[a].height)}t=t.replace(/"/g,""").replace(i.helper.regexes.asteriskDashAndColon,i.helper.escapeCharactersCallback);var f=''+t+'"}return e=(e=(e=(e=(e=(e=r.converter._dispatch("images.before",e,t,r)).replace(/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,a)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,function(e,t,r,n,i,o,s,l){return a(e,t,r,n=n.replace(/\s/g,""),i,o,0,l)})).replace(/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,a)).replace(/!\[([^\]]*?)][ \t]*()\([ \t]??(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,a)).replace(/!\[([^\[\]]+)]()()()()()/g,a),r.converter._dispatch("images.after",e,t,r)}),i.subParser("italicsAndBold",function(e,t,r){function a(e,t,r){return t+e+r}return e=r.converter._dispatch("italicsAndBold.before",e,t,r),e=t.literalMidWordUnderscores?(e=(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return a(t,"","")})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return a(t,"","")})).replace(/\b_(\S[\s\S]*?)_\b/g,function(e,t){return a(t,"","")}):(e=(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/_([^\s_][\s\S]*?)_/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e}),e=t.literalMidWordAsterisks?(e=(e=e.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")})).replace(/([^*]|^)\B\*\*(\S[\s\S]*?)\*\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")})).replace(/([^*]|^)\B\*(\S[\s\S]*?)\*\B(?!\*)/g,function(e,t,r){return a(r,t+"","")}):(e=(e=e.replace(/\*\*\*(\S[\s\S]*?)\*\*\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/\*\*(\S[\s\S]*?)\*\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e})).replace(/\*([^\s*][\s\S]*?)\*/g,function(e,t){return/\S$/.test(t)?a(t,"",""):e}),r.converter._dispatch("italicsAndBold.after",e,t,r)}),i.subParser("lists",function(e,t,r){function a(e,a){r.gListLevel++,e=e.replace(/\n{2,}$/,"\n");var n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,o=/\n[ \t]*\n(?!¨0)/.test(e+="¨0");return t.disableForced4SpacesIndentedSublists&&(n=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),e=(e=e.replace(n,function(e,a,n,s,l,c,u){u=u&&""!==u.trim();var d=i.subParser("outdent")(l,t,r),h="";return c&&t.tasklists&&(h=' class="task-list-item" style="list-style-type: none;"',d=d.replace(/^[ \t]*\[(x|X| )?]/m,function(){var e='"})),d=d.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(e){return"¨A"+e}),a||d.search(/\n{2,}/)>-1?(d=i.subParser("githubCodeBlocks")(d,t,r),d=i.subParser("blockGamut")(d,t,r)):(d=(d=i.subParser("lists")(d,t,r)).replace(/\n$/,""),d=(d=i.subParser("hashHTMLBlocks")(d,t,r)).replace(/\n\n+/g,"\n\n"),d=o?i.subParser("paragraphs")(d,t,r):i.subParser("spanGamut")(d,t,r)),""+(d=d.replace("¨A",""))+"\n"})).replace(/¨0/g,""),r.gListLevel--,a&&(e=e.replace(/\s+$/,"")),e}function n(e,t){if("ol"===t){var r=e.match(/^ *(\d+)\./);if(r&&"1"!==r[1])return' start="'+r[1]+'"'}return""}function o(e,r,i){var o=t.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,s=t.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,l="ul"===r?o:s,c="";if(-1!==e.search(l))!function t(u){var d=u.search(l),h=n(e,r);-1!==d?(c+="\n\n<"+r+h+">\n"+a(u.slice(0,d),!!i)+"\n",l="ul"==(r="ul"===r?"ol":"ul")?o:s,t(u.slice(d))):c+="\n\n<"+r+h+">\n"+a(u,!!i)+"\n"}(e);else{var u=n(e,r);c="\n\n<"+r+u+">\n"+a(e,!!i)+"\n"}return c}return e=r.converter._dispatch("lists.before",e,t,r),e+="¨0",e=(e=r.gListLevel?e.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r){return o(t,r.search(/[*+-]/g)>-1?"ul":"ol",!0)}):e.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(e,t,r,a){return o(r,a.search(/[*+-]/g)>-1?"ul":"ol",!1)})).replace(/¨0/,""),r.converter._dispatch("lists.after",e,t,r)}),i.subParser("metadata",function(e,t,r){function a(e){r.metadata.raw=e,(e=(e=e.replace(/&/g,"&").replace(/"/g,""")).replace(/\n {4}/g," ")).replace(/^([\S ]+): +([\s\S]+?)$/gm,function(e,t,a){return r.metadata.parsed[t]=a,""})}return t.metadata?(e=(e=(e=(e=r.converter._dispatch("metadata.before",e,t,r)).replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(e,t,r){return a(r),"¨M"})).replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(e,t,n){return t&&(r.metadata.format=t),a(n),"¨M"})).replace(/¨M/g,""),e=r.converter._dispatch("metadata.after",e,t,r)):e}),i.subParser("outdent",function(e,t,r){return e=(e=(e=r.converter._dispatch("outdent.before",e,t,r)).replace(/^(\t|[ ]{1,4})/gm,"¨0")).replace(/¨0/g,""),r.converter._dispatch("outdent.after",e,t,r)}),i.subParser("paragraphs",function(e,t,r){for(var a=(e=(e=(e=r.converter._dispatch("paragraphs.before",e,t,r)).replace(/^\n+/g,"")).replace(/\n+$/g,"")).split(/\n{2,}/g),n=[],o=a.length,s=0;s=0?n.push(l):l.search(/\S/)>=0&&(l=(l=i.subParser("spanGamut")(l,t,r)).replace(/^([ \t]*)/g,"

    "),l+="

    ",n.push(l))}for(o=n.length,s=0;s]*>\s*]*>/.test(u)&&(d=!0)}n[s]=u}return e=(e=(e=n.join("\n")).replace(/^\n+/g,"")).replace(/\n+$/g,""),r.converter._dispatch("paragraphs.after",e,t,r)}),i.subParser("runExtension",function(e,t,r,a){if(e.filter)t=e.filter(t,a.converter,r);else if(e.regex){var n=e.regex;n instanceof RegExp||(n=new RegExp(n,"g")),t=t.replace(n,e.replace)}return t}),i.subParser("spanGamut",function(e,t,r){return e=r.converter._dispatch("spanGamut.before",e,t,r),e=i.subParser("codeSpans")(e,t,r),e=i.subParser("escapeSpecialCharsWithinTagAttributes")(e,t,r),e=i.subParser("encodeBackslashEscapes")(e,t,r),e=i.subParser("images")(e,t,r),e=i.subParser("anchors")(e,t,r),e=i.subParser("autoLinks")(e,t,r),e=i.subParser("simplifiedAutoLinks")(e,t,r),e=i.subParser("emoji")(e,t,r),e=i.subParser("underline")(e,t,r),e=i.subParser("italicsAndBold")(e,t,r),e=i.subParser("strikethrough")(e,t,r),e=i.subParser("ellipsis")(e,t,r),e=i.subParser("hashHTMLSpans")(e,t,r),e=i.subParser("encodeAmpsAndAngles")(e,t,r),t.simpleLineBreaks?/\n\n¨K/.test(e)||(e=e.replace(/\n+/g,"
    \n")):e=e.replace(/ +\n/g,"
    \n"),r.converter._dispatch("spanGamut.after",e,t,r)}),i.subParser("strikethrough",function(e,t,r){return t.strikethrough&&(e=(e=r.converter._dispatch("strikethrough.before",e,t,r)).replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(e,a){return function(e){return t.simplifiedAutoLink&&(e=i.subParser("simplifiedAutoLinks")(e,t,r)),""+e+""}(a)}),e=r.converter._dispatch("strikethrough.after",e,t,r)),e}),i.subParser("stripLinkDefinitions",function(e,t,r){var a=function(e,a,n,o,s,l,c){return a=a.toLowerCase(),n.match(/^data:.+?\/.+?;base64,/)?r.gUrls[a]=n.replace(/\s/g,""):r.gUrls[a]=i.subParser("encodeAmpsAndAngles")(n,t,r),l?l+c:(c&&(r.gTitles[a]=c.replace(/"|'/g,""")),t.parseImgDimensions&&o&&s&&(r.gDimensions[a]={width:o,height:s}),"")};return(e=(e=(e+="¨0").replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n\n|(?=¨0)|(?=\n\[))/gm,a)).replace(/^ {0,3}\[(.+)]:[ \t]*\n?[ \t]*\s]+)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*\n?[ \t]*(?:(\n*)["|'(](.+?)["|')][ \t]*)?(?:\n+|(?=¨0))/gm,a)).replace(/¨0/,"")}),i.subParser("tables",function(e,t,r){function a(e){return/^:[ \t]*--*$/.test(e)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(e)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(e)?' style="text-align:center;"':""}function n(e,a){var n="";return e=e.trim(),(t.tablesHeaderId||t.tableHeaderId)&&(n=' id="'+e.replace(/ /g,"_").toLowerCase()+'"'),""+(e=i.subParser("spanGamut")(e,t,r))+"\n"}function o(e,a){return""+i.subParser("spanGamut")(e,t,r)+"\n"}function s(e){var s,l=e.split("\n");for(s=0;s\n\n\n",n=0;n\n";for(var i=0;i\n"}return r+"\n\n"}(h,p)}return t.tables?(e=(e=(e=(e=r.converter._dispatch("tables.before",e,t,r)).replace(/\\(\|)/g,i.helper.escapeCharactersCallback)).replace(/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,s)).replace(/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm,s),r.converter._dispatch("tables.after",e,t,r)):e}),i.subParser("underline",function(e,t,r){return t.underline?(e=r.converter._dispatch("underline.before",e,t,r),e=(e=t.literalMidWordUnderscores?(e=e.replace(/\b___(\S[\s\S]*?)___\b/g,function(e,t){return""+t+""})).replace(/\b__(\S[\s\S]*?)__\b/g,function(e,t){return""+t+""}):(e=e.replace(/___(\S[\s\S]*?)___/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/__(\S[\s\S]*?)__/g,function(e,t){return/\S$/.test(t)?""+t+"":e})).replace(/(_)/g,i.helper.escapeCharactersCallback),e=r.converter._dispatch("underline.after",e,t,r)):e}),i.subParser("unescapeSpecialChars",function(e,t,r){return e=(e=r.converter._dispatch("unescapeSpecialChars.before",e,t,r)).replace(/¨E(\d+)E/g,function(e,t){var r=parseInt(t);return String.fromCharCode(r)}),r.converter._dispatch("unescapeSpecialChars.after",e,t,r)}),i.subParser("makeMarkdown.blockquote",function(e,t){var r="";if(e.hasChildNodes())for(var a=e.childNodes,n=a.length,o=0;o "+(r=r.trim()).split("\n").join("\n> ")}),i.subParser("makeMarkdown.codeBlock",function(e,t){var r=e.getAttribute("language"),a=e.getAttribute("precodenum");return"```"+r+"\n"+t.preList[a]+"\n```"}),i.subParser("makeMarkdown.codeSpan",function(e){return"`"+e.innerHTML+"`"}),i.subParser("makeMarkdown.emphasis",function(e,t){var r="";if(e.hasChildNodes()){r+="*";for(var a=e.childNodes,n=a.length,o=0;o",e.hasAttribute("width")&&e.hasAttribute("height")&&(t+=" ="+e.getAttribute("width")+"x"+e.getAttribute("height")),e.hasAttribute("title")&&(t+=' "'+e.getAttribute("title")+'"'),t+=")"),t}),i.subParser("makeMarkdown.links",function(e,t){var r="";if(e.hasChildNodes()&&e.hasAttribute("href")){var a=e.childNodes,n=a.length;r="[";for(var o=0;o",e.hasAttribute("title")&&(r+=' "'+e.getAttribute("title")+'"'),r+=")"}return r}),i.subParser("makeMarkdown.list",function(e,t,r){var a="";if(!e.hasChildNodes())return"";for(var n=e.childNodes,o=n.length,s=e.getAttribute("start")||1,l=0;l"+t.preList[r]+""}),i.subParser("makeMarkdown.strikethrough",function(e,t){var r="";if(e.hasChildNodes()){r+="~~";for(var a=e.childNodes,n=a.length,o=0;otr>th"),l=e.querySelectorAll("tbody>tr");for(r=0;rp&&(p=g)}for(r=0;r/g,"\\$1>")).replace(/^#/gm,"\\#")).replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3")).replace(/^( {0,3}\d+)\./gm,"$1\\.")).replace(/^( {0,3})([+-])/gm,"$1\\$2")).replace(/]([\s]*)\(/g,"\\]$1\\(")).replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:")}),e.exports?e.exports=i:this.showdown=i}).call(t)}),fe={pangu:n,minimatch:R,beautify:re,style:ce,rdability:de,markdown:Object.freeze({default:he,__moduleExports:he})};e.Plugin=function(e){return void 0==e?fe:fe[e]},Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/src/vender/puread/puread.min.js b/src/vender/puread/puread.min.js index 910e1359..51a4be02 100644 --- a/src/vender/puread/puread.min.js +++ b/src/vender/puread/puread.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PureRead=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var r=0;r?$|<[^/][-_a-zA-Z0-9]+>?$/gi);return e&&e.length>0?[1,e]:[-1,void 0]}function c(t){var e=s(t),r=i(e,2),n=r[0],a=r[1];if(2==n)return t;if(1==n){var o=a[0].trim().replace(/['"<>]/g,"").replace(/ /gi,"=").split("="),l=i(o,3),u=l[0],c=l[1],h=l[2];return c?"class"===c.toLowerCase()?c=u+"."+h:"id"===c.toLowerCase()&&(c=u+"#"+h):c=u,c}return null}function h(t){return/^(\[\[)[\[{`'/]{1}[ \S]+[}`'/\]]\]\]{1}($)/g.test(t)}function d(t){var e=[t.replace(/(^)\[\[|\]\]$/g,"")],r=e[0],n=e[1];switch(r[0]){case"{":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)(),n=0;break;case"'":t=(t=r.replace(/^'|'$/g,"")).match(/^<[a-zA-Z0-9_-]+>/g).join("").replace(/<|>/g,"")+":contains("+t.replace(/<[/a-zA-Z0-9_-]+>/g,"")+")",n=1;break;case"/":t=r.replace(/^\/|\/$/g,"").replace(/\\{2}/g,"\\").replace(/'/g,'"'),n=2;break;case"[":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)()[0],n=3;break;case"`":r=p(r=r.replace(/^`|`$/g,"")),t=$(r),n=4;break;default:n=-1}return[t,n]}function f(t){try{if(""!=t.id)return void 0==t.id?"":"//*[@id='"+t.id+"']";if(t===document.body)return"/html[1]/"+t.tagName.toLowerCase();for(var e=0,r=t.parentNode.childNodes,n=0;n0&&void 0!==arguments[0]?arguments[0]:{global:[],custom:[],local:[]};t(this,n),this.url=(r=(e="/"!=(e=window.location.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,""),window.location.protocol+"//"+window.location.hostname+r+"/"),this.sites=a,this.current={},this.state="none",this.origins=[],this.mathjax=void 0,b=location.href}return e(n,[{key:"SetURL",value:function(t){var e,r=u(t),n=(e="/"!=(e=r.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,"");this.url=r.protocol+"//"+r.hostname+n+"/",b=t}},{key:"SetMinimatch",value:function(t){v=t}},{key:"SetRdability",value:function(t){g=t}},{key:"SetMarkdown",value:function(t){y=t}},{key:"isMathJax",value:function(){var t=this;return void 0==this.mathjax&&(this.mathjax=!1,$("body").find("script").each(function(e,r){r.type.startsWith("math")&&(t.mathjax=!0)})),this.mathjax}},{key:"MathJaxMode",value:function(){var t=x();if(-1!=t)return this.Newsite("read",t[0].outerHTML),this.dom=t[0],this.state="temp",t;var e=k();if(e&&""!=e.content){var r=j(e.content),n=r.id,a=r.cls,i=r.tag;return""!=n?"<"+i+' id="'+n+'">':""!=a?"<"+i+' class="'+a+'">':void 0}}},{key:"Readability",value:function(){try{var t=k();if(!t||""==t.content)throw"Readability error";this.Newsite("read",t.content,t.excerpt);var e=j(t.wrap),r=e.id,n=e.cls,a=e.tag;this.dom=""!=r?$("body").find("#"+r)[0]:""!=n?$("body").find("."+n.replace(/ /gi,"."))[0]:$("body").find(""+a)[0],this.state="temp"}catch(t){var i=x();-1!=i?(this.Newsite("read",i[0].outerHTML),this.dom=i[0],this.state="temp"):this.current.site=l(m)}}},{key:"Getsite",value:function(t,e){return this.sites[t].find(function(t){return t[0]==e})}},{key:"Getsites",value:function(){var t=this,e=[],n=function(){if(v(location.href,"file://**/*.txt")||v(location.href,"http*://**/*.txt"))return function(){var t=location.pathname.split("/").pop(),e="file:"==location.protocol?"local":"remote",r={name:"txtread::"+e,title:"",desc:"",include:"<pre>",auto:!1,exclude:[]};"remote"==e&&(r.include="",r.html=$("body pre").html().replace(/\n/gi,"<br>"));return!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".txt",""))+""),r}();if($($("body").children()[0]).is("pre")&&(v(location.href,"file://**/*.md")||v(location.href,"http*://**/*.md")))return function(){var t=location.pathname.split("/").pop(),e={name:"txtread::"+("file:"==location.protocol?"local":"remote"),title:"",desc:"",include:"",auto:!1,exclude:[]},r=(new y.default.Converter).makeHtml($("body pre").text());return e.html=r,!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".md",""))+""),e}();var t=/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/gi,e={name:$("meta[name='simpread:name']").attr("content"),url:$("meta[name='simpread:url']").attr("content"),title:$("meta[name='simpread:title']").attr("content"),desc:$("meta[name='simpread:desc']").attr("content"),include:$("meta[name='simpread:include']").attr("content"),exp:$("meta[name='simpread:exclude']").attr("content"),auto:$("meta[name='simpread:auto']").attr("content"),exclude:[]};if(e.name&&e.include){if(e.url&&!v(location.href,e.url))return;!e.title&&(e.title=""),!e.desc&&(e.desc=""),!e.exp&&(e.exp=""),e.name="metaread::"+e.name,e.auto="true"==e.auto;var r=["title","desc","include","exp"].findIndex(function(r){return""!=e[r]&&!e[r].match(t)});return e.exclude.push(e.exp),delete e.exp,-1==r?e:void 0}return}();if(this.current.url=this.url,n)this.current.auto=n.auto,this.current.url=n.url,delete n.auto,delete n.url,this.current.site=r({},n),this.current.site.name.startsWith("metaread::")&&(this.state="meta"),this.current.site.name.startsWith("txtread::")&&(this.state="txt");else if(_("local",new Map(this.sites.local),this.url,e),_("global",new Map(this.sites.global),this.url,e),_("person",new Map(this.sites.person),this.url,e),_("custom",new Map(this.sites.custom),this.url,e),e.length>0){var a=void 0;if(e.forEach(function(e){e[1].active&&(a=e,t.current.url=a[0],t.current.site=t.Safesite(r({},a[1]),a[2],a[0]),t.state="adapter")}),!a){var i=e[0];i[1].active=!0,this.current.url=i[0],this.current.site=this.Safesite(r({},i[1]),i[2],i[0]),this.state="adapter"}}else{var o=function(){if(location.pathname.includes("thread")||location.pathname.includes("forum.php")){if($(".t_f").length>0&&$(".favatar").find(".authi").length>0&&$(".avatar").find("img").length>0)return{avatar:[{name:"[[{$('.favatar').find('.authi')}]]"},{url:"[[{$('.avatar').find('img')}]]"}],include:"[[{$('.t_f')}]]"}}else if(/\/t\/[\w-]+\/\d+/.test(location.pathname)&&$("meta[name=generator]").attr("content").includes("discourse"))return{avatar:[{name:"[[{$('.topic-avatar').find('.a[data-user-card]')}]]"},{url:"[[{$('.topic-avatar').find('img')}]]"}],include:"[[{$('.cooked')}]]"};return-1}();-1!=o?(this.Newmultisite("read",o),this.state="temp"):this.Readability()}this.current.site.matching=e}},{key:"Addsites",value:function(t){var e=0;if(0==this.sites.global.length)this.sites.global=this.Formatsites(t),e=this.sites.global.length;else{var r=function(t,e){var r=new Map(e),n=[].concat(o(r.keys())),a=0;return t.map(function(t){n.includes(t[0])?n.includes(t[0]):a++}),{count:a,newsites:t}}(this.Formatsites(t),this.sites.global);e=r.count,this.sites.global=r.newsites}return e}},{key:"Addlocalsites",value:function(t){return this.sites.local=[].concat(o(t)),this.sites.local}},{key:"Addallsites",value:function(t){return this.sites={global:[].concat(o(t.global)),person:[].concat(o(t.person)),custom:[].concat(o(t.custom)),local:[].concat(o(t.local))},this.sites}},{key:"Newsite",value:function(t,e,n){var a={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"[[{$('meta[name=Description]').attr('content')||$('meta[name=description]').attr('content')}]]",include:"",exclude:[]}};e&&(a.site.html=e),this.current.mode=a.mode,this.current.url=a.url,this.current.site=this.Safesite(r({},a.site),"local",a.url),n&&(this.current.site.excerpt=n)}},{key:"Newmultisite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:e.include,exclude:[],avatar:e.avatar}};this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Updatesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1==n&&(n=this.sites[t].length),this.sites[t].splice(n,1,r)}},{key:"Deletesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1!=n&&this.sites[t].splice(n,1),r(n)}},{key:"Safesite",value:function(t,e,r){return t.url=r,t.target=e,""==t.name&&(t.name="tempread::"),(!t.avatar||0==t.avatar.length)&&(t.avatar=[{name:""},{url:""}]),(!t.paging||0==t.paging.length)&&(t.paging=[{prev:""},{next:""}]),t}},{key:"Cleansite",value:function(t){return delete t.url,delete t.html,delete t.target,delete t.matching,t.avatar&&t.avatar.length>0&&""==t.avatar[0].name&&delete t.avatar,t.paging&&t.paging.length>0&&""==t.paging[0].prev&&delete t.paging,t}},{key:"Formatsites",value:function(t){var e=new Map,r=!0,n=!1,a=void 0;try{for(var i,l=t.sites[Symbol.iterator]();!(r=(i=l.next()).done);r=!0){var u=i.value;if(0==O(u)){var s=u.url;delete u.url,e.set(s,u)}}}catch(t){n=!0,a=t}finally{try{!r&&l.return&&l.return()}finally{if(n)throw a}}return[].concat(o(e))}},{key:"Clearsites",value:function(t){t?this.sites[t]=[]:this.sites={global:[],custom:[],local:[]}}},{key:"Origins",value:function(t){var e=t.origins.map(function(t){return t.url});return(e=new Set(this.origins.concat(e))).forEach(function(t){""!=t.trim()&&t.trim().startsWith("http")&&t.trim().endsWith(".json")||e.delete(t)}),this.origins=[].concat(o(e)),this.origins}},{key:"Addorigins",value:function(t){return this.sites.custom=[].concat(o(t)),this.sites.custom}},{key:"Clearorigins",value:function(){var t=this.sites.custom.length;return this.sites.custom=[],t}}]),n}();function x(){var t=$("body"),e=!0,r=!1,n=void 0;try{for(var a,i=["[itemprop='articleBody']","article",".post-content",".entry-content",".post-article",".content-post",".article-entry",".article-content",".article-body",".markdown-body",".post",".content"][Symbol.iterator]();!(e=(a=i.next()).done);e=!0){var o=a.value,l=t.find(o);if(l.length>0)return l}}catch(t){r=!0,n=t}finally{try{!e&&i.return&&i.return()}finally{if(r)throw n}}return-1}function k(){var t=document.location,e=(t.href,t.host,t.protocol,t.host,t.protocol.substr(0,t.protocol.indexOf(":")),t.protocol,t.host,t.pathname.substr(0,t.pathname.lastIndexOf("/")+1),new g.Readability(document.cloneNode(!0)).parse());return e}function _(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=function(t){var e=t.replace("www.","").match(/\.\S+\.\S+/g);return e?e[0].substr(1):t.replace("www.","")},i=u(b),s=[].concat(o(e.keys())),c=r.match(/[.a-zA-z0-9-_]+/g)[1].replace("www.",""),h=a(i.hostname),d=function(){return"/"==i.pathname||/\/(default|index|portal).[0-9a-zA-Z]+$/.test(i.pathname)},f=!0,p=!1,m=void 0;try{for(var g,y=s[Symbol.iterator]();!(f=(g=y.next()).done);f=!0){var w=g.value,x=e.get(w).name,$=a(x);d()||w.endsWith("*")||w.replace(/^http[s]?:/,"")!=r.replace(/^http[s]?:/,"")?w.match(/\*/g)&&1==w.match(/\*/g).length&&!d()&&w.endsWith("*")&&c.includes($)&&h==$&&r.includes(x)?n.push([w,l(e.get(w)),t]):v(i.origin+i.pathname,w)&&n.push([w,l(e.get(w)),t]):n.push([w,l(e.get(w)),t])}}catch(t){p=!0,m=t}finally{try{!f&&y.return&&y.return()}finally{if(p)throw m}}}function O(t){if(!t.name||!t.url||!t.include)return-1;if(-1==s(t.title)[0]||-1==s(t.include)[0]||-1==s(t.desc)[0])return-2;if(t.paging){if(2!=t.paging.length)return-3;if(!t.paging[0].prev)return-4;if(!t.paging[1].next)return-5;if(-1==s(t.paging[0].prev)[0]||-1==s(t.paging[1].next)[0])return-6}if(t.avatar){if(2!=t.avatar.length)return-7;if(!t.avatar[0].name)return-8;if(!t.avatar[1].url)return-9;if(-1==s(t.avatar[0].name)[0]||-1==s(t.avatar[1].url)[0])return-10}return 0}function j(t){var e=t.replace('<div id="readability-page-1" class="page">',""),r=$(e)[0],n=r.outerHTML.replace(r.innerHTML,""),a=$(n)[0],i=a.tagName.toLowerCase(),o=a.className;return{id:a.id,cls:o,tag:i}}function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text",r=$("html");if(h(t)){var n=d(t),a=i(n,2),o=a[0],l=a[1];0==l?t=o:3==l?t=M(r.find(o)):4==l&&(t=o.html())}else"html"==e?t=M(r.find(t)):"multi"==e||(t=r.find(t).text().trim());return t}function M(t){var e="";switch(t.length){case 0:e="<sr-rd-content-error></sr-rd-content-error>";break;case 1:e=t.html().trim();break;default:e=t.map(function(t,e){return $(e).html()}).get().join("<br>")}return e}return function(r){function o(e){t(this,o);var r=a(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.version="0.0.4 build 0616",r.org_url=location.href,r.html={},r.plugin={},r.pure=!1,r.cleanup=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,w),e(o,[{key:"Exist",value:function(){return this.org_url==location.href}},{key:"AddPlugin",value:function(t){this.plugin={minimatch:t.minimatch,pangu:t.pangu,beautify:t.beautify,stylesheet:t.style,rdability:t.rdability,markdown:t.markdown},n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMinimatch",this).call(this,this.plugin.minimatch),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetRdability",this).call(this,this.plugin.rdability),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMarkdown",this).call(this,this.plugin.markdown)}},{key:"ReadMode",value:function(){var t,e,r,n,a;this.html=(t=this.current.site,e=l(t),r=c(""==t.title?"<title>":t.title),n=c(t.desc),a=c(t.include),e.title=""==t.title||"<title>"==t.title?$("head title").text():S(r),e.desc=function(t){if(void 0==t)return t;var e=t.length,r=t.indexOf("。")+1;return e>100&&(t=r>0?t.substr(0,r):t.substr(0,101)+"......"),t}(t.excerpt?t.excerpt:S(n)),e.include=""==t.include&&""!=t.html?t.html:S(a,"html"),e.avatar&&e.avatar.length>0&&""==e.avatar[0].name&&delete e.avatar,e.paging&&e.paging.length>0&&""==e.paging[0].prev&&delete e.paging,e.avatar&&e.avatar.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=S(c(r),"html")}),e.paging&&e.paging.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=S(c(r))}),e)}},{key:"TempMode",value:function(t,e){this.state="temp",this.dom=e,this.Newsite(t,e.outerHTML)}},{key:"GetDom",value:function(t,e){return S(c(t),e)}},{key:"Include",value:function(){var t=this.current.site.include,e=[],r=c(t);try{if(h(r)){var n=d(t),a=i(n,2),o=a[0],l=a[1];0==l?(t=t.replace(/\[\[{\$\(|}\]\]|\).html\(\)/g,""),e=$(d("[[["+t+"]]]")[0])):3==l&&(e=o)}else r&&(e=$("body").find(r))}catch(t){}return e}},{key:"Exclude",value:function(t){return function(t,e){var r=[],n="",a=!0,o=!1,l=void 0;try{for(var u,s=e[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var f=u.value;if(h(f)){var p=d(f),m=i(p,2),v=m[0],g=m[1];if(1==g)n=v;else if(2==g){var y=t.html().match(new RegExp(v,"g"));if(y&&y.length>0){var b=y.join("");n="*["+b+"]"}else n=void 0}else 3==g?v.remove():4==g&&v.remove()}else n=c(f);n&&r.push(n)}}catch(t){o=!0,l=t}finally{try{!a&&s.return&&s.return()}finally{if(o)throw l}}return r.join(",")}(t,this.current.site.exclude)}},{key:"Beautify",value:function(t){0!=t.children().length&&this.plugin.beautify&&(this.cleanup&&this.plugin.beautify.cleanHTML(t,this.pure,this.isMathJax()),this.plugin.beautify.specbeautify(this.current.site.name,t),this.plugin.beautify.removeSpareTag(this.current.site.name,t),this.plugin.beautify.htmlbeautify(t),this.plugin.beautify.commbeautify(this.current.site.name,t))}},{key:"Format",value:function(t){this.plugin.pangu&&this.plugin.pangu.spacingElementByClassName(t)}},{key:"Utils",value:function(){return{dom2Xpath:f,xPath2Dom:p}}}]),o}()}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PureRead=e()}(this,function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function t(e,r,n){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,r);if(void 0===i){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,r,n)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(n):void 0},i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},a=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,l=t[Symbol.iterator]();!(n=(o=l.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&l.return&&l.return()}finally{if(i)throw a}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)};function l(t){return $.extend(!0,{},t)}function u(t){if(document){var e=document.createElement("a");return e.href=t,e}var r=t.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return r&&{href:t,protocol:r[1],host:r[2],hostname:r[3],port:r[4],pathname:r[5],search:r[6],hash:r[7]}}function s(t){if(""==t)return[0,t];if(h(t))return[2,t];var e=t.match(/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/gi);return e&&e.length>0?[1,e]:[-1,void 0]}function c(t){var e=s(t),r=a(e,2),n=r[0],i=r[1];if(2==n)return t;if(1==n){var o=i[0].trim().replace(/['"<>]/g,"").replace(/ /gi,"=").split("="),l=a(o,3),u=l[0],c=l[1],h=l[2];return c?"class"===c.toLowerCase()?c=u+"."+h:"id"===c.toLowerCase()&&(c=u+"#"+h):c=u,c}return null}function h(t){return/^(\[\[)[\[{`'/]{1}[ \S]+[}`'/\]]\]\]{1}($)/g.test(t)}function d(t){var e=[t.replace(/(^)\[\[|\]\]$/g,"")],r=e[0],n=e[1];switch(r[0]){case"{":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)(),n=0;break;case"'":t=(t=r.replace(/^'|'$/g,"")).match(/^<[a-zA-Z0-9_-]+>/g).join("").replace(/<|>/g,"")+":contains("+t.replace(/<[/a-zA-Z0-9_-]+>/g,"")+")",n=1;break;case"/":t=r.replace(/^\/|\/$/g,"").replace(/\\{2}/g,"\\").replace(/'/g,'"'),n=2;break;case"[":r=r.replace(/^{|}$/g,""),t=new Function("return "+r)()[0],n=3;break;case"`":r=p(r=r.replace(/^`|`$/g,"")),t=$(r),n=4;break;default:n=-1}return[t,n]}function f(t){try{if(""!=t.id)return void 0==t.id?"":"//*[@id='"+t.id+"']";if(t===document.body)return"/html[1]/"+t.tagName.toLowerCase();for(var e=0,r=t.parentNode.childNodes,n=0;n<r.length;n++){var i=r[n];if(i===t)return f(t.parentNode)+"/"+t.tagName.toLowerCase()+"["+(e+1)+"]";1===i.nodeType&&i.tagName===t.tagName&&e++}}catch(t){return""}}function p(t){return document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var m={url:"",target:"",matching:[],name:"",title:"",desc:"",exclude:[],include:"",avatar:[],paging:[]},v=void 0,g=void 0,y=void 0,b=void 0,w=function(){function n(){var e,r,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{global:[],custom:[],local:[]};t(this,n),this.url=(r=(e="/"!=(e=window.location.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,""),window.location.protocol+"//"+window.location.hostname+r+"/"),this.sites=i,this.current={},this.state="none",this.origins=[],this.mathjax=void 0,b=location.href}return e(n,[{key:"SetURL",value:function(t){var e,r=u(t),n=(e="/"!=(e=r.pathname)&&e.endsWith("/")?e=e.replace(/\/$/,""):e).replace(/\/[%@#.~a-zA-Z0-9_-]+$|^\/$/g,"");this.url=r.protocol+"//"+r.hostname+n+"/",b=t}},{key:"SetMinimatch",value:function(t){v=t}},{key:"SetRdability",value:function(t){g=t}},{key:"SetMarkdown",value:function(t){y=t}},{key:"isMathJax",value:function(){var t=this;return void 0==this.mathjax&&(this.mathjax=!1,$("body").find("script").each(function(e,r){r.type.startsWith("math")&&(t.mathjax=!0)})),this.mathjax}},{key:"MathJaxMode",value:function(){var t=x();if(-1!=t)return this.Newsite("read",t[0].outerHTML),this.dom=t[0],this.state="temp",t;var e=k();if(e&&""!=e.content){var r=j(e.content),n=r.id,i=r.cls,a=r.tag;return""!=n?"<"+a+' id="'+n+'">':""!=i?"<"+a+' class="'+i+'">':void 0}}},{key:"Readability",value:function(){try{var t=k();if(!t||""==t.content)throw"Readability error";this.Newsite("read",t.content,t.excerpt);var e=j(t.wrap),r=e.id,n=e.cls,i=e.tag;this.dom=""!=r?$("body").find("#"+r)[0]:""!=n?$("body").find("."+n.replace(/ /gi,"."))[0]:$("body").find(""+i)[0],this.state="temp"}catch(t){var a=x();-1!=a?(this.Newsite("read",a[0].outerHTML),this.dom=a[0],this.state="temp"):this.current.site=l(m)}}},{key:"Getsite",value:function(t,e){return this.sites[t].find(function(t){return t[0]==e})}},{key:"Getsites",value:function(){var t=this,e=[],n=function(){if(v(location.href,"file://**/*.txt")||v(location.href,"http*://**/*.txt"))return function(){var t=location.pathname.split("/").pop(),e="file:"==location.protocol?"local":"remote",r={name:"txtread::"+e,title:"<title>",desc:"",include:"<pre>",auto:!1,exclude:[]};"remote"==e&&(r.include="",r.html=$("body pre").html().replace(/\n/gi,"<br>"));return!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".txt",""))+""),r}();if($($("body").children()[0]).is("pre")&&(v(location.href,"file://**/*.md")||v(location.href,"http*://**/*.md")))return function(){var t=location.pathname.split("/").pop(),e={name:"txtread::"+("file:"==location.protocol?"local":"remote"),title:"",desc:"",include:"",auto:!1,exclude:[]},r=(new y.default.Converter).makeHtml($("body pre").text());return e.html=r,!$("title").html()&&$("head").append("<title>"+decodeURI(t.replace(".md",""))+""),e}();var t=/<\S+ (class|id)=("|')?[\w-_=;:' ]+("|')?>?$|<[^/][-_a-zA-Z0-9]+>?$/gi,e={name:$("meta[name='simpread:name']").attr("content"),url:$("meta[name='simpread:url']").attr("content"),title:$("meta[name='simpread:title']").attr("content"),desc:$("meta[name='simpread:desc']").attr("content"),include:$("meta[name='simpread:include']").attr("content"),exp:$("meta[name='simpread:exclude']").attr("content"),auto:$("meta[name='simpread:auto']").attr("content"),exclude:[]};if(e.name&&e.include){if(e.url&&!v(location.href,e.url))return;!e.title&&(e.title=""),!e.desc&&(e.desc=""),!e.exp&&(e.exp=""),e.name="metaread::"+e.name,e.auto="true"==e.auto;var r=["title","desc","include","exp"].findIndex(function(r){return""!=e[r]&&!e[r].match(t)});return e.exclude.push(e.exp),delete e.exp,-1==r?e:void 0}return}();if(this.current.url=this.url,n)this.current.auto=n.auto,this.current.url=n.url,delete n.auto,delete n.url,this.current.site=r({},n),this.current.site.name.startsWith("metaread::")&&(this.state="meta"),this.current.site.name.startsWith("txtread::")&&(this.state="txt");else if(_("local",new Map(this.sites.local),this.url,e),_("global",new Map(this.sites.global),this.url,e),_("person",new Map(this.sites.person),this.url,e),_("custom",new Map(this.sites.custom),this.url,e),e.length>0){var i=void 0;if(e.forEach(function(e){e[1].active&&(i=e,t.current.url=i[0],t.current.site=t.Safesite(r({},i[1]),i[2],i[0]),t.state="adapter")}),!i){var a=e[0];a[1].active=!0,this.current.url=a[0],this.current.site=this.Safesite(r({},a[1]),a[2],a[0]),this.state="adapter"}}else{var o=function(){if(location.pathname.includes("thread")||location.pathname.includes("forum.php")){if($(".t_f").length>0&&$(".favatar").find(".authi").length>0&&$(".avatar").find("img").length>0)return{avatar:[{name:"[[{$('.favatar').find('.authi')}]]"},{url:"[[{$('.avatar').find('img')}]]"}],include:"[[{$('.t_f')}]]"}}else if(/\/t\/[\w-]+\/\d+/.test(location.pathname)&&$("meta[name=generator]").attr("content").includes("discourse"))return{avatar:[{name:"[[{$('.topic-avatar').find('.a[data-user-card]')}]]"},{url:"[[{$('.topic-avatar').find('img')}]]"}],include:"[[{$('.cooked')}]]"};return-1}();-1!=o?(this.Newmultisite("read",o),this.state="temp"):this.Readability()}this.current.site.matching=e}},{key:"Addsites",value:function(t){var e=0;if(0==this.sites.global.length)this.sites.global=this.Formatsites(t),e=this.sites.global.length;else{var r=function(t,e){var r=new Map(e),n=[].concat(o(r.keys())),i=0;return t.map(function(t){n.includes(t[0])?n.includes(t[0]):i++}),{count:i,newsites:t}}(this.Formatsites(t),this.sites.global);e=r.count,this.sites.global=r.newsites}return e}},{key:"Addlocalsites",value:function(t){return this.sites.local=[].concat(o(t)),this.sites.local}},{key:"Addallsites",value:function(t){return this.sites={global:[].concat(o(t.global)),person:[].concat(o(t.person)),custom:[].concat(o(t.custom)),local:[].concat(o(t.local))},this.sites}},{key:"Newsite",value:function(t,e,n){var i={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"[[{$('meta[name=Description]').attr('content')||$('meta[name=description]').attr('content')}]]",include:"",exclude:[]}};e&&(i.site.html=e),this.current.mode=i.mode,this.current.url=i.url,this.current.site=this.Safesite(r({},i.site),"local",i.url),n&&(this.current.site.excerpt=n)}},{key:"Newmultisite",value:function(t,e){var n={mode:t,url:window.location.href,site:{name:"tempread::"+window.location.host,title:"<title>",desc:"",include:e.include,exclude:[],avatar:e.avatar}};this.current.mode=n.mode,this.current.url=n.url,this.current.site=this.Safesite(r({},n.site),"local",n.url)}},{key:"Updatesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1==n&&(n=this.sites[t].length),this.sites[t].splice(n,1,r)}},{key:"Deletesite",value:function(t,e,r){var n=this.sites[t].findIndex(function(t){return t[0]==e});-1!=n&&this.sites[t].splice(n,1),r(n)}},{key:"Safesite",value:function(t,e,r){return t.url=r,t.target=e,""==t.name&&(t.name="tempread::"),(!t.avatar||0==t.avatar.length)&&(t.avatar=[{name:""},{url:""}]),(!t.paging||0==t.paging.length)&&(t.paging=[{prev:""},{next:""}]),t}},{key:"Cleansite",value:function(t){return delete t.url,delete t.html,delete t.target,delete t.matching,t.avatar&&t.avatar.length>0&&""==t.avatar[0].name&&delete t.avatar,t.paging&&t.paging.length>0&&""==t.paging[0].prev&&delete t.paging,t}},{key:"Formatsites",value:function(t){var e=new Map,r=!0,n=!1,i=void 0;try{for(var a,l=t.sites[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;if(0==O(u)){var s=u.url;delete u.url,e.set(s,u)}}}catch(t){n=!0,i=t}finally{try{!r&&l.return&&l.return()}finally{if(n)throw i}}return[].concat(o(e))}},{key:"Clearsites",value:function(t){t?this.sites[t]=[]:this.sites={global:[],custom:[],local:[]}}},{key:"Origins",value:function(t){var e=t.origins.map(function(t){return t.url});return(e=new Set(this.origins.concat(e))).forEach(function(t){""!=t.trim()&&t.trim().startsWith("http")&&t.trim().endsWith(".json")||e.delete(t)}),this.origins=[].concat(o(e)),this.origins}},{key:"Addorigins",value:function(t){return this.sites.custom=[].concat(o(t)),this.sites.custom}},{key:"Clearorigins",value:function(){var t=this.sites.custom.length;return this.sites.custom=[],t}}]),n}();function x(){var t=$("body"),e=!0,r=!1,n=void 0;try{for(var i,a=["[itemprop='articleBody']","article",".post-content",".entry-content",".post-article",".content-post",".article-entry",".article-content",".article-body",".markdown-body",".post",".content"][Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var o=i.value,l=t.find(o);if(l.length>0)return l}}catch(t){r=!0,n=t}finally{try{!e&&a.return&&a.return()}finally{if(r)throw n}}return-1}function k(){var t=document.location,e=(t.href,t.host,t.protocol,t.host,t.protocol.substr(0,t.protocol.indexOf(":")),t.protocol,t.host,t.pathname.substr(0,t.pathname.lastIndexOf("/")+1),new g.Readability(document.cloneNode(!0)).parse());return e}function _(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(t){var e=t.replace("www.","").match(/\.\S+\.\S+/g);return e?e[0].substr(1):t.replace("www.","")},a=u(b),s=[].concat(o(e.keys())),c=r.match(/[.a-zA-z0-9-_]+/g)[1].replace("www.",""),h=i(a.hostname),d=function(){return"/"==a.pathname||/\/(default|index|portal).[0-9a-zA-Z]+$/.test(a.pathname)},f=!0,p=!1,m=void 0;try{for(var g,y=s[Symbol.iterator]();!(f=(g=y.next()).done);f=!0){var w=g.value,x=e.get(w).name,$=i(x);w.startsWith("[[/")&&w.endsWith("/]]")&&new RegExp(w.replace(/^\[\[\/|\/\]\]/g,"")).test(location.href)?n.push([w,l(e.get(w)),t]):d()||w.endsWith("*")||w.replace(/^http[s]?:/,"")!=r.replace(/^http[s]?:/,"")?w.match(/\*/g)&&1==w.match(/\*/g).length&&!d()&&w.endsWith("*")&&c.includes($)&&h==$&&r.includes(x)?n.push([w,l(e.get(w)),t]):v(a.origin+a.pathname,w)&&n.push([w,l(e.get(w)),t]):n.push([w,l(e.get(w)),t])}}catch(t){p=!0,m=t}finally{try{!f&&y.return&&y.return()}finally{if(p)throw m}}}function O(t){if(!t.name||!t.url||!t.include)return-1;if(-1==s(t.title)[0]||-1==s(t.include)[0]||-1==s(t.desc)[0])return-2;if(t.paging){if(2!=t.paging.length)return-3;if(!t.paging[0].prev)return-4;if(!t.paging[1].next)return-5;if(-1==s(t.paging[0].prev)[0]||-1==s(t.paging[1].next)[0])return-6}if(t.avatar){if(2!=t.avatar.length)return-7;if(!t.avatar[0].name)return-8;if(!t.avatar[1].url)return-9;if(-1==s(t.avatar[0].name)[0]||-1==s(t.avatar[1].url)[0])return-10}return 0}function j(t){var e=t.replace('<div id="readability-page-1" class="page">',""),r=$(e)[0],n=r.outerHTML.replace(r.innerHTML,""),i=$(n)[0],a=i.tagName.toLowerCase(),o=i.className;return{id:i.id,cls:o,tag:a}}function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text",r=$("html");if(h(t)){var n=d(t),i=a(n,2),o=i[0],l=i[1];0==l?t=o:3==l?t=M(r.find(o)):4==l&&(t=o.html())}else"html"==e?t=M(r.find(t)):"multi"==e||(t=r.find(t).text().trim());return t}function M(t){var e="";switch(t.length){case 0:e="<sr-rd-content-error></sr-rd-content-error>";break;case 1:e=t.html().trim();break;default:e=t.map(function(t,e){return $(e).html()}).get().join("<br>")}return e}return function(r){function o(e){t(this,o);var r=i(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,e));return r.version="0.0.4 build 0111",r.org_url=location.href,r.html={},r.plugin={},r.pure=!1,r.cleanup=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(o,w),e(o,[{key:"Exist",value:function(){return this.org_url==location.href}},{key:"AddPlugin",value:function(t){this.plugin={minimatch:t.minimatch,pangu:t.pangu,beautify:t.beautify,stylesheet:t.style,rdability:t.rdability,markdown:t.markdown},n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMinimatch",this).call(this,this.plugin.minimatch),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetRdability",this).call(this,this.plugin.rdability),n(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"SetMarkdown",this).call(this,this.plugin.markdown)}},{key:"ReadMode",value:function(){var t,e,r,n,i;this.html=(t=this.current.site,e=l(t),r=c(""==t.title?"<title>":t.title),n=c(t.desc),i=c(t.include),e.title=""==t.title||"<title>"==t.title?$("head title").text():S(r),e.desc=function(t){if(void 0==t)return t;var e=t.length,r=t.indexOf("。")+1;return e>100&&(t=r>0?t.substr(0,r):t.substr(0,101)+"......"),t}(t.excerpt?t.excerpt:S(n)),e.include=""==t.include&&""!=t.html?t.html:S(i,"html"),e.avatar&&e.avatar.length>0&&""==e.avatar[0].name&&delete e.avatar,e.paging&&e.paging.length>0&&""==e.paging[0].prev&&delete e.paging,e.avatar&&e.avatar.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=S(c(r),"html")}),e.paging&&e.paging.forEach(function(t){var e=Object.keys(t).join(),r=t[e];t[e]=S(c(r))}),e)}},{key:"TempMode",value:function(t,e){this.state="temp",this.dom=e,this.Newsite(t,e.outerHTML)}},{key:"GetDom",value:function(t,e){return S(c(t),e)}},{key:"Include",value:function(){var t=this.current.site.include,e=[],r=c(t);try{if(h(r)){var n=d(t),i=a(n,2),o=i[0],l=i[1];0==l?(t=t.replace(/\[\[{\$\(|}\]\]|\).html\(\)/g,""),e=$(d("[[["+t+"]]]")[0])):3==l&&(e=o)}else r&&(e=$("body").find(r))}catch(t){}return e}},{key:"Exclude",value:function(t){return function(t,e){var r=[],n="",i=!0,o=!1,l=void 0;try{for(var u,s=e[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var f=u.value;if(h(f)){var p=d(f),m=a(p,2),v=m[0],g=m[1];if(1==g)n=v;else if(2==g){var y=t.html().match(new RegExp(v,"g"));if(y&&y.length>0){var b=y.join("");n="*["+b+"]"}else n=void 0}else 3==g?v.remove():4==g&&v.remove()}else n=c(f);n&&r.push(n)}}catch(t){o=!0,l=t}finally{try{!i&&s.return&&s.return()}finally{if(o)throw l}}return r.join(",")}(t,this.current.site.exclude)}},{key:"Beautify",value:function(t){0!=t.children().length&&this.plugin.beautify&&(this.plugin.beautify.before(this.current.site.name,t),this.cleanup&&this.plugin.beautify.cleanHTML(t,this.pure,this.isMathJax()),this.plugin.beautify.specbeautify(this.current.site.name,t),this.plugin.beautify.removeSpareTag(this.current.site.name,t),this.plugin.beautify.htmlbeautify(t),this.plugin.beautify.commbeautify(this.current.site.name,t))}},{key:"Format",value:function(t){this.plugin.pangu&&this.plugin.pangu.spacingElementByClassName(t)}},{key:"Utils",value:function(){return{dom2Xpath:f,xPath2Dom:p}}}]),o}()}); diff --git a/src/vender/wiz.js b/src/vender/wiz.js new file mode 100644 index 00000000..6e2942eb --- /dev/null +++ b/src/vender/wiz.js @@ -0,0 +1,126 @@ +/** + * Soure from https://github.com/xcffl/WizWebClipperWE + */ + +var Base64 = { + // private property + _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", + // public method for encoding + encode : function(input) { + var output = ""; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0; + + input = Base64._utf8_encode(input); + + while (i < input.length) { + + chr1 = input.charCodeAt(i++); + chr2 = input.charCodeAt(i++); + chr3 = input.charCodeAt(i++); + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + + if (isNaN(chr2)) { + enc3 = enc4 = 64; + } else if (isNaN(chr3)) { + enc4 = 64; + } + output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); + } + + return output; + }, + // private method for UTF-8 encoding + _utf8_encode : function(string) { + string = string.replace(/\r\n/g, "\n"); + var utftext = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } else if ((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + } +}; + +var wiz_base64Encode = function( str ) { + var scriptFilter = function (html) { + return html.replace(/<script[^<>]*\/>/ig, "").replace(/<script[^<>]*>(((?!<\/script>).)|(\r?\n))*<\/script>/ig, ""); + }; + if (!str || str.length < 1) { + return ""; + } + var base64str = Base64.encode(scriptFilter(str)); + return base64str; +} + +var genGuid = function() { + return (genGuidItem() + genGuidItem() + "-" + genGuidItem() + "-" + genGuidItem() + "-" + genGuidItem() + "-" + genGuidItem() + genGuidItem() + genGuidItem()); +} + +var genGuidItem = function() { + return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); +} + +function getParams( url, title, htmlStr ) { + var params = ""; + var docType = document.doctype; + var source_url = wiz_base64Encode( url ); + var source_html = ""; + var source_title = wiz_base64Encode( title ); + + if (!!docType && !!docType.systemId && !!docType.publicId) { + docType = '<!DOCTYPE HTML PUBLIC "' + docType.publicId + '" "' + docType.systemId + '" >'; + } else { + docType = '<!DOCTYPE HTML>'; + } + source_html = wiz_base64Encode( docType + htmlStr ); + + params = "param-location='" + source_url + "' "; + params += "param-title='" + source_title + "' "; + + params += "0_FrameURL='" + source_url + "' "; + params += "0_FrameHtml='" + source_html + "' "; + + params = "param-fcount='1' " + params; + + return params; +} + +function getInfos( info, access_token ) { + var docGuid = genGuid(); + + info.params = info.params + ' save-command="' + info.cmd + '" userid="' + info.userid + + '" location="' + wiz_base64Encode(info.category) + '" comment="' + wiz_base64Encode('') + + '" tag="' + wiz_base64Encode(info.tag) + '"'; + + info.params = "myWiz='" + access_token + "@userguid' SaveResources='true' document_guid='" + docGuid + "' " + info.params; + var params = { + type : 'clipper', + data : info.params, + customId: docGuid + }; + return params; +} + +if ( typeof module !== 'undefined' ) { + module.exports = { + getParams: getParams, + getInfos : getInfos, + }; +} \ No newline at end of file diff --git a/src/website_list.json b/src/website_list.json index ec76a87c..9745ce28 100644 --- a/src/website_list.json +++ b/src/website_list.json @@ -32,6 +32,24 @@ "<div class='author-share'>", "<div class='embed-control'>" ] + },{ + "name" : "topic.readhub.cn", + "url" : "https://readhub.cn/topic/*", + "title" : "<h2 class='topicTitle___3DA7c'>", + "desc" : "", + "include" : "[[{$('.content___2CL42').find('.summary___3oqrM').parent().html()}]]", + "exclude" : [ + "" + ] + },{ + "name" : "newsflashes.36kr.com", + "url" : "https://36kr.com/newsflashes/*", + "title" : "<a class='item-title'>", + "desc" : "", + "include" : "<pre class='pre-item-des'>", + "exclude" : [ + "" + ] },{ "name" : "36kr.com", "url" : "http://36kr.com/p/", @@ -46,20 +64,29 @@ "<div class='share-nav'>" ] },{ - "name" : "pingwest.com", - "url" : "http*://www.pingwest.com/a/*", + "name" : "s.pingwest.com", + "url" : "http*://www.pingwest.com/s/*", "title" : "<title>", "desc" : "", - "include" : "<article class=\"article-style\">", + "include" : "[[{$($('section.content')[1]).html()}]]", + "exclude" : [ + "" + ] + },{ + "name" : "wire.pingwest.com", + "url" : "http*://www.pingwest.com/wire/", + "title" : "<h1 class='title'>", + "desc" : "", + "include" : "<div id='sc-container'>", "exclude" : [ "<p class='post-footer-wx'>" ] },{ "name" : "pingwest.com", - "url" : "http://www.pingwest.com/wire/", - "title" : "<h1 class='title'>", + "url" : "http*://www.pingwest.com/a/*", + "title" : "<title>", "desc" : "", - "include" : "<div id='sc-container'>", + "include" : "<article class=\"article-style\">", "exclude" : [ "<p class='post-footer-wx'>" ] @@ -201,9 +228,9 @@ },{ "name" : "sspai.com", "url" : "https://sspai.com/post/", - "title" : "<h1 class='title'>", + "title" : "[[{$('title').text().replace( ' - 少数派', '' )}]]", "desc" : "[[{$('meta[name=description]').attr('content')}]]", - "include" : "[[[$('.content')]]]", + "include" : "[[[$('.articleWidth-content').find('.content')]]]", "exclude" : [ "<img id='s1' >", "<hr>", @@ -225,7 +252,7 @@ "url" : "http*://www.dgtle.com/article-*.html", "title" : "<title>", "desc" : "[[{$('meta[name=description]').attr('content')}]]", - "include" : "[[{$('.view_content').html()||$('#view_content').html()}]]", + "include" : "[[{$('.view_content').html()||$('#view_content').html()||$('#articleContent').html()||$('.forum-viewthread-article-box').html()}]]", "exclude" : [ "<div id='comments_top'>", "[[/src=\\S+(xxxxxbbs)\\S+'/]]" @@ -280,7 +307,8 @@ "include" : "[[{$('.RichContent-inner')}]]", "exclude" : [ "<i class='icon-external'>" - ] + ], + "css" : ".MCNLinkCard-info { margin-left: 12px;}" },{ "name" : "geekpark.net", "url" : "http://www.geekpark.net/topics/", @@ -367,6 +395,24 @@ "exclude" : [ "" ] + },{ + "name" : "creatorsdaily.com", + "url" : "[[/https://creatorsdaily.com/posts/\\w+/]]", + "title" : "<span class='sub-title'>", + "desc" : "[[{$('meta[name=Description]').attr('content')||$('meta[name=description]').attr('content')}]]", + "include" : "[[`//*[@id='__next']/section[1]/main[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]`]]", + "exclude" : [ + "[[`/html[1]/div[1]/sr-read[1]/sr-rd-content[1]/div[1]`]]" + ] + },{ + "name" : "spaces.ac.cn", + "url" : "https://spaces.ac.cn/archives/*", + "title" : "<span class='sub-title'>", + "desc" : "[[{$('meta[name=Description]').attr('content')||$('meta[name=description]').attr('content')}]]", + "include" : "<div class='PostContent'>", + "exclude" : [ + "" + ] },{ "name" : "huxiu.com", "url" : "https://www.huxiu.com/article/", @@ -386,6 +432,24 @@ "exclude" : [ "" ] + },{ + "name" : "movie.douban.com", + "url" : "[[/https:\\/\\/movie.douban.com\\/subject\\/\\d+\\/?/]]", + "title" : "<title>", + "desc" : "", + "include" : "<div id='link-report'>", + "exclude" : [ + "" + ] + },{ + "name" : "note.douban.com", + "url" : "[[/https?:\\/\\/www.douban.com\\/note\\/\\d+\\/?/]]", + "title" : "<title>", + "desc" : "", + "include" : "<div id='link-report'>", + "exclude" : [ + "" + ] },{ "name" : "m.douban.com", "url" : "https://m.douban.com/*", @@ -655,7 +719,8 @@ "<table class='navbox'>", "<div class='thumb'>", "<div class='dablink'>", - "<table class='metadata'>" + "<table class='metadata'>", + "<math>" ] },{ "name" : "article.pmcaff.com", @@ -909,6 +974,15 @@ "exclude" : [ "" ] + },{ + "name" : "infoq.cn", + "url" : "http*://www.infoq.cn/article/*", + "title" : "<title>", + "desc" : "", + "include" : "<div class='article-content'>", + "exclude" : [ + "" + ] },{ "name" : "infoq.com", "url" : "http://www.infoq.com/cn/articles/", @@ -1120,7 +1194,9 @@ "desc" : "", "include" : "<div class='article_content'>", "exclude" : [ - "<div class='meau-gotop-box'>" + "<div class='meau-gotop-box'>", + "<div class='more-toolbox'>", + "<div class='person-messagebox'>" ], "css" : ".markdown_views pre code{background-color:transparent!important;}" },{ @@ -1159,6 +1235,16 @@ "exclude" : [ "[['<p>(完)</p>']]" ] + },{ + "name" : "ruanyf.yuque.com", + "url" : "[[/https://www.yuque.com/ruanyf/weekly/issue-\\d+/]]", + "title" : "<h1 id='page-title'>", + "desc" : "[[{$('meta[name=Description]').attr('content')||$('meta[name=description]').attr('content')}]]", + "include" : "[[`//*[@id='content']/div[2]/div[1]/div[1]`]]", + "exclude" : [ + "" + ], + "css": "span svg { display: none; }" },{ "name" : "v2ex.com", "url" : "https://www.v2ex.com/t/", @@ -1838,11 +1924,12 @@ "url" : "http*://post.smzdm.com/p/*", "title" : "<title>", "desc" : "", - "include" : "<div class='news_content'>", + "include" : "[[`//*[@id='articleId']`]]", "exclude" : [ "<h1 class='item-name'>", "<span class='embed-card'>" - ] + ], + "css" : ".embed-card-logo { margin-right: 14px }" },{ "name" : "news.mydrivers.com", "url" : "http://news.mydrivers.com/*/*/*.htm", diff --git a/webpack.config.js b/webpack.config.js index 942aa285..0e9f9d09 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,10 +49,12 @@ const webpack = require( 'webpack' ), { from : "src/manifest.json" , to : '../' }, { from : "src//help_tips.json" , to : '../' }, { from : "src/website_list.json" , to : '../' }, + { from : "src/ga.js" , to : '../' }, { from : 'src/options/options.html', to : '../options/' }, { from : 'src/options/custom.html', to : '../options/' }, { from : 'src/options/sitemgr.html', to : '../options/' }, { from : 'src/options/notice.html', to : '../options/' }, + { from : 'src/options/corb.html', to : '../options/' }, { context: 'src/assets/images/', from : "*" , to : '../assets/images' }, { context: 'src/_locales/', from : "*/*" , to : '../_locales/' }, ]) @@ -174,6 +176,7 @@ const webpack = require( 'webpack' ), custom : './src/options/custom.js', sitemgr : './src/options/sitemgr.js', notice : './src/options/notice.js', + corb : './src/options/corb.js', }, output: { @@ -229,6 +232,7 @@ const webpack = require( 'webpack' ), nanoid : __dirname + '/node_modules/nanoid/generate.js', jquery : __dirname + '/src/vender/jquery-2.1.1.min.js', + axios : __dirname + '/src/vender/axios.min.js', mousetrap : __dirname + '/src/vender/mousetrap.min.js', velocity : __dirname + '/src/vender/velocity.min.js', timeago : __dirname + '/src/vender/timeago.min.js', @@ -237,6 +241,7 @@ const webpack = require( 'webpack' ), filesaver : __dirname + '/src/vender/filesaver.min.js', instapaper : __dirname + '/src/vender/instapaper.js', webdav : __dirname + '/src/vender/webdav.js', + wiz : __dirname + '/src/vender/wiz.js', markdown : __dirname + '/src/vender/turndown/turndown.js', mdgfm : __dirname + '/src/vender/turndown/turndown-plugin-gfm.js', intro : __dirname + '/src/vender/intro/intro.min.js', @@ -257,6 +262,10 @@ const webpack = require( 'webpack' ), highlight : __dirname + '/src/service/highlight.js', output : __dirname + '/src/service/output.js', runtime : __dirname + '/src/service/runtime.js', + permission : __dirname + '/src/service/permission.js', + offline : __dirname + '/src/service/offline.js', + snapshot : __dirname + '/src/service/snapshot.js', + tips : __dirname + '/src/service/tips.js', focus : __dirname + '/src/focus/focus.js', controlbar : __dirname + '/src/focus/controlbar.jsx', @@ -288,6 +297,8 @@ const webpack = require( 'webpack' ), sharecard : __dirname + '/src/module/sharecard.jsx', notice : __dirname + '/src/module/notice.jsx', guide : __dirname + '/src/module/guide.jsx', + urlscheme : __dirname + '/src/module/urlscheme.jsx', + feedback : __dirname + '/src/module/feedback.jsx', editor : __dirname + '/src/module/common/editor.jsx', themesel : __dirname + '/src/module/common/theme.jsx', shortcuts : __dirname + '/src/module/common/shortcuts.jsx', @@ -299,6 +310,7 @@ const webpack = require( 'webpack' ), wavess : __dirname + '/src/vender/waves/waves.js', notify : __dirname + '/src/vender/notify/notify.js', + mduikit_css: __dirname + '/src/vender/mduikit/mduikit.css', textfield : __dirname + '/src/vender/mduikit/textfield.jsx', fab : __dirname + '/src/vender/mduikit/fab.jsx', fap : __dirname + '/src/vender/mduikit/fap.jsx',