Allow disabled wallets to be displayed temporarily on click (thanks @schildbach)

This commit is contained in:
Saivann 2014-07-18 23:19:30 -04:00
parent 4978d92531
commit 627fdb08c7
2 changed files with 31 additions and 1 deletions

View file

@ -368,7 +368,7 @@ wallets:
</ul>
</div>
<div class="wallets" id="wallets" onclick="walletMobileShow(event);">
<div class="wallets" id="wallets" onclick="walletMobileShow(event);walletDisabledShow(event);">
{% for wallet in page.wallets %}{% for wallet in wallet %}{% if wallet[1].platform.mobile %}{% assign platform = wallet[1].platform.mobile %}{% elsif wallet[1].platform.desktop %}{% assign platform = wallet[1].platform.desktop %}{% elsif wallet[1].platform.hardware %}{% assign platform = wallet[1].platform.hardware %}{% else %}{% assign platform = wallet[1].platform.web %}{% endif %}
<div id="wallet-{{ wallet[0] }}" data-walletcompat="{{ wallet[1].compat }}" data-walletlevel="{{ wallet[1].level }}">
<div>

View file

@ -496,6 +496,36 @@ p.appendChild(t);
scrollToNode(p);
}
function walletDisabledShow(e){
//Show disabled wallet on click and disable wallet when mouse leaves the wallet.
var t=getEventTarget(e);
while(t.nodeName!='DIV'&&t.parentNode.id!='wallets'){
if(t.id=='wallets')return;
t=t.parentNode;
}
if(t.className.indexOf('disabled')===-1)return;
removeClass(t,'disabled');
addEvent(t,'mouseover',walletDisabledHide);
addEvent(t,'mouseout',walletDisabledHide);
}
function walletDisabledHide(e){
//Disable wallet when the mouse leaves the wallet bubble.
var t=getEventTarget(e);
while(t.nodeName!='DIV'||t.parentNode.id!='wallets'){
if(t.id=='wallets')return;
t=t.parentNode;
}
clearTimeout(t.getAttribute('data-disabletimeout'));
if(e.type=='mouseover')return;
t.setAttribute('data-disabletimeout',setTimeout(function(){
addClass(t,'disabled');
t.removeAttribute('data-disabletimeout');
removeEvent(t,'mouseout',walletDisabledHide);
removeEvent(t,'mouseover',walletDisabledHide);
},1));
}
function makeEditable(e){
//An easter egg that makes the page editable when user click on the page and hold their mouse button for one second.
//This trick allows translators and writers to preview their work.