'; r.push(staffListView); }); var render = $('#employee_render'); var wrap = $('#staff_overview'); wrap.hide(); //render.hide(); render.html(r.join('')); //render.fadeIn(); } function inactive_depts() { $('.selector').each(function() { var l = $(this).text(); var ids = get_staff_by_dept(l); if(ids.length == 0){ $(this).addClass('inactive'); //$(this).parent().hide(); } //console.log('dept ' + l + ':' + ids.length); }); } function get_staff_by_dept(dept) { dept = dept.toString().trim(); var f = {type:'textequals',block_label:'staff',data_label:'dept', parameter:dept}; var ids = data_fetch(f); console.log(ids.length + ' for ' + dept); return ids; } function dept_select() { $('.selector').each(function() { $(this).click(function() { if($(this).hasClass('inactive')) { return; } $('#staff_overview').fadeIn(); $('#employee_render').hide(); $('#staff_spotlight').hide(); console.log('removing current classes'); $('.selector').each(function() { $(this).removeClass('current'); }); $(this).addClass('current'); var ids = get_staff_by_dept($(this).text().trim()); staff_filter(ids); $('#employee_render').fadeIn(); }); }); } function select_specific_dept(dept) { //not efficient, just used for booting $('.selector').each(function() { var t = $(this).text(); if(t.trim() === dept.trim()) { console.log(dept + ' found'); $(this).click(); if($('#mobile_submenu').css('display') == 'none') //desktop { return false; //stop } } }); } function staff_filter(ids) {	console.log('filtering ' + JSON.stringify(ids)); $('.employee_wrap1').each(function() { $(this).hide() }); ids.forEach(function(id) { var s = $('#'+id); if(s.length) { s.show(); } }); } function staff_select() { $('.employee_wrap1').each(function() { $(this).click(function() { staff_spotlight($(this).attr('id')); vertical_snap(); }); }); $('.back_button1').click(function() { $('#staff_overview').fadeIn(); $('#staff_spotlight').hide(); }); } function staff_spotlight(id) { console.log('spotlight ' + id); var staff = data_fetch({type:'id', 'block_label': 'staff', parameter:id}); if(staff) { $('#staff_photo').css('background-image', 'url('+staff.photo+')'); $('#staff_name').html(staff.name); $('#staff_title').html(staff.title); // console.log('staff.name', staff.name); // console.log('staff.email', staff.email); // console.log('staff.phone', staff.phone); var staff_email = staff.email; var staff_phone = staff.phone; $('#staff_email').html(''); if ( staff_email !== "") { $('#staff_email').html('Email: ' + staff_email); } $('#staff_phone').html(''); if ( staff_phone !== "") { $('#staff_phone').html('Phone: '+ staff_phone); } if(false && staff.about_long && staff.about_long !== "") { console.log('long form bio found: ' + staff.name); var t = text_edit_about_long(staff.about_long); $('#staff_about').html(t); } else { console.log('about long ' + staff.about_long); $('#staff_about').html(staff.about); } $('#staff_overview').hide(); $('#staff_spotlight').fadeIn(); //$('#staff_spotlight').show(); } } function create_mobile_dept_menu() { var items = $('.selector'); console.log('mobile menu creation: ' + items.length + ' items'); var half = Math.floor(items.length/2); var col_left = $('#mobile_submenu .column_left'); var col_right = $('#mobile_submenu .column_right'); var count = 0; items.each(function() { if(count < half) { var lc = $(this).clone(); lc.css('float','right'); lc.css('clear','right'); col_left.append(lc); } else { var rc = $(this).clone(); rc.css('float','left'); rc.css('clear','left'); col_right.append(rc); } count++; }); } function text_edit_about_long(t) { t = t.split('~~~').join('