Created
November 1, 2013 23:22
-
-
Save mayoz/7273511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* upperCase | |
* $(element).upperCase( [text] ); | |
* | |
* mit license. sercan cakir. 2013. | |
*/ | |
$(function () { | |
$.fn.upperCase = function() { | |
return this.each(function() { | |
var $self = $(this), | |
text = $self.text(), | |
temp = []; | |
for(var i = 0; i < text.length; i++) { | |
var char = text.charAt(i), | |
code = text.charCodeAt(i); | |
if (code == 105) temp.push('İ'); | |
else if (code == 305) temp.push('I'); | |
else if (code == 287) temp.push('Ğ'); | |
else if (code == 252) temp.push('Ü'); | |
else if (code == 351) temp.push('Ş'); | |
else if (code == 246) temp.push('Ö'); | |
else if (code == 231) temp.push('Ç'); | |
else if (code >= 97 ) temp.push(char.toUpperCase()); | |
else if (code <= 122) temp.push(char.toUpperCase()); | |
else temp.push(char); | |
} | |
$self.text(temp.join('')); | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment