所有 强制使用字体 脚本的核心脚本
< Commentaires sur 强制使用字体 - 核心
0为单执行模式 一些建议
function changeFont(font) { if (font !== "") { var css = '@namespace url(http://www.w3.org/1999/xhtml);' + 'html,' + '[lang=zh-CN] {' + ' font-family: "' + font + '", sans-serif;' + '}' + '[lang=zh-TW] {' + ' font-family: "'+font+'", sans-serif;' + '}' + '[lang=zh-HK] {' + ' font-family: "'+font+'", sans-serif;' + '}' + '[lang=ja-JP] {' + ' font-family: sans-serif;' + '}' + '[lang=ko-KR] {' + ' font-family: sans-serif;' + '}' + 'body,' + 'input,' + 'textarea,' + 'keygen,' + 'select,' + 'button {' + ' -webkit-font-smoothing: antialiased;' + ' -moz-osx-font-smoothing: grayscale;' + ' text-rendering: optimizeLegibility;' + '}' + '@font-face {' + ' font-family: "Arial";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Tahoma";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Verdana";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Helvetica Neue";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Helvetica";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Segoe UI";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Courier";' + ' src: local("Consolas");' + '}' + '@font-face {' + ' font-family: "Courier New";' + ' src: local("Consolas");' + '}' + '@font-face {' + ' font-family: "SimSun";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "SimSun-ExtB";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "宋体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "NSimSun";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "新宋体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "SimHei";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "黑体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "STHeiti SC";' + ' src: local("PingFang SC");' + '}' + '@font-face {' + ' font-family: "MingLiU";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU_HKSCS";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU_HKSCS-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "PMingLiU";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "PMingLiU-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "STHeiti TC";' + ' src: local("PingFang TC");' + '}';
var style = document.createElement("style"); style.type = "text/css"; style.innerHTML = css; document.documentElement.appendChild(style); }
}
感谢提出建议,我这边会参考一下的
Connectez-vous pour poster une réponse.
0为单执行模式 一些建议
function changeFont(font) { if (font !== "") { var css = '@namespace url(http://www.w3.org/1999/xhtml);' + 'html,' + '[lang=zh-CN] {' + ' font-family: "' + font + '", sans-serif;' + '}' + '[lang=zh-TW] {' + ' font-family: "'+font+'", sans-serif;' + '}' + '[lang=zh-HK] {' + ' font-family: "'+font+'", sans-serif;' + '}' + '[lang=ja-JP] {' + ' font-family: sans-serif;' + '}' + '[lang=ko-KR] {' + ' font-family: sans-serif;' + '}' + 'body,' + 'input,' + 'textarea,' + 'keygen,' + 'select,' + 'button {' + ' -webkit-font-smoothing: antialiased;' + ' -moz-osx-font-smoothing: grayscale;' + ' text-rendering: optimizeLegibility;' + '}' + '@font-face {' + ' font-family: "Arial";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Tahoma";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Verdana";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Helvetica Neue";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Helvetica";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Segoe UI";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "Courier";' + ' src: local("Consolas");' + '}' + '@font-face {' + ' font-family: "Courier New";' + ' src: local("Consolas");' + '}' + '@font-face {' + ' font-family: "SimSun";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "SimSun-ExtB";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "宋体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "NSimSun";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "新宋体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "SimHei";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "黑体";' + ' src: local("' + font + '");' + '}' + '@font-face {' + ' font-family: "STHeiti SC";' + ' src: local("PingFang SC");' + '}' + '@font-face {' + ' font-family: "MingLiU";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU_HKSCS";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "MingLiU_HKSCS-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "PMingLiU";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "PMingLiU-ExtB";' + ' src: local("'+font+'");' + '}' + '@font-face {' + ' font-family: "STHeiti TC";' + ' src: local("PingFang TC");' + '}';
}