File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
blog/themes/freewill/source/js Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,18 @@ function simplifyTextInPage(simplified) {
71
71
72
72
function initializeChineseConversion ( ) {
73
73
var simplified = + $ . cookie ( 'simplified' ) ;
74
+ // ?lang=zh-Hans, ?lang=zh-Hant
75
+ var scriptCode = / [ ? & ; ] l a n g = [ ^ & ; ] * ( H a n [ s t ] ) / i. exec ( window . location . search ) ;
76
+ if ( scriptCode ) {
77
+ simplified = + ( scriptCode [ 1 ] . match ( / H a n s / i) != null ) ;
78
+ $ . cookie ( 'simplified' , simplified , { expires : 365 , path : '/' } ) ;
79
+ }
80
+ simplifyTextInPage ( simplified ) ;
81
+
74
82
$ ( '#btn-simplify' ) . click ( function ( ) {
75
83
simplified = + ! simplified ;
76
84
$ . cookie ( 'simplified' , simplified , { expires : 365 , path : '/' } ) ;
77
85
simplifyTextInPage ( simplified ) ;
78
86
$ ( this ) . blur ( ) ;
79
87
} ) ;
80
- simplifyTextInPage ( simplified ) ;
81
88
}
You can’t perform that action at this time.
0 commit comments