Skip to content

Commit

Permalink
Merge pull request #3746 from PacificCommunity/2.6.3_thumbnail_fix_ba…
Browse files Browse the repository at this point in the history
…ckported

[backport 2.6.x] backport thumbnail fix
  • Loading branch information
Alessio Fabiani committed Apr 11, 2018
2 parents 6497609 + 9de6fb8 commit aa5932d
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions geonode/static/geonode/js/utils/thumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,32 @@ var createMapThumbnail = function(obj_id) {
var map = xmap.clone();
map.find('*').each(function(i) {
e = $(this);
if(e.css('display') === 'none' || (e.attr("class") !== undefined && (e.attr("class").indexOf('olControl') >= 0 || e.attr("class").indexOf('x-') >= 0))) {
e.remove();
} else if (e.attr('src') === '/static/geoexplorer/externals/ext/resources/images/default/s.gif') {
if(e.css('display') === 'none' ||
// leaflet
($('.leaflet-tile-pane')[0] != undefined && e.attr("class") !== undefined &&
((e.attr("class").indexOf('leaflet-layer') < 0 && e.attr("class").indexOf('leaflet-tile') < 0) ||
e.attr("class").indexOf('x-') >= 0)) ||
// OpenLayers
($('.olMapViewport')[0] != undefined && e.attr("class") !== undefined &&
(e.attr("class").indexOf('olControl') >= 0 ||
e.attr("class").indexOf('olImageLoadError') >= 0 ||
e.attr("class").indexOf('ol-overlaycontainer') >= 0 ||
e.attr("class").indexOf('x-') >= 0))
) {
e.remove();
} else if (e.attr('src') !== undefined) {
if (e.attr('src').indexOf('images/default') > 0 || e.attr('src').indexOf('default/img') > 0) {
e.remove();
}
if (!e.attr('src').startsWith("http")) {
var href = e.attr('src');
e.attr('src', 'http:' + href);
}

e.css({
"visibility":"inherit",
"position":"absolute"
});
} else {
e.removeAttr("id");
}
Expand Down

0 comments on commit aa5932d

Please sign in to comment.