fix #95 (thanks jonatkins)

This commit is contained in:
Stefan Breunig 2013-02-14 08:47:49 +01:00
parent 4ceacf719d
commit 485b1c543b
3 changed files with 14 additions and 9 deletions

View File

@ -6,21 +6,20 @@
// be run once.
window.setupLargeImagePreview = function() {
$('#portaldetails').on('click', '.imgpreview img', function() {
$('#portaldetails').on('click', '.imgpreview', function() {
var ex = $('#largepreview');
if(ex.length > 0) {
ex.remove();
return;
}
var img = $(this).parent().html();
var w = $(this)[0].naturalWidth/2;
var h = $(this)[0].naturalHeight/2;
var img = $(this).html();
var w = $(this).find('img')[0].naturalWidth/2;
var h = $(this).find('img')[0].naturalHeight/2;
var c = $('#portaldetails').attr('class');
$('body').append(
'<div id="largepreview" class="'+c+'" style="margin-left: '+(-SIDEBAR_WIDTH/2-w-2)+'px; margin-top: '+(-h-2)+'px">' + img + '</div>'
);
$('#largepreview').click(function() { $(this).remove() });
$('#largepreview img').attr('title', '');
});
}

View File

@ -57,13 +57,16 @@ window.renderPortalDetails = function(guid) {
var lat = d.locationE6.latE6;
var lng = d.locationE6.lngE6;
var perma = 'http://ingress.com/intel?latE6='+lat+'&lngE6='+lng+'&z=17&pguid='+guid;
var imgTitle = 'title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."';
$('#portaldetails')
.attr('class', TEAM_TO_CSS[getTeam(d)])
.html(''
+ '<h3>'+d.portalV2.descriptiveText.TITLE+'</h3>'
// help cursor via “.imgpreview img”
+ '<div class="imgpreview"><img src="'+img+'" title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."/></div>'
+ '<div class="imgpreview" '+imgTitle+' style="background-image: url('+img+')">'
+ '<img class="hide" src="'+img+'"/>'
+ '</div>'
+ '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>'
+ '<div class="mods">'+getModDetails(d)+'</div>'
+ '<div id="randdetails">'+randDetails+'</div>'

View File

@ -18,6 +18,7 @@ body:after {
html, body, #map {
height: 100%;
width: 100%;
}
body {
@ -411,11 +412,13 @@ h3 {
.imgpreview {
height: 200px;
overflow: hidden;
background: no-repeat center center;
background-size: contain;
cursor: help;
}
.imgpreview img {
cursor: help;
.imgpreview img.hide {
display: none;
}
#level {