mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +01:00
new method to create object tag for svg and img for all other image types
This commit is contained in:
parent
5f0a8ae990
commit
e265874bd7
@ -129,6 +129,31 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
|
||||
}
|
||||
}
|
||||
return image;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create DOM img or svn element depending on url
|
||||
*
|
||||
* @param {string} _url source url
|
||||
* @param {string} _alt alt attribute for img tag
|
||||
* @returns DOM node
|
||||
*/
|
||||
image_element: function(_url, _alt)
|
||||
{
|
||||
var icon;
|
||||
if (_url.match(/\.svg$/))
|
||||
{
|
||||
icon = document.createElement('object');
|
||||
icon.type = 'image/svg+xml';
|
||||
icon.data = _url;
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = document.createElement('img');
|
||||
icon.src = _url;
|
||||
if (_alt) icon.alt = _alt;
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user