Skip to content

Commit

Permalink
[js:core] add a unique query param to thumbnail url
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Sep 2, 2017
1 parent 6c4fbf8 commit 4fb2a50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 32 deletions.
30 changes: 1 addition & 29 deletions js/commands/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,7 @@ elFinder.prototype.commands.resize = function() {
data : Object.assign(data, {
cmd : 'resize'
}),
notify : {type : 'resize', cnt : 1},
prepare : function(data) {
var newfile;
if (data) {
if (data.added && data.added.length && data.added[0].tmb) {
newfile = data.added[0];
} else if (data.changed && data.changed.length && data.changed[0].tmb) {
newfile = data.changed[0];
}
if (newfile) {
file = newfile;
src = fm.openUrl(file.hash);
if (file.tmb && file.tmb != '1' && (file.tmb === tmb)) {
file.tmb = '';
return;
}
}
}
tmb = '';
}
notify : {type : 'resize', cnt : 1}
})
.fail(function(error) {
if (dfrd) {
Expand All @@ -58,15 +39,6 @@ elFinder.prototype.commands.resize = function() {
.done(function() {
var url = (file.url != '1')? fm.url(file.hash) : '';

// need tmb reload
if (tmb) {
fm.one('resizedone', function() {
fm.reloadContents(fm.tmb(file).url).done(function() {
fm.trigger('tmbreload', {files: [ {hash: file.hash, tmb: tmb} ]});
});
});
}

fm.reloadContents(src);
if (url && url !== src) {
fm.reloadContents(url);
Expand Down
3 changes: 3 additions & 0 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,9 @@ var elFinder = function(node, opts, bootCallback) {
url = tmbUrl + file.tmb;
}
if (url) {
if (file.ts) {
url += (url.match(/\?/)? '&' : '?') + '_t=' + file.ts;
}
return { url: url, className: cls };
}
}
Expand Down
4 changes: 1 addition & 3 deletions js/ui/cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1136,9 +1136,7 @@ $.fn.elfindercwd = function(fm, options) {
}
tmbObj = fm.tmb(file);
if (reload) {
fm.reloadContents(tmbObj.url).done(function() {
node.find('.elfinder-cwd-icon').addClass(tmbObj.className).css('background-image', "url('"+tmbObj.url+"')");
});
node.find('.elfinder-cwd-icon').addClass(tmbObj.className).css('background-image', "url('"+tmbObj.url+"')");
} else {
attach(node, tmbObj);
}
Expand Down

0 comments on commit 4fb2a50

Please sign in to comment.