Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Script to hide group names in a list of optional groups. The client wanted to see the descriptions and not the names. Note that groups without descriptions are not modified. This script should work on any page that has optional groups.
<script type="text/javascript">
var groupsData = DB.getObjects('groups')
.reduce(function(a, r) { a[r.groups_KEY] = r.Group_Name; return a;}, {})
$(document).ready(function() {
var groupsData = <?= groupsData ?>;
var list = $('label[for^=add_to_groups_KEY]');
list.each(function() {
var m = /(\d+)/.exec($(this).attr('for'));
if (m != null) {
var key = m[1];
if (groupsData.hasOwnProperty(key)) {
var html = $(this).html().trim();
if (groupsData[key] == html) {
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.