1/* 2 * jQuery Remove Uppercase Accents v1.1.1 3 * http://github.com/ebababi/jquery-remove-upcase-accents/ 4 * 5 * Automatically removes accented characters (currently greek) from elements 6 * having their text content uppercase transformed through CSS. 7 * 8 * Copyright © 2012-2013 Nikolaos Anastopoulos 9 * All rights reserved. 10 * 11 * This program is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation, either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 25(function( jQuery ) { 26 27jQuery.extend(jQuery.expr[":"], { 28 uppercase: function( elem ) { 29 var attr = jQuery( elem ).css( "text-transform" ); 30 return ( typeof attr !== "undefined" && attr === "uppercase" ); 31 }, 32 smallcaps: function( elem ) { 33 var attr = jQuery( elem ).css( "font-variant" ); 34 return ( typeof attr !== "undefined" && attr === "small-caps" ); 35 } 36}); 37 38jQuery.extend({ 39 removeAcc: function( elem ) { 40 // Replace uppercase accented greek characters 41 function removeAccEL( text ) { 42 return typeof text !== "string" ? 43 // handle cases that text is not a string 44 text : 45 // global replace of uppercase accented characters 46 text. 47 replace( /\u0386/g, "\u0391" ). // 'Î':'Î' 48 replace( /\u0388/g, "\u0395" ). // 'Î':'Î' 49 replace( /\u0389/g, "\u0397" ). // 'Î':'Î' 50 replace( /\u038A/g, "\u0399" ). // 'Î':'Î' 51 replace( /\u038C/g, "\u039F" ). // 'Î':'Î' 52 replace( /\u038E/g, "\u03A5" ). // 'Î':'Î¥' 53 replace( /\u038F/g, "\u03A9" ). // 'Î':'Ω' 54 replace( /\u0390/g, "\u03B9" ). // 'Î':'ι' 55 replace( /\u03AA/g, "\u0399" ). // 'Ϊ':'Î' 56 replace( /\u03AB/g, "\u03A5" ). // 'Ϋ':'Î¥' 57 replace( /\u03AC/g, "\u03B1" ). // 'ά':'α' 58 replace( /\u03AD/g, "\u03B5" ). // 'Î':'ε' 59 replace( /\u03AE/g, "\u03B7" ). // 'ή':'η' 60 replace( /\u03AF/g, "\u03B9" ). // 'ί':'ι' 61 replace( /\u03B0/g, "\u03C5" ). // 'ΰ':'Ï ' 62 replace( /\u03CA/g, "\u03B9" ). // 'Ï':'ι' 63 replace( /\u03CB/g, "\u03C5" ). // 'Ï':'Ï ' 64 replace( /\u03CC/g, "\u03BF" ). // 'Ï':'ο' 65 replace( /\u03CD/g, "\u03C5" ). // 'Ï':'Ï ' 66 replace( /\u03CE/g, "\u03C9" ); // 'Ï':'Ï' 67 } 68 69 jQuery( elem ).each(function() { 70 this.value = removeAccEL( this.value ); 71 }).attr( "placeholder", function( index, attr ) { 72 return removeAccEL( attr ); 73 }).contents().filter(function() { 74 return this.nodeType === 3; // Node.TEXT_NODE 75 }).each(function() { 76 this.nodeValue = removeAccEL( this.nodeValue ); 77 }); 78 } 79}); 80 81jQuery.fn.extend({ 82 removeAcc: function() { 83 return this.each(function() { 84 jQuery.removeAcc( this ); 85 }); 86 } 87}); 88 89})( jQuery ); 90 91jQuery( document ).ready(function($) { 92 $( ":uppercase:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 93 $( ":smallcaps:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 94 $( ".remove-accents, .remove-accents > *:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 95 $( document ).ajaxComplete(function( event, request, settings ) { 96 $( ":uppercase:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 97 $( ":smallcaps:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 98 $( ".remove-accents, .remove-accents > *:not(input[type!=submit], textarea, .no-remove-accents)" ).removeAcc(); 99 }); 100});
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.