1/** 2 * @file 3 * This file controls accessibility functions on the theme layer. 4 * Based on: http://www.acfonline.org.au/sites/all/themes/acf/js/acf.accessibility.js 5 */ 6 7 8var http_check = getHTTPObject(); 9 10function getHTTPObject(){ 11 //Create a boolean variable to check for a valid Internet Explorer instance. 12 var xmlhttp = false; 13 //Check if we are using IE. 14 try { 15 //If the Javascript version is greater than 5. 16 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 17 } catch (e) { 18 //If not, then use the older active x object. 19 try { 20 //If we are using Internet Explorer. 21 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 22 } catch (E) { 23 //Else we must be using a non-IE browser. 24 xmlhttp = false; 25 } 26 } 27 //If we are using a non-IE browser, create a javascript instance of the object. 28 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 29 xmlhttp = new XMLHttpRequest(); 30 } 31 32 return xmlhttp; 33} 34 35function check_file(path_of_file,toLang) 36{ 37 var path_of_file2=path_of_file; 38 if(path_of_file2.indexOf("?")!=-1) { 39 var checkQ=-1; 40 checkQ=path_of_file2.indexOf("?"); 41 path_of_file2=path_of_file2.substring(0,checkQ); 42 } else if(path_of_file2.indexOf("#")!=-1) { 43 var checkQ=-1; 44 checkQ=path_of_file2.indexOf("#"); 45 path_of_file2=path_of_file2.substring(0,checkQ); 46 } 47 48 http_check.open("Get",path_of_file2,true); 49 50 http_check.onreadystatechange = handleHttpResponse_check; 51 52 http_check.send(null); 53 54 function handleHttpResponse_check() 55 { 56 if(http_check.readyState == 4){ 57 if (http_check.status == 200) { 58 location.href = path_of_file; 59 }else if (http_check.status == 404) { 60 if(toLang=="tc"){ 61 window.alert("éé æ²æä¸æçã"); 62 }else if(toLang=="sc"){ 63 window.alert("è¿é¡µæ²¡æä¸æçã"); 64 }else if(toLang=="en"){ 65 window.alert("This webpage does not have English version."); 66 } 67 } 68 } 69 } 70} 71 72function changeVer(lang) { 73 var hanweb = 'hanweb.kanhan.com/TuniS/'; 74 var langKey = ["tc", "sc", "en", "txt"]; 75 var langs = ["tc", "sc", "en", "txt"]; 76 var fromLang = ''; 77 var toLang = ''; 78 for(counter = 0; counter < langKey.length; counter++){ 79 //if(location.href.search(window.location.host+'/'+langs[counter])!= -1){ 80 if(location.href.search('/'+langs[counter]+'/')!= -1){ 81 fromLang = langs[counter]; 82 } 83 } 84 for(counter = 0; counter < langKey.length; counter++){ 85 if(langKey[counter]==lang){ 86 toLang = langs[counter]; 87 } 88 } 89 90 //window.alert("from "+fromLang+" version to "+toLang+"."); 91 92 if(location.href=='http://'+window.location.host||location.href=='http://'+window.location.host+'/'){ 93 location.href = '/'+toLang+'/index.htm'; 94 }else if(location.href=='http://'+window.location.host+'/'+fromLang+'/'){ 95 check_file(location.href.replace('/'+fromLang+'/', '/'+toLang+'/index.htm'),toLang); 96 }else if(location.href=='http://'+window.location.host+'/'+fromLang){ 97 check_file(location.href.replace('/'+fromLang, '/'+toLang+'/index.htm'),toLang); 98 }else if(fromLang==''){ 99 check_file(location.href.replace(window.location.host+'/', window.location.host+'/'+toLang+'/index.htm'),toLang); 100 } 101 else if (lang=='txt'){ 102 103 /* for .../textonly/... 104 if (location.href.indexOf("/"+toLang+"/") !=-1) { 105 check_file(location.href.replace('/'+toLang, ''),toLang); 106 } 107 else { 108 check_file(location.href.replace('/'+fromLang, '/'+toLang+'/'+fromLang),toLang); 109 } 110 */ 111 //var appendQStr = "textonly=1"; 112 var appendQStr = "/text/"; 113 if (location.href.indexOf(""+appendQStr) !=-1) { 114 //alert(1); 115 //check_file(location.href.replace(""+appendQStr, ''),toLang); 116 location.href = location.href.replace('/'+fromLang+'/text', '/'+fromLang); 117 } 118 else if (location.href.indexOf(appendQStr) !=-1) { 119 //alert(2); 120 //check_file(location.href.replace(appendQStr, ''),toLang); 121 location.href = location.href.replace('/'+fromLang+'/text', '/'+fromLang); 122 } 123 else { 124 if (location.href.indexOf("")!=-1) { 125 126 //check_file(location.href.replace(/(#.*)/, '') + "&"+appendQStr, toLang); 127 location.href = location.href.replace('/'+fromLang, '/'+fromLang+'/text'); 128 //location.href + "&"+appendQStr; 129 } else { 130 131 //check_file(location.href.replace(/(#.*)/, '') + ""+appendQStr, toLang); 132 location.href = location.href.replace('/'+fromLang, '/'+fromLang+'/text'); 133 //return location.href + "?"+appendQStr; 134 } 135 136 } 137 138 } 139 /* 140 //hanweb 141 else if (lang=='sc') { 142 var url = location.href.replace('/'+fromLang, '/tc'); 143 //401 (Unauthorized) 144 //check_file(url.replace(/(http:\/\/)/, '$1hanweb.kanhan.com/TuniS/'),toLang); 145 location.href = url.replace(/(http:\/\/)/, '$1'+hanweb); 146 } 147 else if (fromLang=='tc' && toLang =='tc' || fromLang=='tc' && toLang =='en') { 148 location.href = location.href.replace(hanweb, '').replace('/'+fromLang, '/'+toLang); 149 } 150 //end hanweb 151 */ 152 else{ 153 check_file(location.href.replace('/'+fromLang, '/'+toLang),toLang); 154 } 155} 156 157(function ($) { 158 159/* 160 * @function languageSwitcher 161 * Controls the language switch 162 */ 163Drupal.behaviors.languageSwitcher = { 164 attach: function (context, settings) { 165 166 } 167}; 168 169}(jQuery));
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.