diff options
Diffstat (limited to '_static/han.min.js')
-rw-r--r-- | _static/han.min.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/_static/han.min.js b/_static/han.min.js new file mode 100644 index 0000000..382a71b --- /dev/null +++ b/_static/han.min.js | |||
@@ -0,0 +1,5 @@ | |||
1 | /*! 漢字標準格式 v3.2.7 | MIT License | css.hanzi.co */ | ||
2 | /*! Han.css: the CSS typography framework optimised for Hanzi */ | ||
3 | |||
4 | void function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b(a,!0):"function"==typeof define&&define.amd?define(function(){return b(a,!0)}):b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";function c(a,b){var c=E.create("h-char-group","biaodian cjk");return 0===a.index&&a.isEnd?c.innerHTML=b[0]:(c.innerHTML=a.text,c.classList.add("portion"),0===a.index?c.classList.add("isFirst"):a.isEnd&&c.classList.add("isEnd")),c}function d(a){var b=E.create("div"),c=a.charCodeAt(0).toString(16),d="biaodian cjk "+(a.match(D["char"].biaodian.open)?"bd-open":a.match(D["char"].biaodian.close)?"bd-close bd-end":a.match(D["char"].biaodian.end)?"bd-end":a.match(new RegExp("("+C.biaodian.liga+")"))?"bd-liga":"");return b.innerHTML='<h-char unicode="'+c+'" class="'+d+'">'+a+"</h-char>",b.firstChild}function e(a,b){var c,d=E.create("canvas");return d.width="50",d.height="20",d.style.display="none",x.appendChild(d),c=d.getContext("2d"),c.textBaseline="top",c.font="15px "+b+", sans-serif",c.fillStyle="black",c.strokeStyle="black",c.fillText(a,0,0),{node:d,context:c,remove:function(){E.remove(d,x)}}}function f(a,b){var c,d=a.context,e=b.context;try{for(var f=1;20>=f;f++)for(var g=1;50>=g;g++){if("undefined"==typeof c&&d.getImageData(g,f,1,1).data[3]!==e.getImageData(g,f,1,1).data[3]){c=!1;break}if("boolean"==typeof c)break;50===g&&20===f&&"undefined"==typeof c&&(c=!0)}return a.remove(),b.remove(),a=null,b=null,c}catch(h){}return!1}function g(a,b,c){var a=a,b=b||"sans-serif",c=c||"\u8fadQ";return b=e(c,b),a=e(c,a),!f(a,b)}function h(a){var b,c=E.create("!"),d=a.classList;return c.appendChild(E.clone(a)),E.tag("rt",c.firstChild).forEach(function(a){var c,e=E.create("!"),f=[];do{if(c=(c||a).previousSibling,!c||c.nodeName.match(/((?:h\-)?r[ubt])/i))break;e.insertBefore(E.clone(c),e.firstChild),f.push(c)}while(!c.nodeName.match(/((?:h\-)?r[ubt])/i));b=d.contains("zhuyin")?n(e,a):m(e,a);try{a.parentNode.replaceChild(b,a),f.map(E.remove)}catch(g){}}),k(c)}function i(a){var b=E.create("!");return b.appendChild(E.clone(a)),E.tag("rt",b.firstChild).forEach(function(a){var b,c,d=E.create("!"),e=[];do{if(b=(b||a).previousSibling,!b||b.nodeName.match(/((?:h\-)?r[ubt])/i))break;d.insertBefore(E.clone(b),d.firstChild),e.push(b)}while(!b.nodeName.match(/((?:h\-)?r[ubt])/i));c=E.create("rt"),c.innerHTML=o(a),a.parentNode.replaceChild(c,a)}),b.firstChild}function j(a){var b,c,d,e,f=E.create("!"),g=a.classList;return f.appendChild(E.clone(a)),b=f.firstChild,c=d=E.tag("rb",b),e=c.length,void function(a){a&&(d=E.tag("rt",a).map(function(a,b){if(c[b]){var d=n(c[b],a);try{c[b].parentNode.replaceChild(d,c[b])}catch(e){}return d}}),E.remove(a),b.setAttribute("rightangle","true"))}(b.querySelector("rtc.zhuyin")),E.qsa("rtc:not(.zhuyin)",b).forEach(function(a,c){var f;f=E.tag("rt",a).map(function(a,b){var f,h,i=Number(a.getAttribute("rbspan")||1),j=0,k=[];i>e&&(i=e);do{try{f=d.shift(),k.push(f)}catch(l){}if("undefined"==typeof f)break;j+=Number(f.getAttribute("span")||1)}while(i>j);if(j>i){if(k.length>1)return void console.error("An impossible `rbspan` value detected.",ruby);k=E.tag("rb",k[0]),d=k.slice(i).concat(d),k=k.slice(0,i),j=i}h=m(k,a,{"class":g,span:j,order:c});try{k[0].parentNode.replaceChild(h,k.shift()),k.map(E.remove)}catch(l){}return h}),d=f,1===c&&b.setAttribute("doubleline","true"),E.remove(a)}),k(f)}function k(a){var b=a.firstChild,c=E.create("h-ruby");return c.innerHTML=b.innerHTML,E.setAttr(c,b.attributes),c.normalize(),c}function l(a){if(!a instanceof Element)return a;var b=a.classList;return b.contains("pinyin")?b.add("romanization"):b.contains("romanization")?b.add("annotation"):b.contains("mps")?b.add("zhuyin"):b.contains("rightangle")&&b.add("complex"),a}function m(a,b,c){var d=E.create("h-ru"),b=E.clone(b),c=c||{};return c.annotation="true",Array.isArray(a)?d.innerHTML=a.map(function(a){return"undefined"==typeof a?"":a.outerHTML}).join("")+b.outerHTML:(d.appendChild(E.clone(a)),d.appendChild(b)),E.setAttr(d,c),d}function n(a,b){var a=E.clone(a),c=E.create("h-ru");return c.setAttribute("zhuyin",!0),c.appendChild(a),c.innerHTML+=o(b),c}function o(a){var b,c,d,e="string"==typeof a?a:a.textContent;return b=e.replace(D.zhuyin.diao,""),d=b?b.length:0,c=e.replace(b,"").replace(/[\u02C5]/g,"\u02c7").replace(/[\u030D]/g,"\u0358"),0===d?"":'<h-zhuyin length="'+d+'" diao="'+c+'"><h-yin>'+b+"</h-yin><h-diao>"+c+"</h-diao></h-zhuyin>"}function p(){var a,b=E.create("div");return b.innerHTML="<span>a b</span><span style=\"font-family: 'Han Space'\">a b</span>",x.appendChild(b),a=b.firstChild.offsetWidth!==b.lastChild.offsetWidth,E.remove(b,x),a}function q(a,b,c){return function(){var d=A.localize.writeOnCanvas(b,a),e=A.localize.writeOnCanvas(c,a);return A.localize.compareCanvases(d,e)}}function r(){return q('"Romanization Sans"',"a\u030d","\udb80\udc61")}function s(){return q('"Romanization Sans"',"i\u030d","\udb80\udc69")}function t(){return q('"Zhuyin Kaiti"',"\u31b4\u0358","\udb8c\uddb4")}function u(a){return function(b){var b=b||v,c=A.find(b).avoid(M);return a.forEach(function(a){c.replace(new RegExp(a[0],"ig"),function(b,c){var d=E.clone(N);return d.innerHTML="<h-inner>"+c[0]+"</h-inner>",d.setAttribute("display-as",a[1]),0===b.index?d:""})}),c}}var v=a.document,w=v.documentElement,x=v.body,y="3.2.7",z=["initCond","renderElem","renderHanging","renderJiya","renderHWS","correctBasicBD","substCombLigaWithPUA"],A=function(a,b){return new A.fn.init(a,b)},B=function(){return arguments[0]&&(this.context=arguments[0]),arguments[1]&&(this.condition=arguments[1]),this};A.version=y,A.fn=A.prototype={version:y,constructor:A,context:x,condition:w,routine:z,init:B,setRoutine:function(a){return Array.isArray(a)&&(this.routine=a),this},render:function(a){var b=this,a=Array.isArray(a)?a:this.routine;return a.forEach(function(a){try{"string"==typeof a?b[a]():Array.isArray(a)&&b[a.shift()].apply(b,a)}catch(c){}}),this}},A.fn.init.prototype=A.fn,A.init=function(){return A.init=A().render()};var C={punct:{base:"[\u2026,.;:!?\u203d_]",sing:"[\u2010-\u2014\u2026]",middle:"[\\/~\\-&\u2010-\u2014_]",open:"['\"\u2018\u201c\\(\\[\xa1\xbf\u2e18\xab\u2039\u201a\u201c\u201e]",close:"['\"\u201d\u2019\\)\\]\xbb\u203a\u201b\u201d\u201f]",end:"['\"\u201d\u2019\\)\\]\xbb\u203a\u201b\u201d\u201f\u203c\u203d\u2047-\u2049,.;:!?]"},biaodian:{base:"[\ufe30\uff0e\u3001\uff0c\u3002\uff1a\uff1b\uff1f\uff01\u30fc]",liga:"[\u2014\u2026\u22ef]",middle:"[\xb7\uff3c\uff0f\uff0d\u30a0\uff06\u30fb\uff3f]",open:"[\u300c\u300e\u300a\u3008\uff08\u3014\uff3b\uff5b\u3010\u3016]",close:"[\u300d\u300f\u300b\u3009\uff09\u3015\uff3d\uff5d\u3011\u3017]",end:"[\u300d\u300f\u300b\u3009\uff09\u3015\uff3d\uff5d\u3011\u3017\ufe30\uff0e\u3001\uff0c\u3002\uff1a\uff1b\uff1f\uff01\u30fc]"},hanzi:{base:"[\u4e00-\u9fff\u3400-\u4db5\u31c0-\u31e3\u3007\ufa0e\ufa0f\ufa11\ufa13\ufa14\ufa1f\ufa21\ufa23\ufa24\ufa27-\ufa29]|[\ud800-\udbff][\udc00-\udfff]",desc:"[\u2ff0-\u2ffa]",radical:"[\u2f00-\u2fd5\u2e80-\u2ef3]"},latin:{base:"[A-Za-z0-9\xc0-\xff\u0100-\u017f\u0180-\u024f\u2c60-\u2c7f\ua720-\ua7ff\u1e00-\u1eff]",combine:"[\u0300-\u0341\u1dc0-\u1dff]"},ellinika:{base:"[0-9\u0370-\u03ff\u1f00-\u1fff]",combine:"[\u0300-\u0345\u1dc0-\u1dff]"},kirillica:{base:"[0-9\u0400-\u0482\u048a-\u04ff\u0500-\u052f\ua640-\ua66e\ua67e-\ua697]",combine:"[\u0483-\u0489\u2de0-\u2dff\ua66f-\ua67d\ua69f]"},kana:{base:"[\u30a2\u30a4\u30a6\u30a8\u30aa-\u30fa\u3042\u3044\u3046\u3048\u304a-\u3094\u309f\u30ff]|\ud82c[\udc00-\udc01]",small:"[\u3041\u3043\u3045\u3047\u3049\u30a1\u30a3\u30a5\u30a7\u30a9\u3063\u3083\u3085\u3087\u308e\u3095\u3096\u30c3\u30e3\u30e5\u30e7\u30ee\u30f5\u30f6\u31f0-\u31ff]",combine:"[\u3099-\u309c]",half:"[\uff66-\uff9f]",mark:"[\u30a0\u309d\u309e\u30fb-\u30fe]"},eonmun:{base:"[\uac00-\ud7a3]",letter:"[\u1100-\u11ff\u314f-\u3163\u3131-\u318e\ua960-\ua97c\ud7b0-\ud7fb]",half:"[\uffa1-\uffdc]"},zhuyin:{base:"[\u3105-\u312d\u31a0-\u31ba]",initial:"[\u3105-\u3119\u312a-\u312c\u31a0-\u31a3]",medial:"[\u3127-\u3129]","final":"[\u311a-\u3129\u312d\u31a4-\u31b3\u31b8-\u31ba]",tone:"[\u02d9\u02ca\u02c5\u02c7\u02cb\u02ea\u02eb]",checked:"[\u31b4-\u31b7][\u0358\u030d]?"}},D=function(){var a="[\\x20\\t\\r\\n\\f]",b=C.punct.open,c=(C.punct.close,C.punct.end),d=C.punct.middle,e=C.punct.sing,f=b+"|"+c+"|"+d,g=C.biaodian.open,h=C.biaodian.close,i=C.biaodian.end,j=C.biaodian.middle,k=C.biaodian.liga+"{2}",l=g+"|"+i+"|"+j,m=C.kana.base+C.kana.combine+"?",n=C.kana.small+C.kana.combine+"?",o=C.kana.half,p=C.eonmun.base+"|"+C.eonmun.letter,q=C.eonmun.half,r=C.hanzi.base+"|"+C.hanzi.desc+"|"+C.hanzi.radical+"|"+m,s=C.ellinika.combine,t=C.latin.base+s+"*",u=C.ellinika.base+s+"*",v=C.kirillica.combine,w=C.kirillica.base+v+"*",x=t+"|"+u+"|"+w,y="['\u2019]",z=r+"|(?:"+x+"|"+y+")+",A=C.zhuyin.initial,B=C.zhuyin.medial,D=C.zhuyin["final"],E=C.zhuyin.tone+"|"+C.zhuyin.checked;return{"char":{punct:{all:new RegExp("("+f+")","g"),open:new RegExp("("+b+")","g"),end:new RegExp("("+c+")","g"),sing:new RegExp("("+e+")","g")},biaodian:{all:new RegExp("("+l+")","g"),open:new RegExp("("+g+")","g"),close:new RegExp("("+h+")","g"),end:new RegExp("("+i+")","g"),liga:new RegExp("("+k+")","g")},hanzi:new RegExp("("+r+")","g"),latin:new RegExp("("+t+")","ig"),ellinika:new RegExp("("+u+")","ig"),kirillica:new RegExp("("+w+")","ig"),kana:new RegExp("("+m+"|"+n+"|"+o+")","g"),eonmun:new RegExp("("+p+"|"+q+")","g")},group:{biaodian:[new RegExp("(("+l+"){2,})","g"),new RegExp("("+k+g+")","g")],punct:null,hanzi:new RegExp("("+r+")+","g"),western:new RegExp("("+t+"|"+u+"|"+w+"|"+f+")+","ig"),kana:new RegExp("("+m+"|"+n+"|"+o+")+","g"),eonmun:new RegExp("("+p+"|"+q+"|"+f+")+","g")},jinze:{hanging:new RegExp("("+h+"*|[\u2026\u22ef]*)([\u3001\uff0c\u3002\uff0e])(?!"+i+")","ig"),touwei:new RegExp("("+g+"+)("+z+")("+i+"+)","ig"),tou:new RegExp("("+g+"+)("+z+")","ig"),wei:new RegExp("("+z+")("+i+"+)","ig"),middle:new RegExp("("+z+")("+j+")("+z+")","ig")},zhuyin:{form:new RegExp("^\u02d9?("+A+")?("+B+")?("+D+")?("+E+")?$"),diao:new RegExp("("+E+")","g")},hws:{base:[new RegExp("("+r+")("+x+"|"+b+")","ig"),new RegExp("("+x+"|"+c+")("+r+")","ig")],strict:[new RegExp("("+r+")"+a+"?("+x+"|"+b+")","ig"),new RegExp("("+x+"|"+c+")"+a+"?("+r+")","ig")]},"display-as":{"ja-font-for-hant":["\u67e5 \u67fb","\u555f \u5553","\u9109 \u9115","\u503c \u5024","\u6c61 \u6c5a"],"comb-liga-pua":[["a[\u030d\u0358]","\udb80\udc61"],["e[\u030d\u0358]","\udb80\udc65"],["i[\u030d\u0358]","\udb80\udc69"],["o[\u030d\u0358]","\udb80\udc6f"],["u[\u030d\u0358]","\udb80\udc75"],["\u31b4[\u030d\u0358]","\udb8c\uddb4"],["\u31b5[\u030d\u0358]","\udb8c\uddb5"],["\u31b6[\u030d\u0358]","\udb8c\uddb6"],["\u31b7[\u030d\u0358]","\udb8c\uddb7"]],"comb-liga-vowel":[["a[\u030d\u0358]","\udb80\udc61"],["e[\u030d\u0358]","\udb80\udc65"],["i[\u030d\u0358]","\udb80\udc69"],["o[\u030d\u0358]","\udb80\udc6f"],["u[\u030d\u0358]","\udb80\udc75"]],"comb-liga-zhuyin":[["\u31b4[\u030d\u0358]","\udb8c\uddb4"],["\u31b5[\u030d\u0358]","\udb8c\uddb5"],["\u31b6[\u030d\u0358]","\udb8c\uddb6"],["\u31b7[\u030d\u0358]","\udb8c\uddb7"]]},"inaccurate-char":[["[\u2022\u2027]","\xb7"],["\u22ef\u22ef","\u2026\u2026"],["\u2500\u2500","\u2014\u2014"],["\u2035","\u2018"],["\u2032","\u2019"],["\u2036","\u201c"],["\u2033","\u201d"]]}}();A.UNICODE=C,A.TYPESET=D,A.UNICODE.cjk=A.UNICODE.hanzi,A.UNICODE.greek=A.UNICODE.ellinika,A.UNICODE.cyrillic=A.UNICODE.kirillica,A.UNICODE.hangul=A.UNICODE.eonmun,A.UNICODE.zhuyin.ruyun=A.UNICODE.zhuyin.checked,A.TYPESET["char"].cjk=A.TYPESET["char"].hanzi,A.TYPESET["char"].greek=A.TYPESET["char"].ellinika,A.TYPESET["char"].cyrillic=A.TYPESET["char"].kirillica,A.TYPESET["char"].hangul=A.TYPESET["char"].eonmun;var E={id:function(a,b){return(b||v).getElementById(a)},tag:function(a,b){return this.makeArray((b||v).getElementsByTagName(a))},qsa:function(a,b){return this.makeArray((b||v).querySelectorAll(a))},create:function(a,b){var a="!"===a?v.createDocumentFragment():""===a?v.createTextNode(b||""):v.createElement(a);try{b&&(a.className=b)}catch(c){}return a},clone:function(a,b){return a.cloneNode("boolean"==typeof b?b:!0)},remove:function(a){return a.parentNode.removeChild(a)},setAttr:function(a,b){if("object"==typeof b){var c=b.length;if("object"==typeof b[0]&&"name"in b[0])for(var d=0;c>d;d++)void 0!==b[d].value&&a.setAttribute(b[d].name,b[d].value);else for(var e in b)b.hasOwnProperty(e)&&void 0!==b[e]&&a.setAttribute(e,b[e]);return a}},isIgnorable:function(a){return"WBR"===a.nodeName||a.nodeType===Node.COMMENT_NODE},makeArray:function(a){return Array.prototype.slice.call(a)},extend:function(a,b){var c="object"==typeof a||"function"==typeof a||"object"==typeof b;if(c){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a}}},F=function(b){function c(a,b,c){var d=Element.prototype,e=d.matches||d.mozMatchesSelector||d.msMatchesSelector||d.webkitMatchesSelector;return a instanceof Element?e.call(a,b):c&&/^[39]$/.test(a.nodeType)?!0:!1}var d="0.2.1",e=b.NON_INLINE_PROSE,f=b.PRESETS.prose.filterElements,g=a||{},h=g.document||void 0;if("undefined"==typeof h)throw new Error("Fibre requires a DOM-supported environment.");var i=function(a,b){return new i.fn.init(a,b)};return i.version=d,i.matches=c,i.fn=i.prototype={constructor:i,version:d,finder:[],context:void 0,portionMode:"retain",selector:{},preset:"prose",init:function(a,b){if(b&&(this.preset=null),this.selector={context:null,filter:[],avoid:[],boundary:[]},!a)throw new Error("A context is required for Fibre to initialise.");return a instanceof Node?a instanceof Document?this.context=a.body||a:this.context=a:"string"==typeof a&&(this.context=h.querySelector(a),this.selector.context=a),this},filterFn:function(a){var b=this.selector.filter.join(", ")||"*",d=this.selector.avoid.join(", ")||null,e=c(a,b,!0)&&!c(a,d);return"prose"===this.preset?f(a)&&e:e},boundaryFn:function(a){var b=this.selector.boundary.join(", ")||null,d=c(a,b);return"prose"===this.preset?e(a)||d:d},filter:function(a){return"string"==typeof a&&this.selector.filter.push(a),this},endFilter:function(a){return a?this.selector.filter=[]:this.selector.filter.pop(),this},avoid:function(a){return"string"==typeof a&&this.selector.avoid.push(a),this},endAvoid:function(a){return a?this.selector.avoid=[]:this.selector.avoid.pop(),this},addBoundary:function(a){return"string"==typeof a&&this.selector.boundary.push(a),this},removeBoundary:function(){return this.selector.boundary=[],this},setMode:function(a){return this.portionMode="first"===a?"first":"retain",this},replace:function(a,c){var d=this;return d.finder.push(b(d.context,{find:a,replace:c,filterElements:function(a){return d.filterFn(a)},forceContext:function(a){return d.boundaryFn(a)},portionMode:d.portionMode})),d},wrap:function(a,c){var d=this;return d.finder.push(b(d.context,{find:a,wrap:c,filterElements:function(a){return d.filterFn(a)},forceContext:function(a){return d.boundaryFn(a)},portionMode:d.portionMode})),d},revert:function(a){var b=this.finder.length,a=Number(a)||(0===a?Number(0):"all"===a?b:1);if("undefined"==typeof b||0===b)return this;a>b&&(a=b);for(var c=a;c>0;c--)this.finder.pop().revert();return this}},i.fn.filterOut=i.fn.avoid,i.fn.init.prototype=i.fn,i}(function(){function a(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function b(){return c.apply(null,arguments)||d.apply(null,arguments)}function c(a,c,e,f,g){if(c&&!c.nodeType&&arguments.length<=2)return!1;var h="function"==typeof e;h&&(e=function(a){return function(b,c){return a(b.text,c.startIndex)}}(e));var i=d(c,{find:a,wrap:h?null:e,replace:h?e:"$"+(f||"&"),prepMatch:function(a,b){if(!a[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(f>0){var c=a[f];a.index+=a[0].indexOf(c),a[0]=c}return a.endIndex=a.index+a[0].length,a.startIndex=a.index,a.index=b,a},filterElements:g});return b.revert=function(){return i.revert()},!0}function d(a,b){return new e(a,b)}function e(a,c){var d=c.preset&&b.PRESETS[c.preset];if(c.portionMode=c.portionMode||f,d)for(var e in d)i.call(d,e)&&!i.call(c,e)&&(c[e]=d[e]);this.node=a,this.options=c,this.prepMatch=c.prepMatch||this.prepMatch,this.reverts=[],this.matches=this.search(),this.matches.length&&this.processMatches()}var f="retain",g="first",h=v,i=({}.toString,{}.hasOwnProperty);return b.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},b.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},b.NON_INLINE_PROSE=function(a){return i.call(b.NON_CONTIGUOUS_PROSE_ELEMENTS,a.nodeName.toLowerCase())},b.PRESETS={prose:{forceContext:b.NON_INLINE_PROSE,filterElements:function(a){return!i.call(b.NON_PROSE_ELEMENTS,a.nodeName.toLowerCase())}}},b.Finder=e,e.prototype={search:function(){function b(a){for(var g=0,j=a.length;j>g;++g){var k=a[g];if("string"==typeof k){if(f.global)for(;c=f.exec(k);)h.push(i.prepMatch(c,d++,e));else(c=k.match(f))&&h.push(i.prepMatch(c,0,e));e+=k.length}else b(k)}}var c,d=0,e=0,f=this.options.find,g=this.getAggregateText(),h=[],i=this;return f="string"==typeof f?RegExp(a(f),"g"):f,b(g),h},prepMatch:function(a,b,c){if(!a[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return a.endIndex=c+a.index+a[0].length,a.startIndex=c+a.index,a.index=b,a},getAggregateText:function(){function a(d,e){if(3===d.nodeType)return[d.data];if(b&&!b(d))return[];var e=[""],f=0;if(d=d.firstChild)do if(3!==d.nodeType){var g=a(d);c&&1===d.nodeType&&(c===!0||c(d))?(e[++f]=g,e[++f]=""):("string"==typeof g[0]&&(e[f]+=g.shift()),g.length&&(e[++f]=g,e[++f]=""))}else e[f]+=d.data;while(d=d.nextSibling);return e}var b=this.options.filterElements,c=this.options.forceContext;return a(this.node)},processMatches:function(){var a,b,c,d=this.matches,e=this.node,f=this.options.filterElements,g=[],h=e,i=d.shift(),j=0,k=0,l=0,m=[e];a:for(;;){if(3===h.nodeType&&(!b&&h.length+j>=i.endIndex?b={node:h,index:l++,text:h.data.substring(i.startIndex-j,i.endIndex-j),indexInMatch:j-i.startIndex,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,isEnd:!0}:a&&g.push({node:h,index:l++,text:h.data,indexInMatch:j-i.startIndex,indexInNode:0}),!a&&h.length+j>i.startIndex&&(a={node:h,index:l++,indexInMatch:0,indexInNode:i.startIndex-j,endIndexInNode:i.endIndex-j,text:h.data.substring(i.startIndex-j,i.endIndex-j)}),j+=h.data.length),c=1===h.nodeType&&f&&!f(h),a&&b){if(h=this.replaceMatch(i,a,g,b),j-=b.node.data.length-b.endIndexInNode,a=null,b=null,g=[],i=d.shift(),l=0,k++,!i)break}else if(!c&&(h.firstChild||h.nextSibling)){h.firstChild?(m.push(h),h=h.firstChild):h=h.nextSibling;continue}for(;;){if(h.nextSibling){h=h.nextSibling;break}if(h=m.pop(),h===e)break a}}},revert:function(){for(var a=this.reverts.length;a--;)this.reverts[a]();this.reverts=[]},prepareReplacementString:function(a,b,c,d){var e=this.options.portionMode;return e===g&&b.indexInMatch>0?"":(a=a.replace(/\$(\d+|&|`|')/g,function(a,b){var d;switch(b){case"&":d=c[0];break;case"`":d=c.input.substring(0,c.startIndex);break;case"'":d=c.input.substring(c.endIndex);break;default:d=c[+b]}return d}),e===g?a:b.isEnd?a.substring(b.indexInMatch):a.substring(b.indexInMatch,b.indexInMatch+b.text.length))},getPortionReplacementNode:function(a,b,c){var d=this.options.replace||"$&",e=this.options.wrap;if(e&&e.nodeType){var f=h.createElement("div");f.innerHTML=e.outerHTML||(new XMLSerializer).serializeToString(e),e=f.firstChild}if("function"==typeof d)return d=d(a,b,c),d&&d.nodeType?d:h.createTextNode(String(d));var g="string"==typeof e?h.createElement(e):e;return d=h.createTextNode(this.prepareReplacementString(d,a,b,c)),d.data&&g?(g.appendChild(d),g):d},replaceMatch:function(a,b,c,d){var e,f,g=b.node,i=d.node;if(g===i){var j=g;b.indexInNode>0&&(e=h.createTextNode(j.data.substring(0,b.indexInNode)),j.parentNode.insertBefore(e,j));var k=this.getPortionReplacementNode(d,a);return j.parentNode.insertBefore(k,j),d.endIndexInNode<j.length&&(f=h.createTextNode(j.data.substring(d.endIndexInNode)),j.parentNode.insertBefore(f,j)),j.parentNode.removeChild(j),this.reverts.push(function(){e===k.previousSibling&&e.parentNode.removeChild(e),f===k.nextSibling&&f.parentNode.removeChild(f),k.parentNode.replaceChild(j,k)}),k}e=h.createTextNode(g.data.substring(0,b.indexInNode)),f=h.createTextNode(i.data.substring(d.endIndexInNode));for(var l=this.getPortionReplacementNode(b,a),m=[],n=0,o=c.length;o>n;++n){var p=c[n],q=this.getPortionReplacementNode(p,a);p.node.parentNode.replaceChild(q,p.node),this.reverts.push(function(a,b){return function(){b.parentNode.replaceChild(a.node,b)}}(p,q)),m.push(q)}var r=this.getPortionReplacementNode(d,a);return g.parentNode.insertBefore(e,g),g.parentNode.insertBefore(l,g),g.parentNode.removeChild(g),i.parentNode.insertBefore(r,i),i.parentNode.insertBefore(f,i),i.parentNode.removeChild(i),this.reverts.push(function(){e.parentNode.removeChild(e),l.parentNode.replaceChild(g,l),f.parentNode.removeChild(f),r.parentNode.replaceChild(i,r)}),r}},b}());E.extend(F.fn,{jinzify:function(a){return this.filter(a||null).avoid("h-jinze").replace(D.jinze.touwei,function(a,b){var c=E.create("h-jinze","touwei");return c.innerHTML=b[0],0===a.index&&a.isEnd||1===a.index?c:""}).replace(D.jinze.wei,function(a,b){var c=E.create("h-jinze","wei");return c.innerHTML=b[0],0===a.index?c:""}).replace(D.jinze.tou,function(a,b){var c=E.create("h-jinze","tou");return c.innerHTML=b[0],0===a.index&&a.isEnd||1===a.index?c:""}).replace(D.jinze.middle,function(a,b){var c=E.create("h-jinze","middle");return c.innerHTML=b[0],0===a.index&&a.isEnd||1===a.index?c:""}).endAvoid().endFilter()},groupify:function(a){var a=E.extend({biaodian:!1,hanzi:!1,kana:!1,eonmun:!1,western:!1},a||{});return this.avoid("h-hangable, h-char-group, h-word"),a.biaodian&&this.replace(D.group.biaodian[0],c).replace(D.group.biaodian[1],c),(a.hanzi||a.cjk)&&this.wrap(D.group.hanzi,E.clone(E.create("h-char-group","hanzi cjk"))),a.western&&this.wrap(D.group.western,E.clone(E.create("h-word","western"))),a.kana&&this.wrap(D.group.kana,E.clone(E.create("h-char-group","kana"))),(a.eonmun||a.hangul)&&this.wrap(D.group.eonmun,E.clone(E.create("h-word","eonmun hangul"))),this.endAvoid(),this},charify:function(a){var a=E.extend({biaodian:!1,punct:!1,hanzi:!1,latin:!1,ellinika:!1,kirillica:!1,kana:!1,eonmun:!1},a||{});return this.avoid("h-char"),a.biaodian&&this.replace(D["char"].biaodian.all,function(a,b){return d(b[0])}).replace(D["char"].biaodian.liga,function(a,b){return d(b[0])}),(a.hanzi||a.cjk)&&this.wrap(D["char"].hanzi,E.clone(E.create("h-char","hanzi cjk"))),a.punct&&this.wrap(D["char"].punct.all,E.clone(E.create("h-char","punct"))),a.latin&&this.wrap(D["char"].latin,E.clone(E.create("h-char","alphabet latin"))),(a.ellinika||a.greek)&&this.wrap(D["char"].ellinika,E.clone(E.create("h-char","alphabet ellinika greek"))),(a.kirillica||a.cyrillic)&&this.wrap(D["char"].kirillica,E.clone(E.create("h-char","alphabet kirillica cyrillic"))),a.kana&&this.wrap(D["char"].kana,E.clone(E.create("h-char","kana"))),(a.eonmun||a.hangul)&&this.wrap(D["char"].eonmun,E.clone(E.create("h-char","eonmun hangul"))),this.endAvoid(),this}}),A.find=F,void["setMode","wrap","replace","revert","addBoundary","removeBoundary","avoid","endAvoid","filter","endFilter","jinzify","groupify","charify"].forEach(function(a){A.fn[a]=function(){return this.finder||(this.finder=A.find(this.context)),this.finder[a](arguments[0],arguments[1]),this}});var G={};G.writeOnCanvas=e,G.compareCanvases=f,G.detectFont=g,G.support=function(){function b(a){var b,c=a.charAt(0).toUpperCase()+a.slice(1),d=(a+" "+e.join(c+" ")+c).split(" ");return d.forEach(function(a){"string"==typeof f.style[a]&&(b=!0)}),b||!1}function c(a,b){var c,d,e,f=x||E.create("body"),g=E.create("div"),h=x?g:f,b="function"==typeof b?b:function(){};return c=["<style>",a,"</style>"].join(""),h.innerHTML+=c,f.appendChild(g),x||(f.style.background="",f.style.overflow="hidden",e=w.style.overflow,w.style.overflow="hidden",w.appendChild(f)),d=b(h,a),E.remove(h),x||(w.style.overflow=e),!!d}function d(b,c){var d;return a.getComputedStyle?d=v.defaultView.getComputedStyle(b,null).getPropertyValue(c):b.currentStyle&&(d=b.currentStyle[c]),d}var e="Webkit Moz ms".split(" "),f=E.create("h-test");return{columnwidth:b("columnWidth"),fontface:function(){var a;return c('@font-face { font-family: font; src: url("//"); }',function(b,c){var d=E.qsa("style",b)[0],e=d.sheet||d.styleSheet,f=e?e.cssRules&&e.cssRules[0]?e.cssRules[0].cssText:e.cssText||"":"";a=/src/i.test(f)&&0===f.indexOf(c.split(" ")[0])}),a}(),ruby:function(){var a,b=E.create("ruby"),c=E.create("rt"),e=E.create("rp");return b.appendChild(e),b.appendChild(c),w.appendChild(b),a="none"===d(e,"display")||"ruby"===d(b,"display")&&"ruby-text"===d(c,"display")?!0:!1,w.removeChild(b),b=null,c=null,e=null,a}(),"ruby-display":function(){var a=E.create("div");return a.innerHTML='<h-test-a style="display: ruby;"></h-test-a><h-test-b style="display: ruby-text-container;"></h-test-b>',"ruby"===a.querySelector("h-test-a").style.display&&"ruby-text-container"===a.querySelector("h-test-b").style.display}(),"ruby-interchar":function(){var a,b="inter-character",c=E.create("div");return c.innerHTML='<h-test style="-moz-ruby-position:'+b+";-ms-ruby-position:"+b+";-webkit-ruby-position:"+b+";ruby-position:"+b+';"></h-test>',a=c.querySelector("h-test").style,a.rubyPosition===b||a.WebkitRubyPosition===b||a.MozRubyPosition===b||a.msRubyPosition===b}(),textemphasis:b("textEmphasis"),unicoderange:function(){var a;return c('@font-face{font-family:test-for-unicode-range;src:local(Arial),local("Droid Sans")}@font-face{font-family:test-for-unicode-range;src:local("Times New Roman"),local(Times),local("Droid Serif");unicode-range:U+270C}',function(){a=!G.detectFont("test-for-unicode-range",'Arial, "Droid Sans"',"Q")}),a}(),writingmode:b("writingMode")}}(),G.initCond=function(a){var b,a=a||w,c="";for(var d in G.support)b=(G.support[d]?"":"no-")+d,a.classList.add(b),c+=b+" ";return c};var H=G.support["ruby-interchar"];E.extend(G,{renderRuby:function(a,b){var b=b||"ruby",c=E.qsa(b,a);E.qsa("rtc",a).concat(c).map(l),c.forEach(function(a){var b,c=a.classList;c.contains("complex")?b=j(a):c.contains("zhuyin")&&(b=H?i(a):h(a)),b&&a.parentNode.replaceChild(b,a)})},simplifyRubyClass:l,getZhuyinHTML:o,renderComplexRuby:j,renderSimpleRuby:h,renderInterCharRuby:i}),E.extend(G,{renderElem:function(a){this.renderRuby(a),this.renderDecoLine(a),this.renderDecoLine(a,"s, del"),this.renderEm(a)},renderDecoLine:function(a,b){var b=b||"u, ins",c=E.qsa(b,a),d=new RegExp("^("+b.replace(/\,\s?/g,"|")+")$","ig");c.forEach(function(a){var b;do if(b=(b||a).nextSibling,!b)return;while(E.isIgnorable(b));b.nodeName.match(d)&&b.classList.add("adjacent")})},renderEm:function(a,b){var c=b?"qsa":"tag",b=b||"em",d=E[c](b,a);d.forEach(function(a){var b=A(a);G.support.textemphasis?b.avoid("rt, h-char, h-char-group").charify({biaodian:!0,punct:!0}):b.avoid("rt, h-char, h-char-group").jinzify().groupify({western:!0,biaodian:!0}).charify({hanzi:!0,biaodian:!0,punct:!0,latin:!0,ellinika:!0,kirillica:!0})})}}),A.normalize=G,A.localize=G,A.support=G.support,A.detectFont=G.detectFont,A.fn.initCond=function(){return this.condition.classList.add("han-js-rendered"),A.normalize.initCond(this.condition),this},void["Elem","DecoLine","Em","Ruby"].forEach(function(a){var b="render"+a;A.fn[b]=function(a){return A.normalize[b](this.context,a),this}}),E.extend(A.support,{heiti:!0,songti:A.detectFont('"Han Songti"'),"songti-gb":A.detectFont('"Han Songti GB"'),kaiti:A.detectFont('"Han Kaiti"'),fangsong:A.detectFont('"Han Fangsong"')});var I="* > h-hws:first-child, * > wbr:first-child + h-hws, wbr:first-child + wbr + h-hws",J=function(){var a=E.create("div");return a.appendChild(E.create("","0-")),a.appendChild(E.create("","2")),a.normalize(),2!==a.firstChild.length}(),K=E.create("h-hws");K.setAttribute("hidden",""),K.innerHTML=" ",E.extend(A,{isNodeNormalizeNormal:J,renderHWS:function(a,b){var a=a||v,c=b?"strict":"base",d=A.find(a);return d.avoid(b?"textarea, code, kbd, samp, pre":"textarea"),d.replace(A.TYPESET.hws[c][0],"$1<hws/>$2").replace(A.TYPESET.hws[c][1],"$1<hws/>$2").replace(/(['"]+)<hws\/>(.+?)<hws\/>\1/gi,"$1$2$1").replace(/<hws\/>([\u2018\u201c]+)/gi,"$1").replace(/([\u2019\u201d]+)<hws\/>/gi,"$1").replace("<hws/>",function(){return E.clone(K)}),E.qsa(I,a).forEach(function(a){for(var b=a.parentNode,c=b.firstChild;E.isIgnorable(c);)if(c=c.nextSibling,!c)return;for(;"H-HWS"===c.nodeName&&(E.remove(c,b),c=b.parentNode.insertBefore(E.clone(K),b),b=b.parentNode,J&&b.normalize(),c===b.firstChild););}),J&&a.normalize(),d}}),E.extend(A.fn,{HWS:null,renderHWS:function(a){return A.renderHWS(this.context,a),this.HWS=E.tag("h-hws",this.context),this},revertHWS:function(){return this.HWS.forEach(function(a){E.remove(a)}),this}}),E.extend(A,{detectSpaceFont:p,isSpaceFontLoaded:p()}),A.support["han-space"]=p(),A.renderHanging=function(a){var a=a||v,b=A.find(a);return b.avoid("textarea, code, kbd, samp, pre, h-hangable").replace(D.jinze.hanging,function(a,b){var c=E.create("h-hangable");return c.innerHTML=b[1]+'<h-cs><h-inner hidden> </h-inner><h-char class="biaodian bd-close bd-end cjk">'+b[2]+"</h-char></h-cs>",0===a.index?c:""}),b},E.extend(A.fn,{hanging:null,renderHanging:function(){var a=this.condition.classList,b=p();return b&&a.contains("no-han-space")&&(a.remove("no-han-space"),a.add("han-space")),this.hanging=A.renderHanging(this.context),this},revertHanging:function(){try{this.hanging.revert("all")}catch(a){}return this}}),A.renderJiya=function(a){var a=a||v,b=A.find(a);return b.avoid("textarea, code, kbd, samp, pre, h-char-group").replace(new RegExp("("+C.biaodian.end+"+)("+C.biaodian.open+"+)","g"),function(a,b){if(0===a.index)return a.isEnd?b[0]:b[1];var c=E.create("h-char-group","biaodian cjk portion");return c.innerHTML=b[2],c}).endAvoid(),b.avoid("textarea, code, kbd, samp, pre, h-char").groupify({biaodian:!0}).charify({biaodian:!0}),E.qsa("h-char.biaodian.bd-open, h-char.biaodian.bd-end",a).forEach(function(a){if(!A.find.matches(a,"h-cs *")){var b="<h-inner>"+a.innerHTML+"</h-inner>",c="<h-cs hidden> </h-cs>",d=a.classList.contains("bd-open");a.innerHTML=d?c+b:b+c}}),b},E.extend(A.fn,{jiya:null,renderJiya:function(){return this.jiya=A.renderJiya(this.context),this},revertJiya:function(){try{this.jiya.revert("all")}catch(a){}return this}});var L;L=E.create("h-char","biaodian cjk bd-middle"),L.setAttribute("unicode","b7"),A.correctBasicBD=function(a,b){if(!A.support.unicoderange||b){var c,a=a||v;c=A.find(a),c.wrap(/\u00B7/g,E.clone(L)).charify({biaodian:!0})}},E.extend(A.fn,{basicBD:null,correctBasicBD:function(a){return this.basicBD=A.correctBasicBD(this.context,a),this},revertBasicBD:function(){try{this.basicBD.revert("all")}catch(a){}return this}});var M="textarea, code, kbd, samp, pre",N=E.create("h-char","comb-liga");return E.extend(A,{isVowelCombLigaNormal:r(),isVowelICombLigaNormal:s(),isZhuyinCombLigaNormal:t(),isCombLigaNormal:s()(),substVowelCombLiga:u(A.TYPESET["display-as"]["comb-liga-vowel"]),substZhuyinCombLiga:u(A.TYPESET["display-as"]["comb-liga-zhuyin"]),substCombLigaWithPUA:u(A.TYPESET["display-as"]["comb-liga-pua"]),substInaccurateChar:function(a){var a=a||v,b=A.find(a);b.avoid(M),A.TYPESET["inaccurate-char"].forEach(function(a){b.replace(new RegExp(a[0],"ig"),a[1])})}}),E.extend(A.fn,{"comb-liga-vowel":null,"comb-liga-vowel-i":null,"comb-liga-zhuyin":null,"inaccurate-char":null,substVowelCombLiga:function(){return this["comb-liga-vowel"]=A.substVowelCombLiga(this.context),this},substVowelICombLiga:function(){ | ||
5 | return this["comb-liga-vowel-i"]=A.substVowelICombLiga(this.context),this},substZhuyinCombLiga:function(){return this["comb-liga-zhuyin"]=A.substZhuyinCombLiga(this.context),this},substCombLigaWithPUA:function(){return A.isVowelCombLigaNormal()?A.isVowelICombLigaNormal()||(this["comb-liga-vowel-i"]=A.substVowelICombLiga(this.context)):this["comb-liga-vowel"]=A.substVowelCombLiga(this.context),A.isZhuyinCombLigaNormal()||(this["comb-liga-zhuyin"]=A.substZhuyinCombLiga(this.context)),this},revertVowelCombLiga:function(){try{this["comb-liga-vowel"].revert("all")}catch(a){}return this},revertVowelICombLiga:function(){try{this["comb-liga-vowel-i"].revert("all")}catch(a){}return this},revertZhuyinCombLiga:function(){try{this["comb-liga-zhuyin"].revert("all")}catch(a){}return this},revertCombLigaWithPUA:function(){try{this["comb-liga-vowel"].revert("all"),this["comb-liga-vowel-i"].revert("all"),this["comb-liga-zhuyin"].revert("all")}catch(a){}return this},substInaccurateChar:function(){return this["inaccurate-char"]=A.substInaccurateChar(this.context),this},revertInaccurateChar:function(){try{this["inaccurate-char"].revert("all")}catch(a){}return this}}),a.addEventListener("DOMContentLoaded",function(){var a;w.classList.contains("han-init")?A.init():(a=v.querySelector(".han-init-context"))&&(A.init=A(a).render())}),("undefined"==typeof b||b===!1)&&(a.Han=A),A}); \ No newline at end of file | ||