1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Contacts: Use inline css thumbnail for contacts wo profile pic.

This commit is contained in:
Thomas Tanghus 2013-03-23 01:58:18 +01:00
parent 321cb7bf94
commit 9ce6d9be76
2 changed files with 34 additions and 1 deletions

View File

@ -415,6 +415,10 @@ input:not([type="checkbox"]).propertytype {
text-align: right;
margin: 0;
}
.thumbnail {
background-image:url('data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAALRSURBVDjLpZRLT1pREMftpo9VV03aT9EmXXTVxKTfpaum36Ab04RgUCxxw8oFEsEHYCAqmmAiaEIAQUBAeYgiL8Ob8Li3lOn8T0rT6C1pbheTueecmd+Ze878zwwRzUyznZ2dJ3t7e1/39/ezbrdbhscY89PypkLX19efMSQVjUaH7XabRqMRtVotOjs7G+7u7qawrgrscrn04XBYArDf71Oj0RBgSZIoEAhIWFcFdjqdRYCGwyGh4lqtRqVSSfi7uzvCuiqw3W6Xe72egKJawIrFIt3e3orKbTabrBZcAKxer1O1WqVyuUyFQkEY4AwuqAJvbW15MpmMqBSgm5sburq6Ej6VStHm5qZHFXhtbe1bMBgc41wBzOVylE6nKZ/Pk9/vH2NdFdhkMr23Wq0yqs5ms3RxcUGXl5fCNjY2pNXV1Q+qwDCLxWJkCCWTyd/mcDiI5+2qBQJjIcxub2/LfFF0cnJCrDhAf3Crzf4XmGX8zufzdXgDANEJ5PF4eiztN6rABwcHz7m6L2xtvjC52WyKc4ZPJBJQXYOr/sSyfvxPYA58wb+uY+udnp6KN+LX+0BHR0cUiUQEHH19fHw84POu8V98XllZefpXMPftKxZFky9I7nQ6NBgMxBvR7XYFfCIUtB96Gxvgmzfsc0+XuaiXimDuy7lQKPQd8q1UKgICAGyiPEgaykMv42jgMc99LZvN5jlFMPelIx6P0/X1tUiCICCMiTgwh55GH0N5fNaEeHzjqJCvCOZzSsZiMTo/PyeunPD9p/G7/MAQh3hsgHxFsNFo7KIKQHBRSqD7hjjEIw/5SuBHy8vLhcPDQ+L3gfgiRBVK1U7msI44fvTR24R8cB5UvLCw8NpgMMSXlpa6er2+z5c55n4mr9crNgMUHmPMs2DGi4uLfcQjD/lTBaLRaN6yfZyfn9dwsIOTozqdrq7VakfwGGMe64hD/H3GTxUf41MtMQBvAAAAAElFTkSuQmCC');
}
input[type="checkbox"].propertytype { width: 10px; }
.contactphoto {
float: left; display: inline-block;

View File

@ -34,6 +34,24 @@ OC.Contacts = OC.Contacts || {};
}
};
Contact.prototype.setThumbnail = function(refresh) {
if(this.getPreferredValue('PHOTO', null) === null) {
return;
}
var $elem = this.getListItemElement().find('td.name');
if(!$elem.hasClass('thumbnail')) {
return;
}
$elem.removeClass('thumbnail');
var refreshstr = refresh ? '&refresh='+Math.random() : '';
$elem.css('background-image', 'url(' + OC.filePath('', '', 'remote.php')
+'/contactthumbnail?backend='
+this.metadata.backend+'&parent='
+this.metadata.parent+'&id='
+this.id+refreshstr + ')'
);
}
Contact.prototype.setAsSaving = function(obj, state) {
if(!obj) {
return;
@ -1446,6 +1464,7 @@ OC.Contacts = OC.Contacts || {};
*/
ContactList.prototype.showContacts = function(contacts) {
console.log('showContacts', contacts);
var self = this;
if(contacts.length === 0) {
// ~5 times faster
$('tr:visible.contact').hide();
@ -1453,7 +1472,16 @@ OC.Contacts = OC.Contacts || {};
}
if(contacts === 'all') {
// ~2 times faster
$('tr.contact:not(:visible)').show();
var $elems = $('tr.contact:not(:visible)');
$elems.show();
$.each($elems, function(idx, elem) {
try {
var id = $(elem).data('id');
self.contacts[id].setThumbnail();
} catch(e) {
console.warn('Failed getting id from', $elem, e);
}
});
return;
}
for(var id in this.contacts) {
@ -1465,6 +1493,7 @@ OC.Contacts = OC.Contacts || {};
contact.getListItemElement().hide();
} else {
contact.getListItemElement().show();
contact.setThumbnail();
}
}
};