1(function () { 2 function loadProperties (language) { 3 jQuery.i18n.properties({ 4 name: 'i18n', 5 path: '../i18n/', 6 cache: true, 7 language: language, 8 mode: 'map', 9 callback: function () { 10 var insertEle = $("[data-i18n]"); 11 insertEle.each(function () { 12 try { 13 if (typeof ($(this).attr("placeholder")) != "undefined") { 14 $(this).attr("placeholder", $.i18n.prop($(this).data('i18n'))); 15 } else if (typeof ($(this).attr("button")) != "undefined") { 16 $(this).attr("button", $.i18n.prop($(this).data('i18n'))); 17 } else { 18 $(this).text($.i18n.prop($(this).data('i18n'))); 19 } 20 } catch (e) { 21 console.log("keyä¸åå¨ï¼è¯·å¨é ç½®æä»¶ä¸é 置对åºçkeyï¼" + $(this).data('i18n')); 22 } 23 }); 24 } 25 }); 26 }; 27 28 29 // åå§å 30 $(document).ready(function () { 31 let language = window.localStorage.getItem('xj_lang') || (navigator.language.includes('zh') ? 'zh' : 'en'); 32 window.localStorage.setItem('xj_lang', language) 33 loadProperties(language); 34 $('#lang').text(language === 'zh' ? 'English' : '䏿') 35 $('#lang').attr('data-lang', language === 'zh' ? 'zh' : 'en') 36 }); 37 38 // è¯è¨åæ¢ 39 $('#language-click').click(function () { 40 if ($('#lang').attr('data-lang') === 'zh') { 41 window.localStorage.setItem('xj_lang', 'en') 42 window.location.reload() 43 } else { 44 window.localStorage.setItem('xj_lang', 'zh') 45 window.location.reload() 46 } 47 }) 48})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.