Auto-hide unselected wallet menu entries (thanks Craig Watkins)

This commit is contained in:
Saivann 2015-07-26 20:47:03 -04:00
parent bcc4b1fad5
commit 77511cb0d7
3 changed files with 26 additions and 18 deletions

View file

@ -2540,22 +2540,22 @@ h2 .rssicon{
.walletmenu>ul.menutap>li>ul>li:hover{ .walletmenu>ul.menutap>li>ul>li:hover{
background-position:left 10px; background-position:left 10px;
} }
.walletmenu>ul.menutap li.hover{ .walletmenu>ul.menutap li.active{
background-color:#0d579b; background-color:#0d579b;
} }
.walletmenu>ul.menutap li.hover>a, .walletmenu>ul.menutap li.active>a,
.walletmenu>ul.menutap li.hover>a:link, .walletmenu>ul.menutap li.active>a:link,
.walletmenu>ul.menutap li.hover>a:active, .walletmenu>ul.menutap li.active>a:active,
.walletmenu>ul.menutap li.hover>a:visited{ .walletmenu>ul.menutap li.active>a:visited{
color:#fff; color:#fff;
} }
.walletmenu>ul.menutap>li.hover{ .walletmenu>ul.menutap>li.active{
background-position:left -62px; background-position:left -62px;
} }
.walletmenu>ul.menutap>li.hover>ul{ .walletmenu>ul.menutap>li.active>ul{
display:block; display:block;
} }
.walletmenu>ul.menutap>li>ul>li.hover{ .walletmenu>ul.menutap>li>ul>li.active{
background-position:left -24px; background-position:left -24px;
} }
.wallets{ .wallets{

View file

@ -924,7 +924,7 @@ wallets:
<p class="summary">{% translate pagedesc %}</p> <p class="summary">{% translate pagedesc %}</p>
<div class="walletmenu" id="walletmenu" onclick="walletMenuListener(event);" ontouchstart="walletMenuListener(event);"> <div class="walletmenu" id="walletmenu" onclick="walletMenuListener(event);" ontouchstart="walletMenuListener(event);">
<ul onclick="mobileMenuHover(event);" ontouchstart="mobileMenuHover(event);"> <ul>
<li class="wallet-mobile"> <li class="wallet-mobile">
<a id="mobile" data-walletcompat="mobile">{% translate walletcatmobile %}</a> <a id="mobile" data-walletcompat="mobile">{% translate walletcatmobile %}</a>
<ul> <ul>

View file

@ -355,11 +355,23 @@ if (sessionStorage.getItem('develdocdisclaimerclose') === '1') disclaimerClose()
function walletMenuListener(e) { function walletMenuListener(e) {
// Listen for events on the wallet menu. // Listen for events on the wallet menu.
var t = getEvent(e, 'target'), var walletSelectPlatform = function(e) {
walletSelectPlatform = function() { var t = getEvent(e, 'target'),
p = t;
if (t.nodeName != 'A') return; if (t.nodeName != 'A') return;
if (t.parentNode.className.indexOf('active') !== -1) walletShowPlatform(t.getAttribute('data-walletcompat')); while (p.parentNode.nodeName == 'UL' || p.parentNode.nodeName == 'LI') p = p.parentNode;
if (isMobile() && t.parentNode.getElementsByTagName('UL').length == 0) scrollToNode(document.getElementById('wallets')); for (var i = 0, nds = p.getElementsByTagName('LI'), n = nds.length; i < n; i++) removeClass(nds[i], 'active');
var tt = t;
while (tt != p) {
if (tt.nodeName == 'LI') addClass(tt, 'active');
tt = tt.parentNode;
}
walletShowPlatform(t.getAttribute('data-walletcompat'));
if (isMobile() && !hasSubItems(t)) scrollToNode(document.getElementById('wallets'));
},
hasSubItems = function(t) {
while (t.nodeName != 'LI') t = t.parentNode;
return (t.getElementsByTagName('UL').length > 0);
}; };
// Pre-process events and call appropriate function. // Pre-process events and call appropriate function.
onTouchClick(e, walletSelectPlatform); onTouchClick(e, walletSelectPlatform);
@ -436,12 +448,8 @@ var t = null,
if (platform != 'default') { if (platform != 'default') {
t.setAttribute('data-active', '1'); t.setAttribute('data-active', '1');
addClass(t.parentNode, 'active'); addClass(t.parentNode, 'active');
addClass(t.parentNode, 'hover');
var p = t.parentNode.parentNode.parentNode; var p = t.parentNode.parentNode.parentNode;
if (p.nodeName == 'LI') { if (p.nodeName == 'LI') addClass(p, 'active');
addClass(p, 'active');
addClass(p, 'hover');
}
} }
}, },
updateWallets = function() { updateWallets = function() {