function all_due_credit_resize_cells(post_id, num_of_cols) { var post_width; var cell_width; var text_width; var obj_text_name; var PIXELS_TO_SPARE = 25; var LOOP_LIMIT = 25; var avatar_width; if(post_id > 0){ var obj_post_div = document.getElementById("post-" + post_id); if(obj_post_div){ post_width = obj_post_div.offsetWidth; if(post_width > 0){ //Themes often make some interesting modifications to images. //To ensure that normal names fit without scrollbars, we need to first //exclude the width of the avatar. avatar_width = get_avatar_width(); cell_width = post_width / num_of_cols; text_width = cell_width - avatar_width; //To be safe, take off some pixels in case the theme is generous with borders. //In Firefox, the scrollbar is 15 pixels, for example. We add extra to accomodate //gratuitous borders added by some templates. text_width = text_width - PIXELS_TO_SPARE; if(text_width > 0){ var i = 1; while(true){ obj_text_name = document.getElementById("adc_name_" + i); if(obj_text_name){ obj_text_name.style.width = text_width + "px"; }else{ break; } if(i >= LOOP_LIMIT) break; i++; } } } } } } function get_avatar_width(){ var obj_avatar = document.getElementById("adc_avatar_1"); var obj_text_name = document.getElementById("adc_name_1"); var result; if(obj_avatar && obj_text_name){ result = obj_text_name - obj_avatar.offsetLeft } return result; }