Last active
May 9, 2017 14:27
-
-
Save tatesuke/747a0f688a7c6e48d0def6dbe27aab7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <!-- | |
| * KanTanMarkdown | |
| * Copyright (c) 2016 tatesuke | |
| * Released under the MIT license | |
| * https://github.com/tatesuke/KanTanMarkdown/blob/master/LICENSE | |
| --><head> | |
| <meta charset="utf-8"> | |
| <style>#previewer:after,nav:after{content:".";display:block;font-size:0;clear:both;visibility:hidden}body{margin:0;padding:0;position:relative}body.onDragover{border:5px dashed #99cde1}nav{margint:0}nav #leftNav{float:left}nav #rightNav{float:right}nav:after{height:0}#attach{width:100%;border-top:1px solid gray;border-bottom:1px solid gray;display:none}#attach #attachForm{box-sizing:border-box;width:100%;height:100%;display:none}#attach #attachForm input[type=file]{width:100%}#attach #filer{box-sizing:border-box;width:100%;height:150px;overflow:auto;display:none}#attach #filer input{width:300px}#attach #pasteArea{box-sizing:border-box;width:100%;border:1px solid gray;text-align:center}#attach #attachToggleButton,#attach #previewToggleButton{width:50%}#wrapper{overflow:auto}#wrapper #editorTabWrapper{box-sizing:border-box;width:50%;height:100%;float:left;border-top:none;display:none;margin:0;padding:0}#wrapper #editorTabWrapper #editorTabContents{box-sizing:border-box;width:100%;height:calc(100% - 20px);marign:0;padding:0}#wrapper #editorTabWrapper #editorTabContents #cssEditor,#wrapper #editorTabWrapper #editorTabContents #editor{box-sizing:border-box;resize:none;width:100%;height:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;margin:0}#wrapper #editorTabWrapper #editorTabContents #cssEditor{display:none}#wrapper #editorTabWrapper #editorTabs{box-sizing:border-box;border:0;width:100%;height:20px;margin:0;padding:0}#wrapper #editorTabWrapper #editorTabs li{box-sizing:border-box;list-style:none;float:left;width:50%;height:100%;text-align:center;margin-left:0;border-top:0;border-right:1px solid gray;border-bottom:1px solid gray;border-left:1px solid gray;border-radius:0 0 10px 10px}#importDialog,.popupMenu{border:1px solid gray;position:absolute}#wrapper #editorTabWrapper #editorTabs li a{display:block;width:100%;height:100%;text-decoration:none;color:#000}#previewer,.previewMode #previewer{height:auto;overflow:auto}#wrapper #editorTabWrapper #editorTabs li.selected{background-color:#7a9cd3}#wrapper #editorTabWrapper.fullWidth{width:100%}#previewer{box-sizing:border-box;margin:0 auto}.editMode #previewer{width:50%;height:100%}#previewer:empty{border:0}#previewer:focus{outline:0}#previewer:after{height:0}.popupMenu{display:none;margin:0;padding:0;background-color:#fff}.popupMenu>ul{list-style-type:none;margin:0;padding:0}.popupMenu>ul>li{margin:0}#onlineMenu>ul>li>a{box-sizing:border-box;text-decoration:none;display:block;margin:0;padding:10px;width:100%;height:100%;color:#000}#onlineMenu>ul>li>a:hover{background-color:#99cde1}#importDialog{width:440px;padding:20px;display:none;background-color:#fff}#importDialog ul.buttonArea{list-style-type:none;margin:0;padding:0}#importDialog ul.buttonArea li{display:block;float:left}#importDialog ul.buttonArea li button{height:35px;padding-left:20px;padding-right:20px}.initialState #editorTabWrapper{display:block!important;width:100%!important}.initialState #editor{margin-top:5px!important;font-size:large!important;height:90vh!important}.initialState #attach,.initialState #editorTabs,.initialState #previewer,.initialState nav{display:none!important}@media print{nav{display:none}#previewer{border:0!important;margin:0!important;padding:0!important}}#drawArea,#drawArea #canvasWrapper #baseCanvas,#drawArea #canvasWrapper #mainCanvas,#drawArea #canvasWrapper #workCanvas{position:absolute}#drawArea{top:0;left:0;width:100vw;height:100vh;background-color:gray;display:none}#drawArea #canvasWrapper{box-sizing:border-box;float:left;width:calc(100% - 200px);height:100%;overflow:auto;position:relative;padding:5px 15px 15px 5px}#drawArea .color3,#drawArea .color9{box-sizing:border-box;float:left;border:1px solid #000;margin:0;padding:0}#drawArea #drawControllWrapper{position:relative;background-color:#fff;float:left;width:200px;height:100%}#drawArea div{width:100%}#drawArea button{display:block;width:100%;border:1px solid #000;background-color:#fff}#drawArea button.selected{background-color:#7a9cd3}#drawArea .float50{box-sizing:border-box;float:left;width:50%}#drawArea .float25{box-sizing:border-box;float:left;width:25%}#drawArea .color9{width:11.1%}#drawArea .color3{width:33.3%}#drawArea .color[name=c_ff0000]{background-color:red}#drawArea .color[name=c_34A853]{background-color:#34A853}#drawArea .color[name=c_000000]{background-color:#000}#drawArea .color[name=c_clear],#drawArea .color[name=c_ffffff]{background-color:#fff}#drawArea .clearfix:after{content:".";display:block;height:0;font-size:0;clear:both;visibility:hidden}</style> | |
| <style id="previewerStyle"></style> | |
| <title>原因</title> | |
| </head> | |
| <body class="previewMode initialState"> | |
| <nav> | |
| <div id="leftNav"> | |
| <button id="onlineMenuButton">オンラインメニュー</button><button id="settingMenuButton">設定</button> | |
| </div> | |
| <div id="rightNav"> | |
| <span id="messageArea"></span> | |
| <button id="syncButton">プレビュー(F5)</button><button id="headingSyncButton">見出し同期(F2)</button><button id="toggleButton">編集/閲覧(ESC)</button><button id="saveButton">保存(Ctrl+S)</button> | |
| </div> | |
| </nav> | |
| <div id="attach"> | |
| <form id="attachForm"><input type="file" id="attachButton" multiple=""></form> | |
| <div id="filer"> | |
| <ul id="fileList"> | |
| </ul> | |
| <div id="pasteArea" contenteditable="true">ここをクリックしてCtrl+V(Cmd+V)するとクリップボードの画像を添付できます。</div> | |
| </div> | |
| <button id="attachToggleButton">添付ファイルを表示(Alt+↓)</button><button id="previewToggleButton">プレビューを隠す(Alt+→)</button> | |
| </div> | |
| <div id="wrapper"> | |
| <div id="editorTabWrapper"> | |
| <noscript>このファイルはJavaScriptを有効にするとより正確に表示できます。</noscript> | |
| <div id="editorTabContents"> | |
| <textarea id="editor">毎度お世話になっております。 | |
| このツールは、Markdownから日本企業っぽいメールに変換を行なうツールを「かんたんMarkdown」のCSSで真似してみたバージョンとなっております。 | |
| 元ネタ様はこちらとなっております。 | |
| * https://anydown.github.io/maildown/ | |
| 恐れ入りますがキーボード右上のESCキーを押すと編集モードに切り替わりますのでご査収のほどよろしくお願いします。 | |
| JavaScriptには手を加えず、CSSの変更で全て対応しております。しかしながらCSSは整理せず無理やり上書きしております。心からお詫び申し上げます。 | |
| 大変申し上げにくいのですが、見出しやリストなどを全角記号に変換する他、メール独特の80文字折り返し文化に対応するなどの機能が元ネタ様にはございます。「かんたんMarkdown」バージョンでは横幅を指定しているだけでございます。 | |
| さらに、TinySegmenterを使った簡易分かち書きを利用することで、単語途中での改行を防止する対応も「かんたんMarkdown」バージョンにはございません。 | |
| 至らぬ点が多数ありご迷惑をおかけし、誠に申し訳ございません。 | |
| また、これ以降の文章は全て元ネタ様とおなじになっております。重ねてお詫び申し上げます。 | |
| ## 例の件の対応 | |
| あれの件ですが、大変申し訳ございません。 | |
| もうしばらくお待ちいただけますと幸いです。 | |
| 直ちに、商品を手配させていただき、 | |
| また、後ほど100円値引きクーポン券をご送付させて頂きます。 | |
| 70文字で折り返しを行います。 | |
| 今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。今後共当社をよろしくお願いいたします。 | |
| --- | |
| # 原因 | |
| 考えられる原因は3つです。 | |
| 1. 倉庫が燃えた | |
| 1. 担当者が風邪をひいた | |
| 1. その他 | |
| # 再発防止策 | |
| * よく寝る | |
| * 栄養をとる | |
| * 倉庫のそばで焼き芋をしない | |
| 再発防止のため、本日はこれにて帰宅し、自宅療養させて頂きます。 | |
| 以上、よろしくお願いいたします。 | |
| </textarea> | |
| <textarea id="cssEditor">/* | |
| * CSSの設定を間違えると、最悪の場合 | |
| * 内容を編集できなくなるので注意してください。 | |
| * 標準のCSSに戻したいときはCSSを引き継がずに強制アップデートしてください | |
| * また、CSSの変更はプレビューしないと反映しません。 | |
| */ | |
| .previewMode #previewer { | |
| width: 980px; | |
| } | |
| #previewer { | |
| word-wrap: break-word; | |
| border: 1px solid gray; | |
| font-family: Helvetica, arial, sans-serif; | |
| font-size: 14px; | |
| line-height: 1.6; | |
| background-color: white; | |
| padding: 45px; | |
| } | |
| #previewer > *:first-child { | |
| margin-top: 0 !important; | |
| } | |
| #previewer > *:last-child { | |
| margin-bottom: 0 !important; | |
| } | |
| a { | |
| color: #4183C4; | |
| } | |
| a.absent { | |
| color: #cc0000; | |
| } | |
| a.anchor { | |
| display: block; | |
| padding-left: 30px; | |
| margin-left: -30px; | |
| cursor: pointer; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| bottom: 0; | |
| } | |
| h1, | |
| h2, | |
| h3, | |
| h4, | |
| h5, | |
| h6 { | |
| margin: 20px 0 10px; | |
| padding: 0; | |
| font-weight: bold; | |
| -webkit-font-smoothing: antialiased; | |
| cursor: text; | |
| position: relative; | |
| } | |
| h1:hover a.anchor, | |
| h2:hover a.anchor, | |
| h3:hover a.anchor, | |
| h4:hover a.anchor, | |
| h5:hover a.anchor, | |
| h6:hover a.anchor { | |
| background: url("para.png") no-repeat 10px center; | |
| text-decoration: none; | |
| } | |
| h1 tt, | |
| h1 code { | |
| font-size: inherit; | |
| } | |
| h2 tt, | |
| h2 code { | |
| font-size: inherit; | |
| } | |
| h3 tt, | |
| h3 code { | |
| font-size: inherit; | |
| } | |
| h4 tt, | |
| h4 code { | |
| font-size: inherit; | |
| } | |
| h5 tt, | |
| h5 code { | |
| font-size: inherit; | |
| } | |
| h6 tt, | |
| h6 code { | |
| font-size: inherit; | |
| } | |
| h1 { | |
| font-size: 28px; | |
| color: black; | |
| } | |
| h2 { | |
| font-size: 24px; | |
| border-bottom: 1px solid #cccccc; | |
| color: black; | |
| } | |
| h3 { | |
| font-size: 18px; | |
| } | |
| h4 { | |
| font-size: 16px; | |
| } | |
| h5 { | |
| font-size: 14px; | |
| } | |
| h6 { | |
| color: #777777; | |
| font-size: 14px; | |
| } | |
| p, | |
| blockquote, | |
| ul, | |
| ol, | |
| dl, | |
| li:first, | |
| table, | |
| pre { | |
| margin: 15px 0; | |
| } | |
| hr { | |
| background-color: #e7e7e7; | |
| border: 0 none; | |
| height: 4px; | |
| padding: 0; | |
| } | |
| #previewer > h2:first-child { | |
| margin-top: 0; | |
| padding-top: 0; | |
| } | |
| #previewer > h1:first-child { | |
| margin-top: 0; | |
| padding-top: 0; | |
| } | |
| #previewer > h1:first-child + h2 { | |
| margin-top: 0; | |
| padding-top: 0; | |
| } | |
| #previewer > h3:first-child, | |
| #previewer > h4:first-child, | |
| #previewer > h5:first-child, | |
| #previewer > h6:first-child { | |
| margin-top: 0; | |
| padding-top: 0; | |
| } | |
| a:first-child h1, | |
| a:first-child h2, | |
| a:first-child h3, | |
| a:first-child h4, | |
| a:first-child h5, | |
| a:first-child h6 { | |
| margin-top: 0; | |
| padding-top: 0; | |
| } | |
| h1 p, | |
| h2 p, | |
| h3 p, | |
| h4 p, | |
| h5 p, | |
| h6 p { | |
| margin-top: 0; | |
| } | |
| li p.first { | |
| display: inline-block; | |
| } | |
| ul, | |
| ol { | |
| padding-left: 30px; | |
| } | |
| ul:first-child, | |
| ol:first-child { | |
| margin-top: 0; | |
| } | |
| ul:last-child, | |
| ol:last-child { | |
| margin-bottom: 0; | |
| } | |
| dl { | |
| padding: 0; | |
| } | |
| dl dt { | |
| font-size: 14px; | |
| font-weight: bold; | |
| font-style: italic; | |
| padding: 0; | |
| margin: 15px 0 5px; | |
| } | |
| dl dt:first-child { | |
| padding: 0; | |
| } | |
| dl dt >:first-child { | |
| margin-top: 0; | |
| } | |
| dl dt >:last-child { | |
| margin-bottom: 0; | |
| } | |
| dl dd { | |
| margin: 0 0 15px; | |
| padding: 0 15px; | |
| } | |
| dl dd >:first-child { | |
| margin-top: 0; | |
| } | |
| dl dd >:last-child { | |
| margin-bottom: 0; | |
| } | |
| blockquote { | |
| border-left: 4px solid #dddddd; | |
| padding: 0 15px; | |
| color: #777777; | |
| } | |
| blockquote >:first-child { | |
| margin-top: 0; | |
| } | |
| blockquote >:last-child { | |
| margin-bottom: 0; | |
| } | |
| table { | |
| border-collapse: collapse; | |
| padding: 0; | |
| } | |
| table tr { | |
| border-top: 1px solid #cccccc; | |
| background-color: white; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| table tr:nth-child(2n) { | |
| background-color: #f8f8f8; | |
| } | |
| table tr th { | |
| font-weight: bold; | |
| border: 1px solid #cccccc; | |
| text-align: left; | |
| margin: 0; | |
| padding: 6px 13px; | |
| } | |
| table tr td { | |
| border: 1px solid #cccccc; | |
| text-align: left; | |
| margin: 0; | |
| padding: 6px 13px; | |
| } | |
| table tr th:first-child, | |
| table tr td:first-child { | |
| margin-top: 0; | |
| } | |
| table tr th:last-child, | |
| table tr td:last-child { | |
| margin-bottom: 0; | |
| } | |
| img { | |
| max-width: 100%; | |
| } | |
| span.frame { | |
| display: block; | |
| overflow: hidden; | |
| } | |
| span.frame > span { | |
| border: 1px solid #dddddd; | |
| display: block; | |
| float: left; | |
| overflow: hidden; | |
| margin: 13px 0 0; | |
| padding: 7px; | |
| width: auto; | |
| } | |
| span.frame span img { | |
| display: block; | |
| float: left; | |
| } | |
| span.frame span span { | |
| clear: both; | |
| color: #333333; | |
| display: block; | |
| padding: 5px 0 0; | |
| } | |
| span.align-center { | |
| display: block; | |
| overflow: hidden; | |
| clear: both; | |
| } | |
| span.align-center > span { | |
| display: block; | |
| overflow: hidden; | |
| margin: 13px auto 0; | |
| text-align: center; | |
| } | |
| span.align-center span img { | |
| margin: 0 auto; | |
| text-align: center; | |
| } | |
| span.align-right { | |
| display: block; | |
| overflow: hidden; | |
| clear: both; | |
| } | |
| span.align-right > span { | |
| display: block; | |
| overflow: hidden; | |
| margin: 13px 0 0; | |
| text-align: right; | |
| } | |
| span.align-right span img { | |
| margin: 0; | |
| text-align: right; | |
| } | |
| span.float-left { | |
| display: block; | |
| margin-right: 13px; | |
| overflow: hidden; | |
| float: left; | |
| } | |
| span.float-left span { | |
| margin: 13px 0 0; | |
| } | |
| span.float-right { | |
| display: block; | |
| margin-left: 13px; | |
| overflow: hidden; | |
| float: right; | |
| } | |
| span.float-right > span { | |
| display: block; | |
| overflow: hidden; | |
| margin: 13px auto 0; | |
| text-align: right; | |
| } | |
| code, | |
| tt { | |
| margin: 0 2px; | |
| padding: 0 5px; | |
| white-space: nowrap; | |
| border: 1px solid #eaeaea; | |
| background-color: #f8f8f8; | |
| border-radius: 3px; | |
| } | |
| pre code { | |
| margin: 0; | |
| padding: 0; | |
| white-space: pre-wrap; | |
| border: none; | |
| background: transparent; | |
| } | |
| .highlight pre { | |
| background-color: #f8f8f8; | |
| border: 1px solid #cccccc; | |
| font-size: 13px; | |
| line-height: 19px; | |
| overflow: auto; | |
| padding: 6px 10px; | |
| border-radius: 3px; | |
| } | |
| pre { | |
| background-color: #f8f8f8; | |
| border: 1px solid #cccccc; | |
| font-size: 13px; | |
| line-height: 19px; | |
| overflow: auto; | |
| padding: 6px 10px; | |
| border-radius: 3px; | |
| } | |
| pre code, | |
| pre tt { | |
| background-color: transparent; | |
| border: none; | |
| } | |
| .sequence, | |
| .flow { | |
| overflow: auto; | |
| } | |
| .info { | |
| color: #3a87ad; | |
| background-color: #d9edf7; | |
| border: 1px solid #bce8f1; | |
| font-size: 13px; | |
| line-height: 19px; | |
| padding: 6px 10px; | |
| border-radius: 0px; | |
| margin: 1em 0px 1em; | |
| } | |
| .warn { | |
| color: #c09853; | |
| background-color: #fcf8e3; | |
| border: 1px solid #fbeed5; | |
| font-size: 13px; | |
| line-height: 19px; | |
| padding: 6px 10px; | |
| border-radius: 0px; | |
| margin: 1em 0px 1em; | |
| } | |
| .alert { | |
| color: #b94a48; | |
| background-color: #f2dede; | |
| border: 1px solid #eed3d7; | |
| font-size: 13px; | |
| line-height: 19px; | |
| padding: 6px 10px; | |
| border-radius: 0px; | |
| margin: 1em 0px 1em; | |
| } | |
| @media print { | |
| nav { | |
| display: none; | |
| } | |
| #wrapper { | |
| overflow: visible; | |
| } | |
| #previewer { | |
| border: 0; | |
| } | |
| } | |
| /* これ以降日本企業っぽい対応 */ | |
| .previewMode nav { | |
| display: none; | |
| } | |
| .previewMode #previewer { | |
| width: 100%; | |
| border: 0; | |
| } | |
| #previewer { | |
| border: none; | |
| font-family: "MS ゴシック",sans-serif;; | |
| font-size: 12px; | |
| padding: 10px; | |
| line-height: 1em; | |
| } | |
| h1:before { | |
| content: "【"; | |
| } | |
| h1 { | |
| border:0; | |
| font-weight:normal; | |
| font-size: 12px; | |
| color: black; | |
| } | |
| h1:after { | |
| content: "】"; | |
| } | |
| h2:before { | |
| content: "■"; | |
| } | |
| h2 { | |
| border:0; | |
| font-weight:normal; | |
| font-size: 12px; | |
| color: black; | |
| } | |
| #previewer p { | |
| max-width:35em; | |
| } | |
| #previewer ol { | |
| list-style-type: none; | |
| } | |
| #previewer ol li { | |
| counter-increment: cnt; | |
| } | |
| #previewer ol li:before { | |
| content: "(" counter(cnt) ") "; | |
| } | |
| #previewer hr:before { | |
| content: "----------------------------------------"; | |
| } | |
| #previewer hr { | |
| border: 0; | |
| background-color: rgba(0,0,0,0.0); | |
| position:absolute: | |
| } | |
| </textarea> | |
| </div> | |
| <ol id="editorTabs"> | |
| <li><a href="#" id="markdownTab">Markdown</a></li> | |
| <li class="selected"><a href="#" id="cssTab">CSS</a></li> | |
| </ol> | |
| </div> | |
| <div id="previewer" tabindex="-1"></div> | |
| </div> | |
| <div id="onlineMenu" class="popupMenu"> | |
| <ul> | |
| <li><a href="http://tatesuke.github.io/KanTanMarkdown/ktm.html" target="_blank">新規作成</a></li> | |
| <li><a href="http://tatesuke.github.io/KanTanMarkdown/syntax.html" id="helpButton" target="_blank">Markdown記法ヘルプ(F1)</a></li> | |
| <li><a href="#" id="updateButton">最新版にアップデート(機能実験中)</a></li> | |
| <li><a href="http://tatesuke.github.io/KanTanMarkdown/" target="_blank">かんたんMarkdown <span class="version">v1.20160412.01_lite</span></a></li> | |
| </ul> | |
| </div> | |
| <div id="settingMenu" class="popupMenu"> | |
| <ul> | |
| <li><input type="checkbox" id="settingAutoSync" checked="checked"><label for="settingAutoSync">自動プレビュー</label></li> | |
| <li><input type="checkbox" id="settingExpandtab"><label for="settingExpandtab">タブキーでスペースを挿入</label></li> | |
| <li><input type="checkbox" id="settingAutoCloseTab"><label for="settingAutoCloseTab">`/`を入力したときに閉じタグを自動挿入</label></li> | |
| <li><input type="checkbox" id="settingInsertImgTagAfterAttach"><label for="settingInsertImgTagAfterAttach">画像を添付したらタグを挿入</label></li> | |
| </ul> | |
| </div> | |
| <div id="importDialog"> | |
| <p id="importDialogMessage"></p> | |
| <form> | |
| <ul> | |
| <li><input type="checkBox" checked="checked" id="importDialogAttach"><label for="importDialogAttach">添付ファイル(末尾に挿入)</label></li> | |
| <li><input type="checkBox" checked="checked" id="importDialogMarkdown"><label for="importDialogMarkdown">Markdown(末尾に挿入)</label></li> | |
| <li><input type="checkBox" id="importDialogCss"><label for="importDialogCss">CSS(上書き)</label></li> | |
| </ul> | |
| <ul class="buttonArea"> | |
| <li><button id="importDialogOkButton">OK</button></li> | |
| <li><button id="importDialogCancelButton">キャンセル</button></li> | |
| </ul> | |
| </form> | |
| </div> | |
| <div id="drawArea"> | |
| <div id="canvasWrapper"> | |
| <canvas id="baseCanvas"></canvas> | |
| <canvas id="mainCanvas"></canvas> | |
| <canvas id="workCanvas"></canvas> | |
| </div> | |
| <div id="drawControllWrapper"> | |
| <dl> | |
| <dt>モード</dt> | |
| <dd class="mode"> | |
| <button name="rectangleModeButton">Rectangle</button> | |
| <button name="letterModeButton">Letter</button> | |
| <button name="eraserModeButton">Eraser</button> | |
| <button name="trimModeButton">Trim</button> | |
| </dd> | |
| <dt>枠の太さ</dt> | |
| <dd class="borderWidth clearfix"> | |
| <div class="float50" name="borderWidth"></div> | |
| <button name="minus" class="float25">-</button><button name="plus" class="float25">+</button> | |
| </dd> | |
| <dt>枠の色</dt> | |
| <dd class="borderColor clearfix"> | |
| <button class="color color9" name="c_ff0000"> </button> | |
| <button class="color color9" name="c_34A853"> </button> | |
| <button class="color color9" name="c_000000"> </button> | |
| <button class="color color9" name="c_ffffff"> </button> | |
| <button class="color color3" name="c_clear">透明</button> | |
| <input type="text" name="borderColor"> | |
| </dd> | |
| <dt>塗りつぶしの色</dt> | |
| <dd class="fillColor clearfix"> | |
| <button class="color color9" name="c_ff0000"> </button> | |
| <button class="color color9" name="c_34A853"> </button> | |
| <button class="color color9" name="c_000000"> </button> | |
| <button class="color color9" name="c_ffffff"> </button> | |
| <button class="color color3" name="c_clear">透明</button> | |
| <input type="text" name="fillColor"> | |
| </dd> | |
| <dt>フォント</dt> | |
| <dd class="clearfix"> | |
| <input type="text" name="font"> | |
| </dd> | |
| <dt>拡大率</dt> | |
| <dd class="scale clearfix"> | |
| <div class="float50" name="scale"></div> | |
| <button name="minus" class="float25">-</button><button name="plus" class="float25">+</button> | |
| </dd> | |
| <dt>編集</dt> | |
| <dd> | |
| <button name="undoButton" class="float50">←Undo</button> | |
| <button name="redoButton" class="float50">Redo→</button> | |
| <button name="resetButton">Reset</button> | |
| </dd> | |
| <dt>ファイル</dt> | |
| <dd> | |
| <button name="saveButton">Save</button> | |
| <button name="cancelButton">Cancel</button> | |
| </dd> | |
| </dl> | |
| </div> | |
| </div> | |
| <input type="hidden" id="kantanVersion" value="v1.20160412.01"> | |
| <input type="hidden" id="kantanEdition" value="lite"> | |
| <div id="updateScriptArea"></div> | |
| <script id="markedJs"> | |
| /** | |
| * marked - a markdown parser | |
| * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) | |
| * https://github.com/chjj/marked | |
| */ | |
| (function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]||""});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].split(/ *\| */)}this.tokens.push(item);continue}if(cap=this.rules.lheading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[2]==="="?1:2,text:cap[1]});continue}if(cap=this.rules.hr.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"hr"});continue}if(cap=this.rules.blockquote.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"blockquote_start"});cap=cap[0].replace(/^ *> ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i<l;i++){item=cap[i];space=item.length;item=item.replace(/^ *([*+-]|\d+\.) +/,"");if(~item.indexOf("\n ")){space-=item.length;item=!this.options.pedantic?item.replace(new RegExp("^ {1,"+space+"}","gm"),""):item.replace(/^ {1,4}/gm,"")}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap[i+1])[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&(cap[1]==="pre"||cap[1]==="script"||cap[1]==="style"),text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */)}this.tokens.push(item);continue}if(top&&(cap=this.rules.paragraph.exec(src))){src=src.substring(cap[0].length);this.tokens.push({type:"paragraph",text:cap[1].charAt(cap[1].length-1)==="\n"?cap[1].slice(0,-1):cap[1]});continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"text",text:cap[0]});continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};inline._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;inline._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^<a /i.test(cap[0])){this.inLink=true}else if(this.inLink&&/^<\/a>/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(cap[0]):escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.text(escape(this.smartypants(cap[0])));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){if(!this.options.mangle)return text;var out="",l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"<pre><code>"+(escaped?code:escape(code,true))+"\n</code></pre>"}return'<pre><code class="'+this.options.langPrefix+escape(lang,true)+'">'+(escaped?code:escape(code,true))+"\n</code></pre>\n"};Renderer.prototype.blockquote=function(quote){return"<blockquote>\n"+quote+"</blockquote>\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"<h"+level+' id="'+this.options.headerPrefix+raw.toLowerCase().replace(/[^\w]+/g,"-")+'">'+text+"</h"+level+">\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"</"+type+">\n"};Renderer.prototype.listitem=function(text){return"<li>"+text+"</li>\n"};Renderer.prototype.paragraph=function(text){return"<p>"+text+"</p>\n"};Renderer.prototype.table=function(header,body){return"<table>\n"+"<thead>\n"+header+"</thead>\n"+"<tbody>\n"+body+"</tbody>\n"+"</table>\n"};Renderer.prototype.tablerow=function(content){return"<tr>\n"+content+"</tr>\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"</"+type+">\n"};Renderer.prototype.strong=function(text){return"<strong>"+text+"</strong>"};Renderer.prototype.em=function(text){return"<em>"+text+"</em>"};Renderer.prototype.codespan=function(text){return"<code>"+text+"</code>"};Renderer.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"};Renderer.prototype.del=function(text){return"<del>"+text+"</del>"};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='<a href="'+href+'"';if(title){out+=' title="'+title+'"'}out+=">"+text+"</a>";return out};Renderer.prototype.image=function(href,title,text){var out='<img src="'+href+'" alt="'+text+'"';if(title){out+=' title="'+title+'"'}out+=this.options.xhtml?"/>":">";return out};Renderer.prototype.text=function(text){return text};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i<this.token.header.length;i++){flags={header:true,align:this.token.align[i]};cell+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:true,align:this.token.align[i]})}header+=this.renderer.tablerow(cell);for(i=0;i<this.token.cells.length;i++){row=this.token.cells[i];cell="";for(j=0;j<row.length;j++){cell+=this.renderer.tablecell(this.inline.output(row[j]),{header:false,align:this.token.align[j]})}body+=this.renderer.tablerow(cell)}return this.renderer.table(header,body)}case"blockquote_start":{var body="";while(this.next().type!=="blockquote_end"){body+=this.tok()}return this.renderer.blockquote(body)}case"list_start":{var body="",ordered=this.token.ordered;while(this.next().type!=="list_end"){body+=this.tok()}return this.renderer.list(body,ordered)}case"list_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.token.type==="text"?this.parseText():this.tok()}return this.renderer.listitem(body)}case"loose_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.tok()}return this.renderer.listitem(body)}case"html":{var html=!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;return this.renderer.html(html)}case"paragraph":{return this.renderer.paragraph(this.inline.output(this.token.text))}case"text":{return this.renderer.paragraph(this.parseText())}}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;i<arguments.length;i++){target=arguments[i];for(key in target){if(Object.prototype.hasOwnProperty.call(target,key)){obj[key]=target[key]}}}return obj}function marked(src,opt,callback){if(callback||typeof opt==="function"){if(!callback){callback=opt;opt=null}opt=merge({},marked.defaults,opt||{});var highlight=opt.highlight,tokens,pending,i=0;try{tokens=Lexer.lex(src,opt)}catch(e){return callback(e)}pending=tokens.length;var done=function(err){if(err){opt.highlight=highlight;return callback(err)}var out;try{out=Parser.parse(tokens,opt)}catch(e){err=e}opt.highlight=highlight;return err?callback(err):callback(null,out)};if(!highlight||highlight.length<3){return done()}delete opt.highlight;if(!pending)return done();for(;i<tokens.length;i++){(function(token){if(token.type!=="code"){return--pending||done()}return highlight(token.text,token.lang,function(err,code){if(err)return done(err);if(code==null||code===token.text){return--pending||done()}token.text=code;token.escaped=true;--pending||done()})})(tokens[i])}return}try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+="\nPlease report this to https://github.com/chjj/marked.";if((opt||marked.defaults).silent){return"<p>An error occured:</p><pre>"+escape(e.message+"",true)+"</pre>"}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,sanitizer:null,mangle:true,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); | |
| </script> | |
| <script id="kantanEditorJS"> | |
| function toKantanEditor(a){function b(a,b){for(var c="",d=a.value.charAt(b);">"!=d&&" "!=d;)c+=d,b++,d=a.value.charAt(b);return c}on(a,"keydown",function(b){if(9!=b.which&&9!=b.keyCode)return!0;b.preventDefault();var c=a.selectionStart,d=a.selectionEnd;if(c==d){var e,f=a.value;if(document.querySelector("#settingExpandtab").checked){e="";for(var g=4,h=0,j=c;j>0&&"\n"!=f.charAt(j-1);)j--;for(;c>j;j++){var l=f.charCodeAt(j);h+=9==l?g-h%g:256>l||l>=65377&&65439>=l?1:2}for(var m=g-h%g,n=0;m>n;n++)e+=" "}else e=" ";a.value=f.substr(0,c)+e+f.substr(c,f.length),a.setSelectionRange(c+e.length,c+e.length),k(b.target),i(b.target)}else if(b.shiftKey){for(var g=4,o=a.value;c>0&&"\n"!=o.charAt(c-1);)c--;for("\n"==o.charAt(d-1)&&(d-=1);d<o.length&&"\n"!=o.charAt(d);)d++;d--;for(var p=0,q=o.substring(0,c),j=c;d>j;){for(var l=o.charAt(j),r=0;g>r;){if(" "==l)r+=1,p++;else if(" "==l)r+=2,p++;else{if(" "!=l){q+=l,j++;break}r+=g,p++}l=o.charAt(++j)}for(;"\n"!=l&&d>j;)l=o.charAt(j++),q+=l}q+=o.substr(d),a.value=q,a.selectionStart=c,a.selectionEnd=d-p+1,k(b.target),i(b.target)}else{for(var o=a.value;c>0&&"\n"!=o.charAt(c-1);)c--;for("\n"==o.charAt(d-1)&&(d-=1);d<o.length&&"\n"!=o.charAt(d);)d++;for(var s=1,q=o.substring(0,c)+" ",j=c;d>j;j++){var l=o.charAt(j);q+=l,"\n"==l&&(q+=" ",s++)}q+=o.substr(d),a.value=q,a.selectionStart=c,a.selectionEnd=d+s,k(b.target),i(b.target)}return!1}),on(a,"keydown",function(b){if(13==b.which||13==b.keyCode){b.preventDefault();for(var c=0,d=a.value,e=a.selectionStart;e>0&&"\n"!=d.charAt(e-1);)e--,c++;for(var f="",g=0;c>g;g++){var h=d.charAt(e+g);if(" "!=h&&" "!=h&&" "!=h)break;f+=h}var j=a.selectionStart+f.length+1,l=d.substring(0,a.selectionStart),m=d.substr(a.selectionEnd);a.value=l+"\n"+f+m,a.selectionStart=j,a.selectionEnd=j,k(b.target),i(b.target)}}),on(a,"keydown",function(a){if(191!=a.which&&191!=a.keyCode||a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return!0;if(!document.querySelector("#settingAutoCloseTab").checked)return!0;var c=a.target,d=c.selectionStart-1;if(0>d||"<"!=c.value.charAt(d))return!0;d--;for(var e=null,f=[""];d>=0;)if("<"==c.value.charAt(d)){var g,h;"/"==c.value.charAt(d+1)?(g=!0,h=d+2):(g=!1,h=d+1);var j=b(c,h);if(g)f.push(j);else{if(j!=f[f.length-1]){e=j;break}f.pop()}d--}else d--;if(null==e)return!0;a.preventDefault();var l="/"+e+">",m=c.selectionStart+l.length,n=c.value.substring(0,c.selectionStart),o=c.value.substr(c.selectionEnd);return c.value=n+l+o,c.selectionStart=m,c.selectionEnd=m,k(a.target),i(a.target),!1});var c=!1,d={},e=[],f=[],g={val:a.value,selectionStart:void 0,selectionEnd:void 0},h=void 0;on(a,"keydown",function(a){"Enter"==a.code?i(a.target):86!=a.which&&86!=a.keyCode||!a.ctrlKey&&!a.metaKey||c?86!=a.which&&86!=a.keyCode||!a.ctrlKey&&!a.metaKey||!c||i(a.target):(j(a.target),c=!0);var b=a.keyCode?a.keyCode:a.which;b>=33&&40>=b&&(d[a.code]=!0)}),on(a,"keypress",function(a){d[a.code]=!0}),on(a,"keyup",function(b){if(13==b.which||13==b.keyCode||8==b.which||8==b.keyCode||46==b.which||46==b.keyCode||(86==b.which||86==b.keyCode)&&(b.ctrlKey||b.metaKey)||(88==b.which||88==b.keyCode)&&(b.ctrlKey||b.metaKey))i(b.target);else if(1==d[b.code]){var e=b.keyCode?b.keyCode:b.which;e>=33&&40>=e?(h={val:a.value,selectionStart:a.selectionStart,selectionEnd:a.selectionEnd},d[b.code]=!1):(d[b.code]=!1,i(b.target))}b.ctrlKey||b.metaKey||!c||(c=!1)}),on(a,"changeByJs",function(a){i(a.target)}),on(a,"mouseup",function(b){h={val:a.value,selectionStart:a.selectionStart,selectionEnd:a.selectionEnd}}),on(a,"keydown",function(b){if(90==b.keyCode&&(b.ctrlKey||b.metaKey)&&!b.shiftKey&&(b.preventDefault(),0<e.length)){f.push(g);var c=e.pop();a.value=c.val,a.selectionStart=c.selectionStart,a.selectionEnd=c.selectionEnd,k(b.target),g=c,l(a)}}),on(a,"keydown",function(b){(89==b.keyCode&&(b.ctrlKey||b.metaKey)||90==b.keyCode&&b.ctrlKey&&b.shiftKey||90==b.keyCode&&b.metaKey&&b.shiftKey)&&(b.preventDefault(),0<f.length&&(e.push(g),g=f.pop(),a.value=g.val,a.selectionStart=g.selectionStart,a.selectionEnd=g.selectionEnd,k(b.target),l(a)))});var i=function(a){g.val!=a.value&&(h?(e.push(h),h=void 0):e.push(g),f=[],g={val:a.value,selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})},j=function(a){f=[],g={val:a.value,selectionStart:a.selectionStart,selectionEnd:a.selectionEnd}},k=function(a){var b,c=a.value,d=a.selectionStart,e=a.selectionEnd;try{b=document.execCommand("insertText",!1,"X")}catch(f){b=!1}if(b)a.value=c,a.selectionStart=d,a.selectionEnd=d,a.blur(),a.focus(),a.selectionStart=d,a.selectionEnd=e;else{var g=c.substring(0,d),h=c.substr(e);a.value=g+"X"+h,a.selectionStart=g.length,a.selectionEnd=g.length+1;document.execCommand("delete",!1,null);a.value=c,a.selectionStart=d,a.selectionEnd=e}},l=function(a){var b=document.createEvent("Event");b.initEvent("input",!0,!0),a.dispatchEvent(b)}} | |
| </script> | |
| <script id="kantanDrawerJS"> | |
| function KantanDrawer(a){var b=this;this.drawArea=a,this.canvasWrapper=a.querySelector("#canvasWrapper"),this.baseCanvas=a.querySelector("#baseCanvas"),this.mainCanvas=a.querySelector("#mainCanvas"),this.workCanvas=a.querySelector("#workCanvas");for(var c=a.querySelectorAll(".mode button"),d=0;d<c.length;d++)on(c[d],"click",function(a){var c=this.name.indexOf("ModeButton"),d=this.name.substring(0,c);b.setMode(d)});a.querySelector("[name=borderWidth]");on(a.querySelector(".borderWidth [name=minus]"),"click",function(){b.setBorderWidth(b.borderWidth-1)}),on(a.querySelector(".borderWidth [name=plus]"),"click",function(){b.setBorderWidth(b.borderWidth+1)});var e=a.querySelector("[name=borderColor]");on(e,"keyup",function(){b.setBorderColor(this.value)});for(var f=a.querySelectorAll(".borderColor .color"),d=0;d<f.length;d++)on(f[d],"click",function(){var a=this.name.substr(2);a="clear"==a?"rgba(0, 0, 0, 0)":"#"+a,b.setBorderColor(a)});var g=a.querySelector("[name=fillColor]");on(g,"keyup",function(){b.setFillColor(this.value)});for(var h=a.querySelectorAll(".fillColor .color"),d=0;d<h.length;d++)on(h[d],"click",function(){var a=this.name.substr(2);a="clear"==a?"rgba(0, 0, 0, 0)":"#"+a,b.setFillColor(a)});var i=a.querySelector("[name=font]");on(i,"keyup",function(){b.font=this.value});a.querySelector("[name=scale]");on(a.querySelector(".scale [name=minus]"),"click",function(){b.setScale(b.scale-.1),b.repaint()}),on(a.querySelector(".scale [name=plus]"),"click",function(){b.setScale(b.scale+.1),b.repaint()}),on(a.querySelector("[name=undoButton]"),"click",function(){if(0!=b.commands.length){var a=b.commands.pop();b.redoCommands.push(a),b.repaint()}}),on(a.querySelector("[name=redoButton]"),"click",function(){if(0!=b.redoCommands.length){var a=b.redoCommands.pop();b.commands.push(a),b.repaint()}});var j=a.querySelector("[name=resetButton]");on(j,"click",function(){var a=window.confirm("全ての描画をリセットしますか?この操作は元に戻せません。");1==a&&(b.reset(),b.repaint())});var k=a.querySelector("[name=saveButton]");on(k,"click",function(){for(var a="",c=!0,d=b.mainCanvas.getContext("2d"),e=d.getImageData(0,0,b.baseImg.width,b.baseImg.height),f=0;f<e.data.length;f++)if(0!=e.data[f]){c=!1;break}var g;if(c)g=0==b.trimInfo.x&&0==b.trimInfo.y&&b.trimInfo.w==b.baseImg.width&&b.trimInfo.h==b.baseImg.height?"":JSON.stringify(b.trimInfo);else{var h=document.createElement("canvas");h.width=b.baseImg.width,h.height=b.baseImg.height,tempCtx=h.getContext("2d"),tempCtx.putImageData(e,b.trimInfo.x,b.trimInfo.y),a=h.toDataURL(),g=JSON.stringify(b.trimInfo)}b.saveCallback(a,g),b.reset(),b.hide()});var l=a.querySelector("[name=cancelButton]");on(l,"click",function(){var a=window.confirm("キャンセルしてもいいですか?編集内容は失われます。");1==a&&(b.reset(),b.hide(),b.cancelCallback())}),on(this.workCanvas,"mousedown",function(a){var c=b.commands.length,d=(a.pageX+b.canvasWrapper.scrollLeft)/b.scale+b.trimInfo.x,e=(a.pageY+b.canvasWrapper.scrollTop)/b.scale+b.trimInfo.y;b.modeStrategy.onMouseDown(a,d,e,b.commands,b.workCommands),c!=b.commands.length&&(b.redoCommands=[])}),on(this.workCanvas,"mousemove",function(a){var c=b.commands.length,d=(a.pageX+b.canvasWrapper.scrollLeft)/b.scale+b.trimInfo.x,e=(a.pageY+b.canvasWrapper.scrollTop)/b.scale+b.trimInfo.y;b.modeStrategy.onMouseMove(a,d,e,b.commands,b.workCommands),c!=b.commands.length&&(b.redoCommands=[])}),on(this.workCanvas,"mouseup",function(a){var c=b.commands.length,d=(a.pageX+b.canvasWrapper.scrollLeft)/b.scale+b.trimInfo.x,e=(a.pageY+b.canvasWrapper.scrollTop)/b.scale+b.trimInfo.y;b.modeStrategy.onMouseUp(a,d,e,b.commands,b.workCommands),c!=b.commands.length&&(b.redoCommands=[])})}function DrawCommand(a,b){this.drawer=a,this.strokeStyle=a.borderColor,this.lineWidth=a.borderWidth,this.fillStyle=a.fillColor,this.width=a.baseImg.width,this.height=a.baseImg.height,this.font=a.font,this.paint=b}function TrimModeStrategy(a){this.modeName="trim",this.drawer=a,this.originalScale=a.scale,this.originalMode=a.modeStrategy.modeName,this.mouseStart=null}function RectangleModeStrategy(a){this.modeName="rectangle",this.drawer=a,this.mouseStart=null,this.mouseEnd=null}function EraserModeStrategy(a){this.modeName="eraser",this.drawer=a,this.mouseStart=null,this.mouseEnd=null}function LetterModeStrategy(a){this.modeName="letter",this.drawer=a,this.mouseStart=null,this.mouseEnd=null}KantanDrawer.prototype={show:function(a,b,c,d,e){this.saveCallback=d,this.cancelCallback=e;var f=this;this.baseImg=new Image,this.baseImg.onload=function(){""!=c.trim()?f.trimInfo=JSON.parse(c):f.trimInfo={x:0,y:0,w:this.width,h:this.height},""!=b.trim()?(f.layerImg=new Image,f.layerImg.onload=function(){showBlock(f.drawArea),f.repaint()},f.layerImg.src=b):(showBlock(f.drawArea),f.repaint())},this.baseImg.src=a,this.reset()},hide:function(){this.baseImg=null,this.layerImg=null;for(var a=this.drawArea.querySelectorAll("canvas"),b=0;b<a.length;b++)a[b].removeAttribute("width"),a[b].removeAttribute("height");for(var c=this.drawArea.querySelectorAll("*[class]"),b=0;b<a.length;b++)""==c[b].className&&c[b].removeAttribute("class");for(var d=this.drawArea.querySelectorAll(".mode .selected"),b=0;b<d.length;b++)removeClass(d[b],"selected");this.drawArea.querySelector("div[name=borderWidth]").innerHTML="",this.drawArea.querySelector("div[name=scale]").innerHTML="",hide(this.drawArea)},reset:function(){this.commands=[],this.redoCommands=[],this.workCommands=[],this.layerImg=null,this.trimInfo={x:0,y:0,w:this.baseImg.width,h:this.baseImg.height},this.setMode("rectangle"),this.setBorderWidth(1),this.setBorderColor("#ff0000"),this.setFillColor("rgba(0, 0, 0, 0)"),this.setFont("18px sans-serif"),this.setScale(1)},setMode:function(a){if("rectangle"==a)this.modeStrategy=new RectangleModeStrategy(this),this.modeStrategy.onBeforeModeStart(this.commands,this.workCommands);else if("letter"==a)this.modeStrategy=new LetterModeStrategy(this),this.modeStrategy.onBeforeModeStart(this.commands,this.workCommands);else if("eraser"==a)this.modeStrategy=new EraserModeStrategy(this),this.modeStrategy.onBeforeModeStart(this.commands,this.workCommands);else{if("trim"!=a)throw"未知のモード"+a;0==this.trimInfo.x&&0==this.trimInfo.y&&this.trimInfo.w==this.baseImg.width&&this.trimInfo.h==this.baseImg.height?(this.modeStrategy=new TrimModeStrategy(this),this.modeStrategy.onBeforeModeStart(this.commands,this.workCommands)):(this.trimInfo={x:0,y:0,w:this.baseImg.width,h:this.baseImg.height},this.repaint())}for(var b=drawArea.querySelectorAll(".mode button"),c=0;c<b.length;c++)b[c].classList.remove("selected");drawArea.querySelector(".mode button[name="+this.modeStrategy.modeName+"ModeButton]").classList.add("selected")},setBorderWidth:function(a){var b=drawArea.querySelector("[name=borderWidth]");a>=1&&(this.borderWidth=a),b.textContent=this.borderWidth,b.style.borderBottom=this.borderWidth+"px solid black"},setBorderColor:function(a){var b=drawArea.querySelector("[name=borderColor]");this.borderColor=a,b.value=a,b.style.backgroundColor=a},setFillColor:function(a){var b=drawArea.querySelector("[name=fillColor]");this.fillColor=a,b.value=a,b.style.backgroundColor=a},setFont:function(a){var b=drawArea.querySelector("[name=font]");this.font=a,b.value=a},setScale:function(a){var b=drawArea.querySelector("[name=scale]");a>=.1&&(this.scale=a),b.textContent=this.scale},repaint:function(){this.baseCanvas.width=this.mainCanvas.width=this.workCanvas.width=this.trimInfo.w*this.scale,this.baseCanvas.height=this.mainCanvas.height=this.workCanvas.height=this.trimInfo.h*this.scale;var a=this.drawArea.querySelector("[name=trimModeButton]");0==this.trimInfo.x&&0==this.trimInfo.y&&this.trimInfo.w==this.baseImg.width&&this.trimInfo.h==this.baseImg.height?a.textContent="Trim":a.textContent="Reset Trim";var b=this.baseCanvas.getContext("2d");b.clearRect(0,0,this.baseImg.width,this.baseImg.height),b.save(),b.scale(this.scale,this.scale),b.translate(-this.trimInfo.x,-this.trimInfo.y),b.drawImage(this.baseImg,0,0),b.restore();var c=this.mainCanvas.getContext("2d");c.clearRect(0,0,this.baseImg.width,this.baseImg.height),c.save(),c.scale(this.scale,this.scale),c.translate(-this.trimInfo.x,-this.trimInfo.y),this.layerImg&&c.drawImage(this.layerImg,0,0);for(var d=0;d<this.commands.length;d++){var e=this.commands[d];c.strokeStyle=e.strokeStyle,c.lineWidth=e.lineWidth,c.fillStyle=e.fillStyle,e.paint(c)}c.restore();var f=this.workCanvas.getContext("2d");f.clearRect(0,0,this.baseImg.width,this.baseImg.height),f.save(),f.scale(this.scale,this.scale),f.translate(-this.trimInfo.x,-this.trimInfo.y);for(var d=0;d<this.workCommands.length;d++){var e=this.workCommands[d];f.strokeStyle=e.strokeStyle,f.lineWidth=e.lineWidth,f.fillStyle=e.fillStyle,e.paint(f)}f.restore()}},TrimModeStrategy.prototype={onBeforeModeStart:function(a,b){this.drawer.scale=1,this.drawer.trimInfo={x:0,y:0,w:this.drawer.baseImg.width,h:this.drawer.baseImg.height},b.length=0,b.push(new DrawCommand(this.drawer,function(a){a.save(),a.borderStyle="rgba(0, 0, 0, 0.6)",a.fillStyle="rgba(0, 0, 0, 0.6)",a.clearRect(0,0,this.width,this.height),a.fillRect(0,0,this.width,this.height),a.restore()})),this.drawer.repaint()},onMouseDown:function(a,b,c,d,e){this.mouseStart={x:b,y:c}},onMouseMove:function(a,b,c,d,e){if(null!=this.mouseStart){var f=this;e.length=0,e.push(new DrawCommand(this.drawer,function(a){a.save(),a.borderStyle="rgba(0, 0, 0, 0.6)",a.fillStyle="rgba(0, 0, 0, 0.6)",a.fillRect(0,0,this.width,this.height),a.clearRect(f.mouseStart.x,f.mouseStart.y,b-f.mouseStart.x,c-f.mouseStart.y),a.restore()})),this.drawer.repaint()}},onMouseUp:function(a,b,c,d,e){if(0==a.button){var f=Math.min(this.mouseStart.x,b),g=Math.min(this.mouseStart.y,c),h=Math.max(this.mouseStart.x,b)-f,i=Math.max(this.mouseStart.y,c)-g;this.drawer.trimInfo.x=f,this.drawer.trimInfo.y=g,this.drawer.trimInfo.w=h,this.drawer.trimInfo.h=i,this.mouseStart=null,e.length=0,this.drawer.scale=this.originalScale,this.drawer.setMode(this.originalMode),this.drawer.repaint()}}},RectangleModeStrategy.prototype={onBeforeModeStart:function(a,b){this.mouseStart=null,this.mouseEnd=null,b.length=0,this.drawer.repaint()},onMouseDown:function(a,b,c,d,e){if(0==a.button){this.mouseStart={x:b,y:c},this.mouseEnd={x:b,y:c};var f=this.mouseStart,g=this.mouseEnd;e.length=0,e.push(new DrawCommand(this.drawer,function(a){a.fillRect(f.x,f.y,g.x-f.x,g.y-f.y),a.strokeRect(f.x,f.y,g.x-f.x,g.y-f.y)})),this.drawer.repaint()}},onMouseMove:function(a,b,c,d,e){null!=this.mouseStart&&(this.mouseEnd.x=b,this.mouseEnd.y=c,this.drawer.repaint())},onMouseUp:function(a,b,c,d,e){null!=this.mouseStart&&0==a.button&&(this.mouseStart=null,this.mouseEnd=null,d.push(e[0]),e.length=0,this.drawer.repaint())}},EraserModeStrategy.prototype={onBeforeModeStart:function(a,b){this.mouseStart=null,this.mouseEnd=null,b.length=0,this.drawer.repaint()},onMouseDown:function(a,b,c,d,e){if(0==a.button){this.mouseStart={x:b,y:c},this.mouseEnd={x:b,y:c};var f=this.mouseStart,g=this.mouseEnd;e.length=0,e.push(new DrawCommand(this.drawer,function(a){a.strokeStyle="#808080",a.strokeRect(f.x,f.y,g.x-f.x,g.y-f.y)})),this.drawer.repaint()}},onMouseMove:function(a,b,c,d,e){null!=this.mouseStart&&(this.mouseEnd.x=b,this.mouseEnd.y=c,this.drawer.repaint())},onMouseUp:function(a,b,c,d,e){if(null!=this.mouseStart&&0==a.button){var f=this.mouseStart,g=this.mouseEnd;e.length=0,d.push(new DrawCommand(this.drawer,function(a){a.clearRect(f.x,f.y,g.x-f.x,g.y-f.y)})),this.mouseStart=null,this.mouseEnd=null,this.drawer.repaint()}}},LetterModeStrategy.prototype={onBeforeModeStart:function(a,b){this.mouseStart=null,this.mouseEnd=null,b.length=0,this.drawer.repaint()},onMouseDown:function(a,b,c,d,e){},onMouseMove:function(a,b,c,d,e){},onMouseUp:function(a,b,c,d,e){if(0==a.button){var f=window.prompt("文字を入力してください");null!=f&&(d.push(new DrawCommand(this.drawer,function(a){a.save(),a.font=this.font,a.fillStyle=this.strokeStyle,a.fillText(f,b,c),a.restore()})),this.drawer.repaint())}}}; | |
| </script> | |
| <script id="kantanMarkdownJs"> | |
| function setViewOnly(){document.getElementById("messageArea").innerText="このブラウザでは編集できません。";for(var a=document.querySelectorAll("nav > *"),b=0;b<a.length;b++)a[b].setAttribute("disabled","disabled")}function on(a,b,c){var d;d="string"==typeof a?document.querySelectorAll(a):[a];for(var e=0;e<d.length;e++)d[e].addEventListener(b,c),eventListeners.push({element:d[e],eventName:b,callback:c})}function removeAllEvents(){for(var a=0;a<eventListeners.length;a++){var b=eventListeners[a].element,c=eventListeners[a].eventName,d=eventListeners[a].callback;b.removeEventListener(c,d)}eventListeners=[]}function updateKantanVersion(a){document.getElementById("kantanVersion").value=a;for(var b=document.getElementById("kantanEdition").value,c=document.getElementsByClassName("version"),d=0;d<c.length;d++)c[d].innerText=a+"_"+b}function updateKantanEdition(a){document.getElementById("kantanEdition").value=a}function kantanUpdate(a){a.doUpdate()}function getItem(a,b){try{var c=localStorage.getItem("com.tatesuke.ktm."+a);return null!=c?c:b}catch(d){return b}}function setItem(a,b){try{localStorage.setItem("com.tatesuke.ktm."+a,b)}catch(c){}}function getCachedImageUrl(a,b){var c=imageUrlMap[a];if(null==c&&b){var d=document.getElementById("attach-"+a);return null!=d?cacheImageUrl(a,d.innerHTML):null}return c}function cacheImageUrl(a,b){var c;if(window.URL){var d=base64ToBlob(b);c={blobOrBase64:window.URL.createObjectURL(d),base64:b}}else c={blobOrBase64:b,base64:b};return imageUrlMap[a]=c,c}function uncacheImageUrl(a){var b=imageUrlMap[a];window.URL&&b&&window.URL.revokeObjectURL(b),delete imageUrlMap[a]}function doLayout(){var a=document.getElementById("wrapper"),b=window.innerHeight-a.offsetTop-10;a.style.height=b+"px"}function toggleMode(){var a=document.getElementById("attach"),b=document.getElementById("editorTabWrapper"),c=document.getElementById("editor"),d=document.getElementById("previewer");if(isEditMode()&&(editorScrollBarPos=c.scrollTop,caretStartPos=c.selectionStart,caretEndPos=c.selectionEnd),isEditMode()){isPreviewerOpened=isVisible(d),0==isPreviewerOpened&&openPreview(),hide(a),hide(b),doPreview();for(var e=null,f=null,g=d.querySelectorAll("*"),h=0;h<g.length;h++){var i=d.scrollTop-(g[h].offsetTop-d.offsetTop);(null==e||Math.abs(i)<Math.abs(e))&&(e=i,f=g[h])}addClass(document.querySelector("body"),"previewMode"),removeClass(document.querySelector("body"),"editMode"),doLayout(),d.focus(),f&&(wrapper.scrollTop=f.offsetTop-d.offsetTop+e)}else{showBlock(a),showBlock(b),doPreview();for(var e=null,f=null,g=d.querySelectorAll("*"),h=0;h<g.length;h++){var i=wrapper.scrollTop-(g[h].offsetTop-d.offsetTop);(null==e||Math.abs(i)<Math.abs(e))&&(e=i,f=g[h])}0==isPreviewerOpened&&closePreview(),removeClass(document.querySelector("body"),"previewMode"),addClass(document.querySelector("body"),"editMode"),doLayout(),f&&(d.scrollTop=f.offsetTop-d.offsetTop+e)}isEditMode()&&(c.scrollTop=editorScrollBarPos,c.selectionStart=caretStartPos,c.selectionEnd=caretEndPos,c.focus())}function queuePreview(){var a=document.getElementById("settingAutoSync");a.checked&&(clearTimeout(previewQueue),previewQueue=setTimeout(doPreview,queuePreviewWait))}function doPreview(){var a=document.getElementById("previewer"),b=document.createEvent("Event");b.initEvent("prepreview",!0,!0),a.dispatchEvent(b);var c=isMaxScroll("previewer");a.innerHTML=marked(editor.value);var d=document.querySelector("#previewerStyle"),e=document.querySelector("#cssEditor"),f=replaceAttachURL(e.value);d.innerHTML=f;var g=document.querySelector("h1");g?document.title=g.textContent:document.title="無題",0==saved&&(document.title="* "+document.title);for(var h=document.querySelectorAll("#previewer img"),i=0;i<h.length;i++){var j=h[i];loadImage(j)}var k=document.querySelectorAll("#previewer a");for(i in k){var l=k[i],m=l.href;if(m){var n=m.trim().match(/^attach:(.+)/);if(n){var o=decodeURIComponent(n[1]);getFileBlog(o,function(a){var b=window.URL||window.webkitURL,c=b.createObjectURL(a);l.href=c,l.download=o})}}}if("undefined"!=typeof Diagram)for(var p=document.getElementsByClassName("sequence"),i=0;i<p.length;i++){var q=p[i],r=Diagram.parse(q.textContent);q.innerHTML="",r.drawSVG(q,{theme:"simple"})}if("undefined"!=typeof flowchart)for(var s=document.getElementsByClassName("flow"),i=0;i<s.length;i++){var t=s[i],r=flowchart.parse(t.textContent);t.innerHTML="",r.drawSVG(t)}1==c&&(a.scrollTop=a.scrollHeight);var b=document.createEvent("Event");b.initEvent("previewed",!0,!0),a.dispatchEvent(b)}function replaceAttachURL(a){var b="",c=0,d='url("attach:',e='"';for(d.length;c<a.length;){if(c+d.length<a.length){var f=a.substr(c,d.length);if(f==d){c+=d.length;for(var g="",h=a.charAt(c++);h!=e;)g+=h,h=a.charAt(c++);var i=getCachedImageUrl(g,!0);b+=null==i?d+g+e:'url("'+i.blobOrBase64+e;continue}}var h=a.charAt(c++);if(b+=h,'"'!=h);else{for(h=a.charAt(c++);'"'!=h;)b+=h,h=a.charAt(c++);b+=h}}return b}function loadImage(a){var b=null;if(a.name)b=a.name;else if(a.src){var c=a.src.trim().match(/^attach:(.+)/);c&&(b=decodeURIComponent(c[1]))}null!=b&&loadImageByName(b,function(b,c){var d=document.createElement("canvas");d.width=b,d.height=c,a.src=d.toDataURL()},function(b){a.src=b.blobOrBase64})}function loadImageByName(a,b,c){var d=document.getElementById("attach-"+a);if(null!=d){var e=d.parentNode,f=d.innerHTML,g=e.querySelector("script.layerContent").innerHTML,h=e.querySelector("script.trimInfo").innerHTML;h=""!=h?JSON.parse(h):null;var i=getCachedImageUrl(a,!1);if(i)return void c(i);if(null==h){var j=cacheImageUrl(a,f);return void c(j)}b(h.w,h.h);var k=new Image;k.onload=function(){var b=document.createElement("canvas");b.width=h.w,b.height=h.h;var d=b.getContext("2d");if(d.translate(-h.x,-h.y),d.drawImage(k,0,0),""!=g){var e=new Image;e.onload=function(){d.drawImage(e,0,0);var f=b.toDataURL(),g=cacheImageUrl(a,f);c(g)},e.src=g}else{var f=b.toDataURL(),i=cacheImageUrl(a,f);c(i)}},k.src=f}}function isMaxScroll(a){var b=document.getElementById(a),c=b.scrollHeight,d=b.clientHeight,e=b.scrollTop,f=c-(d+e);return f>=-1&&1>=f}function cssChanged(){saved=!1;var a=document.title;a.match(/^\*/)||(document.title="* "+a)}function attachFiles(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b].type;"text/html"==d?attachHtmlFile(c):attachFile(c)}}function attachFile(a,b){var c=new FileReader;b?c.fileName=b:c.fileName=a.name,c.onload=function(a){var b=a.target;addAttachFileElement(b.fileName,b.result,"","",!0)},c.readAsDataURL(a)}function attachHtmlFile(a){var b=new FileReader;b.fileName=a.name,b.onload=function(a){return function(b){var c=b.target.result,d=c.substring(23,c.length-8),e=document.createElement("html");e.innerHTML=d;var f=e.querySelector("ul#fileList"),g=e.querySelector("textarea#editor");f&&g?showImportDialog("かんたんMarkdownのファイルを検出しました。どの項目をインポートしますか?",function(b){1==b.result?importKantanMarkdown(b,e,a):attachFile(a)}):attachFile(a)}}(a),b.readAsText(a)}function importKantanMarkdown(a,b,c){if(1==a.attach){for(var d=b.querySelectorAll("ul#fileList li"),e=0;e<d.length;e++){var f=d[e].querySelector("script"),g=f.title,h=f.innerHTML,i=d[e].querySelector("script.layerContent"),j=i?i.innerHTML:"",k=d[e].querySelector("script.trimInfo"),l=k?k.innerHTML:"";addAttachFileElement(g,h,j,l,!1)}saved=!1}if(1==a.markdown){var m=b.querySelector("textarea#editor"),n=document.getElementById("editor");n.value=n.value+m.value,saved=!1}if(1==a.css){var o=b.querySelector("#previewerStyle");if(o){var p=document.getElementById("cssEditor"),q=b.querySelector("#cssEditor");""!=o.innerHTML.trim()?(p.value=o.innerHTML,saved=!1):q&&(p.value=q.value,saved=!1)}}doPreview()}function showImportDialog(a,b){document.getElementById("saveButton").disabled=!0,document.getElementById("importDialogMessage").innerText=a;var c=document.getElementById("importDialog");c.querySelector("form").reset(),document.getElementById("importDialogOkButton").onclick=function(a){a.preventDefault(),hide(c),document.getElementById("importDialogMessage").innerText="";var d={result:!0,attach:document.getElementById("importDialogAttach").checked,markdown:document.getElementById("importDialogMarkdown").checked,css:document.getElementById("importDialogCss").checked};return b(d),document.getElementById("importDialogOkButton")&&(document.getElementById("importDialogOkButton").onclick=null),document.getElementById("importDialogCancelButton")&&document.getElementById("importDialogCancelButton").onclick,document.getElementById("saveButton")&&(document.getElementById("saveButton").disabled=!1),!1},document.getElementById("importDialogCancelButton").onclick=function(a){return a.preventDefault(),hide(c),document.getElementById("importDialogMessage").innerText="",b({result:!1}),delete document.getElementById("importDialogOkButton").onclick,delete document.getElementById("importDialogCancelButton").onclick,document.getElementById("saveButton").disabled=!1,!1},showBlock(c);var d=document.querySelector("body");c.style.top="10px",c.style.left=d.offsetWidth/2-c.offsetWidth/2+"px"}function addAttachFileElement(a,b,c,d,e){for(var f=a,g=document.querySelector("#fileList script[title='"+f+"']"),h=2;g;){var i=a.lastIndexOf(".");i=-1!=i?i:a.length;var f=a.substring(0,i),j=a.substr(i);f=f+"_"+h+j,g=document.querySelector("#fileList script[title='"+f+"']"),h++}var k=document.createElement("li"),g=document.createElement("script");g.type="text/template",g.id="attach-"+f,g.title=f,g.innerHTML=b,k.appendChild(g);var l=document.createElement("script");l.type="text/template",addClass(l,"layerContent"),l.innerHTML=c,k.appendChild(l);var m=document.createElement("script");m.type="text/template",addClass(m,"trimInfo"),m.innerHTML=d,k.appendChild(m);var n=document.createElement("button");addClass(n,"upButton"),n.innerHTML="↑",on(n,"click",onUpButtonClicked),k.appendChild(n);var o=document.createElement("button");addClass(o,"downButton"),o.innerHTML="↓",on(o,"click",onDownButtonClicked),k.appendChild(o);var p=document.createElement("input");p.type="text",addClass(p,"fileName"),p.value=f,on(p,"blur",onFileNameChanged),k.appendChild(p);var q=document.createElement("button");addClass(q,"insertButton"),q.innerHTML="Insert Tag",on(q,"click",onInsertButtonClicked),k.appendChild(q);var r=b.match("data:image/.+?;base64,"),s=document.createElement("button");addClass(s,"editButton"),s.innerHTML="Edit",s.disabled=!r,on(s,"click",onEditButtonClicked),k.appendChild(s);var t=document.createElement("button");addClass(t,"downloadButton"),t.innerHTML="Download",on(t,"click",onDownloadButtonClicked),k.appendChild(t);var u=document.createElement("button");addClass(u,"detachButton"),u.innerHTML="×",on(u,"click",onDetachButtonClicked),k.appendChild(u),document.getElementById("fileList").appendChild(k);var v=(document.getElementById("editor"),document.getElementById("toggleButton")),w=document.getElementById("filer");isEditMode()||v.click(),isVisible(w)||openFiler();var x=document.querySelector("#settingInsertImgTagAfterAttach");if(r&&e&&x.checked){var y='<img src="attach:'+f+'">';insertToEditor(document.getElementById("editor"),y)}saved=!1,queuePreview()}function getFileBlog(a,b){var c=document.getElementById("attach-"+a);c||b(null);var d=c.innerHTML,e=d.match(/^\s*data:(.*);base64/)[1];e.match("^image")?loadImageByName(a,function(){},function(a){b(base64ToBlob(a.base64))}):b(base64ToBlob(d))}function base64ToBlob(a){for(var b=a.match(/^\s*data:(.*);base64/)[1],c=atob(a.replace(/^.*,/,"")),d=new Uint8Array(c.length),e=0;e<c.length;e++)d[e]=c.charCodeAt(e);var f=new Blob([d.buffer],{type:b});return f}function onUpButtonClicked(a){var b=a.target.parentNode,c=b.previousElementSibling;if(c){var d=b.parentNode;d.insertBefore(b,c)}}function onDownButtonClicked(a){var b=a.target.parentNode,c=b.nextElementSibling;if(c){var d=b.parentNode;d.insertBefore(c,b)}}function onDetachButtonClicked(a){if(window.confirm("削除していいですか?")){var b=a.target.parentNode,c=b.querySelector("script").name;uncacheImageUrl(c),b.parentNode.removeChild(b),saved=!1}}function onFileNameChanged(a){var b=a.target,c=b.value.trim(),d=b.parentNode.querySelector("script").title;if(c==d)return!0;if(""==c)return alert("名前は必ず入力してください。"),a.target.focus(),!1;var e=document.querySelector("#fileList script[title='"+c+"']");if(e)return alert("名前が重複しています。"),b.focus(),b.selectionStart=0,b.selectionEnd=c.length,!1;var f=b.parentNode.querySelector("script");return uncacheImageUrl(f.title),f.id="attach-"+c,f.title=c,saved=!1,queuePreview(),!0}function onInsertButtonClicked(a){var b=a.target,c=b.parentNode.querySelector("script"),d=c.innerHTML.match("data:image/.+?;base64,"),e=c.title,f=document.getElementById("editor");if(isVisible(f)){var g;g=d?'<img src="attach:'+e+'">':'<a href="attach:'+e+'">'+e+"</a>",insertToEditor(f,g)}var h=document.getElementById("cssEditor");if(isVisible(h)&&d){var g='url("attach:'+e+'")';insertToEditor(h,g)}}function insertToEditor(a,b){var c=a.value,d=a.selectionStart+b.length,e=c.substring(0,a.selectionStart),f=c.substr(a.selectionEnd);a.value=e+b+f,a.selectionStart=d,a.selectionEnd=d,updateScrollPos(a);var g=document.createEvent("Event");g.initEvent("changeByJs",!1,!1),a.dispatchEvent(g)}function onDownloadButtonClicked(a){var b=a.target,c=b.parentNode.querySelector("script"),d=c.title;getFileBlog(d,function(a){if(window.navigator.msSaveBlob)window.navigator.msSaveBlob(a,d);else{var b=window.URL||window.webkitURL,c=b.createObjectURL(a),e=document.createElement("a");e.download=d,e.href=c;var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!1,self,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f),delete e}})}function onEditButtonClicked(a){var b=a.target.parentNode,c=b.querySelector("script"),d=b.querySelector("script.layerContent"),e=b.querySelector("script.trimInfo");addClass(document.querySelector("body"),"drawMode");var f=document.querySelector("nav"),g=document.querySelector("#attach"),h=document.querySelector("#wrapper");hide(f),hide(g),hide(h),drawer.show(c.innerHTML,d.innerHTML,e.innerHTML,function(a,b){d.innerHTML=a,e.innerHTML=b,showBlock(f),showBlock(g),showBlock(h),removeClass(document.querySelector("body"),"drawMode"),uncacheImageUrl(c.title),doPreview()},function(){showBlock(f),showBlock(g),showBlock(h),removeClass(document.querySelector("body"),"drawMode")})}function openFiler(){document.getElementById("attachToggleButton").innerText="添付ファイルを隠す(Alt+↑)",showBlock(document.getElementById("attachForm")),showBlock(document.getElementById("filer")),doLayout()}function closeFiler(){document.getElementById("attachToggleButton").innerText="添付ファイルを表示(Alt+↓)",hide(document.getElementById("attachForm")),hide(document.getElementById("filer")),doLayout()}function openPreview(){var a=document.getElementById("editorTabWrapper"),b=document.getElementById("previewer");isEditMode()&&!isVisible(b)&&(document.getElementById("previewToggleButton").innerText="プレビューを隠す(Alt+→)",removeClass(a,"fullWidth"),showBlock(b),doLayout())}function closePreview(){var a=document.getElementById("editorTabWrapper"),b=document.getElementById("previewer");isEditMode()&&isVisible(b)&&(document.getElementById("previewToggleButton").innerText="プレビューを表示(Alt+←)",addClass(a,"fullWidth"),hide(b),doLayout())}function save(){var a=getHTMLForSave(),b=new Blob([a]);if(window.navigator.msSaveBlob)window.navigator.msSaveBlob(b,document.title+".html");else{var c=window.URL||window.webkitURL,d=c.createObjectURL(b),e=document.createElement("a");e.download=document.title.replace(/^\* /,"")+".html",e.href=d;var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!1,self,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f),delete e}}function getHTMLForSave(){var a=document.getElementById("wrapper").scrollTop,b=document.getElementById("previewer").scrollTop;document.querySelector("#updateScriptArea").innerHTML="";var c=document.getElementById("editor");c.innerHTML=c.value.replace(/</g,"<");var d=document.getElementById("cssEditor");d.innerHTML=d.value;var e=isEditMode();1==e&&toggleMode(),addClass(document.querySelector("body"),"initialState"),document.getElementById("previewer").innerHTML="",document.getElementById("messageArea").innerHTML="",document.getElementById("previewerStyle").innerHTML="",document.title.match(/^\* .*/)&&(document.title=document.title.substr("* ".length));for(var f=document.querySelectorAll("*[style]"),g=0;g<f.length;g++){var h=f[g];h.removeAttribute("style")}document.querySelector("#previewer").removeAttribute("class");var i="<!doctype html>\n<html>\n";i+=document.getElementsByTagName("html")[0].innerHTML;var g=i.lastIndexOf("/script>");return i=i.substring(0,g),i+="/script>\n</body>\n</html>",contentAtSave=c.value,saved=!0,doPreview(),removeClass(document.querySelector("body"),"initialState"),1==e&&toggleMode(),document.getElementById("previewer").scrollTop=b,document.getElementById("wrapper").scrollTop=a,i}function updateSavedFlag(){saved=contentAtSave==document.getElementById("editor").value}function headingSyncToPreviewer(){var a=document.getElementById("editor"),b=document.getElementById("previewer"),c=getCurrentNumberOfHeading(a);scrollPreviewerToHeading(b,c)}function headingSyncToEditor(a){var b=document.getElementById("editor"),c=document.getElementById("previewer"),d=getNumberOfHeading(c,a.target);scrollEditorToHeading(b,d)}function getNumberOfHeading(a,b){var c,d=a.querySelectorAll("h1, h2, h3, h4, h5, h6");for(c=0;c<d.length&&d[c]!=b;c++);return c+1}function scrollEditorToHeading(a,b){for(var c,d=a.value,e=processForHeadingSync(d,d.length),f=0,c=0;c<e.length;c++){var g=e[c];if(g.match(/^# .+$/)&&(f++,f==b))break}var h=0;if(0!=c){var i=0;for(h=0;h<d.length;h++){var j=d.charAt(h);if("\n"==j&&(i++,i==c)){h++;break}}}var k=a.value.indexOf("\n",h);k=-1==k?a.value.length:k,a.selectionStart=h,a.selectionEnd=k,updateScrollPos(a),updateSavedFlag(),a.focus()}function getCurrentNumberOfHeading(a){for(var b=a.value,c=a.selectionStart,d=0;c<b.length&&2>d;)"\n"==b.charAt(c)&&d++,c++;c--;var e=processForHeadingSync(b,c);return 2==d&&e[e.length-1].match(/^#{1,6}\s(.+)$/)&&e.pop(),e.join().split("# ").length-1}function scrollPreviewerToHeading(a,b){if(0==b)a.scrollTop=0;else{var c=a.querySelectorAll("h1, h2, h3, h4, h5, h6"),d=c[b-1];a.scrollTop=d.offsetTop-a.offsetTop}}function processForHeadingSync(a,b){var c=a.substring(0,b),d=c.split("\n"),e=[],f=editor.currentStyle||document.defaultView.getComputedStyle(editor,""),g=f.tabSize||f.MozTabSize||8;g=Number(g);var h,i=!1,j=!1;for(h=0;h<d.length;h++){var k=d[h];k=k.replace(new RegExp("^ {"+g+",}.*"),""),k=k.replace(/^\t+.*/,""),k=k.replace(/^\s+|\s+$/g,""),k=k.replace(/^\s*(>\s*)+/,""),1!=i?1!=j?"~~~"!=k.substring(0,3)?"```"!=k.substring(0,3)?!k.match(/^={2,}$|^-{2,}$/)||e[h-1].match(/^#{1,6}\s(.+)$/)||""==e[h-1]?k.match(/^#{1,6}\s(.+)$/)||k.match(/^<h[1-6]>(.*)$/)?e.push("# "+RegExp.$1):e.push(k.replace(/#/g,"")):(e[h-1]="# "+e[h-1],e.push("")):(j=!0,e.push("")):(i=!0,e.push("")):("```"==k&&(j=!1),e.push("")):("~~~"==k&&(i=!1),e.push(""))}return e}function updateScrollPos(a){var b,c=a.value,d=a.selectionStart,e=a.selectionEnd;try{b=document.execCommand("insertText",!1,"X")}catch(f){b=!1}if(b)a.value=c,a.selectionStart=d,a.selectionEnd=d,a.blur(),a.focus(),a.selectionStart=d,a.selectionEnd=e;else{var g=c.substring(0,d),h=c.substr(e);a.value=g+"X"+h,a.selectionStart=g.length,a.selectionEnd=g.length+1;document.execCommand("delete",!1,null);a.value=c,a.selectionStart=d,a.selectionEnd=e}}function showMarkdown(){var a=document.querySelector("#markdownTab").parentNode;addClass(a,"selected");var b=document.querySelector("#editor");showBlock(b),b.focus();var c=document.querySelector("#cssTab").parentNode;removeClass(c,"selected");var d=document.querySelector("#cssEditor");hide(d)}function showCss(){var a=document.querySelector("#markdownTab").parentNode;removeClass(a,"selected");document.querySelector("#editor");hide(document.querySelector("#editor"));var b=document.querySelector("#cssTab").parentNode;addClass(b,"selected");var c=document.querySelector("#cssEditor");showBlock(c),c.focus()}function addAttachEditLayer(a,b){var c=document.createElement("script");c.type="text/template",c.className="editLayer",c.innerHTML=b;var d=document.getElementById("attach-"+a),e=d.parentNode;e.insertBefore(c,d.nextSibling)}function isEditMode(){return isVisible(document.querySelector("#editorTabWrapper"))}function isDrawMode(){return document.querySelector("body").classList.contains("drawMode")}function isEnable(a){return a&&("undefined"==typeof a.disabled||0==a.disabled)}function isVisible(a){var b=a.currentStyle||document.defaultView.getComputedStyle(a,"");if("none"==b.display)return!1;var c="body"==a.tagName.toLowerCase()?null:a.parentNode;return c?isVisible(c):!0}function showBlock(a){a.style.display="",isVisible(a)||(a.style.display="block")}function hide(a){a.style.display="",isVisible(a)&&(a.style.display="none")}function addClass(a,b){a.classList.add(b)}function removeClass(a,b){a.classList.remove(b),""==a.className&&a.removeAttribute("class")}!function(){var a=document.createElement("div");void 0==a.innerText&&Object.defineProperty(HTMLElement.prototype,"innerText",{get:function(){return this.textContent},set:function(a){this.textContent=a}})}();try{new Blob(["temp"])}catch(e){setViewOnly()}var ua=window.navigator.userAgent.toLowerCase();-1==ua.indexOf("chrome")&&-1!=ua.indexOf("safari")&&setViewOnly(),updateKantanVersion(document.getElementById("kantanVersion").value);var eventListeners=[];on("#updateButton","click",function(a){if(a.preventDefault(),!window.confirm("最新版にアップデートします。\n不測の事態に備えて、現在編集中のドキュメントは保存しておくことをお勧めします。\n\n【OK】:アップデート実行(あと何回かダイアログが表示されます)\n【キャンセル】:キャンセル"))return!1;var b=document.createElement("script");return b.src="http://tatesuke.github.io/KanTanMarkdown/kantanUpdate.js",b["class"]="kantanUpdateScript",b.onerror=function(){alert("アップデートに失敗しました。\nアップデート用のファイルにアクセスできませんでした。\nインターネットに接続されていないか、サーバーダウンです")},document.querySelector("#updateScriptArea").appendChild(b),!1});for(var saveValueElements=document.querySelectorAll("#settingMenu input[type=checkbox]"),i=0;i<saveValueElements.length;i++){var element=saveValueElements[i],savedValue=getItem(element.id,null);null!=savedValue&&(element.checked="true"==savedValue),on(element,"change",function(){setItem(this.id,this.checked)})}toKantanEditor(document.getElementById("editor")),toKantanEditor(document.getElementById("cssEditor")),"undefined"!=typeof hljs&&marked.setOptions({highlight:function(a,b){return hljs.highlightAuto(a,[b]).value}});var imageUrlMap={};addClass(document.querySelector("body"),"previewMode"),removeClass(document.querySelector("body"),"editMode"),removeClass(document.querySelector("body"),"initialState"),isEnable(document.getElementById("toggleButton"))&&""==document.getElementById("editor").innerHTML?toggleMode():doPreview(),doLayout(),on(window,"resize",doLayout);var editorScrollBarPos=0,caretStartPos=0,caretEndPos=0,isPreviewerOpened=!0;on("#toggleButton","click",toggleMode),on("#settingAutoSync","change",function(){1==this.checked?this.setAttribute("checked","checked"):this.removeAttribute("checked")}),on("#syncButton","click",doPreview),on("#editor","change",queuePreview),on("#editor","keyup",queuePreview);var previewQueue=null,queuePreviewWait=300;on("#cssEditor","change",cssChanged),on("#cssEditor","keyup",cssChanged),on("#attachButton","change",function(a){var b=a.target,c=b.files;attachFiles(c)}),on("body","dragover",function(a){a.stopPropagation(),a.preventDefault(),a.dataTransfer.dropEffect="copy",addClass(this,"onDragover")}),on("body","drop",function(a){a.stopPropagation(),a.preventDefault(),attachFiles(a.dataTransfer.files),removeClass(this,"onDragover")}),on("body","dragleave",function(a){removeClass(this,"onDragover")}),on(".upButton","click",onUpButtonClicked),on(".downButton","click",onDownButtonClicked),on(".detachButton","click",onDetachButtonClicked);for(var fileNameElems=document.getElementsByClassName("fileName"),i=0;i<fileNameElems.length;i++){var fileNameElem=fileNameElems[i],script=fileNameElem.parentNode.querySelector("script"),fileName=script.title;fileNameElem.value=fileName}on("#fileList input","blur",onFileNameChanged),on(".insertButton","click",onInsertButtonClicked),on(".downloadButton","click",onDownloadButtonClicked);var drawer=new KantanDrawer(document.querySelector("#drawArea"));on(".editButton","click",onEditButtonClicked),on("#attachToggleButton","click",function(){isVisible(document.getElementById("filer"))?closeFiler():openFiler()}),on("#previewToggleButton","click",function(){isVisible(document.getElementById("previewer"))?closePreview():openPreview()});var contentAtSave=editor.value;on("#saveButton","click",save);var saved=!0;window.onbeforeunload=function(){return saved?void 0:"ドキュメントが保存されていません。"},on("#editor","input",updateSavedFlag),on("#onlineMenuButton","click",function(){var a=document.getElementById("onlineMenu");a.style.top=this.offsetTop+this.scrollHeight+"px",showBlock(a)}),on("body","click",function(a){var b=document.getElementById("onlineMenuButton");a.target!=b&&hide(document.getElementById("onlineMenu"))}),on("#settingMenuButton","click",function(){var a=document.getElementById("settingMenu");a.style.top=this.offsetTop+this.scrollHeight+"px",a.style.left=this.offsetLeft+"px",showBlock(a)}),on("body","click",function(a){var b=a.target,c=document.getElementById("settingMenuButton");if(b==c)return!0;for(var d=document.getElementById("settingMenu");null!=b;){if(b==d)return!0;b=b.parentNode}hide(d)}),on("#headingSyncButton","click",headingSyncToPreviewer),on("#previewer","previewed",function(a){if(isEditMode())for(var b=a.target.querySelectorAll("h1, h2, h3, h4, h5, h6"),c=0;c<b.length;c++)b[c].onmouseover=function(){this.style.cursor="pointer"},b[c].onclick=headingSyncToEditor}),on("#previewer","prepreview",function(a){for(var b=document.getElementById("previewer").querySelectorAll("h1, h2, h3, h4, h5, h6"),c=0;c<b.length;c++)b[c].onmouseover=null,b[c].onclick=null}),on("#markdownTab","click",function(a){return a.preventDefault(),showMarkdown(),!1}),on("#cssTab","click",function(a){return a.preventDefault(),showCss(a),!1}),on("#pasteArea","paste",function(a){if(!a.clipboardData||!a.clipboardData.types)return!0;for(var b=!1,c=0;c<a.clipboardData.types.length;c++)if("Files"==a.clipboardData.types[c]){b=!0;break}if(0==b)return!0;a.preventDefault();for(var c=0;c<a.clipboardData.items.length;c++)attachFile(a.clipboardData.items[c].getAsFile(),"clipboard");return!1}),on("#pasteArea","keyup",function(a){a.preventDefault();var b=document.createElement("div");b.innerHTML=this.innerHTML;var c=b.querySelector("img");if(c){var d=c.src;addAttachFileElement("clipboard",d,"","",!0)}return this.innerHTML="ここをクリックしてCtrl+V(Cmd+V)するとクリップボードの画像を添付できます。",!1}),on("body","keydown",function(a){var b=a.keyCode?a.keyCode:a.which;if(isDrawMode())return 83==b&&(a.ctrlKey||a.metaKey)?(a.preventDefault(),!1):!0;if(27==b){a.preventDefault();var c=document.getElementById("onlineMenu");if(isVisible(c))hide(c);else{var d=document.getElementById("toggleButton");isEnable(d)&&d.click()}return!1}if(83==b&&(a.ctrlKey||a.metaKey)){a.preventDefault();var e=document.getElementById("saveButton");return isEnable(e)&&e.click(),!1}if(116==b||82==b&&(a.ctrlKey||a.metaKey)){a.preventDefault();var f=document.getElementById("syncButton");return isEnable(f)&&f.click(),!1}if(112==b){a.preventDefault();var g=document.getElementById("helpButton");return g.click(),!1}if(37==b&&a.altKey)return a.preventDefault(),openPreview(),!1;if(38==b&&a.altKey)return a.preventDefault(),closeFiler(),!1;if(39==b&&a.altKey)return a.preventDefault(),closePreview(),!1;if(40==b&&a.altKey)return a.preventDefault(),openFiler(),!1;if(113==b){a.preventDefault();var h=document.getElementById("headingSyncButton");return h.click(),!1}return!0}); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment