diff --git a/ajax/libs/Han/2.2.3/fonts/zhuyin.eot b/ajax/libs/Han/2.2.3/fonts/zhuyin.eot new file mode 100644 index 000000000..b2cf183f0 Binary files /dev/null and b/ajax/libs/Han/2.2.3/fonts/zhuyin.eot differ diff --git a/ajax/libs/Han/2.2.3/fonts/zhuyin.ttf b/ajax/libs/Han/2.2.3/fonts/zhuyin.ttf new file mode 100644 index 000000000..9e52003ce Binary files /dev/null and b/ajax/libs/Han/2.2.3/fonts/zhuyin.ttf differ diff --git a/ajax/libs/Han/2.2.3/han.css b/ajax/libs/Han/2.2.3/han.css new file mode 100644 index 000000000..082530072 --- /dev/null +++ b/ajax/libs/Han/2.2.3/han.css @@ -0,0 +1,2277 @@ +@charset "UTF-8"; +/*! + * 漢字標準格式 v2.2.3 + * --- + * Hanzi-optimised CSS Mode + * + * + * + * Lisence: MIT Lisence + * Last Modified: 2014/1/1 + * + */ +/*! normalize.css v2.1.3 | MIT License | git.io/normalize */ +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ +/** + * Correct `block` display not defined in IE 8/9. + */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; } + +/** + * Correct `inline-block` display not defined in IE 8/9. + */ +audio, +canvas, +video { + display: inline-block; } + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ +audio:not([controls]) { + display: none; + height: 0; } + +/** + * Address `[hidden]` styling not present in IE 8/9. + * Hide the `template` element in IE, Safari, and Firefox < 22. + */ +[hidden], +template { + display: none; } + +/* ========================================================================== + Base + ========================================================================== */ +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ +html { + font-family: sans-serif; + /* 1 */ + -ms-text-size-adjust: 100%; + /* 2 */ + -webkit-text-size-adjust: 100%; + /* 2 */ } + +/** + * Remove default margin. + */ +body { + margin: 0; } + +/* ========================================================================== + Links + ========================================================================== */ +/** + * Remove the gray background color from active links in IE 10. + */ +a { + background: transparent; } + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ +a:focus { + outline: thin dotted; } + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ +a:active, +a:hover { + outline: 0; } + +/* ========================================================================== + Typography + ========================================================================== */ +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari 5, and Chrome. + */ +h1 { + font-size: 2em; + margin: 0.67em 0; } + +/** + * Address styling not present in IE 8/9, Safari 5, and Chrome. + */ +abbr[title] { + border-bottom: 1px dotted; } + +/** + * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. + */ +b, +strong { + font-weight: bold; } + +/** + * Address styling not present in Safari 5 and Chrome. + */ +dfn { + font-style: italic; } + +/** + * Address differences between Firefox and other browsers. + */ +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; } + +/** + * Address styling not present in IE 8/9. + */ +mark { + background: #ff0; + color: #000; } + +/** + * Correct font family set oddly in Safari 5 and Chrome. + */ +code, +kbd, +pre, +samp { + font-family: monospace, serif; + font-size: 1em; } + +/** + * Improve readability of pre-formatted text in all browsers. + */ +pre { + white-space: pre-wrap; } + +/** + * Set consistent quote types. + */ +q { + quotes: "\201C" "\201D" "\2018" "\2019"; } + +/** + * Address inconsistent and variable font size in all browsers. + */ +small { + font-size: 80%; } + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +/* ========================================================================== + Embedded content + ========================================================================== */ +/** + * Remove border when inside `a` element in IE 8/9. + */ +img { + border: 0; } + +/** + * Correct overflow displayed oddly in IE 9. + */ +svg:not(:root) { + overflow: hidden; } + +/* ========================================================================== + Figures + ========================================================================== */ +/** + * Address margin not present in IE 8/9 and Safari 5. + */ +figure { + margin: 0; } + +/* ========================================================================== + Forms + ========================================================================== */ +/** + * Define consistent border, margin, and padding. + */ +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; } + +/** + * 1. Correct `color` not being inherited in IE 8/9. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ +legend { + border: 0; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * 1. Correct font family not being inherited in all browsers. + * 2. Correct font size not being inherited in all browsers. + * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. + */ +button, +input, +select, +textarea { + font-family: inherit; + /* 1 */ + font-size: 100%; + /* 2 */ + margin: 0; + /* 3 */ } + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ +button, +input { + line-height: normal; } + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ +button, +select { + text-transform: none; } + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + /* 2 */ + cursor: pointer; + /* 3 */ } + +/** + * Re-set default cursor for disabled elements. + */ +button[disabled], +html input[disabled] { + cursor: default; } + +/** + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + /* 1 */ + padding: 0; + /* 2 */ } + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ +input[type="search"] { + -webkit-appearance: textfield; + /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + /* 2 */ + box-sizing: content-box; } + +/** + * Remove inner padding and search cancel button in Safari 5 and Chrome + * on OS X. + */ +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; } + +/** + * Remove inner padding and border in Firefox 4+. + */ +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; } + +/** + * 1. Remove default vertical scrollbar in IE 8/9. + * 2. Improve readability and alignment in all browsers. + */ +textarea { + overflow: auto; + /* 1 */ + vertical-align: top; + /* 2 */ } + +/* ========================================================================== + Tables + ========================================================================== */ +/** + * Remove most spacing between table cells. + */ +table { + border-collapse: collapse; + border-spacing: 0; } + +/* + * @font-face字體設定 + * --- + * @font-face settings + * + */ +/* --------------------------------------- + `unicode-range` + --------------------------------------- + 瀏覽器若支援,[A-Za-z]顯示為無襯線字體; + 若不支援,顯示為襯線字體。 + --------------------------------------- */ +@font-face { + font-family: han-unicode-range; + src: local(Arial), local("Droid Sans"); } + +@font-face { + font-family: han-unicode-range; + src: local("Times New Roman"), local(Times), local("Droid Serif"); + unicode-range: U+270C; } + +/* --------------------------------------- + 四大字體集及標點 + --- + The Four Typefaces & Biaodian + --------------------------------------- */ +/* --------------------------------------- + 四大字體集・黑體 + --- + The Four Typefaces: Heiti (Gothic) + --------------------------------------- */ +@font-face { + font-family: 'Han Heiti'; + src: local("Hiragino Sans GB"), local("Lantinghei TC"), local("Lantinghei SC"), local("Heiti SC"), local("Heiti TC"), local("Microsoft Yahei"), local("Microsoft Jhenghei"), local("Droid Sans Fallback"); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Heiti'; + src: local(YuGothic), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"); } + +@font-face { + font-family: 'Han Heiti CNS'; + src: local("Hiragino Sans GB"), local("Lantinghei TC"), local("Heiti TC"), local("Microsoft Jhenghei"), local("Heiti SC"), local("Lantinghei SC"), local("Microsoft Yahei"), local("Droid Sans Fallback"); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Heiti CNS'; + src: local(YuGothic), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"); } + +@font-face { + font-family: 'Han Heiti GB'; + src: local("Hiragino Sans GB"), local("Lantinghei SC"), local("Heiti SC"), local("Microsoft Yahei"), local("Droid Sans Fallback"); } + +/* ----------------------------------------- + * 粗體 + * Bold + * ----------------------------------------- */ +@font-face { + font-family: 'Han Heiti'; + font-weight: 600; + src: local("Hiragino Sans GB W6"), local(HiraginoSansGB-W6), local("Lantinghei TC Demibold"), local("Lantinghei SC Demibold"), local(FZLTXHB--B51-0), local(FZLTZHK--GBK1-0), local("Heiti SC Medium"), local("Heiti TC Medium"), local(STHeitiSC-Medium), local(STHeitiTC-Medium), local("Microsoft YaHei Bold"), local("Microsoft Jhenghei Bold"), local(MicrosoftYaHei-Bold), local(MicrosoftJhengHeiBold); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Heiti'; + font-weight: 600; + src: local("YuGothic Bold"), local("Hiragino Kaku Gothic ProN W6"), local("Hiragino Kaku Gothic Pro W6"), local(YuGo-Bold), local(HiraKakuProN-W6), local(HiraKakuPro-W6); } + +@font-face { + font-family: 'Han Heiti CNS'; + font-weight: 600; + src: local("Hiragino Sans GB W6"), local(HiraginoSansGB-W6), local("Lantinghei TC Demibold"), local("Heiti TC Medium"), local("Microsoft Jhenghei Bold"), local(FZLTXHB--B51-0), local(STHeitiTC-Medium), local(MicrosoftJhengHeiBold), local("Lantinghei SC Demibold"), local("Microsoft YaHei Bold"), local("Heiti SC Medium"), local(FZLTZHK--GBK1-0), local(STHeitiSC-Medium), local(MicrosoftYaHei-Bold); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Heiti CNS'; + font-weight: 600; + src: local("YuGothic Bold"), local(YuGo-Bold), local("Hiragino Kaku Gothic ProN W6"), local("Hiragino Kaku Gothic Pro W6"), local(HiraKakuProN-W6), local(HiraKakuPro-W6); } + +@font-face { + font-family: 'Han Heiti GB'; + font-weight: 600; + src: local("Hiragino Sans GB W6"), local(HiraginoSansGB-W6), local("Lantinghei SC Demibold"), local("Microsoft YaHei Bold"), local("Heiti SC Medium"), local(FZLTZHK--GBK1-0), local(STHeitiSC-Medium), local(MicrosoftYaHei-Bold); } + +/* ----------------------------------------- + * 解決Firefox不支援`unicode-range`及粗體調用問題 + * Solution to Firefox's `unicode-range` + * and bold font issues + * ----------------------------------------- */ +@font-face { + font-family: 'Han Heiti'; + src: local("Hiragino Sans GB"), local("Lantinghei TC"), local("Lantinghei SC"), local("Heiti SC"), local("Heiti TC"), local("Microsoft Yahei"), local("Microsoft Jhenghei"), local("Droid Sans Fallback"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Heiti'; + font-weight: 600; + src: local("Hiragino Sans GB W6"), local(HiraginoSansGB-W6), local("Lantinghei TC Demibold"), local("Lantinghei SC Demibold"), local(FZLTXHB--B51-0), local(FZLTZHK--GBK1-0), local("Heiti SC Medium"), local("Heiti TC Medium"), local(STHeitiSC-Medium), local(STHeitiTC-Medium), local("Microsoft YaHei Bold"), local("Microsoft Jhenghei Bold"), local(MicrosoftYaHei-Bold), local(MicrosoftJhengHeiBold); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Heiti CNS'; + src: local("Hiragino Sans GB"), local("Lantinghei TC"), local("Heiti TC"), local("Microsoft Jhenghei"), local("Heiti SC"), local("Lantinghei SC"), local("Microsoft Yahei"), local("Droid Sans Fallback"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Heiti CNS'; + font-weight: 600; + src: local("Hiragino Sans GB W6"), local(HiraginoSansGB-W6), local("Lantinghei TC Demibold"), local("Heiti TC Medium"), local("Microsoft Jhenghei Bold"), local(FZLTXHB--B51-0), local(STHeitiTC-Medium), local(MicrosoftJhengHeiBold), local("Lantinghei SC Demibold"), local("Heiti SC Medium"), local("Microsoft YaHei Bold"), local(FZLTZHK--GBK1-0), local(STHeitiSC-Medium), local(MicrosoftYaHei-Bold); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Heiti GB'; + src: local("Hiragino Sans GB"), local("Lantinghei SC"), local("Heiti SC"), local("Microsoft Yahei"), local("Droid Sans Fallback"); + unicode-range: U+270C; } + +/* --------------------------------------- + 四大字體集・宋體(明朝體) + --- + The Four Typefaces: Songti (Mincho) + --------------------------------------- */ +@font-face { + font-family: 'Han Songti'; + src: local("Songti SC"), local("Songti TC"), local(STSong), local("Lisong Pro"), local(SimSun), local(PMingLiU); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Songti'; + src: local(YuMincho), local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("MS Mincho"); } + +@font-face { + font-family: 'Han Songti CNS'; + src: local("Songti TC"), local("Lisong Pro"), local("Songti SC"), local(STSong), local(PMingLiU), local(SimSun); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Songti CNS'; + src: local(YuMincho), local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"); } + +@font-face { + font-family: 'Han Songti GB'; + src: local("Songti SC"), local(STSong), local(SimSun), local(PMingLiU); } + +/* ----------------------------------------- + * 粗體 + * Bold + * ----------------------------------------- */ +@font-face { + font-family: 'Han Songti'; + font-weight: 600; + src: local("STSongti SC Bold"), local("STSongti TC Bold"), local(STSongti-SC-Bold), local(STSongti-TC-Bold); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Songti'; + font-weight: 600; + src: local("YuMincho Demibold"), local("Hiragino Mincho ProN W6"), local("Hiragino Mincho Pro W6"), local(YuMin-Demibold), local(HiraMinProN-W6), local(HiraMinPro-W6); } + +@font-face { + font-family: 'Han Songti CNS'; + font-weight: 600; + src: local("STSongti TC Bold"), local("STSongti SC Bold"), local(STSongti-TC-Bold), local(STSongti-SC-Bold); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Songti CNS'; + font-weight: 600; + src: local("YuMincho Demibold"), local("Hiragino Mincho ProN W6"), local("Hiragino Mincho Pro W6"), local(YuMin-Demibold), local(HiraMinProN-W6), local(HiraMinPro-W6); } + +@font-face { + font-family: 'Han Songti GB'; + font-weight: 600; + src: local("STSongti SC Bold"), local(STSongti-SC-Bold); } + +/* ----------------------------------------- + * 解決Firefox不支援`unicode-range`及粗體調用問題 + * Solution to Firefox's `unicode-range` + * and bold font issues + * ----------------------------------------- */ +@font-face { + font-family: 'Han Songti'; + src: local("Songti SC"), local("Songti TC"), local(STSongti), local("Lisong Pro"), local("MS Mincho"), local(SimSun), local(PMingLiU); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Songti'; + font-weight: 600; + src: local("STSongti TC Bold"), local("STSongti SC Bold"), local(STSongti-TC-Bold), local(STSongti-SC-Bold); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Songti CNS'; + src: local("Songti TC"), local("Lisong Pro"), local("Songti SC"), local(STSong), local("MS Mincho"), local(PMingLiU), local(SimSun); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Songti CNS'; + font-weight: 600; + src: local("STSongti TC Bold"), local("STSongti SC Bold"), local(STSongti-TC-Bold), local(STSongti-SC-Bold); + unicode-range: U+270C; } + +@font-face { + font-family: 'Han Songti GB'; + src: local("Songti SC"), local(STSong), local(SimSun); + unicode-range: U+270C; } + +/* --------------------------------------- + 四大字體集・楷體 + --- + The Four Typefaces: Kaiti (Cursive) + --------------------------------------- */ +@font-face { + font-family: cursive; + src: local("Kaiti SC"), local(STKaiti), local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF), local(Kaiti), local(DFKai-SB); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Kaiti'; + src: local("Kaiti SC"), local(STKaiti), local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF), local(Kaiti), local(DFKai-SB); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Kaiti CNS'; + src: local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Kaiti GB'; + src: local("Kaiti SC"), local(STKaiti), local(Kai), local(Kaiti), local(DFKai-SB); } + +/* ----------------------------------------- + * 粗體 + * Bold + * ----------------------------------------- */ +@font-face { + font-family: cursive; + font-weight: 600; + src: local("Kaiti SC Bold"), local(STKaiti-SC-Bold); } + +@font-face { + font-family: 'Han Kaiti'; + font-weight: 600; + src: local("Kaiti SC Bold"), local(STKaiti-SC-Bold); } + +@font-face { + font-family: 'Han Kaiti GB'; + font-weight: 600; + src: local("Kaiti SC Bold"), local(STKaiti-SC-Bold); } + +/* --------------------------------------- + 四大字體集・仿宋體 + --- + The Four Typefaces: Fangsong + --------------------------------------- */ +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Fangsong'; + src: local(STFangsong), local(FangSong); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Fangsong CNS'; + src: local(STFangsong), local(FangSong); } + +@font-face { + unicode-range: U+4E00-9FFF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27-FA29, U+3400-4DB5, U+9FBC-9FC2, U+9FC4-9FC5, U+20000-2A6D6, U+2A700-2B734, U+2B740-2B81D, U+3040-309E, U+30A1-30FE, U+3007; + font-family: 'Han Fangsong GB'; + src: local(STFangsong), local(FangSong); } + +/* --------------------------------------- + 漢字標點 + --- + Hanzi puncuation, + ‘Biaodian’(zh) and ‘Yakumono’(ja) + -------------------------------------- + **注意:**為Windows設定的字體*必須*置於 + OS X字體設定後方。 + + **NOTE**: Font settings for Windows + should be *always* placed after tho- + se for OS X. Since there are quite a + few fonts from Windows existing on + OS X as well. + --------------------------------------- + + --------------------------------------- + 單點全形句號(.) + Fullwidth full stop + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local("MS Gothic"), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local("MS Gothic"), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local("MS Gothic"), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local("MS Gothic"), local(SimSun); + unicode-range: U+FF0E; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local(SimSun); + unicode-range: U+FF0E; } + +/* 間隔號(·) + Middle dot + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Songti SC"), local(STSong), local("Heiti SC"), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Songti SC"), local(STSong), local("Heiti SC"), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Songti SC"), local(STSong), local("Heiti SC"), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun); + unicode-range: U+00B7; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Songti SC"), local(STSong), local("Heiti SC"), local(SimSun); + unicode-range: U+00B7; } + +/* 破折號(——) + Em dash + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Yakumono Sans'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Arial Unicode MS"), local("MS Gothic"); + unicode-range: U+2014; } + +@font-face { + font-family: 'Yakumono Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("MS Mincho"), local("Microsoft Yahei"); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSong), local("Microsoft Yahei"), local(SimSun); + unicode-range: U+2014; } + +/* 省略號(……) + Ellipsis + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(Meiryo), local("MS Gothic"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local("MS Mincho"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Yakumono Sans'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(Meiryo), local("MS Gothic"); + unicode-range: U+2026; } + +@font-face { + font-family: 'Yakumono Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("MS Mincho"); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSongti), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Songti SC"), local(STSongti), local(SimSun), local(PMingLiU); + unicode-range: U+2026; } + +/* 彎引號(“‘’”) + Curve quotes + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Lisong Pro"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Lisong Pro"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Lisong Pro"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Lisong Pro"), local("Heiti SC"), local(STHeiti), local(SimSun), local(PMingLiU); + unicode-range: U+201C-201D, U+2018-2019; } + +/* 着重號(●) + Emphasis dots + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local(Georgia), local("Times New Roman"), local("Droid Sans Fallback"); + unicode-range: U+25CF; } + +/* --------------------------------------- + 進階版標點樣式修正 + --- + Advanced Correction to + Hanzi Punctuation + --------------------------------------- + * + * a. 句、逗、頓號(。,、) + * Period, comma, paused comma + * + * b. 分、冒、問、嘆號(;:?!) + * Colon, semicolon, question, exclam- + * ation marks + * + * c. 連接號、正、反斜線(-/\) + * En dash (fullwidth hyphen-minus), + * division slash, back slash + * + */ +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("MS Gothic"); + unicode-range: U+3002, U+FF0C, U+3001, U+FF1B, U+FF1A, U+FF1F, U+FF01, U+FF0D, U+FF0F, U+FF3C; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("MS Mincho"); + unicode-range: U+3002, U+FF0C, U+3001, U+FF1B, U+FF1A, U+FF1F, U+FF01, U+FF0D, U+FF0F, U+FF3C; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Heiti TC"), local("Lihei Pro"), local("Microsoft Jhenghei"), local(PMingLiU); + unicode-range: U+3002, U+FF0C, U+3001; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local("Heiti TC"), local("Lihei Pro"), local("Microsoft Jhenghei"), local(PMingLiU), local("MS Gothic"); + unicode-range: U+FF1B, U+FF1A, U+FF1F, U+FF01; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("MS Mincho"); + unicode-range: U+FF0D, U+FF0F, U+FF3C; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local(STSongti-TC-Regular), local("Lisong Pro"), local("Heiti TC"), local(PMingLiU); + unicode-range: U+3002, U+FF0C, U+3001; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local(PMingLiU), local("MS Mincho"); + unicode-range: U+FF1B, U+FF1A, U+FF1F, U+FF01, U+FF0D, U+FF0F, U+FF3C; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local("MS Gothic"); + unicode-range: U+3002, U+FF0C, U+3001, U+FF1B, U+FF1A, U+FF1F, U+FF01, U+FF0D, U+FF0F, U+FF3C; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Songti SC"), local(STSongti), local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local("Hiragino Sans GB"), local("Heiti SC"), local(STHeiti), local(SimSun), local("MS Mincho"); + unicode-range: U+3002, U+FF0C, U+3001, U+FF1B, U+FF1A, U+FF1F, U+FF01; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local(PMingLiU), local("MS Mincho"); + unicode-range: U+FF0D, U+FF0F, U+FF3C; } + +/* + * a. 引號(「『』」) + * Quotes + * + * b. 括號、書名號(()《》〈〉〔〕) + * Brackets + * + */ +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local(SimSun); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local(SimSun); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Hiragino Kaku Gothic ProN"), local("Hiragino Kaku Gothic Pro"), local(SimSun), local(PMingLiU); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Hiragino Mincho ProN"), local("Hiragino Mincho Pro"), local(SimSun); + unicode-range: U+300C-300F, U+300A-300B, U+3008-3009, U+FF08-FF09, U+3014-3015; } + +/* + * 解決Firefox不支援`Unicode-range`的問題 + * + * Solution to Firefox's `Unicode-range` + * unspported issue + --------------------------------------- */ +@font-face { + font-family: 'Biaodian Sans'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Serif'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Sans'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Serif'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Sans CNS'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Serif CNS'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Sans GB'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Biaodian Pro Serif GB'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +/* --------------------------------------- + @mixin: 四大字體集 + --- + @mixin: The Four Typefaces + --------------------------------------- + 黑體 + Heiti + --------------------------------------- */ +/* 宋體 + Songti + --------------------------------------- */ +/* 楷體 + Kaiti + --------------------------------------- */ +/* 仿宋體 + Fangsong + --------------------------------------- */ +/* --------------------------------------- + 特殊西文及數字字體 + --- + Latin Specialties & numerals + --------------------------------------- */ +/* --------------------------------------- + 襯線西文斜體 + --- + Latin italic serif + --------------------------------------- */ +@font-face { + font-family: 'Latin Italic Serif'; + src: local("Georgia Italic"), local("Times New Roman Italic"), local(Georgia-Italic), local(TimesNewRomanPS-ItalicMT), local(Times-Italic); } + +@font-face { + font-family: 'Latin Italic Serif'; + font-weight: 700; + src: local("Georgia Bold Italic"), local("Times New Roman Bold Italic"), local(Georgia-BoldItalic), local(TimesNewRomanPS-BoldItalicMT), local(Times-Italic); } + +/* --------------------------------------- + 無襯線西文斜體 + --- + Latin italic sans-serif + --------------------------------------- */ +@font-face { + font-family: 'Latin Italic Sans'; + src: local("Helvetica Neue Italic"), local("Helvetica Oblique"), local("Arial Italic"), local(HelveticaNeue-Italic), local(Helvetica-LightOblique), local(Arial-ItalicMT); } + +@font-face { + font-family: 'Latin Italic Sans'; + font-weight: 700; + src: local("Helvetica Neue Bold Italic"), local("Helvetica Bold Oblique"), local("Arial Bold Italic"), local(HelveticaNeue-BoldItalic), local(Helvetica-BoldOblique), local(Arial-BoldItalicMT); } + +/* --------------------------------------- + 數字 + --- + Numerals + --------------------------------------- + 文本數字 + Text figures + --------------------------------------- */ +@font-face { + unicode-range: U+0030-0039; + font-family: 'Numeral TF Sans'; + src: local(Skia), local("Neutraface 2 Text"), local(Candara), local(Corbel); } + +@font-face { + unicode-range: U+0030-0039; + font-family: 'Numeral TF Serif'; + src: local(Georgia), local("Hoefler Text"), local("Big Caslon"); } + +/* 等高數字 + Lining figures + --------------------------------------- */ +@font-face { + unicode-range: U+0030-0039; + font-family: 'Numeral LF Sans'; + src: local("Helvetica Neue"), local(Helvetica), local(Arial); } + +@font-face { + unicode-range: U+0030-0039; + font-family: 'Numeral LF Serif'; + src: local(Palatino), local("Palatino Linotype"), local("Times New Roman"); } + +/* ----------------------------------------- + * 解決Firefox不支援`unicode-range`的問題 + * Solution to Firefox's `unicode-range` + * issues + * ----------------------------------------- */ +@font-face { + font-family: 'Numeral TF Sans'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Numeral TF Serif'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Numeral LF Sans'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +@font-face { + font-family: 'Numeral LF Serif'; + src: local("Lying to Firefox"); + unicode-range: U+270C; } + +/* --------------------------------------- + 注音符號 + --- + Zhuyin + --------------------------------------- */ +/* --------------------------------------- + 注音符號 + --- + Zhuyin + --------------------------------------- */ +@font-face { + unicode-range: U+3105-312D, U+31A0-31BA, U+02D9, U+02CA, U+02C5, U+02C7, U+02CB, U+02EA-02EB; + font-family: 'Zhuyin Kaiti'; + src: url("./fonts/zhuyin.eot") format("embedded-opentype"), url("./fonts/zhuyin.ttf") format("truetype"), local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF), local(PMingLiU); } + +@font-face { + unicode-range: U+3105-312D, U+31A0-31BA, U+02D9, U+02CA, U+02C5, U+02C7, U+02CB, U+02EA-02EB; + font-family: 'Zhuyin Heiti'; + src: local("Hiragino Sans GB"), local("Microsoft Jhenghei"), url("./fonts/zhuyin.eot") format("embedded-opentype"), url("./fonts/zhuyin.ttf") format("truetype"), local(PMingLiU), local(SimSun), local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF); } + +@font-face { + font-family: 'Zhuyin Heiti'; + src: local("Heiti TC"), local("Microsoft Jhenghei"), url("./fonts/zhuyin.eot") format("embedded-opentype"), url("./fonts/zhuyin.ttf") format("truetype"), local(PMingLiU), local(SimSun), local(BiauKai), local("標楷體"), local(DFKaiShu-SB-Estd-BF); + unicode-range: U+3127, U+02C7, U+02CA-B, U+02D9; } + +/* + * 以語言為基礎的元素樣式修正 + * --- + * Language-based style correction, + * Hanzi-optimised CSS Mode + * + */ + /* --------------------------------------- + 變數設定 + --- + Variables + --------------------------------------- + 顏色 + Colours + --------------------------------------- */ +/* --------------------------------------- + 針對normalize.css的改進 + --- + Improvements aim to normalize.css + --------------------------------------- */ +dfn { + font-style: inherit; + font-weight: bold; } + +/* 增進code區塊的可讀性 + Enhances the readability of code blocks + --------------------------------------- */ +pre code { + display: block; + overflow: auto; + white-space: pre; + word-wrap: normal; } + +/* --------------------------------------- + $(selector).charize() + --------------------------------------- + 避頭尾點 + Line breaking rules on punctuation + --------------------------------------- */ +.han-js-charized span.char, +.han-js-bitouwei-rendered span.bitouwei { + display: inline-block; + text-indent: 0; } + +.han-js-charized span.char.space, +.han-js-charized span.char > span { + display: inline; } + +/* --------------------------------------- + 底線 + --- + Underlines + --------------------------------------- + 註記元素(u)及兩相鄰時的底線區別(u+u) + Annotations and adjacent ones + --------------------------------------- */ +:lang(zh) u, +:lang(ja) u { + letter-spacing: 0; + border-bottom: 1px solid; + padding-bottom: 0.05em; + text-decoration: none; } + +u + u { + margin-left: .125em; } + +html.han-js-rendered u + u { + margin-left: 0; } + +html.han-js-rendered u.adjacent { + margin-left: .125em; } + +/* 實驗性功能 */ +/* 避免`border-box` reset的問題 */ +.han-js-rendered.han-lab-underline u, +.han-js-rendered.han-lab-underline u *, +.han-js-rendered.han-lab-underline u *:before, +.han-js-rendered.han-lab-underline u *:after { + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; } + +u.han-js-charized { + border-bottom: 0 none; + text-decoration: none; } + u.han-js-charized span.char:not(:first-of-type):not(:last-of-type) span, + u.han-js-charized hanla, + u.han-js-charized span.char:first-of-type span:after, + u.han-js-charized span.char:last-of-type span:after { + border-bottom: 1px solid; + padding-bottom: .125em; } + u.han-js-charized span.char:first-of-type span, + u.han-js-charized span.char:last-of-type span { + position: relative; } + u.han-js-charized span.char:first-of-type span:after, + u.han-js-charized span.char:last-of-type span:after { + content: ''; + display: inline-block; + left: 0; + margin-left: 1px; + position: absolute; + top: 0; + height: 100%; + width: -moz-calc(100% - 1px ); + width: -webkit-calc(100% - 1px ); + width: calc(100% - 1px ); } + u.han-js-charized span.char:last-of-type span:after { + margin: 0 1px 0 0; } + u.han-js-charized span.char:first-child:last-child span:after { + margin: 0 1px 0; + width: -moz-calc(100% - 2px ); + width: -webkit-calc(100% - 2px ); + width: calc(100% - 2px ); } + u.han-js-charized :not(:first-child) span.char:first-of-type span:after, + u.han-js-charized :not(:last-child) span.char:last-of-type span:after, + u.han-js-charized span.char:not(:first-child):first-of-type span:after, + u.han-js-charized span.char:not(:last-child):last-of-type span:after { + border-bottom: 0; } + u.han-js-charized :not(:first-child) span.char:first-of-type span, + u.han-js-charized :not(:last-child) span.char:last-of-type span, + u.han-js-charized span.char:not(:first-child):first-of-type span, + u.han-js-charized span.char:not(:last-child):last-of-type span { + border-bottom: 1px solid; + padding-bottom: .125em; } + u.han-js-charized hanla:first-child, + u.han-js-charized hanla:last-child { + border: 0 none; } + u.han-js-charized :not(:first-child) hanla:first-child, + u.han-js-charized :not(:last-child) hanla:last-child { + border: 1px solid; } + +/* 重新定製「連結、插入元素」的樣式 + Re-styles anchors and additions + --------------------------------------- */ +html:lang(zh) a:link, +html:lang(zh) a:visited, +html:lang(zh) a:hover, +html:lang(zh) a:active, +html:lang(zh) ins { + text-decoration: inherit; } +html:lang(zh) ins { + border-bottom: 3px double lightgrey; + padding-bottom: .05em; } + +/* --------------------------------------- + 文章內的「標題、一般及詩篇段落、清單等」 + --- + Headings, paragraphs and lists + in article + --------------------------------------- + 四、五號標題 + Headings of level 4 and 5 + --------------------------------------- */ +article h4, +article h5 { + margin: 1em 0; } + +article h4 + h5 { + margin-top: -.5em; } + +/* 段落及清單 + Paragraphs and lists + --------------------------------------- */ +article p, +article li { + line-height: 2; + text-align: justify; } + +article:lang(zh) p.poem-like, +article:lang(zh).poem-like p, +article:lang(zh) .poem-like p, +article:lang(ja) p.poem-like, +article:lang(ja).poem-like p, +article:lang(ja) .poem-like p { + text-indent: 0; + margin-left: 2em; } + +article:lang(ja) p.poem-like, +article:lang(ja).poem-like p, +article:lang(ja) .poem-like p { + margin-left: 1em; } + +article:lang(zh) ol, +article:lang(zh) ul, +article:lang(ja) ol, +article:lang(ja) ul { + margin: .5em 0 .5em 0; + padding: 0; } + article:lang(zh) ol > li, + article:lang(zh) ul > li, + article:lang(ja) ol > li, + article:lang(ja) ul > li { + margin-left: 2em; + padding: 0; } + +article h4 + ul, +article h4 + ol, +article h5 + ul, +article h5 + ol, +article h6 + ul, +article h6 + ol { + margin-top: -.5em; } + +article:lang(ja) ol, +article:lang(ja) ul { + margin-left: 1em; + padding-left: 1.5em; } + article:lang(ja) ol > li, + article:lang(ja) ul > li { + margin-left: 1em; } + +/* --------------------------------------- + 漢拉間隙 + --- + Kerning between Hanzi and Latin letter + --------------------------------------- */ +hanla, +html:not(.han-la) hanla { + display: none; } + +html.han-la hanla:lang(zh), +html.han-la hanla:lang(ja) { + display: inline; + position: static; } + +html.han-la hanla:after { + content: ' '; + display: inline; + font-size: 1ch; + font-size: -webkit-calc(.25em ); } + +html.han-la code hanla:after, +html.han-la pre hanla:after, +html.han-la kbd hanla:after, +html.han-la samp hanla:after, +html.han-la ol > hanla:after, +html.han-la ul > hanla:after { + display: none; } + +/* --------------------------------------- + 書名號(*棄用) + --- + Cites (*deprecated) + --------------------------------------- + * + * 1. 修正Webkit下的字體fallback + * Corrects font fallback on WebKit + * + */ +cite:lang(zh), +cite:lang(ja), +cite:lang(en).piece { + font-style: inherit; } + +cite:lang(zh):before, +cite:lang(zh):after { + content: '《'; + font-family: inherit; + /* 1 */ + line-height: inherit; } + +cite:lang(zh):after { + content: '》'; } + +cite:lang(zh).piece:before { + content: '〈'; } + +cite:lang(zh).piece:after { + content: '〉'; } + +cite:lang(ja):before { + content: '『'; } + +cite:lang(ja):after { + content: '』'; } + +cite:lang(ja).piece:before { + content: '「'; } + +cite:lang(ja).piece:after { + content: '」'; } + +cite:lang(en).piece:before, +cite:lang(en).piece:after { + content: '“'; + font-family: inherit; + /* 1 */ } + +cite:lang(en).piece:after { + content: '”'; } + +cite:lang(en-GB).piece:before { + content: '‘'; } + +cite:lang(en-GB).piece:after { + content: '’'; } + +.no-cite-mark cite:before, +.no-cite-mark cite:after, +cite.no-cite-mark:before, +cite.no-cite-mark:after { + content: '' !important; } + +/* --------------------------------------- + 着重號 + --- + Emphases + --------------------------------------- + * + * 1. Fallback + * + */ +em:lang(zh), +em:lang(ja) { + font-style: inherit; + border-bottom-style: dotted; + border-bottom-width: 2px; + padding-bottom: .05em; + -moz-text-emphasis: circle; + -webkit-text-emphasis: circle; + text-emphasis: circle; + -moz-text-emphasis-position: under; + -webkit-text-emphasis-position: under; + text-emphasis-position: under; + border-bottom-width: -webkit-calc(0px ); } + em:lang(zh) span.biaodian, + em:lang(ja) span.biaodian { + -moz-text-emphasis: none; + -webkit-text-emphasis: none; + text-emphasis: none; + -moz-text-emphasis-position: under; + -webkit-text-emphasis-position: under; + text-emphasis-position: under; } + +em:lang(ja) { + -moz-text-emphasis: sesame; + -webkit-text-emphasis: sesame; + text-emphasis: sesame; + -moz-text-emphasis-position: over; + -webkit-text-emphasis-position: over; + text-emphasis-position: over; } + +.han-js-rendered em:lang(zh), +.han-js-rendered em:lang(ja) { + border-bottom-width: 0; + padding-bottom: auto; } + +.no-textemphasis em:lang(zh) span.char { + font-style: inherit; + position: relative; } + +.no-textemphasis em:lang(zh) span.char:after { + display: inline-block; + left: 0; + margin: .4em 0 0 0; + overflow: hidden; + position: absolute; + text-indent: 0; + top: 0; + height: 1.9em; + content: '・'; + font-style: normal; + font-weight: normal; + line-height: 1.9em; + text-decoration: none; } + +.no-textemphasis em:lang(ja) span.char:after { + content: '、'; + margin: -1.55em 0 0 .32em; + overflow: inherit; } + +.no-textemphasis em:lang(zh) span.latin:after { + margin: .4em 0 0 -.25em; } + +.no-textemphasis em:lang(ja) span.latin:after { + margin: -1.5em 0 0 .1em; } + +.no-textemphasis :lang(zh) em span.space:after, +.no-textemphasis :lang(ja) em span.space:after, +.no-textemphasis :lang(zh) em span.biaodian:after, +.no-textemphasis :lang(ja) em span.biaodian:after { + content: none; } + +:not(:lang(zh)):not(:lang(ja)) em, +:not(:lang(zh)):not(:lang(ja)) em { + -moz-text-emphasis: none; + -webkit-text-emphasis: none; + text-emphasis: none; + -moz-text-emphasis-position: under; + -webkit-text-emphasis-position: under; + text-emphasis-position: under; + font-style: italic; } + +.no-textemphasis :not(:lang(zh)):not(:lang(ja)) em span.char:after { + content: none; } + +/* --------------------------------------- + 變音文字 + --- + Alternative voices + --------------------------------------- + * + * 1. 如果系統不支援楷體 + * If Kaiti is not supported + * + */ +:lang(zh) i, +:lang(ja) i, +i:lang(zh), +i:lang(ja) { + font-style: inherit; } + +i:lang(zh), +i:lang(ja) { + font-family: cursive, serif; } + +.no-fontface-kaiti i:lang(zh), +.no-fontface-kaiti i:lang(ja) { + font-family: serif; + border-bottom: 3px double lightgrey; + padding-bottom: .05em; } + +/* --------------------------------------- + 文章內重點 + --- + Importance in article + --------------------------------------- */ +article strong:lang(zh), +article strong:lang(ja) { + font-family: sans-serif; + font-weight: bold; } + +/* --------------------------------------- + 引用 + --- + Quotes + --------------------------------------- + 行內引言 + Inline quotation + --------------------------------------- */ +q { + quotes: '“' '”' '‘' '’' '“' '”' '‘' '’' '“' '”' '‘' '’'; } + q:lang(zh), q:lang(ja) { + quotes: '「' '」' '『' '』' '「' '」' '『' '』' '「' '」' '『' '』'; } + q:lang(zh-CN), q:lang(zh-Hans), q:lang(en) { + quotes: '“' '”' '‘' '’' '“' '”' '‘' '’' '“' '”' '‘' '’'; } + q:lang(en-GB) { + quotes: '‘' '’' '“' '”' '‘' '’' '“' '”' '‘' '’' '“' '”'; } + q:before { + content: open-quote; } + q:after { + content: close-quote; } + +/* 區塊引用 + Block quotes + --------------------------------------- + 文章內的區塊引用 + In articles + --------------------------------------- */ +article:lang(zh) blockquote, +article:lang(ja) blockquote { + font-family: serif; + margin: 1.5em 0 1.5em 2em; + width: auto; } + +/* 引用中的引用 + Blockquote hierarchies + --------------------------------------- */ +article:lang(zh) blockquote blockquote { + margin: 1em 0 1em 2em; } + +article:lang(ja) blockquote blockquote { + margin: 1em 0 1em 1em; } + +/* 文章區塊下描述元素內的區塊引用 + In article figures + --------------------------------------- */ +article:lang(zh) figure blockquote, +article:lang(ja) figure blockquote { + font-family: serif; + font-size: 1.25em; + margin: .5em 0 0; + padding: 7px; } + article:lang(zh) figure blockquote blockquote, + article:lang(ja) figure blockquote blockquote { + margin: inherit; } + article:lang(zh) figure blockquote p, + article:lang(ja) figure blockquote p { + margin: .2em 0; } + +article:lang(zh) figure figcaption, +article:lang(ja) figure figcaption { + border-top: 1px solid lightgrey; + clear: both; + color: #666; + font: .85em normal sans-serif; + padding-top: .25em; + text-align: justify; } + +/* --------------------------------------- + 漢字註音 + --- + Hanzi Rubies + --------------------------------------- + 羅馬拼音 + Romanisation + --------------------------------------- */ +html.han-js-rendered ruby rt:before, +html.han-js-rendered ruby rt:after { + content: ''; } + +html.ruby ruby rt { + padding: 0 .2em; } + +html.no-ruby ruby { + display: inline-block; + line-height: 1.2; + text-indent: 0; + vertical-align: 1.15em; } + +html.no-ruby ruby, +html.no-ruby ruby .rt { + text-indent: 0; } + +html.no-ruby ruby .rr { + display: inline-table; + text-align: center; } + +html.no-ruby ruby .rb { + display: table-row-group; } + +html.no-ruby ruby:not(.mps) .rt { + display: table-header-group; + font-size: .8em; + line-height: normal; + padding: 0 .05em; + white-space: nowrap; } + +html.no-ruby ruby .rt:empty:after { + content: ' '; + display: inherit; } + +/* 橫式注音符號 + Zhuyin (left-to-right) + --------------------------------------- */ +ruby.mps-ltr rt, +ruby.mps-ltr .rt { + font-family: cursive, serif; } + +/* --------------------------------------- + 代碼元素 + --- + Code + --------------------------------------- */ +code, +kbd, +pre, +samp { + font-family: monospace, sans-serif; } + +/* --------------------------------------- + 在小視窗瀏覽器上(如手持裝置)的微調 + --- + Adjustments to small-width windows + (i.e., mobile devices) + --------------------------------------- */ +@media only screen and (max-width: 480px), only screen and (device-aspect-ratio: 2 / 3), only screen and (device-aspect-ratio: 40 / 71) { + article:lang(zh).poem-like p, + article:lang(zh) .poem-like p, + article:lang(zh) p.poem-like, + article:lang(zh) ol > li, + article:lang(zh) ul > li { + margin-left: 1em; + padding: 0; } + + article:lang(zh) blockquote { + margin-left: 1em; } + + article:lang(zh) blockquote blockquote { + margin-left: 1em; + padding-left: 1em; } } +/* + * 字體設定 + * --- + * Font settings + * + */ + /* --------------------------------------- + 變數設定 + --- + Variables + --------------------------------------- + 預設字體fallback + Default font fallback + --------------------------------------- */ +/* 基本元素的標點樣式修正 */ +html:lang(zh), +button:lang(zh), +input:lang(zh), +select:lang(zh), +textarea:lang(zh) { + font-family: "Biaodian Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html:lang(ja), +button:lang(ja), +input:lang(ja), +select:lang(ja), +textarea:lang(ja) { + font-family: "Yakumono Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } + +html.han-biaodian-pro, +html.han-biaodian-pro button, +html.han-biaodian-pro input, +html.han-biaodian-pro select, +html.han-biaodian-pro textarea { + font-family: "Biaodian Pro Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html.han-biaodian-pro-cns, +html.han-biaodian-pro-cns button, +html.han-biaodian-pro-cns input, +html.han-biaodian-pro-cns select, +html.han-biaodian-pro-cns textarea { + font-family: "Biaodian Pro Sans CNS", "Helvetica Neue", Helvetica, Arial, "Han Heiti CNS", sans-serif; } + +html.han-biaodian-pro-gb, +html.han-biaodian-pro-gb button, +html.han-biaodian-pro-gb input, +html.han-biaodian-pro-gb select, +html.han-biaodian-pro-gb textarea { + font-family: "Biaodian Pro Sans GB", "Helvetica Neue", Helvetica, Arial, "Han Heiti GB", sans-serif; } + +html:lang(zh) :not(:lang(zh)):not(:lang(ja)), +html:lang(ja) :not(:lang(zh)):not(:lang(ja)), +html.han-biaodian-pro :not(:lang(zh)):not(:lang(ja)), +html.han-biaodian-pro-cns :not(:lang(zh)):not(:lang(ja)) { + font-family: "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +/* 書名號 */ +/* + * 1. Corrects font fallback on WebKit + */ +cite:lang(en).piece:before, +cite:lang(en).piece:after { + font-family: Georgia, Times, "Times New Roman", serif; + /* 1 */ } + +/* 着重號 */ +/* 不支援CSS着重號`text-emphasis`的hack所使用的着重號字體 */ +.no-textemphasis :lang(zh) em span.cjk:after, +.no-textemphasis :lang(ja) em span.cjk:after, +.no-textemphasis :lang(zh) em span.latin:after, +.no-textemphasis :lang(ja) em span.latin:after { + font-family: 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', 'MS Mincho', MS-Mincho, serif !important; } + +/* 變音文字 */ +i:lang(zh) { + font-family: 'Biaodian Serif', 'Latin Italic Serif', 'Han Kaiti', cursive, serif; } + +article blockquote i:lang(zh) { + font-family: 'Biaodian Sans', 'Latin Italic Sans', sans-serif; } + +html.han-biaodian-pro i:lang(zh) { + font-family: 'Biaodian Pro Serif', 'Latin Italic Serif', 'Han Kaiti', cursive, serif; } + +html.han-biaodian-pro-cns i:lang(zh) { + font-family: 'Biaodian Pro Sans CNS', 'Latin Italic Serif', 'Han Kaiti', cursive, serif; } + +html.han-biaodian-pro article blockquote i:lang(zh) { + font-family: "Biaodian Pro Sans", "Latin Italic Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html.han-biaodian-pro-cns article blockquote i:lang(zh) { + font-family: "Biaodian Pro Sans CNS", "Latin Italic Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +i:lang(ja) { + font-family: 'Yakumono Serif', 'Latin Italic Serif', 'Han Kaiti', cursive, serif; } + +article blockquote i:lang(ja), +html.han-biaodian-pro i:lang(ja), +html.han-biaodian-pro-cns i:lang(ja), +html.han-biaodian-pro article blockquote i:lang(ja), +html.han-biaodian-pro-cns article blockquote i:lang(ja) { + font-family: "Yakumono Sans", "Latin Italic Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } + +:lang(zh) i:not(:lang(zh)):not(:lang(ja)), +:lang(zh) i :not(:lang(zh)):not(:lang(ja)), +:lang(ja) i:not(:lang(zh)):not(:lang(ja)), +:lang(ja) i :not(:lang(zh)):not(:lang(ja)) { + font-family: "Latin Italic Serif", Georgia, Times, "Times New Roman", serif; } + +article:lang(zh) blockquote i:not(:lang(zh)):not(:lang(ja)), +article:lang(zh) blockquote i :not(:lang(zh)):not(:lang(ja)), +article:lang(ja) blockquote i:not(:lang(zh)):not(:lang(ja)), +article:lang(ja) blockquote i :not(:lang(zh)):not(:lang(ja)) { + font-family: "Latin Italic Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } + +:not(:lang(zh)):not(:lang(ja)) i:not(:lang(zh)):not(:lang(ja)), +:not(:lang(zh)):not(:lang(ja)) i :not(:lang(zh)):not(:lang(ja)), +:not(:lang(zh)):not(:lang(ja)) i:not(:lang(zh)):not(:lang(ja)), +:not(:lang(zh)):not(:lang(ja)) i :not(:lang(zh)):not(:lang(ja)) { + font-family: inherit; + font-style: italic; } + +/* 如果系統不支援楷體 */ +/* If Kaiti is not supported in users' OS. */ +.no-fontface-kaiti i:lang(zh), +.no-fontface-kaiti i:lang(ja) { + font-family: "Biaodian Serif", "Biaodian Sans", "Latin Italic Serif", Georgia, Times, "Times New Roman", "Han Songti", serif; } + +.no-fontface-kaiti i:lang(ja) { + font-family: "Yakumono Serif", "Yakumono Sans", "Latin Italic Serif", Georgia, Times, "Times New Roman", serif; } + +html.han-biaodian-pro.no-fontface-kaiti i:lang(zh) { + font-family: "Biaodian Pro Serif", "Biaodian Pro Sans", "Latin Italic Serif", Georgia, Times, "Times New Roman", "Han Songti", serif; } + +html.han-biaodian-pro-cns.no-fontface-kaiti i:lang(zh) { + font-family: "Biaodian Pro Serif CNS", "Biaodian Pro Sans CNS", "Latin Italic Serif", Georgia, Times, "Times New Roman", "Han Songti", serif; } + +/* 文章內重點(article strong) */ +article strong:lang(zh), +article strong:lang(ja) { + font-family: "Biaodian Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +article strong:lang(ja) { + font-family: "Yakumono Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } + +html.han-biaodian-pro article strong:lang(zh) { + font-family: "Biaodian Pro Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html.han-biaodian-pro-cns article strong:lang(zh) { + font-family: "Biaodian Pro Sans CNS", "Helvetica Neue", Helvetica, Arial, "Han Heiti CNS", sans-serif; } + +html.han-biaodian-pro-gb article strong:lang(zh) { + font-family: "Biaodian Pro Sans GB", "Helvetica Neue", Helvetica, Arial, "Han Heiti GB", sans-serif; } + +article strong:not(:lang(zh)):not(:lang(ja)), +html.han-biaodian-pro article strong:not(:lang(zh)):not(:lang(ja)), +html.han-biaodian-pro-cns article strong:not(:lang(zh)):not(:lang(ja)) { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } + +/* 文章內的區塊引用(blockquote) */ +article:lang(zh) blockquote, +article:lang(ja) blockquote { + font-family: "Biaodian Serif", Georgia, Times, "Times New Roman", "Han Kaiti", cursive, "標楷體", serif; } + +html.han-biaodian-pro article blockquote { + font-family: 'Biaodian Pro Serif', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Kaiti', cursive, serif; } + +html.han-biaodian-pro-cns article blockquote { + font-family: 'Biaodian Pro Serif CNS', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Kaiti CNS', cursive, serif; } + +html.han-biaodian-pro-gb article blockquote { + font-family: 'Biaodian Pro Serif GB', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Kaiti GB', cursive, serif; } + +article blockquote:lang(ja), +html.han-biaodian-pro article blockquote:lang(ja), +html.han-biaodian-pro-cns article blockquote:lang(ja) { + font-family: "Yakumono Serif", Georgia, Times, "Times New Roman", "Han Kaiti", cursive, "標楷體", serif; } + +article:lang(zh) blockquote:not(:lang(zh)):not(:lang(ja)), +article:lang(zh) blockquote :not(:lang(zh)):not(:lang(ja)), +article:lang(ja) blockquote:not(:lang(zh)):not(:lang(ja)), +article:lang(ja) blockquote :not(:lang(zh)):not(:lang(ja)) { + font-family: Georgia, Times, "Times New Roman", "Han Kaiti", cursive, "標楷體", serif; } + +/* 描述元素內的區塊引用 */ +figure:lang(zh) blockquote, +figure:lang(ja) blockquote, +figure:lang(zh) blockquote blockquote +figure:lang(ja) blockquote blockquote { + font-family: "Biaodian Serif", Georgia, Times, "Times New Roman", "Han Songti", serif; } + +html.han-biaodian-pro figure:lang(zh) blockquote { + font-family: 'Biaodian Pro Serif', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Songti', serif; } + +html.han-biaodian-pro-cns figure:lang(zh) blockquote { + font-family: 'Biaodian Pro Serif CNS', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Songti CNS', serif; } + +html.han-biaodian-pro-gb figure:lang(zh) blockquote { + font-family: 'Biaodian Pro Serif GB', 'Numeral LF Serif', Georgia, 'Times New Roman', 'Han Songti GB', serif; } + +figure:lang(ja) blockquote, +figure:lang(ja) blockquote blockquote, +html.han-biaodian-pro figure:lang(ja) blockquote, +html.han-biaodian-pro-cns figure:lang(ja) blockquote { + font-family: 'Yakumono Serif', 'Numeral LF Serif', Georgia, 'Times New Roman', serif; } + +figure:lang(zh) blockquote:before, +figure:lang(ja) blockquote:before { + font: 3em bold Georgia, Times, "Times New Roman", serif; } + +figure figcaption { + font: 0.85em normal "Biaodian Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html.han-biaodian-pro figure:lang(zh) figcaption { + font-family: "Biaodian Pro Sans", "Helvetica Neue", Helvetica, Arial, "Han Heiti", sans-serif; } + +html.han-biaodian-pro-cns figure:lang(zh) figcaption { + font-family: "Biaodian Pro Sans CNS", "Helvetica Neue", Helvetica, Arial, "Han Heiti CNS", sans-serif; } + +html.han-biaodian-pro-gb figure:lang(zh) figcaption { + font-family: "Biaodian Pro Sans GB", "Helvetica Neue", Helvetica, Arial, "Han Heiti GB", sans-serif; } + +html.han-biaodian-pro figure:lang(ja) figcaption, +html.han-biaodian-pro-cns figure:lang(ja) figcaption { + font-family: "Yakumono Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } + +/* 代碼(code) */ +code, +kbd, +pre, +samp { + font-family: Courier, monospace, sans-serif; } + code:lang(zh), + kbd:lang(zh), + pre:lang(zh), + samp:lang(zh) { + font-family: 'Biaodian Sans', Courier, 'Han Heiti', monospace, sans-serif; } + code:lang(ja), + kbd:lang(ja), + pre:lang(ja), + samp:lang(ja) { + font-family: 'Yakumono Sans', Courier, monospace, sans-serif; } + html.han-biaodian-pro code, html.han-biaodian-pro + kbd, html.han-biaodian-pro + pre, html.han-biaodian-pro + samp { + font-family: 'Biaodian Pro Sans', Courier, 'Han Heiti', monospace, sans-serif; } + html.han-biaodian-pro-cns code, html.han-biaodian-pro-cns + kbd, html.han-biaodian-pro-cns + pre, html.han-biaodian-pro-cns + samp { + font-family: 'Biaodian Pro Sans CNS', Courier, 'Han Heiti CNS', monospace, sans-serif; } + html.han-biaodian-pro-gb code, html.han-biaodian-pro-gb + kbd, html.han-biaodian-pro-gb + pre, html.han-biaodian-pro-gb + samp { + font-family: 'Biaodian Pro Sans GB', Courier, 'Han Heiti GB', monospace, sans-serif; } + code:not(:lang(zh)):not(:lang(ja)), + code :not(:lang(zh)):not(:lang(ja)), + kbd:not(:lang(zh)):not(:lang(ja)), + kbd :not(:lang(zh)):not(:lang(ja)), + pre:not(:lang(zh)):not(:lang(ja)), + pre :not(:lang(zh)):not(:lang(ja)), + samp:not(:lang(zh)):not(:lang(ja)), + samp :not(:lang(zh)):not(:lang(ja)) { + font-family: Courier, 'Han Heiti', monospace, sans-serif; } + +/* `` + * + */ +hruby { + display: inline; + /* + * 實驗性註記元素(底線) + * Laboratory annotations + * + */ + /* + * 隱藏的``元素,利於複製貼上 + * Hidden `` elements, + * in order to copy and paste + * + */ + /* + * 羅馬拼音或文字註記 + * Romanization & annotations + * + */ + /* + * 複合式文字註記 + * Complex annotations + * + */ + /* + * 拼、注音直角共同顯示 + * Right-angle + * Romanization & Zhuyin + * + */ + /* + * 國語注音、台灣方言音符號 + * Zhuyin + * + */ + /* 依通用字體集選用注音字體 + * Define Zhuyin font according to + * its parental generic family */ + /* 注音及方言音符號 + * Zhuyin + *** + * a. 偽類`:before`為「注音符」 + * b. 偽類`:after`為「音調」 */ } + u.han-js-charized hruby, + hruby u.han-js-charized { + border-bottom: 1px solid; + padding-bottom: 0.125em; } + u.han-js-charized hruby span.char span, + hruby u.han-js-charized span.char span { + border-bottom: 0 none !important; } + hruby u.han-js-charized + u { + margin-left: 0.125em; } + hruby copy { + display: inline-block; + opacity: 0; + text-indent: -9999999px; + height: 0; + width: 0; } + hruby rb[annotation] { + display: inline-block; + position: relative; + text-indent: 0; } + hruby rb[annotation]:before { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + left: -200%; + position: absolute; + top: -0.5em; + vertical-align: middle; + -moz-transform: scale(0.55); + -webkit-transform: scale(0.55); + transform: scale(0.55); + height: 1em; + width: 500%; + content: attr(annotation); + line-height: 1.5; + text-align: center; + text-indent: 0; } + hruby[complex] rb[annotation][order="1"]:before { + top: -0.5em; } + hruby[complex] rb[annotation][order="2"]:before { + bottom: -0.25em; + top: auto; } + hruby[rightangle] rb[annotation]:before { + bottom: -0.25em; + top: auto; + margin-left: -0.3em; + line-height: 1; } + hruby[generic] rb[yin]:after { + font-family: "Zhuyin Kaiti", cursive, serif; } + hruby[generic="sans-serif"] rb[yin]:before, + hruby[generic="sans-serif"] rb[diao^="ㆴ"]:after, + hruby[generic="sans-serif"] rb[diao^="ㆵ"]:after, + hruby[generic="sans-serif"] rb[diao^="ㆶ"]:after, + hruby[generic="sans-serif"] rb[diao^="ㆷ"]:after { + font-family: "Zhuyin Heiti", sans-serif; } + hruby[generic="serif"] rb[yin]:before { + font-family: "Zhuyin Kaiti", cursive, serif; } + hruby rb[zhuyin] { + display: inline-block; + position: relative; + text-indent: 0; + width: 1.65em; + /* 依注音字符數量為「注音」及「調號」定位 + */ } + hruby rb[zhuyin]:before, hruby rb[zhuyin][diao]:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + position: absolute; + right: 0; + top: 0; + -moz-transform: scale(0.55); + -webkit-transform: scale(0.55); + transform: scale(0.55); + height: 2.7em; + width: 0.8em; + -moz-text-emphasis: none; + -webkit-text-emphasis: none; + text-emphasis: none; + -moz-text-emphasis-position: under; + -webkit-text-emphasis-position: under; + text-emphasis-position: under; + font-style: normal; + font-weight: normal; + line-height: 0.9; + text-indent: 0; + text-decoration: none; } + hruby rb[zhuyin]:before { + content: attr(yin); + line-height: 0.9; + white-space: pre-wrap; + word-break: break-all; } + hruby rb[zhuyin][diao]:after { + right: -0.6em; + width: 1em; + content: attr(diao); } + hruby rb[zhuyin][length="1"]:before { + margin-top: 0.25em; } + hruby rb[zhuyin][length="1"]:after { + margin-top: -0.35em; } + hruby rb[zhuyin][length="2"]:before { + margin-top: -0.15em; } + hruby rb[zhuyin][length="2"]:after { + margin-top: 0.125em; } + hruby rb[zhuyin][length="3"]:before { + margin-top: -0.4em; } + hruby rb[zhuyin][length="3"]:after { + margin-top: 0.25em; } + hruby rb[zhuyin][diao="˙"]:after { + right: -0.275em; } + hruby rb[zhuyin][diao="˙"][length="1"]:after { + margin-top: 0; } + hruby rb[zhuyin][diao="˙"][length="2"]:after { + margin-top: -0.25em; } + hruby rb[zhuyin][diao="˙"][length="3"]:after { + margin-top: -0.55em; } + hruby rb[zhuyin][diao="˪"]:after, hruby rb[zhuyin][diao="˫"]:after { + -moz-transform: scale(0.6); + -webkit-transform: scale(0.6); + transform: scale(0.6); + margin-right: -0.15em; } + hruby rb[zhuyin][diao^="ㆴ"]:after, hruby rb[zhuyin][diao^="ㆵ"]:after, hruby rb[zhuyin][diao^="ㆶ"]:after, hruby rb[zhuyin][diao^="ㆷ"]:after { + margin-right: -0.2em; + margin-top: 0.55em; } + +/* + * 在Retina Display螢幕下,使用更小字體的注音符號 + * Apply even littler font-size + * on Retina Display screen + * + */ +@media screen and (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 192dpi) { + hruby rb[zhuyin] { + width: 1.45em; + /* 依注音字符數量為「音符」及「調號」定位 + */ } + hruby rb[zhuyin]:before, hruby rb[zhuyin][diao]:after { + -moz-transform: scale(0.4); + -webkit-transform: scale(0.4); + transform: scale(0.4); + line-height: 0.9; } + hruby rb[zhuyin]:before { + right: -0.15em; } + hruby rb[zhuyin][length="1"]:before { + margin-top: 0; } + hruby rb[zhuyin][length="1"]:after { + margin-top: -0.125em; } + hruby rb[zhuyin][length="2"]:before { + margin-top: -0.2em; } + hruby rb[zhuyin][length="2"]:after { + margin-top: 0; } + hruby rb[zhuyin][length="3"]:after { + margin-top: 0.125em; } + hruby rb[zhuyin][diao="˙"]:after { + right: -0.375em; } + hruby rb[zhuyin][diao="˙"][length="1"]:after { + margin-top: -0.125em; } + hruby rb[zhuyin][diao="˙"][length="2"]:after { + margin-top: -0.25em; } + hruby rb[zhuyin][diao="˙"][length="3"]:after { + margin-top: -0.5em; } + hruby rb[zhuyin][diao="˪"]:after, hruby rb[zhuyin][diao="˫"]:after { + -moz-transform: scale(0.55); + -webkit-transform: scale(0.55); + transform: scale(0.55); + margin-right: -0.15em; } + hruby rb[zhuyin][diao^="ㆴ"]:after, hruby rb[zhuyin][diao^="ㆵ"]:after, hruby rb[zhuyin][diao^="ㆶ"]:after, hruby rb[zhuyin][diao^="ㆷ"]:after { + margin-right: -0.15em; + margin-top: 0.4em; } } +.writingmode .zhipai hruby rb[annotation]:before { + bottom: auto; + left: -0.1em; + top: -200%; + height: 500%; + width: 1em; } +.writingmode .zhipai hruby rb[zhuyin] { + width: 1.65em; } + .writingmode .zhipai hruby rb[zhuyin]:before, .writingmode .zhipai hruby rb[zhuyin][diao]:after { + top: -0.45em; + -webkit-writing-mode: horizontal-tb; } + .writingmode .zhipai hruby rb[zhuyin]:before { + right: 0.1em; } + .writingmode .zhipai hruby rb[zhuyin][diao]:after { + right: -0.45em; } diff --git a/ajax/libs/Han/2.2.3/js/han.js b/ajax/libs/Han/2.2.3/js/han.js new file mode 100644 index 000000000..f1fbf20bd --- /dev/null +++ b/ajax/libs/Han/2.2.3/js/han.js @@ -0,0 +1,1395 @@ + +/*! + * 漢字標準格式 v2.2.3 + * --- + * Hanzi-optimised CSS Mode + * + * + * + * Lisence: MIT Lisence + * Last Modified: 2014/1/1 + * + */ + +;jQuery.noConflict + +;(function($){ + var version = '2.2.3', + + tests = [], + rubies, + + unicode = [], + + rendered = 'han-js-rendered', + classes = [rendered], + fontfaces = [], + + + han = function() { + $(document).on('ready', function(){ + + // `unicode-range` + classes.push( ( test_for_unicoderange() ? '' : 'no-' ) + 'unicoderange' ) + + // The 4(-1) Typefaces + fontfaces['songti'] = test_for_fontface( 'Han Songti' ) + fontfaces['kaiti'] = test_for_fontface( 'Han Kaiti' ) + fontfaces['fangsong'] = test_for_fontface( 'Han Fangsong' ) + + for ( var font in fontfaces ) { + classes.push( ( fontfaces[font] ? '' : 'no-' ) + 'fontface-' + font ) + } + + // altogether + $('html').addClass( classes.join(' ') ) + + init() + }) + }, + + + init = function( range ) { + if ( !range && $('html').hasClass('no-han-init') ) + return + + var range = range || 'body' + + if ( range !== 'body' && !$(range).hasClass(rendered) ) + $(range).addClass(rendered) + else if ( range === 'body' && !$('html').hasClass(rendered) ) + $('html').addClass(rendered) + + + + /* + * 加強漢字註音功能 + * --- + * Enhance `` element + * + * **注意:**需置於``的hack前。 + * + * **Note:** The necessity of being + * placed before the hack of + * the `` element is required. + */ + + // 語義類別簡化 + $(range).find('ruby, rtc').filter('.pinyin').addClass('romanization') + $(range).find('ruby, rtc').filter('.mps').addClass('zhuyin') + $(range).find('ruby, rtc').filter('.romanization').addClass('annotation') + + $(range).find('ruby').each(function() { + var html = $(this).html(), + hruby = document.createElement('hruby') + + // 羅馬拼音(在不支援``的瀏覽器下) + if ( !tests['ruby']() && + !$(this).hasClass('complex') && + !$(this).hasClass('zhuyin') && + !$(this).hasClass('rightangle') ) { + + // 將拼音轉為元素屬性以便CSS產生偽類 + $(this) + .find('rt') + .each(function(){ + var anno = $(this).html(), + prev = this.previousSibling, + text = prev.nodeValue + + prev.nodeValue = '' + + $(prev).before( + $('') + .html( text ) + .attr('annotation', anno) + .replaceWith(_copy) + ) + + $(this).replaceWith( + _copy().html(anno) + ) + }) + + $(this) + .replaceWith( + $(hruby) + .html( $(this).html() ) + ) + + } else { + var attr = {} + + // 國語注音、台灣方言音符號 + if ( $(this).hasClass('zhuyin') ) { + // 將注音轉為元素屬性以便CSS產生偽類 + $(this).find('rt') + .each(function(){ + _apply_zhuyin(this) + }) + + // 雙行文字註記 + } else if ( $(this).hasClass('complex') ) { + attr.complex = 'complex' + + _apply_annotation(this) + + + // 拼音、注音直角顯示 + } else if ( $(this).hasClass('rightangle') ) { + attr.rightangle = 'rightangle' + + + // 國語注音、台灣方言音符號 + $(this).find('rtc.zhuyin') + .hide() + .each(function(){ + var t = $(this).prevAll('rbc'), + c, len, data + + $(this).find('rt') + .each(function(i){ + var rb = t.find('rb:not([annotation])').eq(i) + _apply_zhuyin(this, rb) + }) + }) + + // 羅馬拼音或文字註記 + _apply_annotation(this) + } + + // 以``元素替代``,避免UA原生樣式的干擾 + $(this).filter(function(){ + return $(this).hasClass("zhuyin") || + $(this).hasClass("complex") || + $(this).hasClass("rightangle") + }).replaceWith( + $(hruby) + .html( $(this).html() ) + .attr('generic', _get_zhuyin_font(this)) + .attr(attr) + ) + } + }) + + + + /* + * 漢拉間隙 + * --- + * Kerning between Hanzi and Latin Letter + * + */ + + if ( $('html').hasClass('han-la') ) + $(range).each(function(){ + var hanzi = unicode_set('hanzi'), + latin = unicode_set('latin') + '|' + unicode['punc'][0], + punc = unicode['punc'] + + patterns = [ + '/(' + hanzi + ')(' + latin + '|' + punc[1] + ')/ig', + '/(' + latin + '|' + punc[2] + ')(' + hanzi + ')/ig' + ] + + + patterns.forEach(function( exp ){ + findAndReplaceDOMText(this, { + find: eval(exp), + replace: '$1$2' + }) + }, this) + + findAndReplaceDOMText(this, { + find: '', + replace: function(){ + return document.createElement('hanla') + } + }) + + this.normalize() + + $('* > hanla:first-child').parent().each(function(){ + if ( this.firstChild.nodeType == 1 ) { + $(this).before( $('') ) + $(this).find('hanla:first-child').remove() + } + }) + }) + + + + /* + * 修正相鄰註記元素``的底線相連問題 + * --- + * fixing the underline-adjacency issue on `` element + * + */ + + if ( $('html').hasClass('han-lab-underline') ) + $(range).find('u').charize('', true, true) + else + $(range).find('u').each(function(){ + var next = this.nextSibling + + while ( next != null && ( next.nodeName === "WBR" || next.nodeType == 8 )) + next = next.nextSibling + + $(next).filter('u').addClass('adjacent') + }) + + + + /* 強調元素``的着重號 + * --- + * punctuation: CJK emphasis dots on `` element + * + */ + + $(range).find('em').charize({ + latin: ( tests['textemphasis']() ) ? 'none' : 'individual' + }) + }, + + + + unicode_set = function( set ) { + var join = ( set.match(/[hanzi|latin]/) ) ? true : false, + result = ( join ) ? unicode[set].join('|') : unicode[set] + + return result + }, + + + _span = function( className ) { + var span = document.createElement('span') + span.className = className + + return span + }, + + + _copy = function() { + return $(document.createElement('copy')) + }, + + + _apply_annotation = function( node ) { + $(node).find('rbc').find('rb') + .each(function(i){ + $(this).attr('index', i) + }) + + $(node).find('rtc:not(.zhuyin)') + .hide() + .each(function(t){ + var c = 0, + rtc = $(this), + rbc = $(this).prevAll('rbc'), + len = $(this).find('rt').length, + data = [] + + $(this).find('rt') + .each(function(h){ + var anno = $(this).html(), + rbspan = $(this).attr('rbspan') || 1, + i = c + + c += Number(rbspan) + + data[h] = { + 'annotation': anno, + 'order': (t==0) ? '1' : '2' + } + + for ( var j=i; j') + .attr( data[k] ) + ) + } + }) + + $(node).find('rb') + .after(' ') + .removeAttr('set index') + .filter('rb[annotation]') + .each(function(){ + var t = $(this).attr('annotation') + $(this).after( _copy().html( t ) ) + }) + }, + + + _get_zhuyin_font = function( node ) { + var reg = /(sans-serif|monospace)$/, + generic = $(node).css('font-family'), + font = generic.match(reg) ? 'sans-serif' : 'serif' + + return font + }, + + + _apply_zhuyin = function( node, rb ) { + var sm = unicode['zhuyin']['shengmu'], + jy = unicode['zhuyin']['jieyin'], + ym = unicode['zhuyin']['yunmu'], + yj = unicode['zhuyin']['yunjiao'], + tone = unicode['zhuyin']['diao'], + + prev, text, zi, + zy = $(node).html(), + yin, diao, form, length, data + + form = ( zy.match(eval('/(' + sm + ')/')) ) ? 'shengmu' : '' + form += ( zy.match(eval('/(' + jy + ')/')) ) ? (( form !== '' ) ? '-' : '') + 'jieyin' : '' + form += ( zy.match(eval('/(' + ym + ')/')) ) ? (( form !== '' ) ? '-' : '') + 'yunmu' : '' + + yin = zy + .replace(eval('/(' + tone + ')/g'), '') + .replace(eval('/(' + yj + '̍)/g'), '') + + length = (yin) ? yin.length : 0 + + diao = ( zy.match(/(\u02D9)/) ) ? '\u02D9' : + ( zy.match(/(\u02CA)/) ) ? '\u02CA' : + ( zy.match(/([\u02C5\u02C7])/) ) ? '\u02C7' : + ( zy.match(/(\u02CB)/) ) ? '\u02CB' : + ( zy.match(/(\u02EA)/) ) ? '\u02EA' : + ( zy.match(/(\u02EB)/) ) ? '\u02EB' : + ( zy.match(/(\u31B4[\u0358\u030d])/) ) ? '\u31B4\u0358' : + ( zy.match(/(\u31B5[\u0358\u030d])/) ) ? '\u31B5\u0358' : + ( zy.match(/(\u31B6[\u0358\u030d])/) ) ? '\u31B6\u0358' : + ( zy.match(/(\u31B7[\u0358\u030d])/) ) ? '\u31B7\u0358' : + ( zy.match(/(\u31B4)/) ) ? '\u31B4' : + ( zy.match(/(\u31B5)/) ) ? '\u31B5' : + ( zy.match(/(\u31B6)/) ) ? '\u31B6' : + ( zy.match(/(\u31B7)/) ) ? '\u31B7' : '' + + data = { + 'zhuyin': zy, + 'yin': yin, + 'diao': diao, + 'length': length, + 'form': form + } + + if ( rb ) + rb + .attr(data) + .append( _copy().html( zy ) ) + else { + prev = node.previousSibling + text = prev.nodeValue.split('') + zi = text.pop() + prev.nodeValue = text.join('') + + $(node) + .before( + $('') + .attr(data) + .text( zi ) + ) + .after( ' ' ) + //.replaceWith( '' ) + .replaceWith( _copy().html( zy ) ) + } + }, + + + findAndReplaceDOMText = function( a, b ) { + var b = b + + b.filterElements = function( el ) { + var name = el.nodeName.toLowerCase(), + classes = ( el.nodeType == 1 ) ? el.getAttribute('class') : '', + charized = ( classes && classes.match(/han-js-charized/) != null ) ? true : false + + return name !== 'style' && name !== 'script' && !charized + } + + return window.findAndReplaceDOMText(a,b) + }, + + + inject_element_with_styles = function( rule, callback, nodes, testnames ) { + var style, ret, node, docOverflow, + + docElement = document.documentElement, + div = document.createElement('div'), + body = document.body, + fakeBody = body || document.createElement('body') + + + style = [''].join('') + + ;(body ? div : fakeBody).innerHTML += style + fakeBody.appendChild(div) + + if ( !body ) { + fakeBody.style.background = '' + fakeBody.style.overflow = 'hidden' + docOverflow = docElement.style.overflow + docElement.style.overflow = 'hidden' + docElement.appendChild(fakeBody) + } + + ret = callback(div, rule) + + if ( !body ) { + fakeBody.parentNode.removeChild(fakeBody) + docElement.style.overflow = docOverflow + } else + div.parentNode.removeChild(div) + + return !!ret + }, + + + write_on_canvas = function( text, font ) { + var canvasNode = document.createElement('canvas') + canvasNode.width = '50' + canvasNode.height = '20' + + canvasNode.style.display = 'none' + canvasNode.className = 'han_support_tests' + document.body.appendChild(canvasNode) + var ctx = canvasNode.getContext('2d') + + ctx.textBaseline = 'top' + ctx.font = '15px ' + font + ', sans-serif' + ctx.fillStyle = 'black' + ctx.strokeStyle = 'black' + + ctx.fillText( text, 0, 0 ) + + return ctx + }, + + + test_for_fontface = function( test, compare, zi ) { + if ( !tests['fontface']() ) + return false + + var test = test, + compare = compare || 'sans-serif', + zi = zi || '辭Q' + + try { + var sans = write_on_canvas( zi, compare ), + test = write_on_canvas( zi, test ), + support + + for (var j=1; j<=20; j++) { + for (var i=1; i<=50; i++) { + var sansData = sans.getImageData(i, j, 1, 1).data, + testData = test.getImageData(i, j, 1, 1).data, + + alpha = [] + + alpha['sans'] = sansData[3] + alpha['test'] = testData[3] + + if ( support !== 'undefined' && alpha['test'] != alpha['sans'] ) + support = true + else if ( support ) + break + if ( i == 20 && j == 20 && !support ) + support = false + } + } + + $('canvas.han_support_tests').remove() + return support + } catch ( err ) { + return false + } + } + + + test_for_unicoderange = function() { + return !test_for_fontface( 'han-unicode-range', 'Arial, "Droid Sans"', 'a' ) + } + + + /** + * -------------------------------------------------------- + * Unicode區段說明(6.2.0) + * Unicode blocks + * -------------------------------------------------------- + * 或參考: + * http://css.hanzi.co/manual/api/javascript_jiekou-han.unicode + * -------------------------------------------------------- + * + ** 以下歸類為「拉丁字母」(`unicode('latin')`)** + * + * 基本拉丁字母:a-z + * 阿拉伯數字:0-9 + * 拉丁字母補充-1:[\u00C0-\u00FF] + * 拉丁字母擴展-A區:[\u0100-\u017F] + * 拉丁字母擴展-B區:[\u0180-\u024F] + * 拉丁字母附加區:[\u1E00-\u1EFF] + * + ** 符號:[~!@#&=_\$\%\^\*\-\+\,\.\/(\\)\?\:\'\"\[\]\(\)'"<>‘“”’] + * + * -------------------------------------------------------- + * + ** 以下歸類為「漢字」(`unicode('hanzi')`)** + * + * CJK一般:[\u4E00-\u9FFF] + * CJK擴展-A區:[\u3400-\u4DB5] + * CJK擴展-B區:[\u20000-\u2A6D6] + * CJK Unicode 4.1:[\u9FA6-\u9FBB]、[\uFA70-\uFAD9] + * CJK Unicode 5.1:[\u9FBC-\u9FC3] + * CJK擴展-C區:[\u2A700-\u2B734] + * CJK擴展-D區:[\u2B740-\u2B81D](急用漢字) + * CJK擴展-E區:[\u2B820-\u2F7FF](**註**:暫未支援) + * CJK擴展-F區(**註**:暫未支援) + * CJK筆畫區:[\u31C0-\u31E3] + * 數字「〇」:[\u3007] + * 日文假名:[\u3040-\u309E][\u30A1-\u30FA][\u30FD\u30FE](**註**:排除片假名中點、長音符) + * + * CJK相容表意文字: + * [\uF900-\uFAFF](**註**:不使用) + * [\uFA0E-\uFA0F\uFA11\uFA13-\uFA14\uFA1F\uFA21\uFA23-\uFA24\uFA27-\uFA29](**註**:12個例外) + * -------------------------------------------------------- + * + ** 符號 + * [·・︰、,。:;?!—⋯….·「『(〔【《〈“‘」』)〕】》〉’”–ー—] + * + ** 其他 + * + * 漢語注音符號、擴充:[\u3105-\u312D][\u31A0-\u31BA] + * 國語五聲調(三聲有二種符號):[\u02D9\u02CA\u02C5\u02C7\u02CB] + * 台灣漢語方言音擴充聲調:[\u02EA\u02EB] + * + */ + + unicode['latin'] = [ + '[A-Za-z0-9\u00C0-\u00FF\u0100-\u017F\u0180-\u024F\u1E00-\u1EFF]' + ] + + unicode['punc'] = [ + '[@&=_\,\.\?\!\$\%\^\*\-\+\/]', + '[\(\\[\'"<‘“]', + '[\)\\]\'">”’]' + ] + + unicode['hanzi'] = [ + '[\u4E00-\u9FFF]', + '[\u3400-\u4DB5\u9FA6-\u9FBB\uFA70-\uFAD9\u9FBC-\u9FC3\u3007\u3040-\u309E\u30A1-\u30FA\u30FD\u30FE\uFA0E-\uFA0F\uFA11\uFA13-\uFA14\uFA1F\uFA21\uFA23-\uFA24\uFA27-\uFA29]', + '[\uD840-\uD868][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF]', + '\uD86D[\uDC00-\uDF3F]|[\uD86A-\uD86C][\uDC00-\uDFFF]|\uD869[\uDF00-\uDFFF]', + '\uD86D[\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1F]', + '[\u31C0-\u31E3]' + ] + + unicode['biaodian'] = [ + '[·・︰、,。:;?!—ー⋯….·/]', + '[「『(〔【《〈“‘]', + '[」』)〕】》〉’”]' + ] + + unicode['zhuyin'] = [] + unicode['zhuyin'][0] = '[\u3105-\u312D\u31A0-\u31BA]' + unicode['zhuyin']['shengmu'] = '[\u3105-\u3119\u312A-\u312C\u31A0-\u31A3]' + unicode['zhuyin']['jieyin'] = '[\u3127-\u3129]' + unicode['zhuyin']['yunmu'] = '[\u311A-\u3126\u312D\u31A4-\u31B3\u31B8-\u31BA]' + unicode['zhuyin']['yunjiao'] = '[\u31B4-\u31B7]' + unicode['zhuyin']['diao'] = '[\u02D9\u02CA\u02C5\u02C7\u02CB\u02EA\u02EB]' + + + + /** + * tests for HTML5/CSS3 features + * + */ + + /* CSS3 property: `column-width` */ + tests['columnwidth'] = function() { + var cw = $('
tester
'), + + bool = ( /^200px$/.test( cw.css("-webkit-column-width") ) || + /^200px$/.test( cw.css("-moz-column-width") ) || + /^200px$/.test( cw.css("-ms-column-width") ) || + /^200px$/.test( cw.css("column-width") ) ) ? true : false + + return bool + } + + + /* -------------------------------------------------------- + * test for '@font-face' + * -------------------------------------------------------- + * Originates from Modernizr (http://modernizr.com) + */ + + tests['fontface'] = function() { + var bool + + inject_element_with_styles('@font-face {font-family:"font"; src:url("https://")}', function( node, rule ) { + var style = document.getElementById('han-support'), + sheet = style.sheet || style.styleSheet, + cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '' + + bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0 + }) + + return bool + } + + + tests['ruby'] = function() { + if ( rubies != null ) + return rubies + + + var ruby = document.createElement('ruby'), + rt = document.createElement('rt'), + rp = document.createElement('rp'), + docElement = document.documentElement, + displayStyleProperty = 'display' + + ruby.appendChild(rp) + ruby.appendChild(rt) + docElement.appendChild(ruby) + + // browsers that support hide the via "display:none" + rubies = ( getStyle(rp, displayStyleProperty) == 'none' || + // but in IE browsers has "display:inline" so, the test needs other conditions: + getStyle(ruby, displayStyleProperty) == 'ruby' + && getStyle(rt, displayStyleProperty) == 'ruby-text' ) ? true : false + + + docElement.removeChild(ruby) + // the removed child node still exists in memory, so ... + ruby = null + rt = null + rp = null + + return rubies + + + function getStyle( element, styleProperty ) { + var result + + if ( window.getComputedStyle ) // for non-IE browsers + result = document.defaultView.getComputedStyle(element,null).getPropertyValue(styleProperty) + else if ( element.currentStyle ) // for IE + result = element.currentStyle[styleProperty] + + return result + } + } + + + tests['textemphasis'] = function() { + var em = $('tester'), + + bool = ( /^dot$/.test( em.css("-webkit-text-emphasis-style") ) || + /^dot$/.test( em.css("text-emphasis-style") ) || + /^dot$/.test( em.css("-moz-text-emphasis-style") ) || + /^dot$/.test( em.css("-ms-text-emphasis-style") ) ) ? true : false + + return bool + } + + + tests['writingmode'] = function() { + var wm = $('
tester
'), + + bool = ( /^tb-rl$/.test( wm.css("writing-mode") ) || + /^vertical-rl$/.test( wm.css("-webkit-writing-mode") ) || + /^tb-rl$/.test( wm.css("-moz-writing-mode") ) || + /^tb-rl$/.test( wm.css("-ms-writing-mode") ) ) ? true: false + + return bool + } + + + + $.fn.extend({ + hanInit: function() { + return init(this) + }, + + + bitouwei: function() { + return this.each(function(){ + $(this).addClass( 'han-js-bitouwei-rendered' ) + + var tou = unicode['biaodian'][0] + unicode['biaodian'][2], + wei = unicode['biaodian'][1], + start = unicode['punc'][0] + unicode['punc'][2], + end = unicode['punc'][1] + + tou = tou.replace(/\]\[/g, '' ) + start = start.replace(/\]\[/g, '' ) + + + // CJK characters + findAndReplaceDOMText(this, { + find: eval( '/(' + wei + ')(' + unicode_set('hanzi') + ')(' + tou + ')/ig' ), + wrap: _span( 'bitouwei bitouweidian' ) + }) + + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('hanzi') + ')(' + tou + ')/ig' ), + wrap: _span( 'bitouwei bitoudian' ) + }) + + findAndReplaceDOMText(this, { + find: eval( '/(' + wei + ')(' + unicode_set('hanzi') + ')/ig' ), + wrap: _span( 'bitouwei biweidian' ) + }) + + + // Latin letters + findAndReplaceDOMText(this, { + find: eval( '/(' + end + ')(' + unicode_set('latin') + '+)(' + start + ')/ig' ), + wrap: _span( 'bitouwei bitouweidian' ) + }) + + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('latin') + '+)(' + start + ')/ig' ), + wrap: _span( 'bitouwei bitoudian' ) + }) + + findAndReplaceDOMText(this, { + find: eval( '/(' + end + ')(' + unicode_set('latin') + '+)/ig' ), + wrap: _span( 'bitouwei biweidian' ) + }) + }) + }, + + + charize: function( glyph, charClass, innerSpan ){ + var glyph = glyph || {}, + charClass = (charClass == true) ? true : false + + glyph = { + cjk: glyph.cjk || 'individual', + bitouwei: (glyph.bitouwei == false) ? false : true, + latin: glyph.latin || 'group' + } + + return this.each(function(){ + if ( glyph.bitouwei ) + $(this).bitouwei() + + + // CJK characters + if ( glyph.cjk === 'individual' ) + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('hanzi') + ')/ig' ), + wrap: _span( 'char cjk' ) + }) + + + if ( glyph.cjk === 'individual' || glyph.cjk === 'biaodian' ) + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('biaodian') + ')/ig' ), + wrap: _span( 'char cjk biaodian' ) + }) + + + if ( glyph.cjk === 'group' ) + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('hanzi') + '+|' + unicode_set('biaodian') + '+)/ig' ), + wrap: _span( 'char cjk' ) + }) + + + var latin_regex = ( glyph.latin === 'group' ) ? + '/(' + unicode_set('latin') + '+)/ig' : + '/(' + unicode_set('latin') + ')/ig' + + findAndReplaceDOMText(this, { + find: eval( latin_regex ), + wrap: _span( 'char latin' ) + }) + + + findAndReplaceDOMText(this, { + find: eval( '/(' + unicode_set('punc') + '+)/ig' ), + wrap: _span( 'char latin punc' ) + }) + + findAndReplaceDOMText(this, { + find: /([\s]+)/ig, + wrap: _span( 'char space' ) + }) + + + if ( innerSpan ) + $(this).find('.char').each(function(){ + $(this).html( + $('').text( $(this).text() ) + ) + }) + + + if ( charClass ) + $(this).addClass('han-js-charized') + }) + } + }) + + + // tests + for ( var feature in tests ) { + classes.push( ( tests[feature]() ? '' : 'no-' ) + feature ) + + if ( !tester ) + var tester = '' + + tester += ' ' + feature + ': tests[\'' + feature + '\'](),\n' + } + + !function(window) { + eval("tester = ({\n" + tester.replace(/\n$/ig, + '\nunicoderange: test_for_unicoderange, \nfont: test_for_fontface\n}') + ")") + }() + + + + han() + + window.han = { + unicode: unicode_set, + support: tester + } + +})(jQuery) + + +/** + * findAndReplaceDOMText v 0.4.0 + * @author James Padolsey http://james.padolsey.com + * @license http://unlicense.org/UNLICENSE + * + * Matches the text of a DOM node against a regular expression + * and replaces each match (or node-separated portions of the match) + * in the specified element. + */ +;window.findAndReplaceDOMText = (function() { + + var PORTION_MODE_RETAIN = 'retain'; + var PORTION_MODE_FIRST = 'first'; + + var doc = document; + var toString = {}.toString; + + function isArray(a) { + return toString.call(a) == '[object Array]'; + } + + function escapeRegExp(s) { + return String(s).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); + } + + function exposed() { + // Try deprecated arg signature first: + return deprecated.apply(null, arguments) || findAndReplaceDOMText.apply(null, arguments); + } + + function deprecated(regex, node, replacement, captureGroup, elFilter) { + if ((node && !node.nodeType) && arguments.length <= 2) { + return false; + } + var isReplacementFunction = typeof replacement == 'function'; + + if (isReplacementFunction) { + replacement = (function(original) { + return function(portion, match) { + return original(portion.text, match.startIndex); + }; + }(replacement)); + } + + // Awkward support for deprecated argument signature (<0.4.0) + var instance = findAndReplaceDOMText(node, { + + find: regex, + + wrap: isReplacementFunction ? null : replacement, + replace: isReplacementFunction ? replacement : '$' + (captureGroup || '&'), + + prepMatch: function(m, mi) { + + // Support captureGroup (a deprecated feature) + + if (!m[0]) throw 'findAndReplaceDOMText cannot handle zero-length matches'; + + if (captureGroup > 0) { + var cg = m[captureGroup]; + m.index += m[0].indexOf(cg); + m[0] = cg; + } + + m.endIndex = m.index + m[0].length; + m.startIndex = m.index; + m.index = mi; + + return m; + }, + filterElements: elFilter + }); + + exposed.revert = function() { + return instance.revert(); + }; + + return true; + } + + /** + * findAndReplaceDOMText + * + * Locates matches and replaces with replacementNode + * + * @param {Node} node Element or Text node to search within + * @param {RegExp} options.find The regular expression to match + * @param {String|Element} [options.wrap] A NodeName, or a Node to clone + * @param {String|Function} [options.replace='$&'] What to replace each match with + * @param {Function} [options.filterElements] A Function to be called to check whether to + * process an element. (returning true = process element, + * returning false = avoid element) + */ + function findAndReplaceDOMText(node, options) { + return new Finder(node, options); + } + + exposed.Finder = Finder; + + /** + * Finder -- encapsulates logic to find and replace. + */ + function Finder(node, options) { + + options.portionMode = options.portionMode || PORTION_MODE_RETAIN; + + this.node = node; + this.options = options; + + // ENable match-preparation method to be passed as option: + this.prepMatch = options.prepMatch || this.prepMatch; + + this.reverts = []; + + this.matches = this.search(); + + if (this.matches.length) { + this.processMatches(); + } + + } + + Finder.prototype = { + + /** + * Searches for all matches that comply with the instance's 'match' option + */ + search: function() { + + var match; + var matchIndex = 0; + var regex = this.options.find; + var text = this.getAggregateText(); + var matches = []; + + regex = typeof regex === 'string' ? RegExp(escapeRegExp(regex), 'g') : regex; + + if (regex.global) { + while (match = regex.exec(text)) { + matches.push(this.prepMatch(match, matchIndex++)); + } + } else { + if (match = text.match(regex)) { + matches.push(this.prepMatch(match, 0)); + } + } + + return matches; + + }, + + /** + * Prepares a single match with useful meta info: + */ + prepMatch: function(match, matchIndex) { + + if (!match[0]) { + throw new Error('findAndReplaceDOMText cannot handle zero-length matches'); + } + + match.endIndex = match.index + match[0].length; + match.startIndex = match.index; + match.index = matchIndex; + + return match; + }, + + /** + * Gets aggregate text within subject node + */ + getAggregateText: function() { + + var elementFilter = this.options.filterElements; + + return getText(this.node); + + /** + * Gets aggregate text of a node without resorting + * to broken innerText/textContent + */ + function getText(node) { + + if (node.nodeType === 3) { + return node.data; + } + + if (elementFilter && !elementFilter(node)) { + return ''; + } + + var txt = ''; + + if (node = node.firstChild) do { + txt += getText(node); + } while (node = node.nextSibling); + + return txt; + + } + + }, + + /** + * Steps through the target node, looking for matches, and + * calling replaceFn when a match is found. + */ + processMatches: function() { + + var matches = this.matches; + var node = this.node; + var elementFilter = this.options.filterElements; + + var startPortion, + endPortion, + innerPortions = [], + curNode = node, + match = matches.shift(), + atIndex = 0, // i.e. nodeAtIndex + matchIndex = 0, + portionIndex = 0, + doAvoidNode; + + out: while (true) { + + if (curNode.nodeType === 3) { + + if (!endPortion && curNode.length + atIndex >= match.endIndex) { + + // We've found the ending + endPortion = { + node: curNode, + index: portionIndex++, + text: curNode.data.substring(match.startIndex - atIndex, match.endIndex - atIndex), + indexInMatch: atIndex - match.startIndex, + indexInNode: match.startIndex - atIndex, // always zero for end-portions + endIndexInNode: match.endIndex - atIndex, + isEnd: true + }; + + } else if (startPortion) { + // Intersecting node + innerPortions.push({ + node: curNode, + index: portionIndex++, + text: curNode.data, + indexInMatch: atIndex - match.startIndex, + indexInNode: 0 // always zero for inner-portions + }); + } + + if (!startPortion && curNode.length + atIndex > match.startIndex) { + // We've found the match start + startPortion = { + node: curNode, + index: portionIndex++, + indexInMatch: 0, + indexInNode: match.startIndex - atIndex, + endIndexInNode: match.endIndex - atIndex, + text: curNode.data.substring(match.startIndex - atIndex, match.endIndex - atIndex) + }; + } + + atIndex += curNode.data.length; + + } + + doAvoidNode = curNode.nodeType === 1 && elementFilter && !elementFilter(curNode); + + if (startPortion && endPortion) { + + curNode = this.replaceMatch(match, startPortion, innerPortions, endPortion); + + // processMatches has to return the node that replaced the endNode + // and then we step back so we can continue from the end of the + // match: + + atIndex -= (endPortion.node.data.length - endPortion.endIndexInNode); + + startPortion = null; + endPortion = null; + innerPortions = []; + match = matches.shift(); + portionIndex = 0; + matchIndex++; + + if (!match) { + break; // no more matches + } + + } else if ( + !doAvoidNode && + (curNode.firstChild || curNode.nextSibling) + ) { + // Move down or forward: + curNode = curNode.firstChild || curNode.nextSibling; + continue; + } + + // Move forward or up: + while (true) { + if (curNode.nextSibling) { + curNode = curNode.nextSibling; + break; + } else if (curNode.parentNode !== node) { + curNode = curNode.parentNode; + } else { + break out; + } + } + + } + + }, + + /** + * Reverts ... TODO + */ + revert: function() { + // Reversion occurs backwards so as to avoid nodes subsequently + // replaced during the matching phase (a forward process): + for (var l = this.reverts.length; l--;) { + this.reverts[l](); + } + this.reverts = []; + }, + + prepareReplacementString: function(string, portion, match, matchIndex) { + var portionMode = this.options.portionMode; + if ( + portionMode === PORTION_MODE_FIRST && + portion.indexInMatch > 0 + ) { + return ''; + } + string = string.replace(/\$(\d+|&|`|')/g, function($0, t) { + var replacement; + switch(t) { + case '&': + replacement = match[0]; + break; + case '`': + replacement = match.input.substring(0, match.startIndex); + break; + case '\'': + replacement = match.input.substring(match.endIndex); + break; + default: + replacement = match[+t]; + } + return replacement; + }); + + if (portionMode === PORTION_MODE_FIRST) { + return string; + } + + if (portion.isEnd) { + return string.substring(portion.indexInMatch); + } + + return string.substring(portion.indexInMatch, portion.indexInMatch + portion.text.length); + }, + + getPortionReplacementNode: function(portion, match, matchIndex) { + + var replacement = this.options.replace || '$&'; + var wrapper = this.options.wrap; + + if (wrapper && wrapper.nodeType) { + // Wrapper has been provided as a stencil-node for us to clone: + var clone = doc.createElement('div'); + clone.innerHTML = wrapper.outerHTML || new XMLSerializer().serializeToString(wrapper); + wrapper = clone.firstChild; + } + + if (typeof replacement == 'function') { + replacement = replacement(portion, match, matchIndex); + if (replacement && replacement.nodeType) { + return replacement; + } + return doc.createTextNode(String(replacement)); + } + + var el = typeof wrapper == 'string' ? doc.createElement(wrapper) : wrapper; + + replacement = doc.createTextNode( + this.prepareReplacementString( + replacement, portion, match, matchIndex + ) + ); + + if (!el) { + return replacement; + } + + el.appendChild(replacement); + + return el; + }, + + replaceMatch: function(match, startPortion, innerPortions, endPortion) { + + var matchStartNode = startPortion.node; + var matchEndNode = endPortion.node; + + var preceedingTextNode; + var followingTextNode; + + if (matchStartNode === matchEndNode) { + + var node = matchStartNode; + + if (startPortion.indexInNode > 0) { + // Add `before` text node (before the match) + preceedingTextNode = doc.createTextNode(node.data.substring(0, startPortion.indexInNode)); + node.parentNode.insertBefore(preceedingTextNode, node); + } + + // Create the replacement node: + var newNode = this.getPortionReplacementNode( + endPortion, + match + ); + + node.parentNode.insertBefore(newNode, node); + + if (endPortion.endIndexInNode < node.length) { // ????? + // Add `after` text node (after the match) + followingTextNode = doc.createTextNode(node.data.substring(endPortion.endIndexInNode)); + node.parentNode.insertBefore(followingTextNode, node); + } + + node.parentNode.removeChild(node); + + this.reverts.push(function() { + if (preceedingTextNode === newNode.previousSibling) { + preceedingTextNode.parentNode.removeChild(preceedingTextNode); + } + if (followingTextNode === newNode.nextSibling) { + followingTextNode.parentNode.removeChild(followingTextNode); + } + newNode.parentNode.replaceChild(node, newNode); + }); + + return newNode; + + } else { + // Replace matchStartNode -> [innerMatchNodes...] -> matchEndNode (in that order) + + + preceedingTextNode = doc.createTextNode( + matchStartNode.data.substring(0, startPortion.indexInNode) + ); + + followingTextNode = doc.createTextNode( + matchEndNode.data.substring(endPortion.endIndexInNode) + ); + + var firstNode = this.getPortionReplacementNode( + startPortion, + match + ); + + var innerNodes = []; + + for (var i = 0, l = innerPortions.length; i < l; ++i) { + var portion = innerPortions[i]; + var innerNode = this.getPortionReplacementNode( + portion, + match + ); + portion.node.parentNode.replaceChild(innerNode, portion.node); + this.reverts.push((function(portion, innerNode) { + return function() { + innerNode.parentNode.replaceChild(portion.node, innerNode); + }; + }(portion, innerNode))); + innerNodes.push(innerNode); + } + + var lastNode = this.getPortionReplacementNode( + endPortion, + match + ); + + matchStartNode.parentNode.insertBefore(preceedingTextNode, matchStartNode); + matchStartNode.parentNode.insertBefore(firstNode, matchStartNode); + matchStartNode.parentNode.removeChild(matchStartNode); + + matchEndNode.parentNode.insertBefore(lastNode, matchEndNode); + matchEndNode.parentNode.insertBefore(followingTextNode, matchEndNode); + matchEndNode.parentNode.removeChild(matchEndNode); + + this.reverts.push(function() { + preceedingTextNode.parentNode.removeChild(preceedingTextNode); + firstNode.parentNode.replaceChild(matchStartNode, firstNode); + followingTextNode.parentNode.removeChild(followingTextNode); + lastNode.parentNode.replaceChild(matchEndNode, lastNode); + }); + + return lastNode; + } + } + + }; + + return exposed; + +}()); + diff --git a/ajax/libs/Han/package.json b/ajax/libs/Han/package.json new file mode 100644 index 000000000..93c228b47 --- /dev/null +++ b/ajax/libs/Han/package.json @@ -0,0 +1,25 @@ +{ + "name": "Han", + "filename": "han.css", + "version": "2.2.3", + "description": "The CSS typography framework optimised for Hanzi", + "keywords": [ + "han", + "Chinese", + "Japanese", + "Korean" + ], + "author": "ethantw ", + "homepage": "http://http://css.hanzi.co/", + "bugs": "https://github.com/ethantw/Han/issues", + "licenses": [ + { + "type": "MIT", + "url": "http://css.hanzi.co/license.md" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/ethantw/Han.git" + } +}