Files
iTop/js/latinise/latinise.min.js
Pierre Goiffon efa7a4ee55 Advanced search improvements (restore 2018-04-10 revisions : r5635..r5641)
* Add 'search_manual_submit' config parameter to manage auto-submit
* bugfixes
** date i18n is now handled (using two new options `datepicker.dateFormat` and `datepicker.timeFormat` computed from `AttributeDateTime::GetFormat()->ToDatePicker()`
** handling of `empty` `not empty` operator titles
*** it led to tohers bugfixes and a redesign of the `_computeTitle` (from overwriting to extension using ie `_computeBetweenDaysOperatorTitle`
*** some bug still remain, because autocomplete needs to been finished before checking on them
* Promote 'friendlyname' in the 'most popular' list
* bugfixes
** filters (criterions, enum and FK without autocomplete) now ignore accent on matching with user input
** this is done by using a pre-existing tool used only by the portal, so it was moved to the core (latinize.min.js)
* Integration with manual submit parameter on client side.
* bugfixes : history/breadcrumb had several c[menu] appended (one for each refresh)
* Fix various sanity bugs

SVN:trunk[5632]
2018-04-12 08:54:05 +00:00

27 lines
965 B
JavaScript

/*
* Library to remove accents from strings.
*
* http://semplicewebsites.com/removing-accents-javascript
*/
var Latinise = {};
Latinise.latin_map = {
"À":"A", "Á":"A", "Â":"A", "Ã":"A", "Ä":"A", "à":"a", "á´":"a", "â":"a", "ã":"a", "ä":"a",
"Å":"A", "å":"a",
"È":"E", "É":"E", "ʨ":"E", "Ë":"E", "è":"e", "é":"e", "ê":"e", "ë":"e",
"Ò":"O", "Ó":"O", "Ô":"O", "Õ":"O", "Ö":"O", "ò":"o", "ó":"o", "ô":"o", "õ":"o", "ö":"o",
"Ù":"U", "Ú":"U", "Û":"U", "Ü":"U", "ù":"u", "ú":"u", "û":"u", "ü":"u",
"Ý":"Y", "Ÿ":"Y", "ý":"y", "ÿ":"y",
"Ç":"C", "ç":"c",
"Š":"S", "š":"s",
"Ž":"Z", "ž":"z",
"Œ":"OE", "œ":"oe", "Æ":"AE", "æ":"ae"
};
String.prototype.latinise = function(){
return this.replace(/[^A-Za-z0-9\[\] ]/g, function(a){
return Latinise.latin_map[a] || a
})
};
String.prototype.latinize = String.prototype.latinise;
String.prototype.isLatin = function(){
return this == this.latinise()
};