Skip to content

Commit 4849833

Browse files
committed
示例插件dat-gui支持国际化
1 parent d473cb4 commit 4849833

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

examples/js/include-web.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
}
9494
if (inArray(includes, 'dat-gui')) {
9595
inputScript("http://cdn.bootcss.com/dat-gui/0.6.5/dat.gui.min.js");
96+
datGuiI18N();
9697
}
9798
if (inArray(includes, 'admin-lte')) {
9899
inputCSS("http://cdn.bootcss.com/admin-lte/2.3.8/css/AdminLTE.min.css");
@@ -147,6 +148,16 @@
147148
}
148149
}
149150

151+
function datGuiI18N() {
152+
document.writeln("<script>function registerEventListener(evt,fn){" +
153+
"if(window.attachEvent){window.attachEvent('on'+evt,fn);}" +
154+
"else{window.addEventListener(evt,fn,false);}" +
155+
"}</script>");
156+
document.writeln("<script>registerEventListener('load',function() { " +
157+
"dat.GUI.TEXT_CLOSED=resources.text_close;dat.GUI.TEXT_OPEN=resources.text_open;" +
158+
"})</script>")
159+
}
160+
150161
load();
151162
window.isLocal = false;
152163
window.server = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : document.location.protocol + "//" + document.location.host;

0 commit comments

Comments
 (0)