行 1: |
行 1: |
− | str = document.getElementsByClassName('mw-parser-output')[0].outerText;
| + | var reg = /(?:([0-9A-Za-z_])([\u4e00-\u9fa5]))|(?:([\u4e00-\u9fa5])([0-9A-Za-z_]))/g; |
− | let s1 = /([0-9A-Za-z_])([\u4e00-\u9fa5])/g;
| + | var result; |
− | let s2 = /([\u4e00-\u9fa5])([0-9A-Za-z_])/g;
| + | $('.mw-parser-output).each(function () { |
− | temp = str.replace(s1, "$1 $2");
| + | while( match = reg.exec(targetText) !== null ) { |
− | str = temp.replace(s2, "$1 $2");
| + | this = this.replace(reg, "$1$3 $2$4"); |
| + | } |
| + | }); |