Created
November 8, 2012 23:32
-
-
Save apanzerj/4042604 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$j(document).ready(function () { | |
var org_names = { | |
'Community Moderator': ["Arnaud de Theux", "Sergio Alvarez", "TJ Baker", "Mikhail Zakharov"] | |
}, needle = ""; | |
jQuery('.name').each(function (index) { | |
$this = jQuery(this); | |
jQuery.each(org_names, function (key, value) { | |
needle = $this[0].outerHTML; | |
if (currentUser.role === 0) { | |
if (needle.search('<br>') !== -1) { | |
needle = needle.split('<br>'); | |
needle = needle[0].split('>'); | |
needle = needle[1]; | |
} else { | |
needle = $j(needle).text(); | |
} | |
needle = needle.replace('\n', ''); | |
if (value.indexOf(jQuery.trim(needle)) >= 0) { | |
$j($this[0]).parent().children().last().append('<div class="gray-text-compact">' + key + '</div>'); | |
} | |
} else { | |
needle = jQuery(needle).children('a').text(); | |
if (value.indexOf(jQuery.trim(needle)) >= 0) { | |
$this.append('<div class="gray-text-compact">' + key + '</div>'); | |
} | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
var org_names = {
'Awesome title': ["Robert Sipko", "Fred Panzer"]
},
needle = "";
jQuery('.name').each(function(index) {
$this = jQuery(this);
jQuery.each(org_names, function(key, value) {
needle = $this[0].outerHTML;
if (currentUser.role === 0) {
if (needle.search('
') !== -1) {
needle = needle.split('
');
needle = needle[0].split('>');
needle = needle[1];
}
needle = needle.replace('\n', '');
if (value.indexOf(jQuery.trim(needle)) >= 0) {
$j($this[0]).parent().children().append('
}
} else {
needle = jQuery(needle).children('a').text();
if (value.indexOf(jQuery.trim(needle)) >= 0) {
$this.append('
}
}
});
});