Unified thumbnail_macro() and render_macro() of Image prototype
This commit is contained in:
parent
126a1dd5c2
commit
eaccff79a9
1 changed files with 13 additions and 13 deletions
|
@ -261,29 +261,29 @@ Image.prototype.macro_macro = function() {
|
||||||
this.parent.constructor === Layout ? "layout.image" : "image");
|
this.parent.constructor === Layout ? "layout.image" : "image");
|
||||||
}
|
}
|
||||||
|
|
||||||
Image.prototype.thumbnail_macro = function() {
|
Image.prototype.thumbnail_macro = function(param) {
|
||||||
if (!this.thumbnailName) {
|
if (!this.thumbnailName) {
|
||||||
return this.render_macro({});
|
return this.render_macro(param);
|
||||||
}
|
}
|
||||||
var description = encode("Thumbnail of image " + this.name);
|
param.src = this.getUrl(this.getThumbnailFile().getName());
|
||||||
return html.tag("img", {
|
param.title || (param.title = encode(this.description));
|
||||||
src: this.getUrl(this.getThumbnailFile().getName()),
|
param.alt = encode(param.alt || param.title);
|
||||||
title: description,
|
param.width = this.thumbnailWidth || String.EMPTY;
|
||||||
width: this.thumbnailWidth || String.EMPTY,
|
param.height = this.thumbnailHeight || String.EMPTY;
|
||||||
height: this.thumbnailHeight || String.EMPTY,
|
param.border = (param.border = 0);
|
||||||
border: 0,
|
html.tag("img", param);
|
||||||
alt: description
|
return;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Image.prototype.render_macro = function(param) {
|
Image.prototype.render_macro = function(param) {
|
||||||
param.src = this.getUrl();
|
param.src = this.getUrl();
|
||||||
param.title || (param.title = encode(this.description));
|
param.title || (param.title = encode(this.description));
|
||||||
|
param.alt = encode(param.alt || param.title);
|
||||||
param.width || (param.width = this.width);
|
param.width || (param.width = this.width);
|
||||||
param.height || (param.height = this.height);
|
param.height || (param.height = this.height);
|
||||||
param.border || (param.border = 0);
|
param.border || (param.border = 0);
|
||||||
param.alt = encode(param.alt || param.title);
|
html.tag("img", param);
|
||||||
return html.tag("img", param);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Image.prototype.getFile = function(name) {
|
Image.prototype.getFile = function(name) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue