function setEntryEvents(){
// TODO it will add the events multiple times if i don't check first!!
// for each entry
$$('.entry').each(function(entry){
// hide edit/delete until roll over
var editLink = entry.getElement('.edit');
var deleteLink = entry.getElement('.delete');
entry.addEvent('mouseover', function(){
if (editLink != null) { editLink.setStyle('display', 'block'); }
if (deleteLink != null) { deleteLink.setStyle('display', 'block'); }
});
entry.addEvent('mouseout', function(){
if (editLink != null) { editLink.setStyle('display', 'none'); }
if (deleteLink != null) { deleteLink.setStyle('display', 'none'); }
});
entry.fireEvent('mouseout');
// assign action to entry names to show profile
var name = entry.getElement('.name');
if (name != null && name.getProperty("staff_id") != null){
var name_click = function(e){
var poo = new Popup({
url: "/~mitoc/wall/common/profile/get_profile.htmx.php?staff_id="+name.getProperty("staff_id"),
// title: ""+name.get('html')+"",
onLoadComplete: function() {
this.setTitle(""+name.get('html')+"");
},
onClose: function(){
name.addEvent('click', name_click);
}
}).show();
name.removeEvents();
};
name.addEvent('click', name_click);
}
});
}
function checkForSmallEntries(){
// add tips to entries that are overflowing
$$('.entry').each(function(entry){
// var width = entry.getComputedSize({'mode':"horizontal"}).width; // width of this entry
var width = entry.getComputedSize().width;
// if any of these sub divs don't fit...
var tooSmall = ['name', 'message', 'time'].some(function(className){
if (entry.getElement("."+className+" span") != null){
var thisWidth = entry.getElement("."+className+" span").getComputedSize({'mode':"horizontal"}).width;
// var thisWidth = entry.getElement("."+className+"").getSize().x;
return (thisWidth > width );
} else {
return false;
}
});
// it needs tips!
if (tooSmall){
new Tips(entry, {
showDelay: 0, hideDelay: 0,
className: entry.getProperty('class') + " " + " tip"
// fixed: true,
// offsets: { x:0, y:0 }
});
entry.store('tip:text', entry.get('html'));
}
});
}