// Function for making sure text only uses url safe symbols function makeSafe(thisText, allowSpace){ var w = "!@#$%^&*()+=[]';,./{}|\":<>?"; var s = 'abcdefghijklmnopqrstuvwxyz0123456789-_'; var x = new Array('àáâãäå', 'ç', 'èéêë', 'ìíîï', 'ñ', 'ðóòôõöø', 'ùúûü', 'ýÿ'); var r = new Array('a', 'c', 'e', 'i', 'n', 'o', 'u', 'y'); if(allowSpace){ s = s + ' '; } thisText = thisText.toLowerCase(); var newText = new Array(); for (i = 0; i < thisText.length; i++){ thisChar = thisText.charAt(i); if(w.indexOf(thisChar) == -1){ if(s.match(''+thisChar+'')){ newText[i] = thisChar; }else{ for (j = 0; j < x.length; j++){ if(x[j].match(thisChar)){ newText[i] = r[j]; } } } } } return newText.join(''); }
// Function for making sure text only uses url safe symbols function makeSafe(thisText, allowSpace){ var w = "!@#$%^&*()+=[]';,./{}|\":<>?"; var s = 'abcdefghijklmnopqrstuvwxyz0123456789-_'; var x = new Array('àáâãäå', 'ç', 'èéêë', 'ìíîï', 'ñ', 'ðóòôõöø', 'ùúûü', 'ýÿ'); var r = new Array('a', 'c', 'e', 'i', 'n', 'o', 'u', 'y'); if(allowSpace){ s = s + ' '; } thisText = thisText.toLowerCase(); var newText = new Array(); for (i = 0; i < thisText.length; i++){ thisChar = thisText.charAt(i); if(w.indexOf(thisChar) == -1){ if(s.match(''+thisChar+'')){ newText[i] = thisChar; }else{ for (j = 0; j < x.length; j++){ if(x[j].match(thisChar)){ newText[i] = r[j]; } } } } } return newText.join(''); }
|