Created
January 11, 2017 13:41
-
-
Save renorram/35945d9ddca3c4fae7c4b57db9fb6f41 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
$(".views-exposed-form #edit-cor .form-item label").each(function(){ | |
var color = $(this).text(); | |
$(this).parent('div.form-item').addClass(filterColor(color)); | |
}); | |
function filterColor(color){ | |
if(typeof color === 'string'){ | |
if($.inArray(color, Drupal.settings.avanz.colors)!== -1){ | |
return cleanString(color.toLowerCase().replace(/ +/g, "-")); | |
} | |
} | |
} | |
function cleanString(string){ | |
var str = string.split(""); | |
for(var x = 0;x<str.length;x++){ | |
var c = str[x]; | |
if(c == 'á'){ | |
str[x] = 'a'; | |
} | |
} | |
return str.join(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment