revert last commit, it broke scrolling. also replace expensive CSS rules with differen solution

This commit is contained in:
Stefan Breunig
2013-02-04 14:21:49 +01:00
parent 1f2c5514d4
commit f85a3b2443
8 changed files with 50 additions and 38 deletions

View File

@ -27,7 +27,7 @@ window.setupLargeImagePreview = function() {
window.setupStyles = function() { window.setupStyles = function() {
$('head').append('<style>' + $('head').append('<style>' +
[ '#sidebar { margin-right: '+(SIDEBAR_WIDTH+2)+'px } ', [ '#map { margin-right: '+(SIDEBAR_WIDTH+2)+'px } ',
'#largepreview.enl img { border:2px solid '+COLORS[TEAM_ENL]+'; } ', '#largepreview.enl img { border:2px solid '+COLORS[TEAM_ENL]+'; } ',
'#largepreview.none img { border:2px solid '+COLORS[TEAM_NONE]+'; } ', '#largepreview.none img { border:2px solid '+COLORS[TEAM_NONE]+'; } ',
'#chatcontrols { bottom: '+(CHAT_SHRINKED+24)+'px; }', '#chatcontrols { bottom: '+(CHAT_SHRINKED+24)+'px; }',

View File

@ -27,7 +27,7 @@ window.chat.clear = function() {
window.chat._newFactionTimestamp = -1; window.chat._newFactionTimestamp = -1;
window.chat._oldPublicTimestamp = -1; window.chat._oldPublicTimestamp = -1;
window.chat._newPublicTimestamp = -1; window.chat._newPublicTimestamp = -1;
$('#chatfaction, #chatpublic, #chatautomated').data('ignoreNextScroll', true).html('<div></div>'); $('#chatfaction, #chatpublic, #chatautomated').data('ignoreNextScroll', true).html('');
} }
window.chat.clearIfRequired = function() { window.chat.clearIfRequired = function() {
@ -296,7 +296,7 @@ window.chat.handlePublicAutomated = function(data) {
case 'PORTAL': case 'PORTAL':
var latlng = [part[1].latE6/1E6, part[1].lngE6/1E6]; var latlng = [part[1].latE6/1E6, part[1].lngE6/1E6];
var js = 'window.zoomToAndShowPortal(\''+part[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])'; var js = 'window.zoomToAndShowPortal(\''+part[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])';
tmpmsg += '<a onclick="'+js+'" title="'+part[1].address+'">'+part[1].name+'</a>'; tmpmsg += '<a onclick="'+js+'" title="'+part[1].address+'" class="help">'+part[1].name+'</a>';
break; break;
} }
}); });
@ -332,7 +332,7 @@ window.chat.renderAutomatedMsgsTo = function() {
return val; return val;
}).join('\n'); }).join('\n');
$('#chatautomated').html('<div>'+msgs+'</div>'); $('#chatautomated').html(msgs);
} }
@ -382,7 +382,7 @@ window.chat.renderPlayerMsgsTo = function(isFaction, data, isOldMsgs, dupCheckAr
prevTime = nowTime; prevTime = nowTime;
}); });
var addTo = isFaction ? $('#chatfaction > div') : $('#chatpublic > div'); var addTo = isFaction ? $('#chatfaction') : $('#chatpublic');
// if there is a change of day between two requests, handle the // if there is a change of day between two requests, handle the
// divider insertion here. // divider insertion here.
@ -408,9 +408,10 @@ window.chat.renderDivider = function(text) {
window.chat.renderMsg = function(msg, nick, time, team) { window.chat.renderMsg = function(msg, nick, time, team) {
var ta = unixTimeToHHmm(time); var ta = unixTimeToHHmm(time);
var tb = unixTimeToString(time, true); var tb = unixTimeToString(time, true);
// help cursor via “#chat time”
var t = '<time title="'+tb+'" data-timestamp="'+time+'">'+ta+'</time>'; var t = '<time title="'+tb+'" data-timestamp="'+time+'">'+ta+'</time>';
var s = 'style="color:'+COLORS[team]+'"'; var s = 'style="color:'+COLORS[team]+'"';
var title = nick.length >= 8 ? 'title="'+nick+'"' : ''; var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
return '<p>'+t+'<mark '+s+'>'+nick+'</mark><span>'+msg+'</span></p>'; return '<p>'+t+'<mark '+s+'>'+nick+'</mark><span>'+msg+'</span></p>';
} }

View File

@ -14,6 +14,7 @@ window.updateGameScore = function(data) {
var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'%&nbsp;</span>'; var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'%&nbsp;</span>';
var es = '<span class="enl" style="width:'+ep+'%;">&nbsp;'+Math.round(ep)+'%</span>'; var es = '<span class="enl" style="width:'+ep+'%;">&nbsp;'+Math.round(ep)+'%</span>';
$('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() }); $('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() });
// help cursor via “#gamestat span”
$('#gamestat').attr('title', 'Resistance:\t\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits'); $('#gamestat').attr('title', 'Resistance:\t\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits');
window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000); window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000);

View File

@ -59,6 +59,7 @@ window.renderPortalDetails = function(guid) {
.attr('class', TEAM_TO_CSS[getTeam(d)]) .attr('class', TEAM_TO_CSS[getTeam(d)])
.html('' .html(''
+ '<h3>'+d.portalV2.descriptiveText.TITLE+'</h3>' + '<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"><img src="'+img+'" title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."/></div>'
+ '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>' + '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>'
+ '<div class="mods">'+getModDetails(d)+'</div>' + '<div class="mods">'+getModDetails(d)+'</div>'

View File

@ -47,7 +47,7 @@ window.renderUpdateStatus = function() {
t += 'Up to date.'; t += 'Up to date.';
if(renderLimitReached()) if(renderLimitReached())
t += ' <span style="color:red" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> ' t += ' <span style="color:red" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
if(window.failedRequestCount > 0) if(window.failedRequestCount > 0)
t += ' ' + window.failedRequestCount + ' requests failed.' t += ' ' + window.failedRequestCount + ' requests failed.'

View File

@ -40,7 +40,8 @@ for(var i = 0; i < d.length; i++) {
// security context so we can access the API easily. Setup as much as // security context so we can access the API easily. Setup as much as
// possible without requiring scripts. // possible without requiring scripts.
document.getElementsByTagName('head')[0].innerHTML = '' document.getElementsByTagName('head')[0].innerHTML = ''
+ '<link rel="stylesheet" type="text/css" href="http://breunigs.github.com/ingress-intel-total-conversion/style.css"/>' //~ + '<link rel="stylesheet" type="text/css" href="http://breunigs.github.com/ingress-intel-total-conversion/style.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://0.0.0.0:8000/style.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css"/>' + '<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Coda"/>'; + '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Coda"/>';
@ -50,8 +51,8 @@ document.getElementsByTagName('body')[0].innerHTML = ''
+ ' <a>expand</a><a>automated</a><a>public</a><a class="active">faction</a>' + ' <a>expand</a><a>automated</a><a>public</a><a class="active">faction</a>'
+ '</div>' + '</div>'
+ '<div id="chat" style="display:none">' + '<div id="chat" style="display:none">'
+ ' <div id="chatfaction"><div></div></div>' + ' <div id="chatfaction"></div>'
+ ' <div id="chatpublic"><div></div></div>' + ' <div id="chatpublic"></div>'
+ ' <div id="chatautomated"></div>' + ' <div id="chatautomated"></div>'
+ '</div>' + '</div>'
+ '<form id="chatinput" style="display:none"><time></time><span>tell faction:</span><input type="text"/></form>' + '<form id="chatinput" style="display:none"><time></time><span>tell faction:</span><input type="text"/></form>'

View File

@ -1,10 +1,4 @@
/* general rules ******************************************************/ /* general rules ******************************************************/
* {
border: 0;
font-family: "coda",arial,helvetica,sans-serif;
margin: 0;
padding: 0;
}
html, body, #map { html, body, #map {
height: 100%; height: 100%;
@ -12,6 +6,8 @@ html, body, #map {
body { body {
font-size: 14px; font-size: 14px;
font-family: "coda",arial,helvetica,sans-serif;
margin: 0;
} }
#map { #map {
@ -50,20 +46,16 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
[title] {
cursor: help;
}
[title=""] {
cursor: auto !important;
}
/* map display, required because GMaps uses a high z-index which is /* map display, required because GMaps uses a high z-index which is
* normally above Leaflets vector pane */ * normally above Leaflets vector pane */
.leaflet-map-pane { .leaflet-map-pane {
z-index: 1000; z-index: 1000;
} }
.help {
cursor: help;
}
/* chat ***************************************************************/ /* chat ***************************************************************/
#chatcontrols { #chatcontrols {
@ -133,17 +125,14 @@ a:hover {
position:relative; position:relative;
} }
/* make text stick to the bottom */
#chat > div > div {
position: absolute;
bottom:0;
left:2px;
}
#chat p { #chat p {
display: block; display: block;
padding: 1px 2px; padding: 1px 2px;
margin:0;
}
#chat time {
cursor: help;
} }
time, mark, #chat span, #chat a { time, mark, #chat span, #chat a {
@ -231,6 +220,8 @@ h2 {
color: #ffce00; color: #ffce00;
font-size: 21px; font-size: 21px;
padding: 0 4px; padding: 0 4px;
margin: 0;
cursor:help;
} }
h2 span { h2 span {
@ -265,6 +256,7 @@ h2 sup, h2 sub {
display: block; display: block;
float: left; float: left;
font-weight: bold; font-weight: bold;
cursor:help;
} }
#gamestat .res { #gamestat .res {
@ -285,6 +277,8 @@ input {
line-height: 22px; line-height: 22px;
padding: 0 4px; padding: 0 4px;
font-size: 14px; font-size: 14px;
border:0;
font-family:inherit;
} }
::-webkit-input-placeholder { ::-webkit-input-placeholder {
@ -304,6 +298,7 @@ input {
h3 { h3 {
font-size: 17px; font-size: 17px;
padding: 0 4px; padding: 0 4px;
margin:0;
} }
.imgpreview { .imgpreview {
@ -311,6 +306,10 @@ h3 {
overflow: hidden; overflow: hidden;
} }
.imgpreview img {
cursor: help;
}
#level { #level {
font-size: 40px; font-size: 40px;
position: absolute; position: absolute;
@ -334,6 +333,11 @@ h3 {
padding: 2px; padding: 2px;
text-align: center; text-align: center;
width: 63.7px; width: 63.7px;
cursor:help;
}
.mods span[title=""] {
cursor: auto;
} }
.res .mods span, .res .meter { .res .mods span, .res .meter {

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @id ingress-intel-total-conversion@breunigs // @id ingress-intel-total-conversion@breunigs
// @name intel map total conversion // @name intel map total conversion
// @version 0.2-2013-02-04-025253 // @version 0.2-2013-02-04-142146
// @namespace https://github.com/breunigs/ingress-intel-total-conversion // @namespace https://github.com/breunigs/ingress-intel-total-conversion
// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js
// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js // @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/total-conversion-build.user.js
@ -40,7 +40,8 @@ for(var i = 0; i < d.length; i++) {
// security context so we can access the API easily. Setup as much as // security context so we can access the API easily. Setup as much as
// possible without requiring scripts. // possible without requiring scripts.
document.getElementsByTagName('head')[0].innerHTML = '' document.getElementsByTagName('head')[0].innerHTML = ''
+ '<link rel="stylesheet" type="text/css" href="http://breunigs.github.com/ingress-intel-total-conversion/style.css"/>' //~ + '<link rel="stylesheet" type="text/css" href="http://breunigs.github.com/ingress-intel-total-conversion/style.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://0.0.0.0:8000/style.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css"/>' + '<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css"/>'
+ '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Coda"/>'; + '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Coda"/>';
@ -475,7 +476,7 @@ window.renderUpdateStatus = function() {
t += 'Up to date.'; t += 'Up to date.';
if(renderLimitReached()) if(renderLimitReached())
t += ' <span style="color:red" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> ' t += ' <span style="color:red" class="help" title="Can only render so much before it gets unbearably slow. Not all entities are shown. Zoom in or increase the limit (search for MAX_DRAWN_*).">RENDER LIMIT</span> '
if(window.failedRequestCount > 0) if(window.failedRequestCount > 0)
t += ' ' + window.failedRequestCount + ' requests failed.' t += ' ' + window.failedRequestCount + ' requests failed.'
@ -711,7 +712,7 @@ window.setupLargeImagePreview = function() {
window.setupStyles = function() { window.setupStyles = function() {
$('head').append('<style>' + $('head').append('<style>' +
[ '#largepreview.res img { border:2px solid '+COLORS[TEAM_RES]+'; } ', [ '#map { margin-right: '+(SIDEBAR_WIDTH+2)+'px } ',
'#largepreview.enl img { border:2px solid '+COLORS[TEAM_ENL]+'; } ', '#largepreview.enl img { border:2px solid '+COLORS[TEAM_ENL]+'; } ',
'#largepreview.none img { border:2px solid '+COLORS[TEAM_NONE]+'; } ', '#largepreview.none img { border:2px solid '+COLORS[TEAM_NONE]+'; } ',
'#chatcontrols { bottom: '+(CHAT_SHRINKED+24)+'px; }', '#chatcontrols { bottom: '+(CHAT_SHRINKED+24)+'px; }',
@ -1157,7 +1158,7 @@ window.chat.handlePublicAutomated = function(data) {
case 'PORTAL': case 'PORTAL':
var latlng = [part[1].latE6/1E6, part[1].lngE6/1E6]; var latlng = [part[1].latE6/1E6, part[1].lngE6/1E6];
var js = 'window.zoomToAndShowPortal(\''+part[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])'; var js = 'window.zoomToAndShowPortal(\''+part[1].guid+'\', ['+latlng[0]+', '+latlng[1]+'])';
tmpmsg += '<a onclick="'+js+'" title="'+part[1].address+'">'+part[1].name+'</a>'; tmpmsg += '<a onclick="'+js+'" title="'+part[1].address+'" class="help">'+part[1].name+'</a>';
break; break;
} }
}); });
@ -1269,9 +1270,10 @@ window.chat.renderDivider = function(text) {
window.chat.renderMsg = function(msg, nick, time, team) { window.chat.renderMsg = function(msg, nick, time, team) {
var ta = unixTimeToHHmm(time); var ta = unixTimeToHHmm(time);
var tb = unixTimeToString(time, true); var tb = unixTimeToString(time, true);
// help cursor via “#chat time”
var t = '<time title="'+tb+'" data-timestamp="'+time+'">'+ta+'</time>'; var t = '<time title="'+tb+'" data-timestamp="'+time+'">'+ta+'</time>';
var s = 'style="color:'+COLORS[team]+'"'; var s = 'style="color:'+COLORS[team]+'"';
var title = nick.length >= 8 ? 'title="'+nick+'"' : ''; var title = nick.length >= 8 ? 'title="'+nick+'" class="help"' : '';
return '<p>'+t+'<mark '+s+'>'+nick+'</mark><span>'+msg+'</span></p>'; return '<p>'+t+'<mark '+s+'>'+nick+'</mark><span>'+msg+'</span></p>';
} }
@ -1607,6 +1609,7 @@ window.updateGameScore = function(data) {
var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'%&nbsp;</span>'; var rs = '<span class="res" style="width:'+rp+'%;">'+Math.round(rp)+'%&nbsp;</span>';
var es = '<span class="enl" style="width:'+ep+'%;">&nbsp;'+Math.round(ep)+'%</span>'; var es = '<span class="enl" style="width:'+ep+'%;">&nbsp;'+Math.round(ep)+'%</span>';
$('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() }); $('#gamestat').html(rs+es).one('click', function() { window.updateGameScore() });
// help cursor via “#gamestat span”
$('#gamestat').attr('title', 'Resistance:\t\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits'); $('#gamestat').attr('title', 'Resistance:\t\t'+r+' MindUnits\nEnlightenment:\t'+e+' MindUnits');
window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000); window.setTimeout('window.updateGameScore', REFRESH_GAME_SCORE*1000);
@ -1841,6 +1844,7 @@ window.renderPortalDetails = function(guid) {
.attr('class', TEAM_TO_CSS[getTeam(d)]) .attr('class', TEAM_TO_CSS[getTeam(d)])
.html('' .html(''
+ '<h3>'+d.portalV2.descriptiveText.TITLE+'</h3>' + '<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"><img src="'+img+'" title="'+getPortalDescriptionFromDetails(d)+'\n\nClick to show full image."/></div>'
+ '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>' + '<span id="level">'+Math.floor(getPortalLevel(d))+'</span>'
+ '<div class="mods">'+getModDetails(d)+'</div>' + '<div class="mods">'+getModDetails(d)+'</div>'