--- /dev/null
+/*\r\r
+ * html2comic Javascript Editor -\r\r
+ * \r\r
+ * main.css\r\r
+ * \r\r
+ * version 0.1.0\r\r
+ *\r\r
+ * \r\r
+ * \r\r
+ */\r\r
+\r\r
+/* VML ( v\:* don't work for ie8(ie8mode))\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ v\:shape,\r\r
+ v\:image {\r\r
+ behavior: url(#default#VML);\r\r
+ display: block;\r\r
+ }\r\r
+\r\r
+/* Reset\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ html, body {\r\r
+ margin: 0;\r\r
+ padding: 0;\r\r
+ overflow: hidden;\r\r
+ }\r\r
+\r\r
+/* Reset\r\r
+---------------------------------------------------------------------------------------*/\r\r
+/*\r\r
+Copyright (c) 2009, Yahoo! Inc. All rights reserved.\r\r
+Code licensed under the BSD License:\r\r
+http://developer.yahoo.net/yui/license.txt\r\r
+version: 2.7.0\r\r
+*/\r\r
+ body{\r\r
+ font: 13px/1.231 arial,helvetica,clean,sans-serif;\r\r
+ line-height: 1;\r\r
+ *font-size: small;\r\r
+ *font: x-small;\r\r
+ }\r\r
+ select, input, button, textarea, button{\r\r
+ font: 99% arial,helvetica,clean,sans-serif;\r\r
+ }\r\r
+ table{\r\r
+ font-size: inherit;\r\r
+ font: 100%;\r\r
+ }\r\r
+ \r\r
+ html, body, div, span, applet, object, iframe,\r\r
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,\r\r
+ a, abbr, acronym, address, big, cite, code,\r\r
+ del, dfn, em, font, img, ins, kbd, q, s, samp,\r\r
+ small, strike, strong, sub, sup, tt, var,\r\r
+ b, u, i, center,\r\r
+ dl, dt, dd, ol, ul, li,\r\r
+ fieldset, form, label, legend,\r\r
+ table, caption, tbody, tfoot, thead {\r\r
+ margin: 0;\r\r
+ padding: 0;\r\r
+ border: 0;\r\r
+ outline: 0;\r\r
+ vertical-align: baseline;\r\r
+ font-family: "Hiragino Kaku Gothic Pro","MS Pゴシック", Osaka, "ヒラギノ角ゴ Pro W3","メイリオ",Meiryo,sans-serif;\r\r
+ }\r\r
+ \r\r
+ p {\r\r
+ text-shadow: #000 0 0 0;/* for Safari */ \r\r
+ -moz-opacity: 0.99;/* for Firefox */ \r\r
+ }\r\r
+ \r\r
+ pre, code, kbd, samp, tt {\r\r
+ font-family: monospace;\r\r
+ line-height: 100%;\r\r
+ *font-size: 108%;\r\r
+ margin-bottom: 1em;\r\r
+ }\r\r
+\r\r
+ /* http://e2designer.seesaa.net/article/152168876.html */\r\r
+ /* http://perishablepress.com/press/2010/06/01/wrapping-content/ */\r\r
+ pre {\r\r
+ white-space: pre; /* CSS 2.0 */\r\r
+ white-space: pre-wrap; /* CSS 2.1 */\r\r
+ white-space: pre-line; /* CSS 3.0 */\r\r
+ white-space: -pre-wrap; /* Opera 4-6 */\r\r
+ white-space: -o-pre-wrap; /* Opera 7 */\r\r
+ white-space: -moz-pre-wrap; /* Mozilla */\r\r
+ white-space: -hp-pre-wrap; /* HP Printers */\r\r
+ word-wrap: break-word; /* IE 5+ */\r\r
+ }\r\r
+ \r\r
+ /* remember to define focus styles! */\r\r
+ :focus { outline: 0;}\r\r
+ \r\r
+ /* remember to highlight inserts somehow! */\r\r
+ ins { text-decoration: none;}\r\r
+ del { text-decoration: line-through;}\r\r
+ \r\r
+ /* http://honoo-no.com/creators/2008/02/14_211120.html */\r\r
+ textarea, input {\r\r
+ font-family: "MS Pゴシック", Osaka, "ヒラギノ角ゴ Pro W3",sans-serif;\r\r
+ }\r\r
+ ul, ol, dl {\r\r
+ margin-left: 2em;\r\r
+ }\r\r
+\r\r
+ dt {\r\r
+ margin: 1em 0 0 1em;\r\r
+ font-weight: bold;\r\r
+ }\r\r
+ dd {\r\r
+ margin: 0.5em 0 0 2em;\r\r
+ }\r\r
+\r\r
+/* ClearFix\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ /* for modern brouser */\r\r
+ claerfix:after { \r\r
+ content: "."; \r\r
+ display: block; \r\r
+ visibility: hidden; \r\r
+ height: 0.1px; \r\r
+ font-size: 0.1em; \r\r
+ line-height: 0; \r\r
+ clear: both; \r\r
+ } \r\r
+ /* IE7,MacIE5 */\r\r
+ .clearfix {\r\r
+ display: inline-block;\r\r
+ }\r\r
+ /* WinIE6 below, Exclude MacIE5 \*/\r\r
+ * html .clearfix {\r\r
+ zoom: 1;\r\r
+ }\r\r
+ .clearfix {\r\r
+ display: block;\r\r
+ overflow: auto;\r\r
+ }\r\r
+ /**/\r\r
+\r\r
+\r\r
+/* Typography\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ a:link { color:#008;}\r\r
+ a:visited { color: #505;}\r\r
+ a { text-decoration: none;}\r\r
+ \r\r
+ a:hover {\r\r
+ text-decoration: underline;\r\r
+ color: #f60;\r\r
+ }\r\r
+ \r\r
+ h2 {\r\r
+ letter-spacing: 2px;\r\r
+ border-bottom: 1px dotted #333333;\r\r
+ font-size: 1.4em;\r\r
+ line-height: 1.4em;\r\r
+ text-align: center;\r\r
+ margin: 0 0 1em;\r\r
+ } \r\r
+ h3, h4 {\r\r
+ font-size: 116%;\r\r
+ font-weight: bold;\r\r
+ }\r\r
+ h3 {\r\r
+ letter-spacing: 1px;\r\r
+ border: 1px #333 solid;\r\r
+ border-width: 0 0 1px 0.5em;\r\r
+ padding: 4px 0 2px 0.6em;\r\r
+ margin: 2em 0 1em;\r\r
+ }\r\r
+ h4 {\r\r
+ letter-spacing: 1px;\r\r
+ border-bottom: 1px #999 dotted;\r\r
+ padding: 6px 6px 2px;\r\r
+ margin: 2em 7px 1em;\r\r
+ }\r\r
+ h5, h6 {\r\r
+ font-size: 1em;\r\r
+ padding: 0 5px 0;\r\r
+ margin: 1.5em 14px 1em;\r\r
+ }\r\r
+ h5 {\r\r
+ border-left: 5px #999 solid;\r\r
+ letter-spacing: 1px;\r\r
+ }\r\r
+ h6 {\r\r
+ border-left: 3px #666 double;\r\r
+ }\r\r
+ \r\r
+ p {\r\r
+ margin: 0 0 1em;\r\r
+ }\r\r
+ \r\r
+ blockquote, cite {}\r\r
+ em {}\r\r
+\r\r
+ /* tables still need 'cellspacing="0"' in the markup */\r\r
+ table {\r\r
+ width: 440px;\r\r
+ border: #999 solid;\r\r
+ border-width: 1px 1px 0 0;\r\r
+ border-collapse: collapse;\r\r
+ empty-cells: show;\r\r
+ border-spacing: 0;\r\r
+ line-height: 1.6em;\r\r
+ /*\*/\r\r
+ margin: 9px auto 1em;\r\r
+ _margin: 9px 15px 1em;\r\r
+ /* */\r\r
+ }\r\r
+\r\r
+ th, td {\r\r
+ padding: 5px;\r\r
+ border: #999 solid;\r\r
+ border-width: 0 0 1px 1px;\r\r
+ }\r\r
+ \r\r
+/* View Container\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ .view-container {\r\r
+ display: none;\r\r
+ position: absolute;\r\r
+ left: 0;\r\r
+ top: 0;\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ }\r\r
+\r\r
+/* Overlay\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #overlay-container,\r\r
+ #overlay-shadow {\r\r
+ position: absolute;\r\r
+ left: 0;\r\r
+ top: 0;\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ }\r\r
+ #overlay-shadow {\r\r
+ background-color: #000;\r\r
+ opacity: 0.5;\r\r
+ -moz-opacity: 0.5;\r\r
+ filter: alpha(opacity=50);\r\r
+ -ms-filter: alpha(opacity=50);\r\r
+ }\r\r
+ .h2c-ActiveX-disabled #overlay-shadow {\r\r
+ \r\r
+ }\r\r
+ \r\r
+ #overlay-close-button {\r\r
+ border: 2px solid #f00;\r\r
+ color: #f00;\r\r
+ font-weight: bold;\r\r
+ font-size: 16px;\r\r
+ line-height: 16px;\r\r
+ text-align: center;\r\r
+ cursor: pointer;\r\r
+ overflow: hidden;\r\r
+ width: 20px;\r\r
+ height: 20px;\r\r
+ padding: 2px;\r\r
+ position: absolute;\r\r
+ top: 9px;\r\r
+ right: 9px;\r\r
+ border-radius: 5px;\r\r
+ -o-border-radius: 5px;\r\r
+ -ms-border-radius: 5px;\r\r
+ -moz-border-radius: 5px;\r\r
+ -webkit-border-radius: 5px;\r\r
+ }\r\r
+\r\r
+/* Button\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ .button {\r\r
+ border: 1px outset #ccc;\r\r
+ background-color: #eee;\r\r
+ color: #666;\r\r
+ font-weight: bold;\r\r
+ text-align: center;\r\r
+ cursor: pointer;\r\r
+ overflow: hidden;\r\r
+ height: 30px;\r\r
+ line-height: 30px;\r\r
+ border-radius: 5px;\r\r
+ -o-border-radius: 5px;\r\r
+ -ms-border-radius: 5px;\r\r
+ -moz-border-radius: 5px;\r\r
+ -webkit-border-radius: 5px;\r\r
+ }\r\r
+\r\r
+/* Loading\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ .loading {\r\r
+ background-image: url( loading.gif);\r\r
+ background-position: 50% 50%;\r\r
+ background-repeat: no-repeat;\r\r
+ }\r\r
+ .error {\r\r
+ background-image: url( error.png);\r\r
+ background-position: 50% 50%;\r\r
+ background-repeat: no-repeat;\r\r
+ }\r\r
+\r\r
+/* img mirror\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ img.img-flip-v { /* 上下反転 */\r\r
+ transform: scale( 1, -1);\r\r
+ -o-transform: scale( 1, -1);\r\r
+ -ms-transform: scale( 1, -1);\r\r
+ -moz-transform: scale( 1, -1);\r\r
+ -webkit-transform: scale( 1, -1);\r\r
+ filter: progid:DXImageTransform.Microsoft.BasicImage( Mirror=1, Rotation=2);\r\r
+ -ms-filter: progid:DXImageTransform.Microsoft.BasicImage( Mirror=1, Rotation=2);\r\r
+ }\r\r
+ v\:image.img-flip-v {\r\r
+ flip: y; /* vml */\r\r
+ } \r\r
+ \r\r
+ img.img-flip-h { /* 左右反転 */\r\r
+ transform: scale( -1, 1);\r\r
+ -o-transform: scale( -1, 1);\r\r
+ -ms-transform: scale( -1, 1);\r\r
+ -moz-transform: scale( -1, 1);\r\r
+ -webkit-transform: scale( -1, 1);\r\r
+ filter: progid:DXImageTransform.Microsoft.BasicImage( Mirror=1);\r\r
+ -ms-filter: progid:DXImageTransform.Microsoft.BasicImage( Mirror=1);\r\r
+ }\r\r
+ v\:image.img-flip-h {\r\r
+ flip: x; /* vml */\r\r
+ }\r\r
+ \r\r
+ img.img-flip-vh { /* 上下左右反転 */\r\r
+ transform: scale( -1, -1);\r\r
+ -o-transform: scale( -1, -1);\r\r
+ -ms-transform: scale( -1, -1);\r\r
+ -moz-transform: scale( -1, -1);\r\r
+ -webkit-transform: scale( -1, -1);\r\r
+ filter: progid:DXImageTransform.Microsoft.BasicImage( Rotation=2);\r\r
+ -ms-filter: progid:DXImageTransform.Microsoft.BasicImage( Rotation=2);\r\r
+ }\r\r
+ v\:image.img-flip-vh {\r\r
+ rotation : 180; /* vml */\r\r
+ }\r\r
+\r\r
+/* img mirror with png-fix\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ .img-flip-v .img-flip-with-pngfix-v,\r\r
+ .img-flip-vh .img-flip-with-pngfix-v {\r\r
+ filter: flipv();\r\r
+ }\r\r
+ .img-flip-h .img-flip-with-pngfix-h,\r\r
+ .img-flip-vh .img-flip-with-pngfix-h {\r\r
+ filter: fliph();\r\r
+ }\r\r
+\r\r
+/* grobal-navi\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #grobal-navi {\r\r
+ position: absolute;\r\r
+ right: 20px;\r\r
+ top: 0;\r\r
+ text-align: right;\r\r
+ height: 30px;\r\r
+ border-right: 1px solid #666;\r\r
+ }\r\r
+ #grobal-navi a,\r\r
+ #grobal-navi a:link,\r\r
+ #grobal-navi a:visited,\r\r
+ #grobal-navi a:active {\r\r
+ text-align: center;\r\r
+ color: #666;\r\r
+ text-decoration: none;\r\r
+ display: block;\r\r
+ float: left;\r\r
+ width: 80px;\r\r
+ border-left: 1px solid #666;\r\r
+ font-size: 12px;\r\r
+ line-height: 12px;\r\r
+ padding: 11px 0 7px;\r\r
+ outline: 0;\r\r
+ }\r\r
+ #grobal-navi a:active {\r\r
+ background-color: #333;\r\r
+ }\r\r
+ #grobal-navi a:hover {\r\r
+ background-color: #999;\r\r
+ color: #fff;\r\r
+ }\r\r
+/*--------------------------------------------------------------------------------------\r\r
+ * \r\r
+ * home\r\r
+ * \r\r
+ -------------------------------------------------------------------------------------*/\r\r
+ #home {\r\r
+\r\r
+ }\r\r
+\r\r
+\r\r
+/*--------------------------------------------------------------------------------------\r\r
+ * \r\r
+ * Editor\r\r
+ * \r\r
+ -------------------------------------------------------------------------------------*/\r\r
+ #editor {\r\r
+ overflow: hidden;\r\r
+ background-color: #f5f5f5;\r\r
+ }\r\r
+\r\r
+ /* Text Editor\r\r
+ --------------------------------------------------------------------------------------*/ \r\r
+ #speach-editor-wrapper {\r\r
+ position: absolute;\r\r
+ }\r\r
+ #speach-editor-wrapper form {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ }\r\r
+ #speach-editor {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ border: 1px outset #ccc;\r\r
+ outline: 1px;\r\r
+ }\r\r
+ #speach-edit-complete-button {\r\r
+ margin: 10px auto 0;\r\r
+ }\r\r
+\r\r
+ /* Image Group\r\r
+ --------------------------------------------------------------------------------------*/\r\r
+ #image-gruop-wrapper {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ }\r\r
+ #image-icon-container {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ height: 200px;\r\r
+ width: 100%;\r\r
+ background-color: #fff;\r\r
+ border: #fff solid;\r\r
+ border-width: 0; \r\r
+ }\r\r
+ #image-gruop-button {\r\r
+ width: 200px;\r\r
+ position: absolute;\r\r
+ left: 0;\r\r
+ bottom: -40px;\r\r
+ _bottom: 0;\r\r
+ }\r\r
+ .image-gruop-item {\r\r
+ width: 150px;\r\r
+ height: 200px;\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ text-align: center;\r\r
+ }\r\r
+ .image-gruop-item .reversible-image-container {\r\r
+ width: 150px;\r\r
+ height: 200px;\r\r
+ }\r\r
+ .image-gruop-item .reversible-image-container img {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ }\r\r
+ .image-gruop-item-title {\r\r
+ position: absolute;\r\r
+ bottom: 0;\r\r
+ left: 0;\r\r
+ text-align: center;\r\r
+ width: 100%;\r\r
+ height: 30px;\r\r
+ }\r\r
+ \r\r
+\r\r
+/* MenuBar\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #menu-bar {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ width: 100%;\r\r
+ height: 30px;\r\r
+ background-color: #fff;\r\r
+ box-shadow: 0 4px 9px #333;\r\r
+ -moz-box-shadow: 0 4px 9px #333;\r\r
+ -webkit-box-shadow: 0 4px 9px #333;\r\r
+ filter:progid:DXImageTransform.Microsoft.Shadow(color=#333333,direction=180,strength=9);\r\r
+ }\r\r
+ .menu-bar-item,\r\r
+ .menu-bar-item-focus {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ width: 80px;\r\r
+ color: #666;\r\r
+ }\r\r
+ .menu-bar-item div,\r\r
+ .menu-bar-item-focus div {\r\r
+ cursor: pointer;\r\r
+ overflow: hidden;\r\r
+ height: 30px;\r\r
+ line-height: 30px; \r\r
+ padding-left: 0.6em;\r\r
+ font-size: 14px;\r\r
+ }\r\r
+ .menu-bar-item-focus div {\r\r
+ background-color: #66f;\r\r
+ color: #eee;\r\r
+ }\r\r
+ .menu-bar-item ul {\r\r
+ display: none;\r\r
+ }\r\r
+ .menu-bar-item-focus ul {\r\r
+ position: absolute;\r\r
+ list-style: none;\r\r
+ top: 30px;\r\r
+ width: 200px;\r\r
+ margin: 0;\r\r
+ padding: 0;\r\r
+ background-color: #fff;\r\r
+ color: #666;\r\r
+ border: 1px solid #ccc;\r\r
+ box-shadow: 1px 4px 9px #333;\r\r
+ -moz-box-shadow: 1px 4px 9px #333;\r\r
+ -webkit-box-shadow: 1px 4px 9px #333;\r\r
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=120,strength=9);\r\r
+ }\r\r
+ .menu-bar-item-focus li {\r\r
+ display: block;\r\r
+ cursor: pointer;\r\r
+ width: 200px;\r\r
+ height: 30px;\r\r
+ line-height: 30px;\r\r
+ }\r\r
+ .menu-bar-item-focus li.disabled {\r\r
+ cursor: default;\r\r
+ }\r\r
+ .menu-bar-item-focus a,\r\r
+ .menu-bar-item-focus a:link,\r\r
+ .menu-bar-item-focus a:visited {\r\r
+ color: #666;\r\r
+ position: relative;\r\r
+ display: block;\r\r
+ width: 200px;\r\r
+ height: 30px;\r\r
+ line-height: 30px;\r\r
+ *cursor: pointer;\r\r
+ }\r\r
+ .menu-bar-item-focus a:hover {\r\r
+ color: #333;\r\r
+ background-color: #ccf;\r\r
+ text-decoration: none;\r\r
+ *cursor: pointer;\r\r
+ } \r\r
+ .menu-bar-item-focus li.disabled a,\r\r
+ .menu-bar-item-focus li.disabled a:link,\r\r
+ .menu-bar-item-focus li.disabled a:visited,\r\r
+ .menu-bar-item-focus li.disabled a:active,\r\r
+ .menu-bar-item-focus li.disabled a:hover {\r\r
+ color: #999;\r\r
+ background-color: #fff;\r\r
+ *cursor: default;\r\r
+ }\r\r
+ .menu-bar-item-focus span {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 10px;\r\r
+ display: block;\r\r
+ font-size: 14px;\r\r
+ font-weight: bold;\r\r
+ width: 120px;\r\r
+ overflow: hidden;\r\r
+ }\r\r
+ .menu-bar-item-focus kbd {\r\r
+ position: absolute;\r\r
+ top: 11px;\r\r
+ left: 140px;\r\r
+ display: block;\r\r
+ font-size: 10px;\r\r
+ color: #999;\r\r
+ width: 60px;\r\r
+ overflow: hidden;\r\r
+ }\r\r
+ .menu-bar-item-focus li.separator {\r\r
+ width: 200px;\r\r
+ height: 0;\r\r
+ line-height: 0;\r\r
+ border-top: 1px solid #ccc;\r\r
+ margin: 0;\r\r
+ padding: 0;\r\r
+ }\r\r
+\r\r
+/* whiteGlass\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #whiteGlass-container {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ }\r\r
+ #whiteGlass-container div {\r\r
+ position: absolute;\r\r
+ background-color: #fff;\r\r
+ opacity: 0.7;\r\r
+ -moz-opacity: 0.7;\r\r
+ filter: alpha(opacity=70);\r\r
+ -ms-filter: alpha(opacity=70);\r\r
+ }\r\r
+ #whiteGlass-top {\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ width: 100%;\r\r
+ height: 20%;\r\r
+ }\r\r
+ #whiteGlass-left {\r\r
+ top: 20%;\r\r
+ left: 0;\r\r
+ width: 20%;\r\r
+ height: 60%;\r\r
+ }\r\r
+ #whiteGlass-right {\r\r
+ top: 20%;\r\r
+ left: 80%;\r\r
+ width: 20%;\r\r
+ height: 60%;\r\r
+ }\r\r
+ #whiteGlass-bottom {\r\r
+ top: 80%;\r\r
+ left: 0;\r\r
+ width: 100%;\r\r
+ height: 20%;\r\r
+ }\r\r
+\r\r
+/* panel\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #panel-border {\r\r
+ position: absolute;\r\r
+ border: 2px solid #333;\r\r
+ }\r\r
+\r\r
+/* mouse-operation-catcher\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #mouse-operation-catcher {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ width: 100%;\r\r
+ height: 100%; /* 100% don't work for ie6, so ie6 need to set height-'px' by js */\r\r
+ *background-color: #fff;\r\r
+ filter: alpha(opacity=0);\r\r
+ }\r\r
+ html>/**/body #mouse-operation-catcher { \r\r
+ background-color /***/: #fff\9; \r\r
+ -ms-filter /***/: alpha(opacity=0)\9;\r\r
+ } \r\r
+ /*\r\r
+ * ieでは、背景を設定しないと、mouse-operation-catcherが働かない。\r\r
+ * activeX有効の場合は背景を着色してfilterで透明に。\r\r
+ * activeX無効の場合は透明gifを使用\r\r
+ * background: url(4x4.gif) fixed repeat;\r
+ */\r\r
+\r\r
+/* comic-element\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #comic-element-container {\r\r
+ position: absolute;\r\r
+ \r\r
+ }\r\r
+ .comic-element-wrapper {\r\r
+ position: absolute;\r\r
+ }\r\r
+ #comic-element-container img {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ left: 0;\r\r
+ }\r\r
+\r\r
+/* comic-element-resizer\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #comic-element-resizer-container {\r\r
+ position: absolute;\r\r
+ border: 1px solid #999;\r\r
+ }\r\r
+ .comic-element-resizer {\r\r
+ position: absolute;\r\r
+ width: 8px;\r\r
+ height: 8px;\r\r
+ font-size: 8px; /* ie */\r\r
+ line-height: 8px; /* ie */\r\r
+ border: 1px solid #333;\r\r
+ background-color: #fff;\r\r
+ }\r\r
+ /*\r\r
+ * marker\r\r
+ */\r\r
+ #comic-element-resizer-top {\r\r
+ top: -5px;\r\r
+ left: 50%;\r\r
+ }\r\r
+ #comic-element-resizer-left {\r\r
+ top: 50%;\r\r
+ left: -5px;\r\r
+ }\r\r
+ #comic-element-resizer-right {\r\r
+ top: 50%;\r\r
+ right: -5px;\r\r
+ }\r\r
+ #comic-element-resizer-bottom {\r\r
+ bottom: -5px;\r\r
+ left: 50%;\r\r
+ }\r\r
+ #comic-element-resizer-top-left {\r\r
+ top: -5px;\r\r
+ left: -5px;\r\r
+ }\r\r
+ #comic-element-resizer-top-right {\r\r
+ top: -5px;\r\r
+ right: -5px;\r\r
+ }\r\r
+ #comic-element-resizer-bottom-left {\r\r
+ bottom: -5px;\r\r
+ left: -5px;\r\r
+ }\r\r
+ #comic-element-resizer-bottom-right {\r\r
+ bottom: -5px;\r\r
+ right: -5px;\r\r
+ } \r\r
+/* panel-resizer\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #panel-resizer-top,\r\r
+ #panel-resizer-bottom {\r\r
+ position: absolute;\r\r
+ border: 1px outset #999;\r\r
+ background-color: #eee;\r\r
+ text-align: center;\r\r
+ font-size: 12px;\r\r
+ line-height: 12px;\r\r
+ padding: 9px 0;\r\r
+ left: -2px;\r\r
+ }\r\r
+ \r\r
+ #panel-resizer-top {\r\r
+ top: -37px;\r\r
+ border-radius: 8px 8px 0 0;\r\r
+ -o-border-radius: 8px 8px 0 0;\r\r
+ -ms-border-radius: 8px 8px 0 0;\r\r
+ -moz-border-radius: 8px 8px 0 0;\r\r
+ -webkit-border-radius: 8px 8px 0 0;\r\r
+ }\r\r
+ #panel-resizer-bottom {\r\r
+ bottom: -37px;\r\r
+ border-radius: 0 0 8px 8px;\r\r
+ -o-border-radius: 0 0 8px 8px;\r\r
+ -ms-border-radius: 0 0 8px 8px;\r\r
+ -moz-border-radius: 0 0 8px 8px;\r\r
+ -webkit-border-radius: 0 0 8px 8px;\r\r
+ }\r\r
+\r\r
+/* baloon-tail-mover\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #baloon-tail-mover {\r\r
+ position: absolute;\r\r
+ width: 8px;\r\r
+ height: 8px;\r\r
+ font-size: 8px; /* ie */\r\r
+ line-height: 8px; /* ie */\r\r
+ border: 1px solid #333;\r\r
+ background-color: #66f;\r\r
+ margin: -5px 0 0 -5px;\r\r
+ }\r\r
+\r\r
+/* comic element console\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #comic-element-consol-wrapper {\r\r
+ position: absolute;\r\r
+ }\r\r
+ #image-element-consol {\r\r
+ width: 50px;\r\r
+ overflow: auto;\r\r
+ }\r\r
+ #text-element-consol {\r\r
+ width: 75px;\r\r
+ overflow: auto;\r\r
+ }\r\r
+\r\r
+ #change-image-button,\r\r
+ #layer-back-button,\r\r
+ #layer-forward-button,\r\r
+ #delete-image-button,\r\r
+ #edit-text-button,\r\r
+ #change-text-style-button,\r\r
+ #hide-text-tail-button,\r\r
+ #back-text-button,\r\r
+ #forward-text-button,\r\r
+ #delete-text-button {\r\r
+ text-indent: -9999px;\r\r
+ width: 25px;\r\r
+ height: 25px;\r\r
+ line-height: 25px;\r\r
+ float: left;\r\r
+ background-image: url(icons.gif);\r\r
+ background-repeat: no-repeat;\r\r
+ background-position: 0 0;\r\r
+ cursor: pointer;\r\r
+ }\r\r
+ #hide-text-tail-button {\r\r
+ background-position: -25px -25px;\r\r
+ }\r\r
+ #change-image-button,\r\r
+ #change-text-style-button {\r\r
+ background-position: -25px 0;\r\r
+ } \r\r
+ #layer-back-button,\r\r
+ #back-text-button {\r\r
+ background-position: -50px 0;\r\r
+ }\r\r
+ #layer-forward-button,\r\r
+ #forward-text-button {\r\r
+ background-position: -50px -25px;\r\r
+ }\r\r
+ #delete-image-button,\r\r
+ #delete-text-button {\r\r
+ background-position: 0 -25px;\r\r
+ }\r\r
+ \r\r
+ .console-out #comic-element-consol-wrapper-when-out {\r\r
+ padding: 5px;\r\r
+ background-color: #333;\r\r
+ }\r\r
+ .console-out #comic-element-consol-tail {\r\r
+ border-width: 0 5px 10px 5px;\r\r
+ border-color: transparent transparent #333 transparent;\r\r
+ _border-color: #fff #fff #333 #fff;\r\r
+ border-style: solid;\r\r
+ width: 0;\r\r
+ height: 0;\r\r
+ font-size: 0;\r\r
+ line-height: 0;\r\r
+ position: absolute;\r\r
+ top: -10px;\r\r
+ left: 50%;\r\r
+ }\r\r
+ \r\r
+\r\r
+ \r\r
+/* Panel > speach\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ .speach {\r\r
+ text-align: center;\r\r
+ display: table;\r\r
+ position: absolute;\r\r
+ top: 16.6%;\r\r
+ left: 16.6%;\r\r
+ width: 66.6%;\r\r
+ height: 66.6%;\r\r
+ padding: 0;\r\r
+ margin: 0;\r\r
+ }\r\r
+ .speach-inner {\r\r
+ display: table-cell;\r\r
+ vertical-align: middle;\r\r
+ }\r\r
+ \r\r
+ /* fix for ie */ \r\r
+ .text-element table,\r\r
+ .text-element tbody,\r\r
+ .text-element tr,\r\r
+ .text-element td {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ border: 0;\r\r
+ padding: 0;\r\r
+ margin: 0;\r\r
+ text-align: center;\r\r
+ vertical-align: middle;\r\r
+ }\r\r
+ .text-element table {\r\r
+ table-layout: fixed; /* ie6で上下中央にテキストがならない対処。固定レイアウトアルゴリズムになるので負荷を下げるらしい */\r\r
+ }\r\r
+ \r\r
+/* Window\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ .window-wrapper {\r\r
+ position: absolute;\r\r
+ top: 10px;\r\r
+ left: 10px;\r\r
+ width: 200px;\r\r
+ height: 200px;\r\r
+ background-color: #fff;\r\r
+ box-shadow: 1px 4px 9px #333;\r\r
+ -moz-box-shadow: 1px 4px 9px #333;\r\r
+ -webkit-box-shadow: 1px 4px 9px #333;\r\r
+ filter: progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=120,strength=9);\r\r
+ }\r\r
+ .window-header,\r\r
+ .window-close-button {\r\r
+ font-size: 12px;\r\r
+ color: #eee;\r\r
+ line-height: 12px;\r\r
+ overflow: hidden;\r\r
+ text-align: center;\r\r
+ padding-top: 8px;\r\r
+ padding-bottom: 6px;\r\r
+ background-color: #333; \r\r
+ }\r\r
+ .window-close-button {\r\r
+ position: absolute;\r\r
+ top: 0;\r\r
+ right: 0;\r\r
+ border-left: 1px solid #666;\r\r
+ padding-left: 9px;\r\r
+ padding-right: 9px;\r\r
+ border-radius: 0 8px 0 0;\r\r
+ -o-border-radius: 0 8px 0 0;\r\r
+ -ms-border-radius: 0 8px 0 0;\r\r
+ -moz-border-radius: 0 8px 0 0;\r\r
+ -webkit-border-radius: 0 8px 0 0;\r\r
+ }\r\r
+ \r\r
+ .window-wrapper,\r\r
+ .window-header {\r\r
+ border-radius: 8px 8px 0 0;\r\r
+ -o-border-radius: 8px 8px 0 0;\r\r
+ -ms-border-radius: 8px 8px 0 0;\r\r
+ -moz-border-radius: 8px 8px 0 0;\r\r
+ -webkit-border-radius: 8px 8px 0 0;\r\r
+ }\r\r
+ .window-body {\r\r
+ position: relative;\r\r
+ overflow: hidden;\r\r
+ }\r\r
+\r\r
+ .window-resize-button {\r\r
+ position: absolute;\r\r
+ bottom: 0;\r\r
+ right: 0;\r\r
+ border-bottom: 20px solid #aaa;\r\r
+ border-left: 20px solid transparent;\r\r
+ _border-left: 20px solid #fff;\r\r
+ line-height: 0;\r\r
+ height: 0;\r\r
+ width: 0;\r\r
+ text-indent: -9999px;\r\r
+ text-align: center;\r\r
+ cursor: pointer;\r\r
+ }\r\r
+ \r\r
+ /*\r\r
+ * page contents\r
+ */\r\r
+ .sidenavi {\r\r
+ width: 100px;\r\r
+ float: left;\r\r
+ }\r\r
+ .sidenavi-item,\r\r
+ .sidenavi-item:link {\r\r
+ display: block;\r\r
+ border-bottom: 1px solid #666;\r\r
+ padding: 1em;\r\r
+ text-decoration: none;\r\r
+ }\r\r
+ .sidenavi-item:hover {\r\r
+ background-color: #ccc;\r\r
+ text-decoration: none;\r\r
+ }\r\r
+ .sidenavi .current {\r\r
+ background-color: #666;\r\r
+ color: #eee;\r\r
+ }\r\r
+ .page-contents {\r\r
+ _position: relative; /* for ie6 */\r\r
+ margin-left: 100px;\r\r
+ padding: 1em 1em 2em 2em;\r\r
+ }\r\r
+ .page-content {\r\r
+ display: none;\r\r
+ }\r\r
+\r\r
+/* editable-text\r\r
+---------------------------------------------------------------------------------------*/\r\r
+\r\r
+ .editable-text {\r\r
+ display: inline-block;\r\r
+ color: #333;\r\r
+ border: 1px solid #ccc;\r\r
+ font-size: 14px;\r\r
+ line-height: 16px;\r\r
+ }\r\r
+ .editable-text a,\r\r
+ .editable-text a:link,\r\r
+ .editable-text a:visited,\r\r
+ .editable-text a:hover,\r\r
+ .editable-text a:active {\r\r
+ padding: 3px;\r\r
+ color: #333;\r\r
+ text-decoration: none;\r\r
+ display: block;\r\r
+ outline: 0;\r\r
+ background-color: #fff;\r\r
+ }\r\r
+ .editable-text a:hover {\r\r
+ background-color: #ccf;\r\r
+ }\r\r
+ .editable-text input {\r\r
+ padding: 3px 0;\r\r
+ width: 100%;\r\r
+ font-family: Arial,Helvetica,sans-serif;\r\r
+ background-color: #ccf;\r\r
+ border: 0;\r\r
+ margin: 0;\r\r
+ outline: 0;\r\r
+ }\r\r
+\r\r
+\r\r
+/* Information Window\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #comic-element-infomation {\r\r
+ background-color: #fff;\r\r
+ position: absolute;\r\r
+ width: 100%;\r\r
+ }\r\r
+ #comic-element-x, #comic-element-z,\r\r
+ #comic-element-y, #comic-element-a,\r\r
+ #comic-element-w, #comic-element-w-percent,\r\r
+ #comic-element-h, #comic-element-h-percent {\r\r
+ position: absolute;\r\r
+ }\r\r
+ \r\r
+ #comic-element-x,\r\r
+ #comic-element-y,\r\r
+ #comic-element-w,\r\r
+ #comic-element-h {\r\r
+ left: 30px;\r\r
+ }\r\r
+ #comic-element-z,\r\r
+ #comic-element-a,\r\r
+ #comic-element-w-percent,\r\r
+ #comic-element-h-percent {\r\r
+ left: 115px;\r\r
+ }\r\r
+ \r\r
+ #comic-element-x, #comic-element-z {\r\r
+ top: 10px;\r\r
+ }\r\r
+ #comic-element-y, #comic-element-a {\r\r
+ top: 40px;\r\r
+ }\r\r
+ #comic-element-w, #comic-element-w-percent {\r\r
+ top: 80px;\r\r
+ }\r\r
+ #comic-element-h, #comic-element-h-percent {\r\r
+ top: 110px;\r\r
+ }\r\r
+ .comic-element-attribute-label {\r\r
+ display: inline-block;\r\r
+ width: 14px;\r\r
+ line-height: 22px;\r\r
+ *line-height: 22px; /* ie用 input周りのサイズあわせ、よく分からない。 */\r\r
+ color: #666;\r\r
+ text-align: center;\r\r
+ }\r\r
+ .comic-element-attribute-value {\r\r
+ width: 40px;\r\r
+ text-align: right;\r\r
+ }\r\r
+ \r\r
+ #comic-element-z-value,\r\r
+ #comic-element-a-value {\r\r
+ width: 35px;\r\r
+ }\r\r
+ #comic-element-w-percent-value,\r\r
+ #comic-element-h-percent-value {\r\r
+ width: 30px;\r\r
+ }\r\r
+\r\r
+/* Background Window\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #bg-pattern,\r\r
+ #select-bg-pattern-button,\r\r
+ #reset-bg-pattern-button,\r\r
+ #bg-color,\r\r
+ #select-bg-color-button,\r\r
+ #reset-bg-color-button {\r\r
+ position: absolute;\r\r
+ text-align: center;\r\r
+ cursor: pointer;\r\r
+ }\r\r
+ \r\r
+ #bg-pattern,\r\r
+ #bg-color {\r\r
+ box-shadow: 1px 2px 3px #000;\r\r
+ -moz-box-shadow: 1px 2px 3px #000;\r\r
+ -webkit-box-shadow: 1px 2px 3px #000;\r\r
+ height: 80px;\r\r
+ top: 15px;\r\r
+ }\r\r
+ #bg-pattern {\r\r
+ left: 15px;\r\r
+ width: 100px;\r\r
+ }\r\r
+ #select-bg-pattern-button,\r\r
+ #reset-bg-pattern-button,\r\r
+ #select-bg-color-button,\r\r
+ #reset-bg-color-button {\r\r
+ border: 1px outset #666;\r\r
+ height: 20px;\r\r
+ top: 115px;\r\r
+ line-height: 20px;\r\r
+ }\r\r
+ #select-bg-pattern-button {\r\r
+ left: 15px;\r\r
+ width: 80px;\r\r
+ }\r\r
+ #reset-bg-pattern-button {\r\r
+ left: 95px;\r\r
+ width: 20px;\r\r
+ }\r\r
+ \r\r
+ #bg-color {\r\r
+ left: 125px;\r\r
+ width: 60px;\r\r
+ background-color: #66f;\r\r
+ }\r\r
+ #select-bg-color-button {\r\r
+ left: 125px;\r\r
+ width: 40px;\r\r
+ }\r\r
+ #reset-bg-color-button {\r\r
+ left: 165px;\r\r
+ width: 20px;\r\r
+ }\r\r
+\r\r
+\r\r
+\r\r
+/* Tool-box Window\r\r
+---------------------------------------------------------------------------------------*/ \r\r
+ #toolbox-add-image-button,\r\r
+ #toolbox-add-text-button,\r\r
+ #toolbox-edit-bg-button,\r\r
+ #toolbox-switch-grid,\r\r
+ #toolbox-popup-help-button,\r\r
+ #toolbox-publish-button {\r\r
+ position: absolute;\r\r
+ left: 10px;\r\r
+ width: 90px;\r\r
+ border: 1px outset #999;\r\r
+ height: 40px;\r\r
+ line-height: 40px;\r\r
+ text-align: center;\r\r
+ cursor: pointer;\r\r
+ background-color: #ccc;\r\r
+ border-radius: 8px;\r\r
+ -o-border-radius: 8px;\r\r
+ -ms-border-radius: 8px;\r\r
+ -moz-border-radius: 8px;\r\r
+ -webkit-border-radius: 8px;\r\r
+ }\r\r
+ #toolbox-add-image-button {\r\r
+ top: 10px; \r\r
+ }\r\r
+ #toolbox-add-text-button {\r\r
+ top: 60px;\r\r
+ }\r\r
+ #toolbox-edit-bg-button {\r\r
+ top: 110px;\r\r
+ height: 30px;\r\r
+ line-height: 30px;\r\r
+ }\r\r
+ #toolbox-switch-grid,\r\r
+ #toolbox-popup-help-button {\r\r
+ top: 150px;\r\r
+ height: 30px;\r\r
+ line-height: 30px;\r\r
+ }\r\r
+ #toolbox-switch-grid {\r\r
+ width: 45px !important;\r\r
+ }\r\r
+ #toolbox-popup-help-button {\r\r
+ width: 35px !important;\r\r
+ left: 65px !important;\r\r
+ }\r\r
+ \r\r
+ #toolbox-publish-button {\r\r
+ top: 190px;\r\r
+ height: 50px;\r\r
+ line-height: 50px;\r\r
+ }\r\r
+\r\r
+/* Grid\r\r
+---------------------------------------------------------------------------------------*/\r\r
+ #grid {\r\r
+ width: 100%;\r\r
+ height: 100%;\r\r
+ position: absolute;\r\r
+ left: 0;\r\r
+ top: 0;\r\r
+ background-attachment: fixed;\r\r
+ background-repeat: repeat;\r\r
+ /* background-image: url('grid.gif'); grid用イメージはgrid使用時にjsで埋め込み */\r\r
+ }\r\r
+\r\r
--- /dev/null
+/*!
+ * jQuery JavaScript Library v1.6.2
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Jun 30 14:16:56 2011 -0400
+ */
+(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cr(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cq(){cn=b}function cp(){setTimeout(cq,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bC.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bR,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bX(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bX(a,c,d,e,"*",g));return l}function bW(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bN),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bA(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bv:bw;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bx(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bm(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(be,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bl(a){f.nodeName(a,"input")?bk(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bk)}function bk(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bj(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bi(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bh(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bg(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(x,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z])/ig,x=function(a,b){return b.toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!A){A=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||D.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(H)return H.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0},m&&f.extend(p,{position:"absolute",left:-1e3,top:-1e3});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]||i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:|^on/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=w:v&&c!=="className"&&(f.nodeName(a,"form")||u.test(c))&&(i=v)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}},value:{get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return f.prop(a,c)?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.attrHooks.title=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.
+shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,N(a.origType,a.selector),f.extend({},a,{handler:M,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,N(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?E:D):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=E;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=E;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=E,this.stopPropagation()},isDefaultPrevented:D,isPropagationStopped:D,isImmediatePropagationStopped:D};var F=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},G=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?G:F,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?G:F)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&K("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&K("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var H,I=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function(c){var d=c.target,e,g;if(!!y.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=I(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var L={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||D,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=x.exec(h),k="",j&&(k=j[0],h=h.replace(x,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,L[h]?(a.push(L[h]+k),h=h+k):h=(L[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+N(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+N(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=T.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/<tbody/i,ba=/<|&#?\w+;/,bb=/<(?:script|object|embed|option|style)/i,bc=/checked\s*(?:[^=]|=\s*.checked.)/i,bd=/\/(java|ecma)script/i,be=/^\s*<!(?:\[CDATA\[|\-\-)/,bf={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!bf[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bc.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bg(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bm)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bb.test(a[0])&&(f.support.checkClone||!bc.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j
+)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++h)bi(e[h],g[h])}if(b){bh(a,d);if(c){e=bj(a),g=bj(d);for(h=0;e[h];++h)bh(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!ba.test(k))k=b.createTextNode(k);else{k=k.replace(Z,"<$1></$2>");var l=($.exec(k)||["",""])[1].toLowerCase(),m=bf[l]||bf._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=_.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Y.test(k)&&o.insertBefore(b.createTextNode(Y.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bl(k[i]);else bl(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bd.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bn=/alpha\([^)]*\)/i,bo=/opacity=([^)]*)/,bp=/([A-Z]|^ms)/g,bq=/^-?\d+(?:px)?$/i,br=/^-?\d/,bs=/^[+\-]=/,bt=/[^+\-\.\de]+/g,bu={position:"absolute",visibility:"hidden",display:"block"},bv=["Left","Right"],bw=["Top","Bottom"],bx,by,bz;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bx(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bs.test(d)&&(d=+d.replace(bt,"")+parseFloat(f.css(a,c)),h="number"),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bx)return bx(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bA(a,b,d);f.swap(a,bu,function(){e=bA(a,b,d)});return e}},set:function(a,b){if(!bq.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bo.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bn.test(g)?g.replace(bn,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bB=/%20/g,bC=/\[\]$/,bD=/\r?\n/g,bE=/#.*$/,bF=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bG=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bH=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bI=/^(?:GET|HEAD)$/,bJ=/^\/\//,bK=/\?/,bL=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bM=/^(?:select|textarea)/i,bN=/\s+/,bO=/([?&])_=[^&]*/,bP=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bQ=f.fn.load,bR={},bS={},bT,bU;try{bT=e.href}catch(bV){bT=c.createElement("a"),bT.href="",bT=bT.href}bU=bP.exec(bT.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bQ)return bQ.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bL,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bM.test(this.nodeName)||bG.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bD,"\r\n")}}):{name:b.name,value:c.replace(bD,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bT,isLocal:bH.test(bU[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bW(bR),ajaxTransport:bW(bS),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?bZ(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b$(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bF.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bE,"").replace(bJ,bU[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bN),d.crossDomain==null&&(r=bP.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bU[1]&&r[2]==bU[2]&&(r[3]||(r[1]==="http:"?80:443))==(bU[3]||(bU[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bX(bR,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bI.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bK.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bO,"$1_="+x);d.url=y+(y===d.url?(bK.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bX(bS,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bB,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn,co=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cr("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cs(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cr("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cr("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cs(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cr("show",1),slideUp:cr("hide",1),slideToggle:cr("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cn||cp(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!cl&&(co?(cl=!0,g=function(){cl&&(co(g),e.tick())},co(g)):cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||cp(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var ct=/^t(?:able|d|h)$/i,cu=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cv(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!ct.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cu.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cu.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cv(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cv(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
+
+
+/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
+ *
+ * Version: 3.0.2
+ *
+ * Requires: 1.2.2+
+ */
+(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
\ No newline at end of file
--- /dev/null
+/*
+ * html2comic Javascript Editor -
+ *
+ * main.js
+ * version 0.2.0
+ *
+ * author:
+ * itozyun
+ *
+ * licence:
+ * 3-clause BSD
+ *
+ * ----------------------------------------
+ * - naming of comic's elements -
+ *
+ * 0.comic strip(en) : koma manga(jp)
+ *
+ * 1.panel(en) : koma(jp)
+ * +------------+
+ * | |
+ * | |
+ * | |
+ * | |
+ * +------------+
+ *
+ * 2.speach balloon(en) : fukidasi(jp)
+ * ________
+ * / \
+ * | |
+ * < Hello!! |
+ * | |
+ * \________/
+ *
+ * 3.img
+ *
+ *
+ * ----------------------------------------
+ * window
+ * +----------------------------+
+ * | CANVAS_CONTROL |
+ * | - panel |
+ * | +----------+ |
+ * | | +----------+ |
+ * | | | | |
+ * | | | | |
+ * | +-| | |
+ * | +----------+ |
+ * | - WHITE_GLASS_CONTROL |
+ * +----------------------------+
+ *
+ * ----------------------------------------
+ * naming rules
+ *
+ * Class
+ * ThisIsClass
+ *
+ * const & Singleton Class
+ * THIS_IS_CONST = 'this is const';
+ *
+ * var
+ * thisIsVar
+ *
+ * value of jquery
+ * jqWrapper, JQ_WRAPPER
+ *
+ * value of dom element
+ * elmWrapper, ELM_WRAP
+ *
+ * value of vml element
+ * vmkImg, VML_SHAPE
+ *
+ */
+
+var h2c = ( function(){
+ var FUNCTION_ARRAY = [],
+ URL = document.location.href.split( '#')[ 0],
+ IS_LOCAL = URL.indexOf( 'file:') === 0,
+ URL_PARAMS = ( function(){
+ var search = document.location.search,
+ l = search.length;
+ if( 1 < l){
+ var query = search.substring( 1),
+ params = query.split( '&'),
+ ret = {}, elm, name;
+ while( params.length > 0){
+ elm = params.shift().split( '=');
+ name = decodeURIComponent( elm[ 0]);
+ if( elm.length === 2){
+ ret[ name] = ( function( v){
+ if( '' + parseFloat( v) === v) return parseFloat( v);
+ if( v === 'true') return true;
+ if( v === 'false') return false;
+ if( v === 'null') return null;
+ if( v === 'undefined') return undefined;
+ return v;
+ })( decodeURIComponent( elm[ 1]));
+ } else
+ if( elm.length === 1){
+ ret[ name] = true;
+ }
+ }
+ return ret;
+ }
+ return {};
+ })(),
+ IS_DEBUG = IS_LOCAL === true || URL_PARAMS.debug === true,
+ isIE = navigator.userAgent.toLowerCase().indexOf( 'msie') !== -1,
+ ieVersion = isIE === true ? parseInt( navigator.appVersion.toLowerCase().replace( /.*msie[ ]/, '').match( /^[0-9]+/)) : 0,
+ ieMode = ieVersion === 8 ? document.documentMode : 0,
+ isStanderdMode = document.compatMode === 'CSS1Compat',
+ jqWindow , jqDocument , jqBody;
+
+ ( function(){
+ var _elms = document.getElementsByTagName( '*'),
+ _elm,
+ i = 0;
+ while( i < _elms.length){
+ _elm = _elms[ i];
+ if( _elm.nodeType === 8 && _elm.parentNode){
+ _elm.parentNode.removeChild( _elm);
+ } else {
+ ++i;
+ }
+ }
+ })();
+
+ return {
+ version: '0.2.0',
+ init: function(){
+ jqWindow = $( window);
+ jqDocument = $( document);
+ jqBody = $( document.body);
+
+ var l = FUNCTION_ARRAY.length,
+ _fn;
+ for( var i=0; i<l; i++){
+ _fn = FUNCTION_ARRAY[ i];
+ _fn.init && _fn.init( _fn === h2c.view ? FUNCTION_ARRAY : undefined);
+ }
+
+ delete h2c.init;
+ },
+ fn: function( _fn){
+ FUNCTION_ARRAY.push( _fn);
+ h2c.init === undefined && _fn.init && _fn.init();
+ },
+ isIE: isIE,
+ ieVersion: ieVersion,
+ ieRenderingVersion: ieMode !== 0 ? ieMode : ieVersion,
+ isStanderdMode: isStanderdMode,
+ VENDER_PREFIX: ( function() {
+ var ua = navigator.userAgent.toLowerCase();
+ if ( ua.indexOf('opera') !== -1) {
+ return 'O';
+ } else if ( ua.indexOf('msie') !== -1) {
+ return 'ms';
+ } else if ( ua.indexOf('webkit') !== -1) {
+ return 'webkit';
+ } else if ( navigator.product === 'Gecko') {
+ return 'Moz';
+ }
+ return '';
+ })(),
+ ACTIVEX: ( function(){
+ if( isIE === false || ieVersion > 8) return false;
+ var className = document.body.className,
+ test;
+ if( className && className.indexOf( 'h2c-ActiveX-enabled') !== -1) return true;
+ if( className && className.indexOf( 'h2c-ActiveX-disabled') !== -1) return false;
+ try {
+ test = new ActiveXObject('DXImageTransform.Microsoft.gradient');
+ } catch( e){
+ return false;
+ }
+ return !!test;
+ })(),
+ jqWindow: function(){
+ return jqWindow;
+ },
+ jqDocument: function(){
+ return jqDocument;
+ },
+ jqBody: function(){
+ return jqBody;
+ },
+ URL_PARAMS: URL_PARAMS,
+ LOCAL: IS_LOCAL,
+ DEBUG: IS_DEBUG,
+ LINE_FEED_CODE_TEXTAREA : ( function(){
+ var text = document.getElementById( 'shadowTxtarea'),
+ form = text.parentNode;
+ form.parentNode.removeChild( form);
+ return text.value;
+ })(),
+ LINE_FEED_CODE_PRE : ( function(){
+ var pre = document.getElementById( 'shadowPre');
+ pre.parentNode.removeChild( pre);
+ return isIE === true ? this.LINE_FEED_CODE_TEXTAREA : pre.innerHTML; // ie ??
+ })()
+ }
+})();
+
+/*
+ * h2c.util
+ *
+ * getElementSize( _elm)
+ * getImageSize()
+ *
+ */
+
+h2c.util = ( function(){
+ var ELM_SIZE_GETTER = ( function(){
+ var ret = document.createElement( 'DIV'),
+ style = ret.style;
+ ret.id = 'elmSizeGetter';
+ style.position = 'absolute';
+ style.left = '0px';
+ style.top = '-9999px';
+ style.visibility = 'hidden';
+ document.body.appendChild( ret);
+ return ret;
+ })(),
+ IMG_SIZE_GETTER = ( function(){
+ var ret = ELM_SIZE_GETTER.cloneNode( true);
+ ret.id = 'imgSizeGetter';
+ document.body.appendChild( ret);
+ return ret;
+ })();
+ return {
+ extend: function( baseInstance, extend){
+ for( var key in extend){
+ baseInstance[ key] = extend[ key];
+ }
+ return baseInstance;
+ },
+ getElementSize: function( _elm){
+ if( !_elm){
+ return {
+ width: 0,
+ height: 0
+ }
+ }
+ var parentElm = _elm.parentNode,
+ prevElm = _elm.previousSibling,
+ nextElm = _elm.nextSibling,
+ displayNone = _elm.style.display === 'none';
+ if( displayNone === true) _elm.style.display = '';
+ ELM_SIZE_GETTER.appendChild( _elm);
+ var ret = {
+ width: _elm.offsetWidth,
+ height: _elm.offsetHeight
+ }
+ if( displayNone === true) _elm.style.display = 'none';
+ if( nextElm){
+ parentElm.insertBefore( _elm, nextElm);
+ } else
+ if( prevElm && prevElm.nextSibling){
+ parentElm.insertBefore( _elm, prevElm.nextSibling);
+ } else {
+ parentElm && parentElm.appendChild( _elm);
+ }
+ return ret;
+ },
+ getImageSize: function( img){
+ var parentElm = img.parentNode,
+ prevElm = img.previousSibling,
+ nextElm = img.nextSibling,
+ displayNone = img.style.display === 'none';
+ if( displayNone === true) img.style.display = '';
+ IMG_SIZE_GETTER.appendChild( img);
+ var size = getActualDimension( img);
+ IMG_SIZE_GETTER.removeChild( img);
+ if( displayNone === true) img.style.display = 'none';
+ if( nextElm){
+ parentElm.insertBefore( img, nextElm);
+ } else
+ if( prevElm && prevElm.nextSibling){
+ parentElm.insertBefore( img, prevElm.nextSibling);
+ } else {
+ parentElm && parentElm.appendChild( img);
+ }
+ return size;
+
+ /* LICENSE: MIT
+ * AUTHOR: uupaa.js@gmail.com
+ */
+ function getActualDimension(image) {
+ var run, mem, w, h, key = "actual";
+
+ // for Firefox, Safari, Google Chrome
+ if ("naturalWidth" in image) {
+ return {
+ width: image.naturalWidth,
+ height: image.naturalHeight
+ };
+ }
+
+ if ("src" in image) { // HTMLImageElement
+ if (image[key] && image[key].src === image.src) {
+ return image[key];
+ }
+ if (document.uniqueID) { // for IE
+ run = image.runtimeStyle;
+ mem = { w: run.width, h: run.height }; // keep runtimeStyle
+ run.width = "auto"; // override
+ run.height = "auto";
+ w = image.width;
+ h = image.height;
+ run.width = mem.w; // restore
+ run.height = mem.h;
+ } else { // for Opera and Other
+ /*
+ function fn() {
+ w = image.width;
+ h = image.height;
+ }
+ mem = { w: image.width, h: image.height }; // keep current style
+ image.removeAttribute("width");
+ image.addEventListener("DOMAttrModified", fn, false);
+ image.removeAttribute("height");
+ // call fn
+ image.removeEventListener("DOMAttrModified", fn, false);
+ image.width = mem.w; // restore
+ image.height = mem.h;
+ */
+ mem = { w: image.width, h: image.height }; // keep current style
+ image.removeAttribute("width");
+ image.removeAttribute("height");
+ w = image.width;
+ h = image.height;
+ image.width = mem.w; // restore
+ image.height = mem.h;
+ }
+ return image[key] = { width: w, height: h, src: image.src }; // bond
+ }
+ // HTMLCanvasElement
+ return { width: image.width, height: image.height };
+ }
+ },
+ loadImage: function( URLorELM, onLoad, onError, delay, timeout){
+ delay = delay || 250;
+ timeout = timeout || 5000;
+ var type = typeof URLorELM,
+ img, images, src, abstractPath;
+ if( type === 'string'){
+ src = URLorELM;
+ // images = [];
+ } else
+ // http://d.hatena.ne.jp/hottolinkblog/20090228/1235823487
+ if( type === 'object' && typeof URLorELM.hspace !== 'undefined' && typeof URLorELM.vspace !== 'undefined'){
+ img = URLorELM;
+ images = [ img];
+ src = img.src;
+ } else {
+ return;
+ }
+ abstractPath = this.getAbsolutePath( src);
+
+ loadImage( images, abstractPath,
+ function( abspath, actualW, actualH){
+ if( abstractPath !== abspath) return;
+ onLoad && setTimeout( function(){ // 一度読み込まれた画像は即座にonLoadされてしまうので遅延
+ onLoad( src, actualW, actualH);
+ }, 0);
+ },
+ function( abspath){
+ if( abstractPath !== abspath) return;
+ onError && setTimeout( function(){
+ onError( src);
+ }, 0);
+ }, delay, timeout
+ );
+
+ /* LICENSE: MIT?
+ * URL: http://d.hatena.ne.jp/uupaa/20080413/1208067631
+ * AUTHOR: uupaa.js@gmail.com
+ *
+ * fixed for ie6-8 by h2c
+ * new Image -> document.createElement( 'IMG')
+ */
+ function loadImage( images, abspath, onLoad, onError, delay, timeout) {
+ images = images || document.images;
+ var img,
+ i = 0, l = images.length,
+ tick = 0;
+ for(; i < l; ++i) {
+ img = images[i];
+ if ( img.src === abspath && img.complete) {
+ var size = h2c.util.getImageSize( img);
+ onLoad( abspath, size.width, size.height);
+ return;
+ }
+ }
+ img = document.createElement( 'IMG'); //var img = new Image(); ではieでimgのsizeが取れない、、、removeChildも失敗し、imgSizeGetterにimgが残る
+ img.finish = false;
+ img.onabort = img.onerror = function() {
+ if (img.finish) { return; }
+ img.finish = true;
+ onError(abspath);
+ img.onload = img.onabort = img.onerror = "";
+ };
+ img.onload = function() {
+ img.finish = true;
+ if (window.opera && !img.complete) {
+ onError(abspath);
+ img.onload = img.onabort = img.onerror = "";
+ return;
+ }
+ var size = h2c.util.getImageSize( img);
+ onLoad( abspath, size.width, size.height);
+ img.onload = img.onabort = img.onerror = "";
+ //img = void 0;
+ };
+ img.src = abspath;
+ if (!img.finish && timeout) {
+ setTimeout(function() {
+ if (img.finish) { return; }
+ if (img.complete) {
+ img.finish = true;
+ if (img.width) { return; }
+ onError(abspath);
+ img.onload = img.onabort = img.onerror = "";
+ return;
+ }
+ if ((tick += delay) > timeout) {
+ img.finish = true;
+ onError(abspath);
+ img.onload = img.onabort = img.onerror = "";
+ return;
+ }
+ setTimeout(arguments.callee, delay);
+ }, 0);
+ }
+ }
+ },
+ getAbsolutePath: function( path) {
+ var e = document.createElement("div");
+ e.innerHTML = '<a href=\"' + path + '\" />';
+ return e.firstChild.href;
+ }
+ }
+})();
+
+/*
+ * window resize event, overlay と currentなviewに流す
+ * view modeの保持
+ * editor, overlay, comic-viewer, image-explorer
+ * fadeIn, faseOut
+ */
+h2c.view = ( function(){
+ var jqWindow,
+ funcArray,
+ HOME_ID = 'home',
+ currentView,
+ elmCurrent,
+ viewID = ( function(){
+ var _viewID = h2c.URL_PARAMS.view || HOME_ID,
+ _elmView = document.getElementById( _viewID),
+ _elmHome = document.getElementById( HOME_ID);
+ if( _elmView){
+ _elmHome.style.display = '';
+ _elmView.style.display = 'block';
+ elmCurrent = _elmView;
+ return _viewID;
+ }
+ elmCurrent = _elmHome;
+ return HOME_ID;
+ })();
+
+ function onWindowResize(){
+ var _fn,
+ l = funcArray.length,
+ w = jqWindow.width(),
+ h = jqWindow.height();
+ for( var i=0; i<l; ++i){
+ _fn = funcArray[ i];
+ _fn.onWindowResize && _fn.onWindowResize( w, h);
+ }
+ }
+ return {
+ init: function( _funcArray){
+ funcArray = _funcArray;
+ jqWindow = h2c.jqWindow();
+ jqWindow.resize( onWindowResize);
+
+ setTimeout( onWindowResize, 100);
+
+ delete h2c.view.init;
+ },
+ show: function( _view){
+ for( var key in h2c){
+ if( h2c[ key] === _view){
+ var elm = document.getElementById( key);
+ if( currentView !== _view && elm){
+ this.current = viewID = key;
+ currentView = _view;
+ elmCurrent.style.display = '';
+ elm.style.display = 'block';
+ elmCurrent = elm;
+ }
+ return;
+ }
+ }
+ alert( 'fault!!');
+ },
+ current: viewID
+ }
+})();
+
+h2c.view.HOME = 'home'; //
+h2c.view.COMICS = 'comic-list';
+h2c.view.IMAGES = 'image-list';
+h2c.view.SETTING = 'setting';
+h2c.view.EDITOR = 'editor'; // edit mode
+
+h2c.overlay = ( function(){
+ var SHADOW_OPACITY = 0.5,
+ jqBody, jqConteiner, jqShadow, jqCloseButton,
+ currentOverlay = null,
+ visible = false;
+ return {
+ init: function(){
+ jqBody = h2c.jqBody();
+ jqConteiner = $( '#overlay-container');
+ jqShadow = $( '#overlay-shadow');
+ jqCloseButton = $( '#overlay-close-button').click( function( e){
+ currentOverlay && currentOverlay.onClose && currentOverlay.onClose();
+ h2c.overlay.hide();
+ return false;
+ });
+
+ delete h2c.overlay.init;
+ },
+ show: function( _currentOverlay){
+ if( visible === true && currentOverlay === _currentOverlay) return;
+ jqConteiner.stop().css( {
+ filter: '',
+ opacity: ''
+ }).fadeIn();
+ visible = true;
+ currentOverlay = _currentOverlay;
+ jqCloseButton.toggle( !!_currentOverlay.onClose);
+ },
+ hide: function(){
+ currentOverlay = null;
+ if( visible === false) return;
+ jqConteiner.stop().css( {
+ filter: '',
+ opacity: ''
+ }).fadeOut();
+ visible = false;
+ },
+ onWindowResize: function( _windowW, _windowH){
+ jqConteiner.css( { height: _windowH});
+ jqShadow.css( { height: _windowH});
+ currentOverlay && currentOverlay.onWindowResize && setTimeout( function(){ // 先にeditorのcanvasを確定する。
+ currentOverlay.onWindowResize( _windowW, _windowH);
+ }, 0);
+ }
+ }
+})();
+
+/* ----------------------------------------
+ * KEY
+ *
+ * - EDITABLE_TEXT_CONTROL
+ * - EDITABLE_TEXT_CLASS
+ * .update: function,
+ * .show: function,
+ * .hide: function,
+ * .start: function,
+ * .finish: finish,
+ * .enabled: function,
+ * .index: function,
+ * .instance: function
+ *
+ * .SHIFT_DOWN_EVENT: 'shiftDown',
+ * .SHIFT_UP_EVENT: 'shiftUp',
+ * .CTRL_DOWN_EVENT: 'ctrlDown',
+ * .CTRL_UP_EVENT: 'ctrlUp',
+ * .SPACE_DOWN_EVENT: 'spaceDown',
+ * .SPACE_UP_EVENT: 'spaceUp',
+ * .init: function,
+ * .addKeyEvent: function,
+ * .keyEventDispatcher: function,
+ * .createEditableText: function,
+ *
+ * ショートカットキーの監視とテキスト入力(input, textarea)を管理する。
+ * キー入力はdocumentで受けて、テキスト編集中(input, textarea)はそちらにキーイベント流す。
+ *
+ */
+h2c.key = ( function(){
+ var log,
+ jqWindow,
+ keyOperationChatcher,
+ KEYEVENT_ARRAY = [],
+ shiftEnabled = false,
+ ctrlEnabled = false;
+ spaceEnabled = false;
+
+ var EDITABLE_TEXT_CONTROL = ( function(){
+ var EDITABLE_TEXT_TABLE = {},
+ currentText = null;
+
+ var EDITABLE_TEXT_CLASS = function( WRAPPER_ELM, ON_UPDATE_FUNCTION, GROUP_ID){
+ var ELM = WRAPPER_ELM.children( '.editable-value').eq( 0),
+ value = ELM.html(),
+ jqInput,
+ index = EDITABLE_TEXT_TABLE[ GROUP_ID].length,
+ instance,
+ enabled = true,
+ A = $( '<a href="#" onclick="return false;"></a>').html( value).click( function(e){
+ instance = instance || EDITABLE_TEXT_TABLE[ GROUP_ID][ index];
+ EDITABLE_TEXT_CONTROL.start( instance);
+ A.hide();
+ jqInput = $( '<input type="text"/>').val( value)//.keydown( finish).keypress( finish);
+ ELM.append( jqInput);
+ jqInput.focus().select();
+ });
+ ELM.addClass( 'editable-text').html( A);
+
+ function finish(e){
+ if(e){
+ var keyCode = e.keyCode;
+ if( keyCode === 13 || keyCode === 27 || keyCode === 9 || keyCode === 18 || e.altKey === true){ // 13.return 27.esc 9.tab 18.alt
+ _finish( keyCode !== 27 ? jqInput.val() : value);
+ keyCode === 9 && GROUP_ID && EDITABLE_TEXT_CONTROL.tabShift( GROUP_ID, index, e.shiftKey === true ? -1 : 1);
+ }
+ } else {
+ _finish( jqInput.val());
+ }
+ function _finish( VALUE_NEW){
+ value = VALUE_NEW;
+ A.html( VALUE_NEW).show();
+ jqInput.remove();
+ jqInput = null;
+ ON_UPDATE_FUNCTION && VALUE_NEW !== value && ON_UPDATE_FUNCTION( VALUE_NEW, value);
+ EDITABLE_TEXT_CONTROL.finish( instance);
+ }
+ }
+ return {
+ update: function( _value){
+ value = _value !== undefined ? _value : value;
+ A.html( value);
+ jqInput && jqInput.val( value);
+ currentText === instance && finish();
+ },
+ show: function(){
+ enabled === false && WRAPPER_ELM.show();
+ enabled= true;
+ },
+ hide: function(){
+ enabled === true && WRAPPER_ELM.hide();
+ enabled = false;
+ },
+ start: function(){
+ !jqInput && A.click();
+ },
+ finish: finish,
+ enabled: function(){
+ return enabled;
+ }
+ }
+ }
+
+ return {
+ create: function( ELM, ON_UPDATE_FUNCTION, GROUP_ID){
+ if( GROUP_ID && !EDITABLE_TEXT_TABLE[ GROUP_ID]) EDITABLE_TEXT_TABLE[ GROUP_ID] = [];
+ var ret = EDITABLE_TEXT_CLASS.apply( {}, [ ELM, ON_UPDATE_FUNCTION, GROUP_ID])
+ GROUP_ID && EDITABLE_TEXT_TABLE[ GROUP_ID].push( ret);
+ return ret;
+ },
+ start: function( _currentText){
+ currentText !== _currentText && currentText && currentText.finish();
+ currentText = _currentText;
+ },
+ finish: function( _currentText){
+ if( currentText !== _currentText) return;
+ currentText = null
+ },
+ keyEventRellay: function( e){
+ currentText && currentText.finish( e);
+ return !!currentText;
+ },
+ tabShift: function( _groupID, _index, _way){
+ var GROUP_ARRAY = EDITABLE_TEXT_TABLE[ _groupID] || [],
+ l = GROUP_ARRAY.length,
+ i = _index +_way;
+ if( l < 2) return;
+ while( i !== _index){
+ i = i < 0 ?
+ l -1 :
+ i === l ? 0 : i; // 0 < i < l
+ if( GROUP_ARRAY[ i].enabled() === true) break;
+ i += _way;
+ }
+ if( i === _index) return;
+ setTimeout( function(){ GROUP_ARRAY[ i].start();}, 0);
+ }
+ }
+ })();
+
+ function keyHit( e){
+ log.html( [ e.keyCode, e.shiftKey, e.ctrlKey, e.altKey].join( ','));
+ //keyOperationChatcher.val( '');
+ var cancel = false,
+ key = e.keyCode;
+ if( EDITABLE_TEXT_CONTROL.keyEventRellay( e) === false){
+ if( key === 16 || e.shiftKey === true){
+ keyOperationChatcher.trigger( h2c.key.SHIFT_DOWN_EVENT);
+ shiftEnabled = true;
+ }
+ if( key === 17 || e.ctrlKey === true){
+ keyOperationChatcher.trigger( h2c.key.CTRL_DOWN_EVENT);
+ ctrlEnabled = true;
+ }
+ if( key === 32){
+ keyOperationChatcher.trigger( h2c.key.SPACE_DOWN_EVENT);
+ spaceEnabled = true;
+ }
+
+ var l = KEYEVENT_ARRAY.length,
+ d;
+ for( var i=0; i<l; i++){
+ d = KEYEVENT_ARRAY[ i];
+ if( d.keyCode === key && d.shift === e.shiftKey && d.ctrl === e.ctrlKey){
+ setTimeout( d.callback, 0);
+ cancel = true;
+ }
+ }
+ }
+ if( key === 13 ||key === 18 || key === 9 || key === 27 || e.altKey === true || cancel === true){ // 13.enter 18.esc 9.tab 27.esc
+ e.preventDefault();
+ e.keyCode = 0;
+ e.cancelBubble = true;
+ e.returnValue = false;
+ return false;
+ }
+ }
+
+ return {
+ SHIFT_DOWN_EVENT: 'shiftDown',
+ SHIFT_UP_EVENT: 'shiftUp',
+ CTRL_DOWN_EVENT: 'ctrlDown',
+ CTRL_UP_EVENT: 'ctrlUp',
+ SPACE_DOWN_EVENT: 'spaceDown',
+ SPACE_UP_EVENT: 'spaceUp',
+ init: function(){
+ log = $( '#key-event-log').html( 'ready');
+
+ jqWindow = h2c.jqWindow().focus();
+ keyOperationChatcher = h2c.jqDocument()
+ .keydown( keyHit)
+ .keyup( function( e){
+ log.html( '-' +e.altKey);
+ var key = e.keyCode;
+ if( key === 16 || e.shiftKey === true){
+ keyOperationChatcher.trigger( h2c.key.SHIFT_UP_EVENT);
+ shiftEnabled = false;
+ }
+ if( key === 17 || e.ctrlKey === true){
+ keyOperationChatcher.trigger( h2c.key.CTRL_UP_EVENT);
+ ctrlEnabled = false;
+ }
+ if( key === 32){
+ keyOperationChatcher.trigger( h2c.key.SPACE_UP_EVENT);
+ spaceEnabled = false;
+ }
+ e.preventDefault();
+ e.keyCode = 0;
+ e.cancelBubble = true;
+ e.returnValue = false;
+ return false;
+ }).mouseenter( function(){
+ jqWindow.focus();
+ });
+ h2c.isIE === true && h2c.ieRenderingVersion < 8 && keyOperationChatcher.keypress( function( e){
+ var key = e.keyCode;
+ if( key === 13 || key === 27){
+ keyHit( e);
+ return false;
+ }
+ });
+
+ delete h2c.key.init;
+ },
+ addKeyEvent: function( _keyCode, _shift, _ctrl, _callbackFunction){
+ KEYEVENT_ARRAY.push( {
+ keyCode: _keyCode,
+ shift: _shift,
+ ctrl: _ctrl,
+ callback: _callbackFunction
+ });
+ },
+ addCursorEvent: function( _shift, _ctrl, _callbackFunction){
+
+ },
+ keyEventDispatcher: function(){
+ return keyOperationChatcher;
+ },
+ createEditableText: EDITABLE_TEXT_CONTROL.create,
+ shiftEnabled: function(){
+ return shiftEnabled;
+ },
+ ctrlEnabled: function(){
+ return ctrlEnabled;
+ },
+ spaceEnabled: function(){
+ return spaceEnabled;
+ }
+ }
+})();
+
+/* ----------------------------------------
+ * Vector Support
+ *
+ * __________
+ * / \
+ * / \
+ * |,startX,Y |
+ * tailX,Y - < |
+ * |'endX,Y |
+ * \ /
+ * \__________/
+ *
+ * SVG
+ * -----------------------
+ * ie9, other modern browser
+ *
+ * XML
+ * -----------------------
+ * ie5.5-8
+ *
+ * 内部の角度計算は radian で統一したい。
+ * 当初 vectorEnabled = true で一度書いてみる。
+ * 駄目なら、代替のイメージのsrcの用意もここで担当。
+ * 閲覧と編集両方で使う。
+ *
+ */
+h2c.balloon = ( function() {
+ var MIN_BALLOON_WIDTH = 30,
+ MIN_BALLOON_HEIGHT = 30,
+ TAIL_WIDTH = 6,
+ TAIL_HEIGHT = 10,
+ STROKE_WIDTH = 1.2,
+ PADDING_TOP = TAIL_HEIGHT,
+ PADDING_LEFT = TAIL_HEIGHT,
+ ACCURACY = 1, // 有効少数桁
+ IS_VML = h2c.isIE === true && h2c.ieVersion < 9,
+ ELM_BALLOON_ORIGIN = ( function(){
+ var ret;
+ try {
+ if( IS_VML === true){
+ ret = document.createElement( 'DIV');
+ var shape = document.createElement( 'v:shape');
+ shape.coordorigin = "0,0";
+ shape.strokecolor = "black";
+ shape.strokeweight = STROKE_WIDTH;
+ shape.fillcolor = "white";
+ ret.appendChild( shape);
+ } else {
+ var kSVGNS = 'http://www.w3.org/2000/svg';
+ ret = document.createElementNS( kSVGNS, 'svg');
+ var path = document.createElementNS( kSVGNS, 'path');
+ path.setAttribute( 'fill', "white");
+ path.setAttribute( 'stroke', "black");
+ path.setAttribute( 'strokeWidth', STROKE_WIDTH);
+ ret.appendChild( path);
+ }
+ return ret;
+ } catch( e){
+ return null;
+ }
+ })(),
+ vectorEnabled = ELM_BALLOON_ORIGIN !== null;
+
+ var XBROWSER_BALLOON_CLASS = function( w, h, a){
+ var balloonElm = vectorEnabled === true ? ELM_BALLOON_ORIGIN.cloneNode( true) : document.createElement( 'IMG'), // h2c.imageに変更
+ PI = Math.PI, cos = Math.cos, sin = Math.sin,
+ abs = Math.abs, pow = Math.pow;
+
+ draw( a, w, h);
+
+ function draw( _a, _w, _h){
+ a = _a !== undefined ? _a : a;
+ w = _w ? _w -PADDING_TOP *2 : w;
+ h = _h ? _h -PADDING_LEFT *2 : h;
+
+ if( vectorEnabled === false){
+ balloonElm.setAttribute( 'src', balloonUrlBuilder( a));
+ return;
+ }
+
+ var rx = w /2,
+ ry = h /2,
+ tailRad = a * PI / 180,
+ tailX = rx +( rx +TAIL_HEIGHT) * cos( tailRad),
+ tailY = ry +( ry +TAIL_HEIGHT) * sin( tailRad),
+ startX, startY, endX, endY;
+ /*
+ * tailの太さをTAIL_WIDTHに一致させるため、角度を絞りつつ計算
+ */
+ ( function( a, rx, ry, sin, cos, pow){
+ var startRad, endRad,
+ _startX, _startY, _endX, _endY,
+ tailDeg = 0, d,
+ TARGET = TAIL_WIDTH * TAIL_WIDTH,
+ DEG_TO_RAD = PI / 180;
+
+ for( var i = 45; i > 0.01; i /= 2){
+ d = ( tailDeg +i) /2;
+ startRad = ( a +d) * DEG_TO_RAD;
+ endRad = ( a -d) * DEG_TO_RAD;
+
+ _startX = rx +cos( startRad) *rx;
+ _startY = ry +sin( startRad) *ry;
+ _endX = rx +cos( endRad) *rx;
+ _endY = ry +sin( endRad) *ry; //円弧上のY位置=円中心Y+sin(角度×PI÷180)×円半径
+
+ if( pow( ( _startX -_endX), 2) + pow( ( _startY -_endY), 2) < TARGET){
+ tailDeg += i;
+ startX = _startX;
+ startY = _startY;
+ endX = _endX;
+ endY = _endY;
+ }
+ }
+ })( a, rx, ry, sin, cos, pow);
+
+ /*
+ *
+ */
+ IS_VML === true ?
+ ( function ( tailX, tailY, startX, startY, rx, ry, endX, endY, _w, _h){
+ var l = ',',
+ round = Math.round,
+ shape = balloonElm.getElementsByTagName( 'shape')[ 0];
+
+ shape.style.width = w +'px';
+ shape.style.height = h +'px';
+ shape.coordsize = [ _w, _h].join( l);
+ shape.path = [
+ ' ar ', 0, l, 0, l, _w, l, _h, l,
+ round( startX), l, round( startY), l,
+ round( endX), l, round( endY),
+ ' l ', round( tailX), l, round( tailY),
+ ' x e'
+ ].join( '');
+
+ balloonElm.style.marginTop = tailY < 0 ? Math.floor( ( 60 +tailY) /10) : 10;
+ balloonElm.style.marginLeft = tailX < 0 ? Math.floor( ( 60 +tailX) /10) : 10;
+
+ })( tailX *10, tailY *10, endX *10, endY *10, rx *10, ry *10, startX *10, startY *10, w *10, h *10)
+ :
+ ( function (){
+ var l = ',',
+ path = balloonElm.getElementsByTagName( 'path')[ 0];
+
+ balloonElm.setAttribute( 'width', w +PADDING_LEFT *2);
+ balloonElm.setAttribute( 'height', h +PADDING_TOP *2);
+ path.setAttribute( 'd', [
+ 'M', cround( tailX + PADDING_LEFT), l, cround( tailY +PADDING_TOP),
+ 'L', cround( startX +PADDING_LEFT), l, cround( startY +PADDING_TOP),
+ 'A', rx, l, ry,
+ '0 1 1', // flag
+ cround( endX +PADDING_LEFT), l, cround( endY +PADDING_TOP),
+ 'z'
+ ].join( ' '));
+
+ function cround( v, r){
+ r = r || ACCURACY;
+ return Math.round( v *pow( 10.0, r)) /pow( 10.0, r);
+ }
+ })();
+ }
+
+ function balloonUrlBuilder( _a){
+ return 'url'//
+ }
+ return {
+ elm: balloonElm,
+ resize: draw,
+ angle: function( _a){
+ if( _a && _a !== a){
+ draw( _a);
+ }
+ },
+ type: function( _type){
+ //draw( _a);
+ },
+ destroy: function(){
+ balloonElm.parentNode.removeChild( balloonElm);
+ balloonElm = null;
+ delete this.destroy;
+ }
+ }
+ };
+
+ vectorEnabled === true && ( function(){
+ var detect = XBROWSER_BALLOON_CLASS.apply( {}, [ 100, 100, 0]),
+ size = h2c.util.getElementSize( detect.elm);
+ vectorEnabled = size.width !== 0 && size.height !== 0;
+ detect.destroy();
+ detect = size = null;
+ })();
+
+ return {
+ init: function(){
+ delete h2c.balloon.init;
+ },
+ enabled: function() {
+ return vectorEnabled;
+ },
+ VML: IS_VML === true && vectorEnabled === true,
+ createBalloon: function( _w, _h, _a){
+ return XBROWSER_BALLOON_CLASS.apply( {}, [ _w, _h, _a]);
+ },
+ TYPE_NONE: 0,
+ TYPE_SPEACH_BALLOON: 1,
+ TYPE_THINKING: 2,
+ TYPE_BOM: 3,
+ TYPE_BLACK_BOX: 4,
+ TYPE_BLUE_BOX: 5
+ }
+})();
+
+/* ----------------------------------------
+ * h2c.image
+ *
+ * xBackendな画像反転、画像描画機能。
+ *
+ * 画像の反転
+ * - css3
+ * - ActiveX (ie)
+ * - VML (ie)
+ * - canvas ??
+ * - flash(lite)
+ * - silverlight
+ * - pettan server
+ *
+ * png画像の表示(アルファpngをサポートしないie6以下のため)
+ * - ActiveX
+ * - VML
+ * - flash(lite)
+ * - silverlight
+ *
+ * -moz-transform:scale( -1, -1);
+ */
+h2c.image = ( function(){
+ var REG_PNG = /\.png?/i,
+ IS_CSS3 = 0,
+ IS_VML = 1,
+ IS_ACTIVEX = 2,
+ IS_CANVAS = 3,
+ IS_FLASH = 4,
+ IS_SILVERLIGHT = 5,
+ IS_SERVER = 6,
+ IS_ACTIVEX_SERVER = 7,
+ BACKEND = ( function(){
+ if( h2c.DEBUG === true && h2c.URL_PARAMS.rimg){
+ var rimg = h2c.URL_PARAMS.rimg.toLowerCase();
+ if( rimg === 'css3') return IS_CSS3;
+ if( rimg === 'activex') return IS_ACTIVEX;
+ if( rimg === 'vml') return IS_VML;
+ }
+ if( h2c.isIE === false || h2c.ieVersion >= 9) return IS_CSS3; // 不十分!
+ if( h2c.balloon.VML === true) return IS_VML;
+ if( h2c.ACTIVEX === true) return IS_ACTIVEX;
+ if( h2c.FLASH === true) return IS_FLASH;
+ if( h2c.SILVERLIGHT === true) return IS_SILVERLIGHT;
+ return IS_SERVER;
+ })(),
+ PNG_FIX = h2c.isIE === true && h2c.ieVersion <= 6,
+ BACKEND_WHEN_PNG = PNG_FIX === false ? BACKEND : ( function(){
+ if( h2c.balloon.VML === true) return IS_VML;
+ if( h2c.FLASH === true) return IS_FLASH;
+ if( h2c.SILVERLIGHT === true) return IS_SILVERLIGHT;
+ if( h2c.ACTIVEX === true) return IS_ACTIVEX_SERVER;
+ return IS_SERVER;
+ })();
+
+ var XBackendReversibleImageClass = ( function(){
+ var CLASS_NAME = 'reversible-image-container',
+ CLASS_NAME_LOADING = CLASS_NAME + ' loading',
+ CLASS_NAME_ERROR = CLASS_NAME +' error',
+ RETRY_DELAY = 5000;
+ NUM_RETRY = 3;
+
+ var css3Image = function( url, w, h, onLoadCallback){
+ var elmWrap = document.createElement( 'div'),
+ elmImg,
+ loaded = false,
+ retryTimer = null;
+ elmWrap.className = CLASS_NAME_LOADING;
+ h2c.util.loadImage( url, onLoad, onError, 100, 10000);
+ function onLoad( _url, _actualW, _actualH){
+ if( elmWrap === null) return;
+ elmImg = new Image;
+ elmImg.src = url;
+ elmWrap.appendChild( elmImg); // load後にimg
+ elmWrap.className = CLASS_NAME;
+ onLoadCallback && onLoadCallback( _url, _actualW, _actualH);
+ onLoadCallback = null;
+ loaded = true;
+ resize( w, h);
+ }
+ function onError( _url){
+ if( elmWrap === null) return;
+ elmWrap.className = CLASS_NAME_ERROR;
+ retryTimer = setTimeout( function(){
+ elmWrap.className = CLASS_NAME_LOADING;
+ h2c.util.loadImage( url, onLoad, onError, 100, 10000);
+ }, RETRY_DELAY);
+ }
+ function resize( _w, _h){
+ w = _w !== undefined ? _w : w;
+ h = _h !== undefined ? _h : h;
+ if( loaded === false) return;
+ elmImg.className = w < 0 || h < 0 ? ( 'img-flip-' + ( w < 0 && h < 0 ? 'vh' : ( w < 0 ? 'v' : 'h'))) : '';
+ }
+ return {
+ elm : elmWrap,
+ resize: resize,
+ destroy: function(){
+ loaded === true && elmWrap.removeChild( elmImg);
+ retryTimer !== null && clearTimeout( retryTimer);
+ elmWrap = vmlImg = onLoadCallback = retryTimer = null;
+ elmWrap = elmImg = onLoadCallback = null;
+ delete this.destroy;
+ }
+ }
+ }
+ var activexImage = css3Image;
+ var vmlImage = function( url, w, h, onLoadCallback){
+ var elmWrap = document.createElement( 'div'),
+ vmlImg,
+ loaded = false,
+ retryTimer = null;
+ elmWrap.className = CLASS_NAME_LOADING;
+ h2c.util.loadImage( url, onLoad, onError, 100, 10000);
+ function onLoad( _url, _actualW, _actualH){
+ if( elmWrap === null) return;
+ elmWrap.className = CLASS_NAME;
+ vmlImg = document.createElement( 'v:image');
+ vmlImg.src = url;
+ loaded = true;
+ resize( w, h);
+ onLoadCallback && onLoadCallback( _url, _actualW, _actualH);
+ onLoadCallback = null;
+ }
+ function onError( _url){
+ if( elmWrap === null) return;
+ elmWrap.className = CLASS_NAME_ERROR;
+ retryTimer = setTimeout( function(){
+ elmWrap.className = CLASS_NAME_LOADING;
+ h2c.util.loadImage( url, onLoad, onError, 100, 10000);
+ }, RETRY_DELAY);
+ }
+ function resize( _w, _h){
+ w = _w !== undefined ? _w : w;
+ h = _h !== undefined ? _h : h;
+ if( loaded !== true) return;
+ vmlImg.style.width = w < 0 ? -w : w +'px';
+ vmlImg.style.height = h < 0 ? -h : h +'px';
+ //if( flipH !== _flipH || flipV !== _flipV){
+ vmlImg.parentNode === elmWrap && elmWrap.removeChild( vmlImg);
+ //}
+ vmlImg.className = w < 0 || h < 0 ? ( 'img-flip-' + ( w < 0 && h < 0 ? 'vh' : ( w < 0 ? 'v' : 'h'))) : '';
+ elmWrap.appendChild( vmlImg);
+ }
+ return {
+ elm : elmWrap,
+ resize: resize,
+ destroy: function(){
+ loaded === true && elmWrap.removeChild( vmlImg);
+ retryTimer !== null && clearTimeout( retryTimer);
+ elmWrap = vmlImg = onLoadCallback = retryTimer = null;
+ delete this.destroy;
+ }
+ }
+ }
+ var serverImage = function( url, w, h, onLoadCallback){
+
+ }
+
+ return function( url, w, h, onLoadCallback){
+ var flipH = w < 0,
+ flipV = h < 0,
+ onLoadCallbackAsync = onLoadCallback,// ? function(){ setTimeout( onLoadCallback, 0);} : undefined,// 一度読み込んだ画像は即座にonLoadになるため遅延
+ xBackendImage = ( function( urlIsXDomain){
+ if( BACKEND === IS_CSS3) return css3Image.apply( {}, [ url, w, h, onLoadCallbackAsync]);
+ if( BACKEND === IS_VML) return vmlImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);
+ if( BACKEND === IS_ACTIVEX) return activexImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);
+ return serverImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);
+ })();
+ return {
+ elm: xBackendImage.elm,
+ w: function( _w){
+ _w !== undefined && xBackendImage.resize( _w, h);
+ return w;
+ },
+ h: function( _h){
+ _h !== undefined && xBackendImage.resize( w, _h);
+ return h;
+ },
+ resize: xBackendImage.resize,
+ destroy: function(){
+ xBackendImage.destroy && xBackendImage.destroy();
+ xBackendImage = onLoadCallback = onLoadCallbackAsync = null;
+ delete this.destroy;
+ }
+ }
+ }
+ })();
+ return {
+ init: function(){
+
+ },
+ createReversibleImage: function( url, w, h, onLoadCallback){
+ return XBackendReversibleImageClass.apply( {}, [ url, w, h, onLoadCallback]);
+ }
+ }
+})();
+
+/* ----------------------------------------
+ * h2c.editor
+ * - HISTORY
+ * - WINDOW_CONTROL
+ * - WINDOW_CLASS
+ * - INFOMATION_WINDOW
+ * - TOOL_BOX_WINDOW
+ * - CANVAS_CONTROL
+ * - GRID_CONTROL
+ * - WHITE_GLASS_CONTROL
+ * - PANEL_BORDER_CONTROL
+ * - COMIC_ELEMENT_CONTROL
+ * - PanelResizerClass
+ * - COMIC_ELEMENT_OPERATOR
+ * - TAIL_MOVER
+ * - ImageElementClass
+ * - TextElementClass
+ *
+ */
+h2c.editor = ( function(){
+ var COMIC_ELEMENT_TYPE_IMAGE = 0,
+ COMIC_ELEMENT_TYPE_TEXT = 1,
+ MOUSE_LISTENER_ARRAY = [],
+ currentListener = null,
+ ELM_MOUSE_EVENT_CHATCHER = document.getElementById( 'mouse-operation-catcher'),
+ jqMouseEventChacher,
+ jqEditor,
+ windowW, windowH,
+ currentCursor = '';
+
+/* ----------------------------------------
+ * MENU BAR
+ * div
+ * div.title
+ * ul
+ * li
+ * a
+ * span
+ * kbd shortcut
+ * li.separator
+ */
+ var MENU_BAR_CONTROL = ( function(){
+ var BAR_ID = 'menu-bar',
+ ELM_BAR = document.getElementById( BAR_ID),
+ ELM_ITEM_CLASSNAME = 'menu-bar-item',
+ ELM_ITEM_ORIGN = ( function(){
+ var ret = document.createElement( 'DIV'),
+ div = document.createElement( 'DIV'),
+ ul = document.createElement( 'UL');
+ ret.className = ELM_ITEM_CLASSNAME;
+ ret.appendChild( div);
+ ret.appendChild( ul);
+ return ret;
+ })(),
+ ELM_SELECTION_ORIGN = ( function(){
+ var ret = document.createElement( 'LI'),
+ a = document.createElement( 'A'),
+ span = document.createElement( 'SPAN'),
+ key = document.createElement( 'KBD');
+ a.href = '#';
+ a.appendChild( span);
+ a.appendChild( key);
+ ret.appendChild( a);
+ return ret;
+ })(),
+ EMPTY_FUNCTION = new Function,
+ ITEM_ARRAY = [],
+ barH,
+ itemW = h2c.util.getElementSize( ELM_ITEM_ORIGN).width,
+ selectionW = h2c.util.getElementSize( ELM_ITEM_ORIGN.getElementsByTagName( 'UL')[ 0]).width,
+ jqStage, jqBar;
+ barH = h2c.util.getElementSize( ELM_BAR).height;
+ ELM_BAR.style.top = ( -barH) +'px';
+
+ var MenuBarItemClass = function( title){
+ var ELM_WRAPPER = ELM_ITEM_ORIGN.cloneNode( true),
+ ELM_TITLE = ELM_WRAPPER.getElementsByTagName( 'DIV')[ 0],
+ ELM_SELECTION = ELM_WRAPPER.getElementsByTagName( 'UL')[ 0],
+ INDEX = ITEM_ARRAY.length,
+ SELECTION_CALLBACK_ARRAY = [],
+ numSelection = 0,
+ visible = false;
+ ELM_TITLE.innerHTML = title;
+
+ ELM_WRAPPER.style.left = ( itemW * INDEX) +'px';
+ ELM_BAR.appendChild( ELM_WRAPPER);
+
+ function onClick( e){
+ var that = this,
+ i = ( function(){
+ var parent = that.parentNode,
+ children = parent.getElementsByTagName( 'LI'),
+ l = children.length;
+ for(var i=0; i<l; ++i){
+ if( children[ i] === that) return i;
+ }
+ return -1;
+ })();
+ i !== -1 && this.className !== 'disabled' && SELECTION_CALLBACK_ARRAY[ i]();
+ e.stopPropagation();
+ return false;
+ }
+ return {
+ init: function(){
+ $( ELM_SELECTION).children( 'li').click( onClick);
+ delete this.init;
+ },
+ show: function(){
+ if( visible === true) return;
+ jqStage.append( ELM_WRAPPER);
+ ELM_WRAPPER.className = ELM_ITEM_CLASSNAME +'-focus';
+ this.onShow && setTimeout( this.onShow, 0);
+ visible = true;
+ },
+ hide: function(){
+ if( visible === false) return;
+ ELM_BAR.appendChild( ELM_WRAPPER);
+ ELM_WRAPPER.className = ELM_ITEM_CLASSNAME;
+ this.onHide && setTimeout( this.onHide, 0);
+ visible = false;
+ },
+ createSelection: function( title, shortcut, callback, visible, separateBefore, separateAfter){
+ var ret = MenubarSelectionClass.apply( {}, [ ELM_SELECTION, title, shortcut, visible, separateAfter]),
+ before = SELECTION_CALLBACK_ARRAY.length > 0 ? SELECTION_CALLBACK_ARRAY[ SELECTION_CALLBACK_ARRAY.length -1] : null;
+ SELECTION_CALLBACK_ARRAY.push( callback);
+ if( ( separateBefore === true && before) || ( before && before.separateAfter === true)){
+ ret.elm.style.borderTop = '1px solid #ccc';
+ }
+ return ret;
+ },
+ createAjaxSelection: function(){
+ var elmLoading = document.createElement( 'li');
+ elmLoading.className = 'loading';
+ elmLoading.style.height = '90px';
+ ELM_SELECTION.appendChild( elmLoading);
+
+ delete this.createAjaxSelection;
+ return function(){
+ SELECTION_CALLBACK_ARRAY.shift();
+ ELM_SELECTION.removeChild( elmLoading);
+ elmLoading = null;
+ $( ELM_SELECTION).children( 'li').click( onClick);
+ }
+ }
+ }
+ }
+ var MenubarSelectionClass = function( container, title, shortcut, visible, separateAfter){
+ var ELM_WRAPPER = ELM_SELECTION_ORIGN.cloneNode( true),
+ ELM_TITLE = ELM_WRAPPER.getElementsByTagName( 'SPAN')[ 0];
+ updateTitle( title);
+ updateVisible( visible);
+
+ ( function(){
+ var ELM_SHORTCUT = ELM_WRAPPER.getElementsByTagName( 'KBD')[ 0];
+ if( shortcut){
+ ELM_SHORTCUT.innerHTML = shortcut;
+ } else {
+ ELM_SHORTCUT.parentNode.removeChild( ELM_SHORTCUT);
+ }
+ })();
+
+ container.appendChild( ELM_WRAPPER);
+
+ function updateTitle( _title){
+ ELM_TITLE.innerHTML = title = _title;
+ }
+ function updateVisible( _visible){
+ _visible !== undefined && ( function(){
+ visible = !!_visible;
+ ELM_WRAPPER.className = visible === true ? '' : 'disabled';
+ })();
+ }
+ return {
+ elm: ELM_WRAPPER,
+ title: function( _title){
+ _title !== undefined && updateTitle( _title);
+ return title;
+ },
+ visible: function( _visible){
+ visible !== !!_visible && updateVisible( _visible);
+ return visible;
+ },
+ separateAfter: separateAfter
+ }
+ }
+
+ function createMenubarItem( title){
+ var _item = MenuBarItemClass.apply( {}, [ title]);
+ ITEM_ARRAY.push( _item);
+ return _item;
+ }
+ return {
+ init: function(){
+ jqStage = jqEditor;
+ jqBar = $( '#' +BAR_ID).animate( { top: 0});
+
+ var l = ITEM_ARRAY.length;
+ for( var i=0; i<l; ++i){
+ ITEM_ARRAY[ i].init();
+ }
+
+ delete MENU_BAR_CONTROL.init;
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ if( barH >= _mouseY){
+ return true;
+ }
+ var l = ITEM_ARRAY.length;
+ for( var i=0; i<l; ++i){
+ ITEM_ARRAY[ i].hide();
+ }
+ return false;
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ return false;
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ var l = ITEM_ARRAY.length;
+ if( barH < _mouseY || itemW * l < _mouseX) return false;
+ for( var i=0; i<l; ++i){
+ if( i * itemW <= _mouseX && _mouseX < ( i +1) * itemW){
+ ITEM_ARRAY[ i].show();
+ } else {
+ ITEM_ARRAY[ i].hide();
+ }
+ }
+ return true;
+ },
+ busy: function( _busy){
+ return false;
+ },
+ onWindowResize: function( _windowW, _windowH){
+
+ },
+ QUIT: createMenubarItem( 'Quit'),
+ EDIT: createMenubarItem( 'Edit'),
+ WINDOW: createMenubarItem( 'Window'),
+ HELP: h2c.util.extend( createMenubarItem( 'Help'), {
+
+ }) // extend, onShow, ajaxselection, HELP_DOCUMENTS_CONTROL.load()
+ }
+ })();
+
+
+/* ----------------------------------------
+ * HISTORY
+ */
+ var HISTORY = ( function() {
+ var STACK_BACK = [], STACK_FORWARD = [],
+ menubarBack, menubarForward,
+ log;
+
+ h2c.key.addKeyEvent( 90, false, true, back); // ctrl + Z
+ h2c.key.addKeyEvent( 90, true, true, forward); // ctrl + Y
+ h2c.key.addKeyEvent( 89, false, true, forward); // ctrl + shift + Z
+
+ menubarBack = MENU_BAR_CONTROL.EDIT.createSelection( 'back', 'ctrl + z', back, false);
+ menubarForward = MENU_BAR_CONTROL.EDIT.createSelection( 'forward', 'ctrl + y', back, false, false, true);
+
+ function back(){
+ /*
+ * currentを控えてSTACK_FORWARD.push(current)
+ * STACK_BACK.pop()を実行してcurrentに
+ */
+ if( STACK_BACK.length === 0) return;
+
+ var state = STACK_BACK.pop();
+ state && state.fn( state.argBack);
+ menubarBack.visible( STACK_BACK.length !== 0);
+
+ STACK_FORWARD.push( state);
+ menubarForward.visible( true);
+ }
+ function forward(){
+ if( STACK_FORWARD.length === 0) return;
+
+ var state = STACK_FORWARD.pop();
+ state.fn( state.argForword);
+ menubarForward.visible( STACK_FORWARD.length !== 0);
+
+ STACK_BACK.push( state);
+ menubarBack.visible( true);
+ }
+ return {
+ init: function(){
+ log = $( '#history-log');
+ delete HISTORY.init;
+ },
+ saveState: function( _function, _argBack, _argForword, _destory) {
+ STACK_BACK.push( {
+ fn: _function,
+ argBack: _argBack,
+ argForword: _argForword,
+ destroy: _destroy
+ });
+ menubarBack.visible( true);
+
+ //log.html( 'save' +STACK_BACK.length + '-' +'-' +STACK_FORWARD.length)
+ while( STACK_FORWARD.length > 0){
+ var _stack = STACK_FORWARD.shift(),
+ __argBack = _stack.argBack,
+ __argForword = _stack.argForword,
+ _destroy = _stack.destroy,
+ _value;
+ _stack.fn = null;
+ if( typeof __argBack === 'array'){
+ while( __argBack.length > 0){
+ _value = __argBack.shift();
+ _destroy === true && _value.destroy && _value.destroy();
+ }
+ }
+ if( typeof _argForword === 'array'){
+ while( __argForword.length > 0){
+ _value = __argForword.shift();
+ _destroy === true && _value.destroy && _value.destroy();
+ }
+ }
+ }
+ menubarForward.visible( false);
+ }
+ }
+ })();
+
+
+/* ----------------------------------------
+ * HELP_DOCUMENTS_CONTROL
+ * * menubar の help 下に help documents の index を挿入
+ * * help window に help documents を挿入
+ */
+ var HELP_DOCUMENTS_CONTROL = ( function(){
+ var onLoadFunction = MENU_BAR_CONTROL.HELP.createAjaxSelection();
+ return {
+ load: function(){
+ // HELP_DOCUMENTS_WINDOW.setAjaxContent();
+ var help = MENU_BAR_CONTROL.HELP;
+ //help.createSelection();
+ //onLoadFunction();
+ }
+ }
+ })();
+
+
+/* ----------------------------------------
+ * WINDOWS_CONTROL
+ */
+ var WINDOWS_CONTROL = ( function(){
+ /*
+ * 表示上手前にあるwindowは、WINDOW_ARRAYの先頭にあり、htmlでは後ろにある。
+ */
+ var DEFAULT_MIN_WINDOW_WIDTH = 200,
+ DEFAULT_MIN_WINDOW_HEIGHT = 200,
+ WINDOW_ARRAY = [],
+ jqContainer,
+ currentWindow,
+ currentWindowIndex = -1,
+ log;
+
+ var jqWindowOrigin,
+ windowCloseButtonWidth;
+ var WindowClass = function( bodyTempleteID, title, x, y, w, h, visible, CLOSE_BUTTON_ENABLED, RESIZE_BUTTON_ENABLED, minWindowW, minWindowH){
+ var MOUSE_CURSOR = updateMouseCursor,
+ MENUBAR_SELWCTION = MENU_BAR_CONTROL.WINDOW.createSelection(
+ ( visible !== true ? 'show ' : 'hide ') +title,
+ null,
+ function(){
+ visible === true ? instance.close() : instance.open();
+ }, true
+ ),
+ jqStage,
+ jqWrapper, jqHeader, elmBody, elmBodyStyle,
+ startX, startY, startW, startH,
+ xOffset, yOffset,
+ headerH, bodyH,
+ isDragging = false,
+ isResizing = false,
+ bodyIsTachable = false,
+ instance;
+
+ function update( _x, _y, _w, _h){
+ ( w !== _w || h !== _h) && instance.onResize && instance.onResize( _w, _h);
+ x = _x || x;
+ y = _y || y;
+ w = _w || w;
+ h = _h || h;
+ jqWrapper.css( {
+ left: x,
+ top: y,
+ width: w,
+ height: h
+ });
+ bodyH = h -headerH;
+ elmBodyStyle.height = bodyH +'px';
+ }
+ function bodyBackOrForward( isBack){
+ if( bodyIsTachable === !isBack) return;
+ elmBodyStyle.position = isBack === true ? 'relative' : 'absolute';
+ elmBodyStyle.left = isBack === true ? 0 : x +'px';
+ elmBodyStyle.top = isBack === true ? 0 : y +headerH +'px';
+ elmBodyStyle.width = isBack === true ? '' : w +'px';
+ bodyIsTachable === isBack && isBack === true ? jqWrapper.append( elmBody) : jqStage.append( elmBody);
+ bodyIsTachable = !isBack;
+ }
+
+ return {
+ setInstance: function(){
+ instance = this;
+ delete this.setInstance;
+ },
+ init: function( jqContainer){
+ jqWindowOrigin = jqWindowOrigin || ( function(){
+ return $( $( '#windowTemplete').remove().html());
+ })();
+ windowCloseButtonWidth = windowCloseButtonWidth || ( function(){
+ return h2c.util.getElementSize( jqWindowOrigin.clone( true).find( '.window-close-button').get( 0)).width;
+ })();
+
+
+ jqStage = jqEditor;
+ this.$ = jqWrapper = jqWindowOrigin.clone( true);
+ jqHeader = jqWrapper.children( '.window-header').eq( 0).html( title);
+ headerH = h2c.util.getElementSize( jqHeader.get( 0)).height;
+ elmBody = jqWrapper.children( '.window-body').get( 0);
+ elmBodyStyle = elmBody.style;
+ if( bodyTempleteID) {
+ jqWrapper.find( '.window-body-insert-position').replaceWith( $( $( '#' +bodyTempleteID).remove().html()));
+ } else {
+ jqWrapper.find( '.window-body-insert-position').remove();
+ }
+ CLOSE_BUTTON_ENABLED !== true && jqWrapper.find( '.window-close-button').remove();
+
+ jqContainer.append( jqWrapper); // domに追加しないと、this.onInit()が正しく動かない.
+ jqWrapper.fadeIn(); // appendした後に fadeIn() しないと ie で filterが適用されない.
+ if( RESIZE_BUTTON_ENABLED === true){
+ jqWrapper.find( '.window-resize-button').eq( 0)
+ .mousedown( function( e){
+ bodyBackOrForward( true);
+ isResizing = true;
+ startX = x;
+ startY = y;
+ startW = w;
+ startH = h;
+ xOffset = e.pageX;
+ yOffset = e.pageY;
+ MOUSE_CURSOR( 'nw-resize');
+ e.stopPropagation();
+ return false;
+ });
+ } else {
+ jqWrapper.find( '.window-resize-button').remove();
+ }
+ update( x, y, w, h);
+ this.onInit && this.onInit();
+ delete this.init;
+ },
+ x: function(){ return x;},
+ y: function(){ return y;},
+ w: function(){ return w;},
+ h: function(){ return h;},
+ $: null,
+ visible: visible,
+ open: function(){
+ if( visible === true) return;
+ this.visible = visible = true;
+ this.onOpen && setTimeout( this.onOpen, 0);
+ openWindow( this);
+ MENUBAR_SELWCTION.title( 'hide ' +title);
+ },
+ close: function(){
+ if( visible === false) return;
+ this.visible = visible = false;
+ this.onClose && setTimeout( this.onClose, 0);
+ closeWindow( this);
+ MENUBAR_SELWCTION.title( 'show ' +title);
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ if( x > _mouseX || y > _mouseY || x +w < _mouseX || y +headerH < _mouseY ) return;
+ if( CLOSE_BUTTON_ENABLED === true && x +w -windowCloseButtonWidth < _mouseX){
+ this.close();
+ return;
+ }
+ isDragging = true;
+ MOUSE_CURSOR( 'move');
+ startX = x;
+ startY = y;
+ startW = w;
+ startH = h;
+ xOffset = _mouseX;
+ yOffset = _mouseY;
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ isDragging = isResizing = false;
+ MOUSE_CURSOR( '');
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ var _updateX = _mouseX -xOffset,
+ _updateY = _mouseY -yOffset;
+
+ if( isResizing === true){
+ var _w = startW +_updateX,
+ _h = startH +_updateY;
+ update( startX, startY, _w < minWindowW ? minWindowW : _w, _h < minWindowH ? minWindowH : _h);
+ return;
+ } else
+ if( isDragging === true) {
+ update( startX +_updateX, startY +_updateY);
+ return;
+ } else
+ if( x > _mouseX || x +w < _mouseX ) return;
+
+ ( y <= _mouseY && y +headerH >= _mouseY ) ?
+ MOUSE_CURSOR( 'pointer') : // hit to header
+ MOUSE_CURSOR( '');
+ bodyBackOrForward( y +headerH > _mouseY || y +headerH +bodyH < _mouseY);
+ },
+ onMouseOut: function( _mouseX, _mouseY){
+ bodyIsTachable === true && bodyBackOrForward( true);
+ isDragging = false;
+ MOUSE_CURSOR( '');
+ },
+ busy: function(){
+ return isDragging === true || isResizing === true;
+ },
+ bodyHeight: function(){
+ return bodyH;
+ }
+ }
+ };
+
+ function getCurrentWindow( _mouseX, _mouseY){
+ if( currentWindow && currentWindow.busy() === true) return currentWindowIndex;
+ var l = WINDOW_ARRAY.length,
+ _currentWindow = null,
+ _win, _x, _y;
+ currentWindowIndex = -1;
+ for( var i=0; i<l; i++){
+ _win = WINDOW_ARRAY[ i];
+ _x = _win.x();
+ _y = _win.y();
+ if( _x <= _mouseX && _y <= _mouseY && _x +_win.w() >= _mouseX && _y +_win.h() >= _mouseY){
+ _currentWindow = _win;
+ currentWindowIndex = i;
+ break;
+ }
+ }
+ currentWindow && currentWindow !== _currentWindow && currentWindow.onMouseOut( _mouseX, _mouseY);
+ currentWindow = _currentWindow;
+ return currentWindowIndex;
+ }
+ function openWindow( _window){
+ if( _window.visible !== true) return;
+ WINDOW_ARRAY.unshift( _window);
+ WINDOWS_CONTROL.init === undefined &&
+ ( _window.init === undefined ?
+ jqContainer.append( _window.$.stop().fadeIn()) :
+ _window.init( jqContainer)
+ );
+ }
+ function closeWindow( _window){
+ var l = WINDOW_ARRAY.length;
+ for( var i=0; i<l; ++i){
+ if( WINDOW_ARRAY[ i] === _window){
+ WINDOW_ARRAY.splice( i, 1);
+ _window.$.stop().fadeOut( function(){
+ this.parentNode.removeChild( this);
+ });
+ return;
+ }
+ }
+ }
+
+ return {
+ init: function(){
+ jqContainer = $( '#window-container');
+
+ var l = WINDOW_ARRAY.length,
+ _window;
+ for( var i=l-1; i >= 0; --i){
+ _window = WINDOW_ARRAY[ i];
+ _window.visible === true && _window.init && _window.init( jqContainer);
+ }
+ log = $( '#window-log');
+
+ delete WINDOWS_CONTROL.init;
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ var _index = getCurrentWindow( _mouseX, _mouseY);
+ if( _index === 0){
+ currentWindow.onMouseMove( _mouseX, _mouseY);
+ return true;
+ } else
+ if( _index !== -1){ // 先頭のクリックでない場合
+ // Array を前に
+ WINDOW_ARRAY.splice( currentWindowIndex, 1);
+ WINDOW_ARRAY.unshift( currentWindow);
+ // Domを最後に
+ jqContainer.append( currentWindow.$);
+ currentWindowIndex = 0;
+ return true;
+ }
+ return false;
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ if( getCurrentWindow( _mouseX, _mouseY) === 0){
+ currentWindow.onMouseUp( _mouseX, _mouseY);
+ return true;
+ }
+ return false;
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ if( getCurrentWindow( _mouseX, _mouseY) === 0){
+ currentWindow.onMouseDown( _mouseX, _mouseY);
+ return true;
+ }
+ return false;
+ },
+ onMouseClick: function( _mouseX, _mouseY){
+ return false;
+ },
+ busy: function(){
+ return currentWindow !== null;
+ },
+ onWindowResize: function( _windowW, _windowH){
+ /*
+ * 画面外に出るwindowの移動
+ */
+ },
+ createWindow: function( scope, EXTENDS, bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH){
+ opt_visible = opt_visible !== false;
+ opt_closeButtonEnabled = opt_closeButtonEnabled === true;
+ opt_resizeButtonEnabled = opt_resizeButtonEnabled === true;
+ opt_minWindowW = opt_minWindowW || ( w < DEFAULT_MIN_WINDOW_WIDTH) ? w : DEFAULT_MIN_WINDOW_WIDTH;
+ opt_minWindowH = opt_minWindowH || ( h < DEFAULT_MIN_WINDOW_HEIGHT) ? h : DEFAULT_MIN_WINDOW_HEIGHT;
+
+ var _window = h2c.util.extend(
+ WindowClass.apply( scope, [ bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH]),
+ EXTENDS
+ );
+ _window.setInstance();
+ opt_visible === true && openWindow( _window);
+ return _window;
+ }
+ }
+ })();
+
+/* ----------------------------------------
+ * TOOL_BOX_WINDOW
+ */
+ var TOOL_BOX_WINDOW = ( function(){
+ var addImageButton, addTextButton, editBgButton, switchGridButton, popupHelpButton, publishButton,
+ gridSwitchFunction;
+
+ h2c.key.addKeyEvent( 73, false, true, addImage);
+ MENU_BAR_CONTROL.EDIT.createSelection( 'Add Image', 'ctrl + I', addImage, true, true, false);
+
+ h2c.key.addKeyEvent( 84, false, true, addText);
+ MENU_BAR_CONTROL.EDIT.createSelection( 'Add Text', 'ctrl + T', addText, true, false, true);
+
+ h2c.key.addKeyEvent( 71, false, true, switchGrid);
+ MENU_BAR_CONTROL.EDIT.createSelection( 'show Grid', 'ctrl + G', switchGrid, true, true, true);
+
+ function addImage(){
+ setTimeout( function(){ CANVAS_CONTROL.createImageElement();}, 0);
+ }
+ function addText(){
+ setTimeout( function(){ CANVAS_CONTROL.createTextElement();}, 0);
+ }
+ function switchGrid(){
+ setTimeout( gridSwitchFunction, 0);
+ }
+ function popupHelp(){
+ setTimeout( function(){ HELP_DOCUMENTS_WINDOW.open();}, 0);
+ }
+
+ return WINDOWS_CONTROL.createWindow(
+ this,
+ {
+ onInit: function(){
+ addImageButton = $( '#toolbox-add-image-button').click( function(e){
+ addImage();
+ e.preventDefault();
+ return false;
+ });
+
+ addTextButton = $( '#toolbox-add-text-button').click( function(e){
+ addText();
+ e.preventDefault();
+ return false;
+ });
+
+ editBgButton = $( '#toolbox-edit-bg-button').click( function( e){
+ setTimeout( function(){
+ INFOMATION_WINDOW.open();
+ }, 0);
+ e.preventDefault();
+ return false;
+ });
+
+ switchGridButton = $( '#toolbox-switch-grid').click( function( e){
+ switchGrid();
+ e.preventDefault();
+ return false;
+ });
+
+ popupHelpButton = $( '#toolbox-popup-help-button').click( function( e){
+ popupHelp();
+ e.preventDefault();
+ return false;
+ });
+
+ publishButton = $( '#toolbox-publish-button');
+
+ delete this.onInit;
+ },
+ setGridSwitchFunction: function( _gridSwitchFunction){
+ gridSwitchFunction = _gridSwitchFunction || gridSwitchFunction;
+ }
+ },
+ 'toolbox-window', 'Tool box', 0, 215, 110, 290, true
+ );
+ })();
+
+/* ----------------------------------------
+ * INFOMATION_WINDOW
+ */
+ var INFOMATION_WINDOW = ( function(){
+ var FADE_EFFECT_ENABLED = h2c.isIE === false || h2c.ieVersion >= 8,
+ FADE_IN_EFFECT = FADE_EFFECT_ENABLED === true ? 'fadeIn' : 'show',
+ FADE_OUT_EFFECT = FADE_EFFECT_ENABLED === true ? 'fadeOut' : 'hide',
+ backgroundInfomationElm,
+ jqComicElementInformation,
+ xValueElm, yValueElm, zValueElm, aValueElm, wValueElm, hValueElm,
+ wPercentElm, hPercentElm,
+ currentComicElement = null,
+ currentElementType = -1;
+
+ return WINDOWS_CONTROL.createWindow(
+ this,
+ {
+ onInit: function(){
+ backgroundInfomationElm = $( '#panel-background-information');
+
+ jqComicElementInformation = $( '#comic-element-infomation').hide().css( {
+ height: this.bodyHeight()
+ });
+ var TAB_GROUP_ID = 'comic-element-attribute';
+ var CREATER = h2c.key.createEditableText;
+ xValueElm = CREATER( $( '#comic-element-x'), null, TAB_GROUP_ID);
+ yValueElm = CREATER( $( '#comic-element-y'), null, TAB_GROUP_ID);
+ zValueElm = CREATER( $( '#comic-element-z'), null, TAB_GROUP_ID);
+ aValueElm = CREATER( $( '#comic-element-a'), null, TAB_GROUP_ID);
+ wValueElm = CREATER( $( '#comic-element-w'), null, TAB_GROUP_ID);
+ hValueElm = CREATER( $( '#comic-element-h'), null, TAB_GROUP_ID);
+ wPercentElm = CREATER( $( '#comic-element-w-percent'), null, TAB_GROUP_ID);
+ hPercentElm = CREATER( $( '#comic-element-h-percent'), null, TAB_GROUP_ID);
+ delete this.onInit;
+ },
+ onResize: function( w, h){
+ jqComicElementInformation && jqComicElementInformation.css( {
+ height: this.bodyHeight()
+ });
+ },
+ update: function( _currentElementType, x, y, z, a, w, h, wPercent, hPercent){
+ if( currentElementType !== _currentElementType){
+ if( _currentElementType !== -1){
+ if( _currentElementType === 1){
+ aValueElm.show();
+ wPercentElm.hide();
+ hPercentElm.hide();
+ } else {
+ aValueElm.hide();
+ wPercentElm.show();
+ hPercentElm.show();
+ }
+ currentElementType === -1 && jqComicElementInformation.stop().css( {
+ filter: '',
+ opacity: ''
+ })[ FADE_IN_EFFECT]();
+ } else {
+ currentElementType !== -1 && jqComicElementInformation.stop().css({
+ filter: '',
+ opacity: ''
+ })[ FADE_OUT_EFFECT]();
+ }
+ currentElementType = _currentElementType;
+ }
+ if( currentElementType !== -1){
+ xValueElm.update( x);
+ yValueElm.update( y);
+ zValueElm.update( z);
+ _currentElementType === 1 && aValueElm.update( a);
+ wValueElm.update( w);
+ hValueElm.update( h);
+ _currentElementType === 0 && wPercentElm.update( wPercent);
+ _currentElementType === 0 && hPercentElm.update( hPercent);
+ } else {
+
+ }
+ }
+ },
+ 'infomation-window', 'Infomation', 0, 30, 200, 180, true
+ );
+ })();
+
+/* ----------------------------------------
+ * HELP_WINDOW
+ */
+ var HELP_DOCUMENTS_WINDOW = ( function(){
+ var visible = true,
+ hasAjaxContents = false,
+ jqAjaxContents,
+ jqNaviItems,
+ jqPages;
+ function jumpPage( _index){
+
+ }
+ function onOpen( _pageIndex){
+ _pageIndex = _pageIndex || 0;
+ if( hasAjaxContents === false){
+ $.ajax({
+ url: 'help/jp.html',
+ dataType: 'html',
+ success: function( html){
+ $( html).find( 'script,style,object,applet,embed,iframe,frame').remove();
+ jqNaviItems = jqAjaxContents.removeClass( 'loading').append( html)
+ .find( 'a.sidenavi-item').attr( 'href', '#')
+ .click( function( e){
+ var that = this,
+ parent = this.parentNode,
+ i = ( function(){
+ var children = parent.getElementsByTagName( 'A'),
+ l = children.length;
+ for( var i=0; i<l; ++i){
+ if( children[ i] === that) return i;
+ }
+ return -1;
+ })();
+ e.stopPropagation();
+ if( i === -1) return false;
+ jqNaviItems.removeClass( 'current').eq( i).addClass( 'current');
+ jqPages.hide().eq( i).show();
+
+ return false;
+ });
+ jqNaviItems.eq( _pageIndex).addClass( 'current');
+ jqPages = jqAjaxContents.find( '.page-content');
+ jqPages.eq( _pageIndex).show();
+ }
+ });
+ hasAjaxContents = true;
+ } else {
+ jqNaviItems.removeClass( 'current').eq( _pageIndex).addClass( 'current');
+ jqPages.hide().eq( _pageIndex).show();
+ }
+ }
+ return WINDOWS_CONTROL.createWindow(
+ this,
+ {
+ onInit: function(){
+ jqAjaxContents = this.$.find( '.window-body').addClass( 'loading').css( { height: this.bodyHeight()});
+ onOpen( 0);
+ delete this.onInit;
+ },
+ onResize: function( w, h){
+ jqAjaxContents && jqAjaxContents.css( { height: this.bodyHeight()});
+ },
+ setAjaxContent: function( html){
+
+ delete this.onLoadAjaxContent;
+ }
+ },
+ null, 'Help', 0, 215, 400, 350, false, true, true, 300, 300
+ );
+ })();
+
+/* ----------------------------------------
+ * - CANVAS_CONTROL
+ * - GRID_CONTROL
+ * - WHITE_GLASS_CONTROL
+ * - PANEL_BORDER_CONTROL
+ * - COMIC_ELEMENT_CONTROL
+ * - PanelResizerClass
+ * - COMIC_ELEMENT_OPERATOR
+ * - ImageElementClass
+ * - TextElementClass
+ */
+ var CANVAS_CONTROL = ( function(){
+ var DEFAULT_PANEL_WIDTH = 400,
+ DEFAULT_PANEL_HEIGHT = 300,
+ MIN_PANEL_HEIGHT = 20,
+ BORDER_WIDTH = 2,
+ RESIZER_BORDER_WIDTH = 1,
+ SPACE_ENABLED = h2c.key.spaceEnabled,
+ canvasW, canvasH, canvasX, canvasY,
+ xOffset, yOffset, startCanvasX, startCanvasY,
+ isDragging = false,
+ hasFocus = false;
+
+ var GRID_CONTROL = ( function(){
+ var elmGrid = document.getElementById( 'grid'),
+ jQGrid,
+ visible = false;
+
+ function update(){
+ jQGrid.css( {
+ opacity: '',
+ fliter: ''
+ }).stop()[ visible === true ? 'fadeOut' : 'fadeIn']();
+ visible = !visible;
+ if( visible === true){
+ elmGrid.style.backgroundImage = "url('grid.gif')";
+ }
+ return visible;
+ }
+ return {
+ init: function(){
+ jQGrid = $( elmGrid);
+ this.resize();
+ TOOL_BOX_WINDOW.setGridSwitchFunction( update);
+ delete GRID_CONTROL.init;
+ },
+ resize: function(){
+ elmGrid.style.backgroundPosition = [ canvasX % 10, 'px ', canvasY % 10, 'px'].join( '');
+ elmGrid.style.height = windowH +'px';
+ },
+ enabled: function(){
+ return visible;
+ }
+ }
+ })();
+
+ /*
+ * WHITE_GLASS_CONTROL
+ */
+ var WHITE_GLASS_CONTROL = ( function(){
+ var styleTop = document.getElementById( 'whiteGlass-top').style,
+ styleLeft = document.getElementById( 'whiteGlass-left').style,
+ styleRight = document.getElementById( 'whiteGlass-right').style,
+ styleBottom = document.getElementById( 'whiteGlass-bottom').style;
+ function resize(){
+ var _w = canvasW,
+ _h = canvasH,
+ marginTop = canvasY,
+ marginBottom = windowH -_h -marginTop,
+ marginX = canvasX,
+ rightWidth = windowW -_w -marginX;
+
+ styleTop.height = ( marginTop < 0 ? 0 : marginTop) +'px';
+
+ styleLeft.top = marginTop +'px';
+ styleLeft.width = ( marginX < 0 ? 0 : marginX) +'px';
+ styleLeft.height = ( _h + marginBottom) +'px';
+
+ styleRight.top = marginTop +'px';
+ styleRight.left = _w +marginX +'px';
+ styleRight.width = ( rightWidth < 0 ? 0 : rightWidth) +'px';
+ styleRight.height = ( _h + marginBottom) +'px';
+
+ styleBottom.top = ( _h +marginTop) +'px';
+ styleBottom.left = marginX +'px';
+ styleBottom.width = _w +'px';
+ styleBottom.height = ( marginBottom < 0 ? 0 : marginBottom) +'px';
+ }
+ return {
+ resize: resize
+ }
+ })();
+
+ /*
+ * PANEL_BORDER_CONTROL
+ */
+ var PANEL_BORDER_CONTROL = ( function(){
+ var panelElm, borderWidth;
+
+ function resize(){
+ panelElm.css( {
+ left: canvasX -BORDER_WIDTH,
+ top: canvasY -BORDER_WIDTH,
+ width: canvasW,
+ height: canvasH
+ });
+ }
+
+ return {
+ init: function(){
+ panelElm = $( '#panel-border');
+ borderWidth = panelElm.css( 'border-width');
+
+ delete PANEL_BORDER_CONTROL.init;
+ },
+ resize: resize
+ }
+ })();
+
+ /*
+ * COMIC_ELEMENT_CONTROL
+ * - PanelResizerClass
+ * - COMIC_ELEMENT_OPERATOR
+ * - ImageElementClass
+ * - TextElementClass
+ */
+ var COMIC_ELEMENT_CONTROL = ( function( _onResizeFunction){
+ var MIN_OBJECT_SIZE = 19,
+ log,
+ currentElement = null,
+ _canvasX, _canvasY, _canvasW, _canvasH,
+ MOUSE_HIT_AREA = 10,
+ SAVE = HISTORY.saveState;
+ /*
+ * --------------------------------------------------------------------------------------------
+ * panel resizer
+ */
+ var PanelResizerClass = function( ELM, onPanelResizeFunction, isTop){
+ var BORDER_WIDTH = 2,
+ yOffset, y, _canvasY, _canvasH,
+ RESIZER_HEIGHT = 30,
+ isDragging = false,
+ SAVE = HISTORY.saveState,
+ MOUSE_CURSOR = updateMouseCursor;
+
+ function restoreState( arg){
+ if( arg && arg.length > 3){
+ canvasX = arg[ 0] || canvasX;
+ canvasY = arg[ 1] || canvasY;
+ canvasW = arg[ 2] || canvasW;
+ canvasH = arg[ 3] || canvasH;
+
+ /*
+ * PANEL_RESIZER_TOP の場合、リサイズに併せてコミック要素を移動させている。
+ * currentElementを一度PANEL_RESIZER_TOPにしたのちresize
+ */
+ onPanelResizeFunction( isTop);
+ }
+ }
+
+ return {
+ init: function( _elm){
+ this.$ = $( ELM);
+ ELM.style.width = ( canvasW +2)+'px';
+ },
+ $: null,
+ hitareaX: function(){ return -1;},
+ hitareaY: function(){ return isTop === true ? ( -35 -BORDER_WIDTH) : ( canvasH +5 +BORDER_WIDTH);},
+ hitareaW: function(){ return canvasW +2;},
+ hitareaH: function(){ return RESIZER_HEIGHT;},
+ resize: resize,
+ dragging: function(){
+ return isDragging;
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ yOffset = _mouseY;
+ _canvasY = canvasY;
+ _canvasH = canvasH;
+ isDragging = true;
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ if( isDragging !== true){
+ COMIC_ELEMENT_OPERATOR.hide();
+ MOUSE_CURSOR( 'n-resize');
+ } else {
+ var move = _mouseY -yOffset;
+ if( isTop === true){
+ //if( 0 < _canvasH - move){
+ if( _canvasH - move < MIN_PANEL_HEIGHT){
+ move = _canvasH -MIN_PANEL_HEIGHT;
+ }
+ canvasY = _canvasY +move;
+ canvasH = _canvasH -move;
+ log.html( move)
+ onPanelResizeFunction( true);
+ //}
+ } else {
+ var _h = _canvasH +move;
+ if( 0 < _h && _h < windowH -canvasY -RESIZER_HEIGHT -5 -BORDER_WIDTH){
+ if( _h < MIN_PANEL_HEIGHT){
+ _h = MIN_PANEL_HEIGHT;
+ }
+ canvasH = _h;
+ onPanelResizeFunction( false);
+ }
+ }
+ }
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ ( _canvasY !== canvasY || _canvasH !== canvasH) && SAVE( restoreState, [ NaN, _canvasY, NaN, _canvasH], [ NaN, canvasY, NaN, canvasH]);
+ isDragging = false;
+ }
+ }
+ };
+
+ var PANEL_RESIZER_TOP = PanelResizerClass.apply( {}, [ document.getElementById( 'panel-resizer-top'), _onResizeFunction, true]),
+ PANEL_RESIZER_BOTTOM = PanelResizerClass.apply( {}, [ document.getElementById( 'panel-resizer-bottom'), _onResizeFunction, false]),
+ DRAGGABLE_ELEMENT_ARRAY = [ PANEL_RESIZER_TOP, PANEL_RESIZER_BOTTOM],
+ NUM_RESIZER = DRAGGABLE_ELEMENT_ARRAY.length;
+
+ _onResizeFunction = PanelResizerClass = undefined;
+
+ /*
+ * --------------------------------------------------------------------------------------------
+ * COMIC_ELEMENT_OPERATOR
+ */
+ var COMIC_ELEMENT_OPERATOR = ( function(){
+ var MOUSE_CURSOR = updateMouseCursor,
+ SAVE = HISTORY.saveState,
+ INFOMATION = INFOMATION_WINDOW.update,
+ GRID_ENABLED = GRID_CONTROL.enabled,
+ HIT_AREA = MOUSE_HIT_AREA,
+ RESIZER = ( function( HIT_AREA){
+ var POSITION_ARRAY = [],
+ FLOOR = Math.floor,
+ CURSOR_AND_FLIP = [
+ { cursor: 'n-resize', v: 3},
+ { cursor: 'e-resize', h: 2},
+ { cursor: 'e-resize', h: 1},
+ { cursor: 'n-resize', v: 0},
+ { cursor: 'nw-resize', h: 5, v: 6, vh: 7},
+ { cursor: 'ne-resize', h: 4, v: 7, vh: 6},
+ { cursor: 'ne-resize', h: 7, v: 4, vh: 5},
+ { cursor: 'nw-resize', h: 6, v: 5, vh: 4}
+ ],
+ elmResizerContainerStyle = document.getElementById( 'comic-element-resizer-container').style,
+ elmResizerTopStyle = document.getElementById( 'comic-element-resizer-top').style,
+ elmResizerLeftStyle = document.getElementById( 'comic-element-resizer-left').style,
+ elmResizerRightStyle = document.getElementById( 'comic-element-resizer-right').style,
+ elmResizerBottomStyle = document.getElementById( 'comic-element-resizer-bottom').style,
+ x, y, w, h,
+ currentIndex;
+ elmResizerContainerStyle.display = 'none';
+ return {
+ x: function(){ return x;},
+ y: function(){ return y;},
+ w: function(){ return w;},
+ h: function(){ return h;},
+ update: function( _x, _y, _w, _h){
+ x = _x !== undefined ? _x : x;
+ y = _y !== undefined ? _y : y;
+ w = _w !== undefined ? _w : w;
+ h = _h !== undefined ? _h : h;
+ elmResizerContainerStyle.left = x +'px';
+ elmResizerContainerStyle.top = y +'px';
+ elmResizerContainerStyle.width = w +'px';
+ elmResizerContainerStyle.height = h +'px';
+ elmResizerTopStyle.left = FLOOR( w /2 -10 /2) +'px';
+ elmResizerLeftStyle.top = FLOOR( h /2 -10 /2) +'px';
+ elmResizerRightStyle.top = FLOOR( h /2 -10 /2) +'px';
+ elmResizerBottomStyle.left = FLOOR( w /2 -10 /2) +'px';
+
+ POSITION_ARRAY.splice( 0, POSITION_ARRAY.length);
+ POSITION_ARRAY.push(
+ {x: x +5, y: y -HIT_AREA, w: w -5 *2, h: HIT_AREA +5},
+ {x: x -HIT_AREA, y: y +HIT_AREA +5, w: HIT_AREA +5, h: h -5 *2},
+ {x: x +w -5, y: y +HIT_AREA +5, w: HIT_AREA +5, h: h -5 *2},
+ {x: x +5, y: y +h -5, w: w -5 *2, h: HIT_AREA +5},
+ {x: x -HIT_AREA, y: y -HIT_AREA, w: HIT_AREA +5, h: HIT_AREA +5},
+ {x: x +w -HIT_AREA, y: y -HIT_AREA, w: HIT_AREA +5, h: HIT_AREA +5},
+ {x: x -HIT_AREA, y: y +h -5, w: HIT_AREA +5, h: HIT_AREA +5},
+ {x: x +w -5, y: y +h -5, w: HIT_AREA +5, h: HIT_AREA +5}
+ );
+ },
+ index: function( _mouseX, _mouseY){
+ if( TAIL_MOVER.hitText( _mouseX -x, _mouseY -y) === true){
+ MOUSE_CURSOR( 'move');
+ return TAIL_MOVER_INDEX;
+ }
+ var p,
+ l = POSITION_ARRAY.length;
+ for( var i=0; i<l; i++){
+ p = POSITION_ARRAY[ i];
+ if( p.x <= _mouseX && p.y <= _mouseY && p.x + p.w >= _mouseX && p.y +p.h >= _mouseY){
+ MOUSE_CURSOR( CURSOR_AND_FLIP[ i].cursor);
+ return currentIndex = i;
+ }
+ }
+ return -1;
+ },
+ flip: function( _flipV, _flipH){
+ var p = CURSOR_AND_FLIP[ currentIndex];
+ currentIndex = _flipH === true || _flipV === true ? p[
+ _flipH === true && _flipV === true ? 'vh' : ( _flipH === true ? 'h' : 'v')
+ ] : currentIndex;
+ MOUSE_CURSOR( CURSOR_AND_FLIP[ currentIndex].cursor);
+ return currentIndex;
+ },
+ show: function(){
+ elmResizerContainerStyle.display = '';
+ },
+ hide: function(){
+ elmResizerContainerStyle.display = 'none';
+ }
+ }
+ })( HIT_AREA),
+ TAIL_MOVER = ( function(){
+ var ELM_MOVER = document.getElementById( 'baloon-tail-mover'),
+ //ELM_MOVER_PARENT = ELM_MOVER.parentNode,
+ //ELM_MOVER_NEXT = ELM_MOVER.nextSibling,
+ SIZE = ( function(){
+ var _size = h2c.util.getElementSize( ELM_MOVER);
+ return _size.width;
+ })(),
+ SIN = Math.sin,
+ COS = Math.cos,
+ ATAN = Math.atan,
+ FLOOR = Math.floor,
+ DEG_TO_RAD = Math.PI / 180,
+ RAD_TO_DEG = 1 /DEG_TO_RAD,
+ currentText = null,
+ x, y, w, h, a, radA;
+ //ELM_MOVER_PARENT.removeChild( ELM_MOVER);
+
+ function draw( _w, _h, _a){
+ w = _w !== undefined ? _w : w;
+ h = _h !== undefined ? _h : h;
+ a = _a !== undefined ? _a : a;
+ radA = a *DEG_TO_RAD;
+ x = FLOOR( ( ( COS( radA) /2 +0.5) *( w +SIZE)) -SIZE /2);
+ y = FLOOR( ( ( SIN( radA) /2 +0.5) *( h +SIZE)) -SIZE /2);
+ ELM_MOVER.style.left = x +'px';
+ ELM_MOVER.style.top = y +'px';
+ log.html( [ w, h, a].join());
+ }
+
+ return {
+ update: draw,
+ show: function( _currentText){
+ /*
+ * domから抜かないとieで表示されてしまう。visibilityのほうがいい
+ */
+ //ELM_MOVER_NEXT !== ELM_MOVER.nextSibling && ELM_MOVER_PARENT.insertBefore(ELM_MOVER, ELM_MOVER_NEXT);
+ ELM_MOVER.style.visibility = '';
+ draw( _currentText.w, _currentText.h, _currentText.angle());
+ currentText = _currentText;
+ },
+ hide: function(){
+ //ELM_MOVER.parentNode === ELM_MOVER_PARENT && ELM_MOVER_PARENT.removeChild( ELM_MOVER);
+ ELM_MOVER.style.visibility = 'hidden';
+ currentText = null;
+ },
+ hitText: function( _mouseX, _mouseY){
+ var _x = x -SIZE /2,
+ _y = y -SIZE /2;
+ return currentIsTextElement === true && _x <= _mouseX && _y <= _mouseY && _x +SIZE >= _mouseX && _y +SIZE >= _mouseY;
+ },
+ onDrag: function( _mouseX, _mouseY){
+ draw( w, h,
+ _mouseX !== 0 ?
+ ATAN( _mouseY /_mouseX) *RAD_TO_DEG +( _mouseX < 0 ? 180 : 0) :
+ _mouseY > 0 ? 0 : 180
+ );
+ currentText && currentText.angle( a);
+ updateInfomation( undefined, undefined, undefined, a);
+ }
+ }
+ })(),
+ COMIC_ELEMENT_CONSOLE = ( function(){
+ var jqStage,
+ jqConsoleParent,
+ jqConsoleWrapper,
+ jqConsoleTail,
+ jqImgConsole, jqTextConsole,
+ currentElement = null,
+ currentType = -1,
+ visible = false,
+ imgConsoleWidth, imgConsoleHeight,
+ textConsoleWidth, textConsoleHeight,
+ consoleWidth, consoleHeight,
+ consoleX, consoleY,
+ tailSize = 10,
+ buttonClickable = false;
+
+ function buttonBackOrForward( isBack){
+ var offest = jqConsoleWrapper.offset();
+ jqConsoleWrapper.css( {
+ position: isBack === true ? '' : 'absolute',
+ left: isBack === true ? consoleX : offest.left,
+ top: isBack === true ? consoleY : offest.top
+ });
+ buttonClickable === isBack && ( isBack === true ? jqConsoleParent : jqStage).append( jqConsoleWrapper);
+ buttonClickable = !isBack;
+ }
+ return {
+ init: function(){
+ jqStage = jqEditor;
+ jqConsoleTail = $( '#comic-element-consol-tail');
+ jqImgConsole = $( '#image-element-consol').hide();
+ var imgConsoleSize = h2c.util.getElementSize( jqImgConsole.get( 0));
+ imgConsoleWidth = imgConsoleSize.width;
+ imgConsoleHeight = imgConsoleSize.height;
+
+ jqTextConsole = $( '#text-element-consol').hide();
+ var textConsoleSize = h2c.util.getElementSize( jqTextConsole.get( 0));
+ textConsoleWidth = textConsoleSize.width;
+ textConsoleHeight = textConsoleSize.height;
+
+ jqConsoleWrapper = $( '#comic-element-consol-wrapper').hide();
+ jqConsoleParent = jqConsoleWrapper.parent();
+
+ $( '#edit-text-button').click( function(){
+ if( currentElement === null) return;
+ TEXT_EDITOR_CONTROL.show( currentElement);
+ buttonBackOrForward( true);
+ });
+ $( '#delete-image-button, #delete-text-button').click( function(){
+ if( currentElement === null) return;
+ buttonBackOrForward( true);
+ removeComicElement( currentElement);
+ SAVE( restoreComicElement, [ true, currentElement], [ false, currentElement], true);
+ COMIC_ELEMENT_OPERATOR.hide();
+ });
+ $( '#change-image-button').click( function(){
+ if( currentElement === null) return;
+ buttonBackOrForward( true);
+ IMAGE_GROUP_EXPROLER.show( currentElement.url);
+ });
+ $( '#layer-forward-button, #forward-text-button').click( function(){
+ if( currentElement === null) return;
+ replaceComicElement( currentElement, true);
+ updateInfomation();
+ SAVE( restoreReplaceObject, [ currentElement, false], [ currentElement, true]);
+ });
+ $( '#layer-back-button, #back-text-button').click( function(){
+ if( currentElement === null) return;
+ replaceComicElement( currentElement, false);
+ updateInfomation();
+ SAVE( restoreReplaceObject, [ currentElement, true], [ currentElement, false]);
+ });
+
+ delete COMIC_ELEMENT_CONSOLE.init;
+ },
+ show: function( _currentElement, _w, _h){
+ visible === false && jqConsoleWrapper.show();
+ visible = true;
+ currentElement = _currentElement;
+ var _currentType = _currentElement.type;
+ if( currentType !== _currentType){
+ currentType = _currentType;
+ jqImgConsole.toggle( _currentType === COMIC_ELEMENT_TYPE_IMAGE);
+ jqTextConsole.toggle( _currentType === COMIC_ELEMENT_TYPE_TEXT);
+ consoleWidth = _currentType === COMIC_ELEMENT_TYPE_IMAGE ? imgConsoleWidth : textConsoleWidth;
+ consoleHeight = _currentType === COMIC_ELEMENT_TYPE_IMAGE ? imgConsoleHeight : textConsoleHeight;
+ }
+ consoleX = Math.floor( ( _w -consoleWidth) /2);
+
+ if( _w > consoleWidth * 1.5 && _h > consoleHeight * 1.5){
+ consoleY = Math.floor( ( _h -consoleHeight) /2);
+ jqConsoleWrapper.css( {
+ left: consoleX,
+ top: consoleY
+ }).removeClass( 'console-out');
+ } else {
+ consoleY = _h +tailSize;
+ jqConsoleWrapper.css( {
+ left: consoleX,
+ top: consoleY
+ }).addClass( 'console-out');
+ }
+ },
+ hide: function (){
+ visible === true && jqConsoleWrapper.hide();
+ visible = false;
+ currentElement = null;
+ },
+ x: function(){ return consoleX;},
+ y: function(){ return consoleY;},
+ w: function(){ return consoleWidth;},
+ h: function(){ return consoleHeight;},
+ onMouseMove: function( _mouseX, _mouseY){
+ if( consoleX > _mouseX || consoleY > _mouseY || consoleX +consoleWidth < _mouseX || consoleY +consoleHeight < _mouseY){
+ buttonClickable === true && buttonBackOrForward( true);
+ return false;
+ }
+ buttonClickable === false && buttonBackOrForward( false);
+ return true;
+ },
+ onMouseOut: function( _mouseX, _mouseY){
+ buttonClickable === true && buttonBackOrForward( true);
+ }
+ }
+ })(),
+ TAIL_MOVER_INDEX = 99,
+ RESIZE_COMMAND_ARRAY = [
+ { x: 0, w: 0, y: 1, h: -1}, //top
+ { x: 1, w: -1, y: 0, h: 0}, //left
+ { x: 0, w: 1, y: 0, h: 0}, //right
+ { x: 0, w: 0, y: 0, h: 1}, //bottom
+ { x: 1, w: -1, y: 1, h: -1}, //top-left
+ { x: 0, w: 1, y: 1, h: -1}, //top-right
+ { x: 1, w: -1, y: 0, h: 1}, //bottom-left
+ { x: 0, w: 1, y: 0, h: 1} //bottom-right
+ ],
+ currentResizerIndex = -1,
+ currentIsTextElement = false,
+ currentElement = null,
+ x, y, w, h, angle, flipV, flipH,
+ startX, startY, startW, startH, startA, startFilpV, startFilpH,
+ xOffset, yOffset,
+ isDragging = false,
+ currentUpdated = false;
+
+ function resize( _x, _y, _w, _h, _angle){
+ x = _x !== undefined ? _x : x;
+ y = _y !== undefined ? _y : y;
+ w = _w !== undefined ? _w : w;
+ h = _h !== undefined ? _h : h;
+ angle = _angle !== undefined ? _angle : angle;
+
+ RESIZER.update( x, y, w, h);
+ currentIsTextElement === true && TAIL_MOVER.update( w, h, angle);
+ COMIC_ELEMENT_CONSOLE.show( currentElement, w, h);
+ updateInfomation( x, y, currentElement.z, angle, w, h);
+ }
+ function updateInfomation( _x, _y, _z, _a, _w, _h){
+ _w = _w !== undefined ? _w : w;
+ _h = _h !== undefined ? _h : h;
+ INFOMATION(
+ currentElement === null ? -1 : currentElement.type,
+ _x !== undefined ? _x : x,
+ _y !== undefined ? _y : y,
+ _z !== undefined ? _z : ( currentElement === null ? '*' : currentElement.z),
+ _a !== undefined ? Math.floor( _a) : ( currentIsTextElement === true ? Math.floor( angle) : '-'),
+ _w,
+ _h,
+ currentElement === null || currentIsTextElement === true ? '-' : ( currentElement.actualW() === 0 ? '?' : Math.floor( _w / currentElement.actualW() *100)),
+ currentElement === null || currentIsTextElement === true ? '-' : ( currentElement.actualH() === 0 ? '?' : Math.floor( _h / currentElement.actualH() *100))
+ );
+ }
+ function show( _currentElement){
+ currentElement === null && RESIZER.show();
+ if( currentElement !== _currentElement){
+ currentElement = _currentElement;
+ startX = _currentElement.x;
+ startY = _currentElement.y;
+ startW = _currentElement.w;
+ startH = _currentElement.h;
+
+ currentIsTextElement = ( _currentElement.type === COMIC_ELEMENT_TYPE_TEXT);
+ startA = currentIsTextElement === true ? _currentElement.angle() : 0;
+ currentIsTextElement === true ? TAIL_MOVER.show( _currentElement) : TAIL_MOVER.hide();
+
+ startFilpV = flipV = currentIsTextElement === false ? _currentElement.flipV() : 0;
+ startFilpH = flipH = currentIsTextElement === false ? _currentElement.flipH() : 0;
+
+ resize( startX, startY, startW, startH, startA);
+ isDragging = currentUpdated = false;
+ }
+ }
+ function hide(){
+ currentElement !== null && RESIZER.hide();
+ currentElement = null;
+ MOUSE_CURSOR( '');
+ TAIL_MOVER.hide();
+ isDragging = currentUpdated = false;
+ COMIC_ELEMENT_CONSOLE.hide();
+ updateInfomation();
+ }
+ function restoreState( arg){
+ if( arg && arg.length !== 8) return;
+ var _currentElement = arg[ 0],
+ _x = arg[ 1], _y = arg[ 2], _w = arg[ 3], _h = arg[ 4],
+ _a = arg[ 5],
+ _flipV = arg[ 6], _flipH = arg[ 7];
+ if( !_currentElement) return;
+ _currentElement.type === COMIC_ELEMENT_TYPE_IMAGE ?
+ _currentElement.animate( _x, _y, _w, _h, _flipV, _flipH) :
+ _currentElement.animate( _x, _y, _w, _h, _a);
+ currentElement === _currentElement ? resize( _x, _y, _w, _h, _a) : show( _currentElement);
+ }
+ function saveState(){
+ currentElement && SAVE( restoreState,
+ [ currentElement, startX, startY, startW, startH, startA, startFilpV, startFilpH],
+ [ currentElement, x, y, w, h, angle, flipV, flipH]
+ );
+ startX = x;
+ startY = y;
+ startW = w;
+ startH = h;
+ startA = angle;
+ startFilpV = flipV;
+ startFilpH = flipH;
+ }
+ return {
+ init: function(){
+ COMIC_ELEMENT_CONSOLE.init(); // COMIC_ELEMENT_CONSOLE が要素の高さを取得するため、RESIZER.initがあと。
+
+ hide();
+ delete COMIC_ELEMENT_OPERATOR.init;
+ },
+ hide: hide,
+ dragging: function(){
+ return isDragging;
+ },
+ hitareaX: function( _comicElement, _x){
+ if( _comicElement === currentElement){
+ var _consoleX = COMIC_ELEMENT_CONSOLE.x();
+ return x +( _consoleX < 0 ? _consoleX : 0) -HIT_AREA;
+ }
+ return _x -HIT_AREA;
+ },
+ hitareaY: function( _comicElement, _y){
+ return _y -HIT_AREA;
+ },
+ hitareaW: function( _comicElement, _w){
+ if( _comicElement === currentElement){
+ var _consoleW = COMIC_ELEMENT_CONSOLE.w();
+ return ( _consoleW < w ? w : _consoleW) +HIT_AREA *2;
+ }
+ return _w +HIT_AREA *2;
+ },
+ hitareaH: function( _comicElement, _h){
+ if( _comicElement === currentElement){
+ var _consoleY = COMIC_ELEMENT_CONSOLE.y();
+ return ( _consoleY < h ? h : _consoleY +COMIC_ELEMENT_CONSOLE.h()) +HIT_AREA *2;
+ }
+ return _h +HIT_AREA *2;
+ },
+ onMouseDown: function( _currentElement, _mouseX, _mouseY){
+ //show( _currentElement);
+ xOffset = _mouseX;
+ yOffset = _mouseY;
+ currentResizerIndex = RESIZER.index( _mouseX, _mouseY);
+ currentResizerIndex === -1 && MOUSE_CURSOR( 'move');
+ isDragging = true;
+ },
+ onMouseMove: function( _currentElement, _mouseX, _mouseY){
+ show( _currentElement);
+ var moveX = _mouseX -xOffset,
+ moveY = _mouseY -yOffset;
+ if( isDragging === true){
+ if( currentResizerIndex !== -1){
+ if( currentResizerIndex === TAIL_MOVER_INDEX){
+ TAIL_MOVER.onDrag( _mouseX -x -w /2, _mouseY -y -h /2); //Balloonの中心を0,0とする座標系に変換
+ } else {
+ var com = RESIZE_COMMAND_ARRAY[ currentResizerIndex],
+ _x = x +moveX *com.x,
+ _y = y +moveY *com.y,
+ _w = w +moveX *com.w,
+ _h = h +moveY *com.h,
+ update = false;
+
+ if( _w > MIN_OBJECT_SIZE && _h > MIN_OBJECT_SIZE){
+ update = true;
+ } else
+ if( currentElement.type === COMIC_ELEMENT_TYPE_TEXT){
+ } else
+ if( _w < -MIN_OBJECT_SIZE || _h < -MIN_OBJECT_SIZE){
+ var __x, __y;
+ if( _w < -MIN_OBJECT_SIZE && _h > MIN_OBJECT_SIZE){
+ // flipH
+ __x = _x;
+ x = _x = _x +_w;
+ y = _y;
+ w = _w = __x -_x;
+ h = _h;
+ currentElement.flip( false, true);
+ currentResizerIndex = RESIZER.flip( false, true);
+ flipV = currentElement.flipV();
+ } else
+ if( _w > MIN_OBJECT_SIZE && _h < -MIN_OBJECT_SIZE){
+ // flipV
+ __y = _y;
+ x = _x;
+ y = _y = _y +_h;
+ w = _w;
+ h = _h = __y -_y;
+ currentElement.flip( true, false);
+ currentResizerIndex = RESIZER.flip( true, false);
+ flipH = currentElement.flipH();
+ } else {
+ // flipVH
+ __x = _x;
+ __y = _y;
+ x = _x = _x +_w;
+ y = _y = _y +_h;
+ w = _w = __x -_x;
+ h = _h = __y -_y;
+ currentElement.flip( true, true);
+ currentResizerIndex = RESIZER.flip( true, true);
+ flipV = currentElement.flipV();
+ flipH = currentElement.flipH();
+ }
+ update = true;
+ xOffset = _mouseX;
+ yOffset = _mouseY;
+ }
+
+ if( update === true){
+ RESIZER.update( _x, _y, _w, _h);
+ currentElement.resize( _x, _y, _w, _h);
+ currentIsTextElement === true && TAIL_MOVER.update( _w, _h);
+ COMIC_ELEMENT_CONSOLE.show( currentElement, _w, _h);
+ updateInfomation( _x, _y, undefined, undefined, _w, _h);
+ }
+ }
+ currentUpdated = ( currentUpdated === true) ? true : ( moveX !== 0 || moveY !== 0);
+ } else {
+ var _x = x +moveX,
+ _y = y +moveY;
+ if( GRID_ENABLED() === true){
+ _x = Math.floor( _x / 10) * 10;
+ _y = Math.floor( _y / 10) * 10;
+ }
+ RESIZER.update( _x, _y);
+ currentElement.resize( _x, _y);
+ currentUpdated = ( currentUpdated === true) ? true : ( moveX !== 0 || moveY !== 0);
+ updateInfomation( _x, _y);
+ }
+ } else {
+ currentElement && COMIC_ELEMENT_CONSOLE.onMouseMove( _mouseX -x, _mouseY -y);
+ RESIZER.index( _mouseX, _mouseY) === -1 && MOUSE_CURSOR( '');
+ }
+ },
+ onMouseUp: function( _currentElement, _mouseX, _mouseY){
+ resize(
+ RESIZER.x(), RESIZER.y(), RESIZER.w(), RESIZER.h(),
+ currentIsTextElement === true ? currentElement.angle() : 0
+ );
+ currentElement && currentElement.resize( x, y, w, h);
+ MOUSE_CURSOR( '');
+ currentUpdated === true && saveState();
+ isDragging = currentUpdated = false;
+ },
+ onMouseClick: function( _mouseX, _mouseY){
+ //return currentElement ? COMIC_ELEMENT_CONSOLE.onMouseClick( _mouseX -x, _mouseY -y) : false;
+ }
+ }
+ })();
+ /*
+ * // COMIC_ELEMENT_OPERATOR
+ */
+
+ var AbstractComicElement = function( JQ_WAPPER, COMIC_ELM_TYPE, update, x, y, w, h, z, domIndex){
+ var OPERATOR = COMIC_ELEMENT_OPERATOR;
+ return {
+ $: JQ_WAPPER,
+ type: COMIC_ELM_TYPE,
+ x: x,
+ y: y,
+ w: w,
+ h: h,
+ z: z,
+ domIndex: domIndex,
+ hitareaX: function(){ return OPERATOR.hitareaX( this, this.x);},
+ hitareaY: function(){ return OPERATOR.hitareaY( this, this.y);},
+ hitareaW: function(){ return OPERATOR.hitareaW( this, this.w);},
+ hitareaH: function(){ return OPERATOR.hitareaH( this, this.h);},
+ shift: function( _shiftX, _shiftY){
+ update( this.x +_shiftX, this.y +_shiftY);
+ },
+ dragging: function(){
+ return OPERATOR.dragging();
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ OPERATOR.onMouseMove( this, _mouseX, _mouseY);
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ OPERATOR.onMouseUp( this, _mouseX, _mouseY);
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ OPERATOR.onMouseDown( this, _mouseX, _mouseY);
+ }
+ }
+ };
+ /*
+ * --------------------------------------------------------------------------------------------
+ * ImageElementClass
+ */
+ var jqImageElementOrigin;
+ var ImageElementClass = function( url, IMAGE_SET_ID, x, y, z, w, h, domIndex){
+ jqImageElementOrigin = jqImageElementOrigin || $( $( '#imgElementTemplete').remove().html());
+
+ var JQ_WRAPPER = jqImageElementOrigin.clone( true),
+ OPERATOR = COMIC_ELEMENT_OPERATOR,
+ SAVE = HISTORY.saveState,
+ HIT_AREA = MOUSE_HIT_AREA,
+ reversibleImage = null,
+ actualW = 0, actualH = 0,
+ flipH = w < 0 ? -1 : 1,
+ flipV = h < 0 ? -1 : 1,
+ instance;
+ w = Math.floor( w);
+ h = Math.floor( h);
+
+ function update( _x, _y, _w, _h, animate){
+ instance.x = x = _x !== undefined ? _x : x;
+ instance.y = y = _y !== undefined ? _y : y;
+ instance.w = w = _w !== undefined ? _w : w;
+ instance.h = h = _h !== undefined ? _h : h;
+ JQ_WRAPPER[ animate === true ? 'animate' : 'css']( {
+ left: x,
+ top: y,
+ width: w,
+ height: h
+ }, 250, function(){ reversibleImage.resize( flipH * w, flipV * h);});
+ animate !== true && reversibleImage.resize( flipH * w, flipV * h);
+ }
+
+ function updateUrl( _url){
+ if( url === _url) return;
+ url = _url || url;
+ var _reversibleImage = h2c.image.createReversibleImage( url, flipH * w, flipV * h, function( _url, _actualW, _actualH){
+ actualW = _actualW;
+ actualH = _actualH;
+ });
+ if( reversibleImage !== null){
+ JQ_WRAPPER.children( reversibleImage.elm).replaceWith( _reversibleImage.elm);
+ reversibleImage.destroy();
+ } else {
+ JQ_WRAPPER.append( _reversibleImage.elm);
+ }
+ reversibleImage = _reversibleImage;
+ }
+ return h2c.util.extend(
+ AbstractComicElement.apply( this, [ JQ_WRAPPER, COMIC_ELEMENT_TYPE_IMAGE, update, x, y, w, h, z, domIndex]),
+ {
+ init: function(){
+ instance = this;
+ updateUrl();
+ update();
+ delete this.init;
+ },
+ flip: function( _flipH, _flipV){
+ if( _flipH !== true && _flipV !== true) return;
+ flipH = _flipH === true ? -flipH : flipH;
+ flipV = _flipV === true ? -flipV : flipV;
+ reversibleImage.resize( flipH * w, flipV * h);
+ },
+ flipV: function(){
+ return flipV;
+ },
+ flipH: function(){
+ return flipH;
+ },
+ url: function( _url, _actualW, _actualH){
+ if( _url && _url !== url){
+ SAVE( updateUrl, url, _url);
+ actualW = _actualW;
+ actualH = _actualH;
+ updateUrl( _url);
+ }
+ return url
+ },
+ actualW: function(){ return actualW;},
+ actualH: function(){ return actualH;},
+ resize: update,
+ animate: function ( _x, _y, _w, _h, _flipH, _flipV){
+ flipH = _flipH !== undefined ? _flipH : flipH;
+ flipV = _flipV !== undefined ? _flipV : flipV;
+ update( _x, _y, _w, _h, true);
+ },
+ getAsHtml: function(){
+
+ },
+ getAsJson: function(){
+
+ },
+ destroy: function(){
+ reversibleImage.destroy();
+ JQ_WRAPPER.remove();
+ JQ_WRAPPER = reversibleImage = OPERATOR = null;
+ delete this.destroy;
+ }
+ }
+ );
+ }
+ /*
+ * / ImageElementClass
+ * --------------------------------------------------------------------------------------------
+ */
+
+
+ /*
+ * --------------------------------------------------------------------------------------------
+ * TextElementClass
+ *
+ * ELM はh2c.domで書き出したものを突っ込むcreateの場合
+ *
+ * type
+ * 0.none
+ * 1.speach balloon
+ * 2.think
+ * 3.bom
+ * 4.black-box( dq style)
+ * 5.blue-box( ff style)
+ *
+ */
+ var jqTextElementOrigin;
+ var TextElementClass = function( type, a, text, x, y, z, w, h, domIndex){
+ jqTextElementOrigin = jqTextElementOrigin || ( function(){
+ var _OLD_IE = $( $( '#textElementTempleteForOldIE').remove().html()),
+ _MODERN = $( $( '#textElementTemplete').remove().html());
+ return h2c.isIE === true && h2c.ieRenderingVersion < 8 ? _OLD_IE : _MODERN;
+ })();
+
+ var JQ_WRAPPER = jqTextElementOrigin.clone( true),
+ XBROWSER_BALLOON = h2c.balloon.createBalloon( w, h, a, type),
+ TEXT_ELM = JQ_WRAPPER.find( 'td,.speach-inner').eq( 0),
+ OPERATOR = COMIC_ELEMENT_OPERATOR,
+ HIT_AREA = MOUSE_HIT_AREA,
+ SAVE = HISTORY.saveState,
+ instance;
+
+ JQ_WRAPPER.find( 'img').eq( 0).replaceWith( XBROWSER_BALLOON.elm);
+
+ function update( _x, _y, _w, _h, _a, animate){
+ instance.x = x = _x !== undefined ? _x : x;
+ instance.y = y = _y !== undefined ? _y : y;
+ instance.w = w = _w !== undefined ? _w : w;
+ instance.h = h = _h !== undefined ? _h : h;
+ a = _a !== undefined ? _a : a;
+
+ JQ_WRAPPER[ animate === true ? 'animate' : 'css']( {
+ left: x,
+ top: y,
+ width: w,
+ height: h
+ }, 250,
+ function(){
+ XBROWSER_BALLOON.resize( a, w, h);
+ }
+ );
+ animate !== true && XBROWSER_BALLOON.resize( a, w, h);
+ }
+
+ function updateType( _type){
+ if( type !== _type){
+ type = _type || type;
+ XBROWSER_BALLOON.type( type);
+ }
+ }
+ function updateAngle( _a){
+ if( _a !== undefined && a !== _a){
+ a = _a !== undefined ? _a : a;
+ XBROWSER_BALLOON.angle( a);
+ }
+ }
+ function updateText( _text){
+ text = _text || text || '';
+ TEXT_ELM.html( text);
+ }
+
+ return h2c.util.extend(
+ AbstractComicElement.apply( this, [ JQ_WRAPPER, COMIC_ELEMENT_TYPE_TEXT, update, x, y, w, h, z, domIndex]),
+ {
+ init: function(){
+ instance = this;
+ updateText();
+ update();
+ delete this.init;
+ },
+ angle: function( _a){
+ _a !== undefined && update( NaN, NaN, NaN, NaN, _a);
+ return a;
+ },
+ text: function( _text){
+ if( _text && text !== _text) {
+ SAVE( updateText, text || '', _text);
+ updateText( _text);
+ }
+ return text;
+ },
+ resize: update,
+ animate: function ( _x, _y, _w, _h, _a){
+ update( _x, _y, _w, _h, _a, true);
+ },
+ destroy: function(){
+ JQ_WRAPPER.remove();
+ XBROWSER_BALLOON.destroy();
+ OPERATOR = null;
+ delete this.destroy;
+ },
+ getAsJSON: function(){
+
+ },
+ getAsJsonString: function(){
+
+ },
+ getAsHTML: function(){},
+ getAsXML: function(){}
+
+ }
+ );
+ }
+ /*
+ * リサイズが、ResizerTopによって行われた場合、comicElementのyを動かして見かけ上動かないようにする。
+ */
+ function resize( isResizerTopAction){
+ if( isResizerTopAction === true){
+ var _shiftX = canvasW -_canvasW,
+ _shiftY = canvasH -_canvasH,
+ l = DRAGGABLE_ELEMENT_ARRAY.length;
+ for( var i = NUM_RESIZER; i < l; i++){
+ DRAGGABLE_ELEMENT_ARRAY[ i].shift( _shiftX, _shiftY);
+ }
+ }
+ _canvasW = canvasW;
+ _canvasH = canvasH;
+
+ comicElementContainer.css( {
+ width: _canvasW,
+ height: _canvasH,
+ top: canvasY,
+ left: canvasX
+ });
+ }
+
+ /*
+ * append, remove, replace
+ *
+ * comicElement には、z-position と dom-index がある。
+ * z-position は 表示上の位置。大きいほど前に表示される( z-index)
+ * dom-index は 意味上の順番。htmlタグの登場順で、検索結果や音声読み上げブラウザで正しく意味が取れる順番。
+ *
+ * editerでは、実際には z-index は使わず、htmlの順序で前後を表現する。
+ * dom-index は、数値のみ保持して、投稿時にcomicElementを適宜に並び替える。
+ *
+ * append comicElement
+ * 1. 新しい comicElement の z-position を得る
+ * 2. z の同じ comicElementを見つけ、その前に加える。または一番先頭へ。(DRAGGABLE_ELEMENT_ARRAY)
+ * zが大きいほど、DRAGGABLE_ELEMENT_ARRAYの先頭へ。但しNUM_RESIZER番目より下。
+ * 3. dom位置は、DRAGGABLE_ELEMENT_ARRAY とは反対に、前のものほど後ろへ。
+ *
+ *
+ * remove comicElement
+ * 1. remove
+ * 2. renumber z
+ */
+ function appendComicElement( _comicElement) {
+ _comicElement.init && _comicElement.init();
+ var z = _comicElement.z,
+ l = DRAGGABLE_ELEMENT_ARRAY.length;
+ _comicElement.$.stop().css( {
+ filter: '',
+ opacity: ''
+ });
+ if( z === undefined || z === NaN || z < 0 || z >= l -NUM_RESIZER){
+ DRAGGABLE_ELEMENT_ARRAY.splice( NUM_RESIZER, 0, _comicElement);
+ comicElementContainer.append( _comicElement.$.fadeIn());
+ } else {
+ var insertIndex = ( function(){
+ for( var ret = NUM_RESIZER; ret < l; ++ret){
+ if( DRAGGABLE_ELEMENT_ARRAY[ ret].z <= z) return ret +1;
+ }
+ return NUM_RESIZER;
+ })();
+ DRAGGABLE_ELEMENT_ARRAY[ insertIndex -1].$.after( _comicElement.$.fadeIn());
+ DRAGGABLE_ELEMENT_ARRAY.splice( insertIndex, 0, _comicElement);
+ }
+ sortComicElement();
+ }
+ function removeComicElement( _comicElement) {
+ var l = DRAGGABLE_ELEMENT_ARRAY.length;
+ for( var i=NUM_RESIZER; i<l; ++i){
+ if( DRAGGABLE_ELEMENT_ARRAY[ i] === _comicElement){
+ DRAGGABLE_ELEMENT_ARRAY.splice( i, 1);
+ sortComicElement();
+ _comicElement.$.stop().css( {
+ filter: '',
+ opacity: ''
+ }).fadeOut( function(){
+ this.parentNode.removeChild( this);
+ });
+ currentElement = currentElement === _comicElement ? null : currentElement;
+ return;
+ }
+ }
+ }
+ function restoreComicElement( arg){
+ var isAppend = arg[ 0],
+ comicElement = arg[ 1];
+ isAppend === true ? appendComicElement( comicElement) : removeComicElement( comicElement);
+ }
+ /*
+ * DRAGGABLE_ELEMENT_ARRAY の順番を基準に、zの再計算
+ * jqElmの並び替え。
+ */
+ function sortComicElement(){
+ var l = DRAGGABLE_ELEMENT_ARRAY.length,
+ _comicElement, jqElm, jqNext;
+ for( var i=NUM_RESIZER; i < l; ++i){
+ _comicElement = DRAGGABLE_ELEMENT_ARRAY[ i];
+ jqElm = _comicElement.$;
+ jqNext && jqNext.before( jqElm);
+ _comicElement.z = l -i -NUM_RESIZER +1;
+ jqNext = jqElm;
+ }
+ }
+ function replaceComicElement( _comicElement, goForward){
+ // DRAGGABLE_ELEMENT_ARRAYの再構築
+ var l = DRAGGABLE_ELEMENT_ARRAY.length,
+ i = ( function(){
+ for( var ret = NUM_RESIZER; ret < l; ++ret){
+ if( DRAGGABLE_ELEMENT_ARRAY[ ret] === _comicElement) return ret;
+ }
+ return -1;
+ })();
+ if( i === -1) return;
+ if( goForward === true){
+ if( i === NUM_RESIZER) return;
+ DRAGGABLE_ELEMENT_ARRAY.splice( i, 1);
+ DRAGGABLE_ELEMENT_ARRAY.splice( i -1, 0, _comicElement);
+ } else {
+ if( i === l -1) return;
+ DRAGGABLE_ELEMENT_ARRAY.splice( i, 1);
+ DRAGGABLE_ELEMENT_ARRAY.splice( i +1, 0, _comicElement);
+ }
+ sortComicElement();
+ }
+ function restoreReplaceObject( arg){
+ replaceComicElement( arg[ 0], arg[ 1]);
+ }
+
+ return {
+ init: function(){
+ /*
+ * Resizer
+ */
+ PANEL_RESIZER_TOP.init();
+ PANEL_RESIZER_BOTTOM.init();
+ /*
+ * comic-element
+ */
+ comicElementContainer = $( '#comic-element-container');
+
+ appendComicElement( ImageElementClass.apply( {}, [ 'images/13.gif', 'penchan', 10, 10, 0, 100, 140]));
+ appendComicElement( TextElementClass.apply( {}, [ 0, 270, 'Hello', 50, 70, 1, 200, 160]));
+
+ COMIC_ELEMENT_OPERATOR.init( updateMouseCursor);
+ /*
+ *
+ */
+ log = $( '#operation-catcher-log');
+
+ resize();
+ log.html( 'vector' +h2c.balloon.enabled());
+ delete COMIC_ELEMENT_CONTROL.init;
+ },
+ resize: resize,
+ onMouseMove: function( _mouseX, _mouseY){
+ var l = DRAGGABLE_ELEMENT_ARRAY.length,
+ _X = _mouseX -( _canvasX || canvasX),
+ _Y = _mouseY -( _canvasY || canvasY),
+ _elm, _x, _y;
+
+ if( currentElement !== null && currentElement.dragging() === true){
+ currentElement.onMouseMove( _X, _Y);
+ return true;
+ }
+ if( currentElement !== null){
+ _x = currentElement.hitareaX();
+ _y = currentElement.hitareaY();
+ if( _x <= _X && _y <= _Y && _x + currentElement.hitareaW() >= _X && _y +currentElement.hitareaH() >= _Y){
+ currentElement.onMouseMove( _X, _Y); // cursor
+ return true;
+ }
+ }
+ for( var i=0; i<l; i++){
+ _elm = DRAGGABLE_ELEMENT_ARRAY[ i];
+ _x = _elm.hitareaX();
+ _y = _elm.hitareaY();
+ // hitTest
+ if( _x <= _X && _y <= _Y && _x + _elm.hitareaW() >= _X && _y +_elm.hitareaH() >= _Y){
+ currentElement = _elm;
+ currentElement.onMouseMove( _X, _Y); // cursor
+ log.html( [ _X, _Y, _x, _y, i].join( ','));
+ return true;
+ }
+ }
+ currentElement = null;
+ COMIC_ELEMENT_OPERATOR.hide();
+ log.html( [ _X, _Y, _x, _y].join( ','));
+ return false;
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ var ret = currentElement !== null && currentElement.dragging() === true;
+ ret === true && currentElement.onMouseUp( _mouseX -_canvasX || canvasX, _mouseY -_canvasY || canvasY);
+ _canvasX = _canvasY = NaN;
+ return ret;
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ _canvasX = canvasX;
+ _canvasY = canvasY;
+ currentElement !== null && currentElement.onMouseDown( _mouseX -canvasX, _mouseY -canvasY);
+ return currentElement !== null;
+ },
+ onMouseClick: function( _mouseX, _mouseY){
+ return currentElement !== null &&
+ currentElement !== PANEL_RESIZER_TOP &&
+ currentElement !== PANEL_RESIZER_BOTTOM &&
+ COMIC_ELEMENT_OPERATOR.onMouseClick( _mouseX -canvasX, _mouseY -canvasY);
+ },
+ onMouseOut: function( _mouseX, _mouseY){
+ currentElement !== null && currentElement.dragging() === true && currentElement.onMouseUp( _mouseX -canvasX, _mouseY -canvasY);
+ _canvasX = _canvasY = NaN;
+ currentElement = null;
+ COMIC_ELEMENT_OPERATOR.hide();
+ return false;
+ },
+ busy: function(){
+ return currentElement !== null ? currentElement.dragging() : false;
+ },
+ createImageElement: function( url, imagesetID, x, y, z, w, h){
+ w = w || 200; //ActualWidth
+ h = h || 150; //ActualHeight
+ x = x || Math.floor( canvasW /2 -w /2);
+ y = y || Math.floor( canvasH /2 -h /2);
+ IMAGE_GROUP_EXPROLER.show( function( _url, _w, _h){
+ var _comicElement = ImageElementClass.apply( {}, [ _url, imagesetID, x, y, z || -1, w, h]);
+ appendComicElement( _comicElement);
+ _comicElement.animate( undefined, undefined, _w, _h);
+ SAVE( restoreComicElement, [ false, _comicElement], [ true, _comicElement], true);
+ });
+ },
+ createTextElement: function( type, angle, text, x, y, z, w, h){
+ type = type || 0;
+ angle = angle || 0;
+ text = text || '';
+ w = w || 200;
+ h = h || 150;
+ x = x || Math.floor( canvasW /2 -w /2 +Math.random() *10);
+ y = y || Math.floor( canvasH /2 -h /2 +Math.random() *10);
+ var _comicElement = TextElementClass.apply( {}, [ type, angle, text, x, y, z || -1, w, h]);
+ TEXT_EDITOR_CONTROL.show( _comicElement, function( _comicElement){
+ appendComicElement( _comicElement);
+ SAVE( restoreComicElement, [ false, _comicElement], [ true, _comicElement], true);
+ });
+ }
+ }
+ })( resize);
+
+ /*
+ *
+ */
+ function resize( isResizerTopAction){
+ GRID_CONTROL.resize();
+ WHITE_GLASS_CONTROL.resize();
+ PANEL_BORDER_CONTROL.resize();
+ COMIC_ELEMENT_CONTROL.resize( isResizerTopAction);
+ }
+ return {
+ init: function( _canvasW, _canvasH){
+ canvasW = _canvasW || DEFAULT_PANEL_WIDTH;
+ canvasH = _canvasH || DEFAULT_PANEL_HEIGHT;
+ canvasX = Math.floor( ( windowW -canvasW) /2);
+ canvasY = Math.floor( ( windowH -canvasH) /2);
+
+ GRID_CONTROL.init();
+ // WHITE_GLASS_CONTROL.init();
+ PANEL_BORDER_CONTROL.init();
+ COMIC_ELEMENT_CONTROL.init();
+
+ resize();
+
+ h2c.jqDocument()
+ .bind( h2c.key.SPACE_DOWN_EVENT, function(){
+ hasFocus === true && isDragging === false && COMIC_ELEMENT_CONTROL.busy() === false && updateMouseCursor( 'crosshair');
+ })
+ .bind( h2c.key.SPACE_UP_EVENT, function(){
+ hasFocus === true && COMIC_ELEMENT_CONTROL.busy() === false && updateMouseCursor( '');
+ isDragging = false;
+ });
+
+ delete CANVAS_CONTROL.init;
+ },
+ x: function(){ return canvasX;},
+ y: function(){ return canvasY;},
+ onWindowResize: function( _windowW, _windowH){
+ canvasX = Math.floor(( _windowW - canvasW) / 2);
+ canvasY = Math.floor(( _windowH - canvasH) / 2);
+ resize();
+ },
+ onMouseMove: function( _mouseX, _mouseY){
+ hasFocus = true;
+ if( isDragging === true){
+ canvasX = startCanvasX +_mouseX -xOffset;
+ canvasY = startCanvasY +_mouseY -yOffset;
+ resize();
+ } else {
+ COMIC_ELEMENT_CONTROL.onMouseMove( _mouseX, _mouseY)
+ }
+ },
+ onMouseUp: function( _mouseX, _mouseY){
+ if( COMIC_ELEMENT_CONTROL.onMouseUp( _mouseX, _mouseY) === false && isDragging === true){
+ isDragging = false;
+ updateMouseCursor( '');
+ }
+ },
+ onMouseDown: function( _mouseX, _mouseY){
+ if( COMIC_ELEMENT_CONTROL.onMouseDown( _mouseX, _mouseY) === false && isDragging === false && SPACE_ENABLED() === true){
+ xOffset = _mouseX;
+ yOffset = _mouseY;
+ startCanvasX = canvasX;
+ startCanvasY = canvasY;
+ isDragging = true;
+ updateMouseCursor( 'move');
+ }
+ },
+ onMouseClick: function( _mouseX, _mouseY){
+ COMIC_ELEMENT_CONTROL.onMouseClick( _mouseX, _mouseY)
+ },
+ onMouseOut: function( _mouseX, _mouseY){
+ if( COMIC_ELEMENT_CONTROL.onMouseOut( _mouseX, _mouseY) === false){
+
+ }
+ },
+ busy: function( _busy){
+ hasFocus = !!_busy;
+ return isDragging === true || COMIC_ELEMENT_CONTROL.busy();
+ },
+ createImageElement: function( url, imagesetID, x, y, z, w, h){
+ COMIC_ELEMENT_CONTROL.createImageElement( url, imagesetID, x, y, z, w, h);
+ },
+ createTextElement: function( type, angle, text, x, y, w, h, z){
+ COMIC_ELEMENT_CONTROL.createTextElement( type, angle, text, x, y, w, h, z);
+ }
+ }
+ })();
+
+/* ----------------------------------------
+ * Text Editor (Overlay)
+ */
+
+ var TEXT_EDITOR_CONTROL = ( function(){
+ var jqWrap, jqTextarea, jqButton,
+ textElement, onUpdateFunction;
+
+ function close(){
+ jqWrap.hide();
+ textElement = onUpdateFunction = null;
+ }
+ return {
+ init: function(){
+ this.jqWrap = jqWrap = $( '#speach-editor-wrapper').hide();
+ jqTextarea = $( '#speach-editor');
+ jqButton = $( '#speach-edit-complete-button').click( function(){
+ h2c.overlay.hide();
+ textElement && textElement.text( jqTextarea.val());
+ onUpdateFunction && onUpdateFunction( textElement);
+ close();
+ });
+ delete TEXT_EDITOR_CONTROL.init;
+ },
+ jqWrap: null,
+ show: function( _textElement, _onUpdateFunction){
+ textElement = _textElement;
+ onUpdateFunction = _onUpdateFunction || null;
+ h2c.overlay.show( this);
+ var h = _textElement.h;
+ jqWrap.show().css( {
+ left: _textElement.x +CANVAS_CONTROL.x(),
+ top: _textElement.y +CANVAS_CONTROL.y(),
+ width: _textElement.w,
+ height: h
+ });
+ jqTextarea.val( _textElement.text()).focus();
+
+ /*
+ * ie6,7は、textarea { width:100%}でも高さが変わらない。rowsを設定。
+ */
+ h2c.isIE === true && h2c.ieVersion <= 7 && setTimeout( function(){
+ var rows = 0;
+ while( jqTextarea.height() < h){
+ rows++;
+ jqTextarea.attr( 'rows', rows);
+ }
+ rows > 1 && jqTextarea.attr( 'rows', rows -1);
+ }, 0);
+ },
+ onWindowResize: function(){
+ textElement && this.show( textElement);
+ },
+ onClose: close
+ }
+ })();
+
+/* ----------------------------------------
+ * Image Group Exproler (Overlay)
+ */
+ var IMAGE_GROUP_EXPROLER = ( function(){
+ var ICON_ARRAY = [],
+ WHEEL_DELTA = 64,
+ containerW, containerH, wrapX,
+ jqWrap, jqContainer, jqItemOrigin,
+ itemW, itemH,
+ jqName, jqButton, buttonW,
+ onUpdateFunction,
+ winW,
+ onEnterInterval = null;
+
+ var BASE_PATH = h2c.LOCAL === false ? 'http://pettan.heroku.com/images/' : 'images/',
+ THUMB_PATH = BASE_PATH, // + 'thumbnail/',
+ LIMIT_FILESIZE = 1024 * 10; // 10KB
+ var IMAGE_DATA = {
+ pen001: [
+ {
+ "created_at": "2011-11-13T08:57:39Z",
+ "ext": "png",
+ "filesize": 9969,
+ "height": 463,
+ "id": 1,
+ "updated_at": "2011-11-13T08:57:39Z",
+ "width": 441
+ },
+ {
+ "created_at": "2011-11-13T08:57:54Z",
+ "ext": "gif",
+ "filesize": 5418,
+ "height": 500,
+ "id": 2,
+ "updated_at": "2011-11-13T08:57:54Z",
+ "width": 500
+ },
+ {
+ "created_at": "2011-11-13T08:58:06Z",
+ "ext": "gif",
+ "filesize": 8758,
+ "height": 464,
+ "id": 3,
+ "updated_at": "2011-11-13T08:58:06Z",
+ "width": 366
+ },
+ {
+ "created_at": "2011-11-13T08:58:23Z",
+ "ext": "gif",
+ "filesize": 9383,
+ "height": 480,
+ "id": 4,
+ "updated_at": "2011-11-13T08:58:23Z",
+ "width": 392
+ },
+ {
+ "created_at": "2011-11-13T08:58:33Z",
+ "ext": "gif",
+ "filesize": 11061,
+ "height": 500,
+ "id": 5,
+ "updated_at": "2011-11-13T08:58:33Z",
+ "width": 500
+ },
+ {
+ "created_at": "2011-11-20T09:50:43Z",
+ "ext": "gif",
+ "filesize": 1131,
+ "height": 126,
+ "id": 6,
+ "updated_at": "2011-11-20T09:50:43Z",
+ "width": 259
+ },
+ {
+ "created_at": "2011-11-20T09:50:55Z",
+ "ext": "gif",
+ "filesize": 1125,
+ "height": 126,
+ "id": 7,
+ "updated_at": "2011-11-20T09:50:55Z",
+ "width": 259
+ },
+ {
+ "created_at": "2011-11-20T11:33:12Z",
+ "ext": "gif",
+ "filesize": 17919,
+ "height": 600,
+ "id": 8,
+ "updated_at": "2011-11-20T11:33:12Z",
+ "width": 800
+ },
+ {
+ "created_at": "2011-11-20T11:33:12Z",
+ "ext": "gif",
+ "filesize": 17919,
+ "height": 600,
+ "id": 9,
+ "updated_at": "2011-11-20T11:33:12Z",
+ "width": 800
+ },
+ {
+ "created_at": "2011-11-20T11:33:12Z",
+ "ext": "gif",
+ "filesize": 17919,
+ "height": 600,
+ "id": 10,
+ "updated_at": "2011-11-20T11:33:12Z",
+ "width": 800
+ },
+ {
+ "created_at": "2011-11-20T11:33:12Z",
+ "ext": "gif",
+ "filesize": 17919,
+ "height": 600,
+ "id": 11,
+ "updated_at": "2011-11-20T11:33:12Z",
+ "width": 800
+ },
+ {
+ "created_at": "2011-11-22T09:17:20Z",
+ "ext": "gif",
+ "filesize": 9055,
+ "height": 473,
+ "id": 12,
+ "updated_at": "2011-11-22T09:17:20Z",
+ "width": 405
+ },
+ {
+ "created_at": "2011-11-22T10:11:07Z",
+ "ext": "gif",
+ "filesize": 8758,
+ "height": 464,
+ "id": 13,
+ "updated_at": "2011-11-22T10:11:07Z",
+ "width": 366
+ },
+ {
+ "created_at": "2011-11-24T09:05:12Z",
+ "ext": "gif",
+ "filesize": 6431,
+ "height": 386,
+ "id": 16,
+ "updated_at": "2011-11-24T09:05:12Z",
+ "width": 453
+ },
+ {
+ "created_at": "2011-11-26T04:52:12Z",
+ "ext": "gif",
+ "filesize": 6421,
+ "height": 426,
+ "id": 17,
+ "updated_at": "2011-11-26T04:52:12Z",
+ "width": 306
+ },
+ {
+ "created_at": "2011-11-26T04:52:12Z",
+ "ext": "gif",
+ "filesize": 6421,
+ "height": 426,
+ "id": 18,
+ "updated_at": "2011-11-26T04:52:12Z",
+ "width": 306
+ },
+ {
+ "created_at": "2011-11-26T04:52:12Z",
+ "ext": "gif",
+ "filesize": 6421,
+ "height": 426,
+ "id": 19,
+ "updated_at": "2011-11-26T04:52:12Z",
+ "width": 306
+ },
+ {
+ "created_at": "2011-11-26T04:52:12Z",
+ "ext": "gif",
+ "filesize": 6421,
+ "height": 426,
+ "id": 20,
+ "updated_at": "2011-11-26T04:52:12Z",
+ "width": 306
+ },
+ {
+ "created_at": "2011-11-26T04:52:12Z",
+ "ext": "gif",
+ "filesize": 6421,
+ "height": 426,
+ "id": 21,
+ "updated_at": "2011-11-26T04:52:12Z",
+ "width": 306
+ }
+ ]
+ }
+
+ var ImageGroupIconClass = function( INDEX, data){
+ var JQ_ICON_WRAP = jqItemOrigin.clone( true),
+ SRC = [ BASE_PATH, data.id, '.', data.ext].join( ''),
+ LOW_SRC = data.filesize && data.filesize > LIMIT_FILESIZE ? [ THUMB_PATH, data.id, '.', data.ext].join( '') : null,
+ reversibleImage = null,
+ onEnterFlag = false;
+ JQ_ICON_WRAP.children( 'div').eq( 0).html( data.filesize + 'bytes');
+ jqContainer.append( JQ_ICON_WRAP.css( { left: INDEX * itemW}));
+
+ return {
+ onEnter: function(){
+ if( onEnterFlag === true) return;
+ reversibleImage = h2c.image.createReversibleImage( LOW_SRC || SRC, itemW, itemH, function( url, imgW, imgH){
+ if( reversibleImage === null) {
+ alert( url);
+ return;
+ }
+ /*
+ * ieでサイズが取れない、、、
+ */
+ imgW = imgW || data.width || 64;
+ imgH = imgH || data.height || 64;
+ JQ_ICON_WRAP.children( 'div').eq( 1).html( imgW +'x' +imgH);
+ var zoom = 128 /( imgW > imgH ? imgW : imgH),
+ h = Math.floor( imgH *zoom),
+ w = Math.floor( imgW *zoom);
+ reversibleImage.elm.style.width = w +'px';
+ reversibleImage.elm.style.height = h +'px';
+ reversibleImage.elm.style.margin = Math.floor( itemH /2 -h /2)+'px 0 0';
+ reversibleImage.resize( w, h);
+ JQ_ICON_WRAP.click( function( e){
+ h2c.overlay.hide();
+ if (onUpdateFunction) {
+ if( LOW_SRC === null){
+ onUpdateFunction( SRC, imgW, imgH);
+ } else {
+ ( function( onUpdate){
+ h2c.util.loadImage( SRC,
+ function( _abspath, imgW, imgH){
+ onUpdate( SRC, imgW, imgH);
+ onUpdate = null;
+ },
+ function( _abspath){
+ onUpdate( SRC, data.width || 64, data.height || 64);
+ onUpdate = null;
+ }
+ );
+ })( onUpdateFunction); // close()で値が消えるので、クロージャに保持
+ }
+ }
+ close();
+ });
+ });
+ JQ_ICON_WRAP.children( 'img').replaceWith( reversibleImage.elm);
+ onEnterFlag = true;
+ },
+ destroy: function(){
+ reversibleImage && reversibleImage.destroy();
+ JQ_ICON_WRAP.remove();
+ reversibleImage = JQ_ICON_WRAP = null;
+ delete this.destroy;
+ }
+ }
+ }
+
+ function close(){
+ jqContainer.stop().animate( {
+ height: 0,
+ top: Math.floor( windowH /2)
+ }, function(){
+ jqWrap.hide()
+ });
+ while( ICON_ARRAY.length > 0){
+ ICON_ARRAY.shift().destroy();
+ }
+ onEnterInterval !== null && window.clearTimeout( onEnterInterval);
+ onUpdateFunction = onEnterInterval = null;
+ }
+ function onEnterShowImage(){
+ var l = ICON_ARRAY.length,
+ _start = -wrapX /itemW -1,
+ _end = _start + winW /itemW +1;
+ for( var i=0; i<l; ++i){
+ _start < i && i < _end && ICON_ARRAY[ i].onEnter();
+ }
+ onEnterInterval !== null && window.clearTimeout( onEnterInterval);
+ onEnterInterval = null;
+ }
+ return {
+ init: function(){
+ this.jqWrap = jqWrap = $( '#image-gruop-wrapper').hide();
+ jqContainer = $( '#image-icon-container').mousewheel(
+ function( e, delta){
+ if( winW < containerW){
+ wrapX += delta *WHEEL_DELTA;
+ wrapX = wrapX > 0 ? 0 : wrapX < winW -containerW ? winW -containerW : wrapX;
+ jqContainer.css( { left: wrapX});
+
+ onEnterInterval !== null && window.clearTimeout( onEnterInterval);
+ onEnterInterval = window.setTimeout( onEnterShowImage, 500);
+ }
+ //e.stopPropagation();
+ return false;
+ });
+ containerH = h2c.util.getElementSize( jqContainer.get( 0)).height;
+ jqItemOrigin = $( $( '#imageGruopItemTemplete').remove().html());
+ var itemSize = h2c.util.getElementSize( jqItemOrigin.get( 0));
+ itemW = itemSize.width;
+ itemH = itemSize.height;
+ jqName = $( '#gruop-name-display');
+ jqButton = $( '#image-gruop-button').click( function(){
+ h2c.overlay.hide();
+ // onUpdateFunction && onUpdateFunction( textElement);
+ close();
+ });
+ buttonW = h2c.util.getElementSize( jqButton.get( 0)).width;
+ delete IMAGE_GROUP_EXPROLER.init;
+ },
+ jqWrap: null,
+ show: function( _onUpdateFunction){
+ onUpdateFunction = _onUpdateFunction;
+ h2c.overlay.show( this);
+
+ var CURRENT_GROUP_ARRAY = IMAGE_DATA[ 'pen001'] || [],
+ l = CURRENT_GROUP_ARRAY.length;
+ for( var i=0; i<l; ++i){
+ ICON_ARRAY.push( ImageGroupIconClass.apply( {}, [ i, CURRENT_GROUP_ARRAY[ i]]));
+ }
+ wrapX = 0;
+ containerW = l * itemW;
+
+ winW = windowW;
+ var w = winW > containerW ? winW : containerW,
+ h = windowH > containerH ? containerH : windowH;
+
+ jqWrap.show();
+ jqContainer.css( {
+ width: w,
+ height: 0,
+ left: 0,
+ top: Math.floor( windowH /2)
+ }).stop().animate( {
+ height: h,
+ top: Math.floor( windowH /2 -h /2)
+ });
+
+ jqButton.css( {
+ left: Math.floor( winW /2 -buttonW /2),
+ top: Math.floor( windowH /2 +containerH /2 +10)
+ });
+
+ onEnterShowImage();
+ },
+ onWindowResize: function( _windowW, _windowH){
+ var w = _windowW > containerW ? _windowW : containerW,
+ h = _windowH > containerH ? containerH : _windowH,
+ offsetW = Math.floor( _windowW /2 -winW /2);
+ winW = _windowW;
+ if( offsetW <= 0){ // smaller
+ jqContainer.css( {
+ left: offsetW,
+ width: w
+ }).animate( {
+ left: 0,
+ top: Math.floor( _windowH /2 -h /2)
+ });
+ } else {
+ jqContainer.css( { // bigger
+ left: 0,
+ width: w,
+ borderLeftWidth: offsetW
+ }).animate( {
+ top: Math.floor( _windowH /2 -h /2),
+ borderLeftWidth: 0
+ });
+ }
+ jqButton.css( {
+ left: Math.floor( _windowW /2 -buttonW /2),
+ top: Math.floor( _windowH /2 +containerH /2 +10)
+ });
+ onEnterShowImage();
+ },
+ onClose: close
+ }
+ })();
+
+ function updateMouseCursor( _cursor){
+ if( currentCursor !== _cursor){
+ currentCursor = _cursor;
+ ELM_MOUSE_EVENT_CHATCHER.style.cursor = _cursor;
+ }
+ }
+ function centering(){
+ h2c.editor.onWindowResize( windowW, windowH);
+ }
+ function mouseEventRellay( rellayMethod, e){
+ var _mouseX = e.pageX,
+ _mouseY = e.pageY;
+ if( currentListener !== null && currentListener.busy() === true){
+ currentListener[ rellayMethod]( _mouseX, _mouseY);
+ } else {
+ currentListener = null;
+ var l = MOUSE_LISTENER_ARRAY.length,
+ _listener;
+ for( var i=0; i<l; ++i){
+ _listener = MOUSE_LISTENER_ARRAY[ i];
+ if( typeof _listener[ rellayMethod] === 'function' && _listener[ rellayMethod]( _mouseX, _mouseY) === true){
+ currentListener = _listener;
+ break;
+ } else {
+ _listener.busy( false);
+ }
+ }
+ }
+ e.stopPropagation();
+ return false;
+ }
+
+ return {
+ init: function(){
+ var jqWindow = h2c.jqWindow();
+ windowW = jqWindow.width();
+ windowH = jqWindow.height();
+
+ jqEditor = $( '#editor');
+
+ h2c.key.addKeyEvent( 96, false, true, centering);
+ h2c.key.addKeyEvent( 48, false, true, centering);
+
+ HISTORY.init();
+ MENU_BAR_CONTROL.EDIT.createSelection( 'centering', 'ctrl + 0', centering, true, true, true);
+
+ WINDOWS_CONTROL.init();
+ CANVAS_CONTROL.init();
+
+ // last
+ MENU_BAR_CONTROL.init();
+
+ TEXT_EDITOR_CONTROL.init();
+ IMAGE_GROUP_EXPROLER.init();
+ /*
+ * jqMouseEventChacher は透明な要素で、
+ * マウスイベントをcurrentElement(currentElement)に伝えるのが仕事
+ * このような実装になるのは、ここの表示オブジェクトにイベントを設定した場合、表示が追いつかずマウスカーソルが外れたタイミングでイベントが終わってしまうため。
+ */
+ /*
+ * MOUSE_LISTENER_ARRAY は、表示順に格納.手前の要素が最初
+ * MENU_BAR_CONTROL,
+ * WINDOW_CONTROL,
+ * CANVAS_CONTROL
+ * .busy() === true なら、そのままonMouseMove()にイベントを流す.これはArrayの後ろから、奥の表示要素から
+ * onMouseMove()に流してみて、false が帰れば、次にリスナーにも流す.
+ */
+ MOUSE_LISTENER_ARRAY.push( MENU_BAR_CONTROL, WINDOWS_CONTROL, CANVAS_CONTROL);
+
+ jqMouseEventChacher = $( ELM_MOUSE_EVENT_CHATCHER)
+ .mousemove( function( e){
+ return mouseEventRellay( 'onMouseMove', e);
+ }).mousedown( function( e){
+ return mouseEventRellay( 'onMouseDown', e);
+ }).mouseup( function( e){
+ return mouseEventRellay( 'onMouseUp', e);
+ }).mouseout( function( e){
+ return mouseEventRellay( 'onMouseUp', e);
+ }).click( function( e){
+ var _mouseX = e.pageX,
+ _mouseY = e.pageY;
+ if( CANVAS_CONTROL.busy() === true || WINDOWS_CONTROL.onMouseClick( _mouseX, _mouseY) === false){
+ CANVAS_CONTROL.onMouseClick( _mouseX, _mouseY);
+ }
+ e.stopPropagation();
+ return false;
+ }).css( {
+ height: windowH // ie6
+ });
+
+ delete h2c.editor.init;
+ },
+ onWindowResize: function( _windowW, _windowH){
+ windowW = _windowW;
+ windowH = _windowH;
+
+ /*
+ * ieは +'px'が不要みたい
+ */
+ jqEditor.get( 0).style.height = _windowH +'px';
+ ELM_MOUSE_EVENT_CHATCHER.style.height = _windowH +'px';
+
+ WINDOWS_CONTROL.onWindowResize( _windowW, _windowH);
+ MENU_BAR_CONTROL.onWindowResize( _windowW, _windowH);
+ CANVAS_CONTROL.onWindowResize( _windowW, _windowH);
+ },
+ MIN_WIDTH: 320,
+ MIN_HEIGHT: 320
+ }
+})();
+
+h2c.log = ( function(){
+ return {
+ init: function(){}
+ }
+})();
+
+h2c.io = ( function(){
+
+ return {
+ init: function(){}
+ }
+})();
+
+
+/*
+ * 画像一覧は
+ * お気に入り画像一覧 > tag:ペン次郎 > ペン次郎:笑う
+ * 最近アップロードされた画像 > images
+ * 最近使われた画像 > images
+ * キャラクター画像庫 > アニマル系 > tag:ペン次郎 > ペン次郎:笑う
+ * 風景画像庫 >
+ * 効果画像庫 >
+ * アイテム画像庫 >
+ *
+ * 画像一覧を読み込むタイミング
+ */
+h2c.file = ( function(){
+ var TREE_TYPE_IS_COMIC = 1,
+ TREE_TYPE_IS_IMAGE = 2,
+ TREE_TYPE_IS_SETTING = 3,
+ TREE_TYPE_IS_HELP = 4,
+ FILE_TYPE_IS_FOLDER = 1,
+ FILE_TYPE_IS_IMAGE = 2,
+ FILE_TYPE_IS_PANEL = 3,
+ FILE_TYPE_IS_SETTING = 4,
+ FILE_TYPE_IS_HTML = 5,
+ FILE_STATE_IS_UNKNOWN = 0,
+ FILE_STATE_IS_OK = 1,
+ FILE_STATE_IS_LOADING = 2,
+ FILE_STATE_IS_ERROR = 3,
+ FILE_STATE_IS_BROKEN = 4,
+ TREE_EVENT_UPDTE = 'onUpdate',
+ FILE_EVENT_UPDATED_ATTRIVUTE = 'onUpdate',
+ FILE_EVENT_GET_SEQENTIAL_FILES = 'gotSeqentilFiles',
+ FILEDATA_RESITER = [],
+ FILEDATA_ACCESS = [];
+
+ var REQUEST_CONTROLER = ( function(){
+ var REQUEST_TICKET_RESISTER = [],
+ DATA_IS_JSON = 1;
+
+ var RequestTicketClass = ( function(){
+
+ })();
+
+ return {
+ init: function(){
+ delete REQUEST_CONTROLER.init;
+ },
+ getJson: function( _url, _onLoad, _onError){
+ REQUEST_TICKET_RESISTER.push( RequestTicketClass.apply( {}, [ _url, _onLoad, _onError]));
+ }
+ }
+ })();
+ /* ----------------------
+ * folder
+ * name
+ * file [],
+ * ID( imgGroupID, comicID)
+ * ----------------------
+ *
+ * img-group(folder)
+ * name - rename,
+ * groupID,
+ * img []
+ * author, licence,
+ * create, update
+ *
+ * img
+ * name - rename
+ * src(id)
+ * groupID - updateGropuID
+ * actualWidth, actualHeight,
+ * author, licence( 'by,no-resize'),
+ * create, update, tag,
+ * actualWidth, actualHeight
+ *
+ * ----------------------
+ *
+ * comic
+ * id
+ * name - rename
+ * width
+ * editmode
+ * panel []
+ *
+ * panel
+ * comicID,
+ * seqno,
+ * height,
+ * border,
+ * elments [
+ * height,
+ * bg-color,
+ * bg-image,
+ * bg-position,
+ * bg-repeate,
+ * border,
+ * ]
+ *
+ * ----------------------
+ */
+ var FILE_CONTROLER = ( function(){
+ var FILE_EVENT_LISTENER_RESISTER = [],
+ TREE_ACCESS = [];
+
+ var TreeClass = function( TREE_ROOTFILE){
+ var UID = TREE_ACCESS.length,
+ currentFile = TREE_ROOTFILE,
+ PARENT_FILE_RESITER = [],
+ ACCESS = {
+ fileEventChatcher: dispatchFileEvent,
+ destroy: onDestroy
+ };
+
+ function dispatchFileEvent( fileEvent){
+
+ }
+ function onDestroy(){
+
+ }
+
+ TREE_ACCESS.push( ACCESS);
+
+ FILE_CONTROLER.getSeqentialFiles( currentFile);
+ return {
+ ROOT_FILE :function(){
+ return TREE_ROOTFILE;
+ },
+ currentFile: function(){
+ return currentFile;
+ },
+ hierarky: function(){
+ return PARENT_FILE_RESITER.length;
+ },
+ down: function( _index){
+ if( typeof _index !== 'number' || _index < 0 || _index >= currentFile.getChildFileLength()) return;
+ PARENT_FILE_RESITER.unshift( currentFile);
+ currentFile = currentFile.getChildFileByIndex( _index);
+ FILE_CONTROLER.getSeqentialFiles( currentFile);
+ return currentFile;
+ },
+ up: function(){
+ if( PARENT_FILE_RESITER.length === 0) return;
+ currentFile = PARENT_FILE_RESITER.shift();
+ FILE_CONTROLER.getSeqentialFiles( currentFile);
+ return currentFile;
+ },
+ addEventListener: function( UID, _eventType, _callback){
+ FILE_CONTROLER.addEventListener( UID, _eventType, _callback);
+ },
+ removeEventListener: function( UID, _eventType, _callback){
+ FILE_CONTROLER.removeEventListener( UID, _eventType, _callback);
+ },
+ createSearchResultFolder: function( _searchParam){
+
+ },
+ destroySearchResultFolder: function( _searchParam){
+
+ },
+ destroy: function(){
+ FILE_CONTROLER.destroyTree( UID);
+ }
+ }
+ };
+
+ var FileEventTicketClass = function( UID, _eventType, _callback){
+ return {
+ fileUID: UID,
+ eventType: _eventType,
+ callBack: _callback
+ }
+ }
+
+ var FileEventClass = function( eventType, file, key, value){
+ return {
+ eventType: eventType,
+ targetFile: file,
+ updatedAttribute: key,
+ updatedValue: value
+ }
+ }
+
+ function disptchFileEvent( eventType, fileUID, key, value){
+ var _fileEvent = FileEventClass.apply( {}, [ eventType, fileUID, key, value]),
+ l = TREE_ACCESS.length,
+ _tree;
+ for( var i=0; i<l; ++i){
+ _tree = TREE_ACCESS[ i];
+ _tree !== null && _tree.fileEventChatcher( _fileEvent);
+ }
+ }
+ function getFileDataAccess( UIDorFILE){
+ var l = FILEDATA_ACCESS.length,
+ i = typeof UIDorFILE === 'number' ?
+ ( UIDorFILE > 0 && UIDorFILE > l ? UIDorFILE : -1) :
+ ( function(){
+ for( var i=0; i<l; ++i){
+ if( FILEDATA_ACCESS[ i] === UIDorFILE) return i;
+ }
+ return -1;
+ })();
+ return i !== -1 ? FILEDATA_ACCESS[ i] : null;
+ }
+
+ return {
+ init: function(){
+ delete FILE_CONTROLER.init;
+ },
+ createTree: function( _rootFileData){
+ return TreeClass.apply( {}, [ _rootFileData]);
+ },
+ getFileData: function( _file){
+ var _access = getFileDataAccess( _file);
+ return _access !== null ? _access.DATA : null;
+ },
+ getSeqentialFiles: function( _uid){
+
+ },
+ updateFileAttribute: function( _uid, key, _value, _opt_callback){
+ var _fileData = getFileDataAccess( _uid),
+ _type = _fileData.TYPE;
+
+ },
+ getFileAttribute: function( _uid, KEYorKEYARRAY){
+ var _fileData = getFileDataAccess( _uid),
+ _type = _fileData.TYPE;
+ },
+ move: function( _prentUID, _targetfile, _newFolder, _newIndex, _opt_callback){
+ var _parentData = getFileDataAccess( _prentUID),
+ _parentType = _parentData.TYPE,
+ _targetData = getFileDataAccess( _targetfile),
+ _targetType = _targetData.TYPE;
+ },
+ replace: function( _uid, _file, _newIndex){
+
+ }
+ }
+ })();
+
+ /*
+ * fileのdataはobjectで保持している。
+ * h2c.file.の外からファイルをみるときは、FileClassを通して操作する。
+ * fileの変更、それに付随して追加されたイベントは、treeで管理される。
+ * treeがdestryされると、fileのイベントリスナーも全て削除される。
+ */
+
+ var FileClass = function( TREE, PARENT_FILE, DATA){
+ var TYPE = DATA.type,
+ UID = FILEDATA_ACCESS.length,
+ CHILDREN = DATA.children;
+
+ FILEDATA_ACCESS.push(
+ {
+ TYPE: TYPE,
+ DATA: DATA,
+ CHILDREN: CHILDREN,
+ destroy: function(){
+ PARENT_FILE = DATA = CHILDREN = null;
+ delete this.destroy;
+ }
+ }
+ );
+ return {
+ TYPE: function(){ return TYPE;},
+ state: function(){
+ return DATA.state !== undefined ? DATA.state : FILE_STATE_IS_OK;
+ },
+ childFileLength: function(){
+ return typeof CHILDREN === 'array' ? CHILDREN.length : 0;
+ },
+ getChildFileByIndex: function( _index){
+ if( typeof _index !== 'number' || _index < 0 || typeof CHILDREN !== 'array' || _index >= CHILDREN.length) return;
+ return FileClass.apply( {}, [ TREE, PARENT_FILE, this, CHILDREN[ _index]]);
+ },
+ getChildFileIndex: function( _FILEorFILEDATA){
+ if( typeof CHILDREN !== 'array') return -1;
+ var l = CHILDREN.length,
+ _fileData = ( function(){
+ var l = FILEDATA_RESITER.length;
+ for( var i=0; i<l; ++i){
+ if( _FILEorFILEDATA === FILEDATA_RESITER[ i]) return _FILEorFILEDATA;
+ }
+ return FILE_CONTROLER.getFileData( _FILEorFILEDATA);
+ })();
+ if( _fileData === null) return -1;
+ for( var i=0; i<l; ++i){
+ if( CHILDREN[ i] === _fileData) return i;
+ }
+ return -1;
+ },
+ isChildFile: function( _FILEorFILEDATA){
+ return this.getChildFileIndex( _FILEorFILEDATA) !== -1;
+ },
+ getAttribute: function( KEYorKEYARRAY){
+ return FILE_CONTROLER.getFileAttribute( UID, KEYorKEYARRAY);
+ },
+ getSeqentialFiles: function(){
+ FILE_CONTROLER.getSeqentialFiles( this);
+ },
+ updateAttribute: function( key, value, opt_callback){
+ TREE.updateFileAttribute( UID, key, value, opt_callback);
+ },
+ move: function( _newFolder, _newIndex, opt_callback){
+ TREE.move( PARENT_FILE, UID, _newFolder, _newIndex, opt_callback);
+ },
+ replace: function( _newIndex, opt_callback){
+ TREE.replace( PARENT_FILE, UID, _newIndex, opt_callback);
+ },
+ addEventListener: function( _eventType, _callback){
+ TREE.addEventListener( UID, _eventType, _callback);
+ },
+ removeEventListener: function( _eventType, _callback){
+ TREE.removeEventListener( UID, _eventType, _callback);
+ }
+ }
+ };
+
+ var ROOT_FILEDATA = {
+ name: 'root',
+ type: FILE_TYPE_IS_FOLDER,
+ children: []
+ },
+ IMAGE_FILEDATA = {
+ name: 'image root',
+ type: FILE_TYPE_IS_FOLDER
+ },
+ COMIC_FILEDATA = {
+ name: 'comic root',
+ type: FILE_TYPE_IS_FOLDER
+ },
+ SETTING_FILEDATA = {
+ name: 'setting root',
+ type: FILE_TYPE_IS_FOLDER
+ },
+ HELP_FILEDATA = {
+ name: 'help root',
+ type: FILE_TYPE_IS_FOLDER
+ };
+ FILEDATA_RESITER.push( ROOT_FILEDATA, IMAGE_FILEDATA, COMIC_FILEDATA, SETTING_FILEDATA, HELP_FILEDATA);
+ ROOT_FILEDATA.children.push( IMAGE_FILEDATA, COMIC_FILEDATA, SETTING_FILEDATA, HELP_FILEDATA);
+
+ var SYSTEM_TREE = FILE_CONTROLER.createTree( FileClass.apply( {}, [ null, null, ROOT_FILEDATA])),
+ ROOT_FILE = SYSTEM_TREE.ROOT_FILE(),
+ COMIC_ROOT_INDEX = ROOT_FILE.getChildFileByIndex( COMIC_FILEDATA),
+ COMIC_ROOT_FILE = ROOT_FILE.getChildFileByIndex( COMIC_ROOT_INDEX),
+ IMAGE_ROOT_INDEX = ROOT_FILE.getChildFileByIndex( IMAGE_FILEDATA),
+ IMAGE_ROOT_FILE = ROOT_FILE.getChildFileByIndex( IMAGE_ROOT_INDEX),
+ SETTING_ROOT_INDEX = ROOT_FILE.getChildFileByIndex( SETTING_FILEDATA),
+ SETTING_ROOT_FILE = ROOT_FILE.getChildFileByIndex( SETTING_ROOT_INDEX),
+ HELP_ROOT_INDEX = ROOT_FILE.getChildFileByIndex( HELP_FILEDATA),
+ HELP_ROOT_FILE = ROOT_FILE.getChildFileByIndex( HELP_ROOT_INDEX);
+
+ return {
+ init: function(){
+ REQUEST_CONTROLER.init();
+ FILE_CONTROLER.init();
+ delete h2c.file.init;
+ },
+ createTree: function( _treeType){
+ var _rootFile;
+ if( _treeType === TREE_TYPE_IS_COMIC) _rootFile = COMIC_ROOT_FILE;
+ if( _treeType === TREE_TYPE_IS_IMAGE) _rootFile = IMAGE_ROOT_FILE;
+ if( _treeType === TREE_TYPE_IS_SETTING) _rootFile = SETTING_ROOT_FILE;
+ if( _treeType === TREE_TYPE_IS_HELP) _rootFile = HELP_ROOT_FILE;
+ if( _rootFile === undefined) return;
+ return FILE_CONTROLER.createTree( _rootFile);
+ },
+ TREE_TYPE_IS_COMIC: TREE_TYPE_IS_COMIC,
+ TREE_TYPE_IS_IMAGE: TREE_TYPE_IS_IMAGE,
+ TREE_TYPE_IS_SETTING: TREE_TYPE_IS_SETTING,
+ FILE_TYPE_IS_FOLDER: FILE_TYPE_IS_FOLDER,
+ FILE_TYPE_IS_IMAGE: FILE_TYPE_IS_IMAGE,
+ FILE_TYPE_IS_PANEL: FILE_TYPE_IS_PANEL,
+ FILE_TYPE_IS_SETTING: FILE_TYPE_IS_SETTING
+ }
+})();
+
+// i18n
+// login
+// lib
+
+h2c.fn( h2c.view);
+h2c.fn( h2c.overlay);
+h2c.fn( h2c.key);
+h2c.fn( h2c.balloon);
+h2c.fn( h2c.editor);
+h2c.fn( h2c.file);
+
+$(window).ready( h2c.init);