Skip to content

Commit b4d3b89

Browse files
committed
Support script code Hans/Hant in querystring.
1 parent c493d91 commit b4d3b89

File tree

1 file changed

+8
-1
lines changed
  • blog/themes/freewill/source/js

1 file changed

+8
-1
lines changed

blog/themes/freewill/source/js/main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,18 @@ function simplifyTextInPage(simplified) {
7171

7272
function initializeChineseConversion() {
7373
var simplified = +$.cookie('simplified');
74+
// ?lang=zh-Hans, ?lang=zh-Hant
75+
var scriptCode = /[?&;]lang=[^&;]*(Han[st])/i.exec(window.location.search);
76+
if (scriptCode) {
77+
simplified = +(scriptCode[1].match(/Hans/i) != null);
78+
$.cookie('simplified', simplified, {expires: 365, path: '/'});
79+
}
80+
simplifyTextInPage(simplified);
81+
7482
$('#btn-simplify').click(function() {
7583
simplified = +!simplified;
7684
$.cookie('simplified', simplified, {expires: 365, path: '/'});
7785
simplifyTextInPage(simplified);
7886
$(this).blur();
7987
});
80-
simplifyTextInPage(simplified);
8188
}

0 commit comments

Comments
 (0)