Merge branch 'jsimprove'

This commit is contained in:
Saivann 2015-07-29 18:22:11 -04:00
commit 0a18c277fb
No known key found for this signature in database
GPG key ID: 5780F5D31B5577B0
16 changed files with 752 additions and 662 deletions

View file

@ -28,6 +28,7 @@ HTML::Proofer.new(
## Links to ignore
:href_ignore => [
'#', ## hrefs pointing to the current page (htmlproofer fails them)
/^$/, ## anchors with no href attribute set (for clickable javascript elements)
/^\/bin/, ## /bin dir is not part of repository; holds Bitcoin Core binaries
/^\/stats/ ## /stats dir is not part of repository; generated by separate stats script
],

View file

@ -6,7 +6,7 @@ http://opensource.org/licenses/MIT.
<!--Temporary disclaimer BEGIN-->
<div id="develdocdisclaimer" class="develdocdisclaimer"><div>
<b>BETA</b>: This documentation has not been extensively reviewed by Bitcoin experts and so likely contains numerous errors. Please use the <em>Issue</em> and <em>Edit</em> links on the bottom left menu to help us improve. <a href="#" onclick="disclaimerClose(event);">Click here</a> to close this disclaimer.
<a class="develdocdisclaimerclose" href="#" onclick="disclaimerClose(event);">X</a>
<a class="develdocdisclaimerclose" onclick="disclaimerClose(event);">X</a>
</div></div>
<script>disclaimerAutoClose();</script>
<!--Temporary disclaimer END-->

View file

@ -4,7 +4,7 @@ http://opensource.org/licenses/MIT.
{% endcomment %}
<p class="mainsummary">{% translate listintro %}</p>
<div class="mainvideo"><div onclick="loadYoutubeVideo(event);" data-youtubeurl="//www.youtube.com/embed/Gc2en3nHxA4?rel=0&amp;showinfo=0&amp;wmode=opaque&amp;autoplay=1{% if page.lang != 'en' %}&amp;cc_load_policy=1&amp;hl={{ page.lang }}&amp;cc_lang_pref={{ page.lang }}{% endif %}">
<div class="mainvideo"><div onclick="loadYoutubeVideo(event);" ontouchstart="loadYoutubeVideo(event);" data-youtubeurl="//www.youtube.com/embed/Gc2en3nHxA4?rel=0&amp;showinfo=0&amp;wmode=opaque&amp;autoplay=1{% if page.lang != 'en' %}&amp;cc_load_policy=1&amp;hl={{ page.lang }}&amp;cc_lang_pref={{ page.lang }}{% endif %}">
<img src="/img/video/video_wuc.jpg" alt="Youtube video">
<div class="mainvideoicon"></div>
<div class="mainvideoiconhover"></div>

View file

@ -3,7 +3,7 @@ This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}
<ul class="lang">
<li><a href="#" onclick="return false;">{{ site.langs[page.lang] }}</a>
<li><a>{{ site.langs[page.lang] }}</a>
<ul>
<li><ul>
{% assign i = 0 %}{% assign c = site.langsorder.size | divided_by: 2 | plus: 1 %}

View file

@ -4,7 +4,7 @@ http://opensource.org/licenses/MIT.
{% endcomment %}
<ul id="menusimple" class="menusimple" onclick="mobileMenuHover(event);" ontouchstart="mobileMenuHover(event);">
<li><a href="#" onclick="return false;">{% translate menu-intro layout %}</a>
<li><a>{% translate menu-intro layout %}</a>
<ul>
<li{% if page.id == 'bitcoin-for-individuals' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate bitcoin-for-individuals url %}">{% translate menu-bitcoin-for-individuals layout %}</a></li>
<li{% if page.id == 'bitcoin-for-businesses' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate bitcoin-for-businesses url %}">{% translate menu-bitcoin-for-businesses layout %}</a></li>
@ -14,7 +14,7 @@ http://opensource.org/licenses/MIT.
<li{% if page.id == 'you-need-to-know' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate you-need-to-know url %}">{% translate menu-you-need-to-know layout %}</a></li>
</ul>
</li>
<li><a href="#" onclick="return false;">{% translate menu-resources layout %}</a>
<li><a>{% translate menu-resources layout %}</a>
<ul>
<li{% if page.id == 'resources' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate resources url %}">{% translate menu-resources layout %}</a></li>
<li{% if page.id == 'community' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate community url %}">{% translate menu-community layout %}</a></li>
@ -24,7 +24,7 @@ http://opensource.org/licenses/MIT.
</ul>
</li>
<li{% if page.id == 'innovation' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate innovation url %}">{% translate menu-innovation layout %}</a></li>
<li><a href="#" onclick="return false;">{% translate menu-participate layout %}</a>
<li><a>{% translate menu-participate layout %}</a>
<ul>
<li{% if page.id == 'support-bitcoin' %} class="active"{% endif %}><a href="/{{ page.lang }}/{% translate support-bitcoin url %}">{% translate menu-support-bitcoin layout %}</a>
{% if page.lang == 'en' %}<li{% if page.id == 'full-node' %} class="active"{% endif %}><a href="/en/full-node">Running a full node</a></li>{% endif %}

View file

@ -3,4 +3,4 @@ This file is licensed under the MIT License (MIT) available on
http://opensource.org/licenses/MIT.
{% endcomment %}
<a id="menumobile" class="menumobile" onclick="mobileMenuShow(event);" ontouchstart="mobileMenuShow(event);" href="#"></a>
<a id="menumobile" class="menumobile" onclick="mobileMenuShow(event);" ontouchstart="mobileMenuShow(event);"></a>

View file

@ -35,13 +35,16 @@ h3{
}
a:link,
a:visited,
a:active{
a:active,
a.link-js{
color:#2c6fad;
text-decoration:none;
cursor:pointer;
}
a:link:hover,
a:visited:hover,
a:active:hover{
a:active:hover,
a.link-js:hover{
color:#63a4e1;
}
a img,
@ -316,6 +319,7 @@ table td,table th{
color:#2c6fad;
}
.menusimple>li a{
cursor:pointer;
font-family:'Ubuntu', sans-serif;
font-weight:300;
font-size:110%;
@ -1460,6 +1464,8 @@ div.post {
display:none;
}
.wallets>div>a{
color:#2c6fad;
cursor:pointer;
font-size:94%;
text-align:center;
text-decoration:none;
@ -1476,6 +1482,9 @@ div.post {
-webkit-transition:opacity 400ms ease-out;
transition:opacity 400ms ease-out;
}
.wallets>div>a:hover{
color:#63a4e1;
}
.wallets>div>a>span{
display:none;
position:absolute;
@ -2231,6 +2240,7 @@ h2 .rssicon{
-moz-appearance:none;
}
.menumobile{
cursor:pointer;
display:inline-block;
float:right;
height:40px;
@ -2249,6 +2259,8 @@ h2 .rssicon{
margin:0;
height:auto;
overflow:auto;
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-tap-highlight-color:transparent;
}
.menusimple>li a,
.menusimple>li>ul>li a{
@ -2273,13 +2285,16 @@ h2 .rssicon{
.menusimple.menutap li:hover>ul{
display:none;
}
.menusimple.menutap li.hover{
.menusimple.menutap li.hover,
.menusimple.menutap li.active{
background-color:#2c6fad;
}
.menusimple.menutap li.hover>a{
.menusimple.menutap li.hover>a,
.menusimple.menutap li.active>a{
color:#fff;
}
.menusimple.menutap li.hover>ul{
.menusimple.menutap li.hover>ul,
.menusimple.menutap li.active>ul{
display:block;
}
.logo{
@ -2496,6 +2511,10 @@ h2 .rssicon{
padding:0;
border:0;
}
.walletmenu{
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-tap-highlight-color:transparent;
}
.walletmenu>ul{
display:block;
}
@ -2525,27 +2544,29 @@ h2 .rssicon{
.walletmenu>ul.menutap>li>ul>li:hover{
background-position:left 10px;
}
.walletmenu>ul.menutap li.hover{
.walletmenu>ul.menutap li.active{
background-color:#0d579b;
}
.walletmenu>ul.menutap li.hover>a,
.walletmenu>ul.menutap li.hover>a:link,
.walletmenu>ul.menutap li.hover>a:active,
.walletmenu>ul.menutap li.hover>a:visited{
.walletmenu>ul.menutap li.active>a,
.walletmenu>ul.menutap li.active>a:link,
.walletmenu>ul.menutap li.active>a:active,
.walletmenu>ul.menutap li.active>a:visited{
color:#fff;
}
.walletmenu>ul.menutap>li.hover{
.walletmenu>ul.menutap>li.active{
background-position:left -62px;
}
.walletmenu>ul.menutap>li.hover>ul{
.walletmenu>ul.menutap>li.active>ul{
display:block;
}
.walletmenu>ul.menutap>li>ul>li.hover{
.walletmenu>ul.menutap>li>ul>li.active{
background-position:left -24px;
}
.wallets{
width:auto;
height:auto;
-webkit-tap-highlight-color:rgba(0,0,0,0);
-webkit-tap-highlight-color:transparent;
}
.wallets>div:hover>span{
display:none;
@ -2612,7 +2633,7 @@ h2 .rssicon{
margin-top:10px;
padding:0;
}
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div:hover>div{
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div.hover>div{
display:block;
background:none;
width:auto;
@ -2621,16 +2642,25 @@ h2 .rssicon{
margin-top:10px;
}
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div>div>p,
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div>div>div{
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div>div>div,
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div>div>span{
display:none;
position:relative;
width:auto;
height:auto;
visibility:visible;
opacity:1;
border:0;
background:none;
padding:0;
top:0;
left:-20px;
}
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div:hover>div>span{
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div.hover>div>p,
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div.hover>div>div{
display:block;
}
.wallets.walletsmobile>div>div>h2:first-child+div+div+div>div.hover>div>span{
display:none;
}
.download{

View file

@ -924,7 +924,7 @@ wallets:
<p class="summary">{% translate pagedesc %}</p>
<div class="walletmenu" id="walletmenu" onclick="walletMenuListener(event);" ontouchstart="walletMenuListener(event);">
<ul onclick="mobileMenuHover(event);" ontouchstart="mobileMenuHover(event);">
<ul>
<li class="wallet-mobile">
<a id="mobile" data-walletcompat="mobile">{% translate walletcatmobile %}</a>
<ul>
@ -955,7 +955,7 @@ wallets:
<h2>{{ wallet[1].title }}</h2>
<div>{% for os in platform.os %}<img src="/img/os/{{ os }}.png" alt="{% translate platform{{os}} %}" title="{% translate platform{{os}} %}" />{% endfor %}</div>
<div>{% if platform.link == 'bitcoincore' %}<a href="/{{ page.lang }}/{% translate download url %}">{% translate walletdownload %}</a>{% elsif platform.link contains 'play.google.com' or platform.link contains 'itunes.apple.com' or platform.link contains 'chrome.google.com' %}<a href="{{ platform.link }}">{% translate walletdownload %}</a>{% else %}<a href="{{ platform.link }}">{% translate walletvisit %}</a>{% endif %}{% if platform.source %}<a href="{{ platform.source }}">{% translate walletsourcecode %}</a>{% endif %}</div>
<div>
<div ontouchstart="walletScoreListener(event);" onclick="walletScoreListener(event);">
{% for check in platform.check %}{% if check[0] == 'privacy' and platform.privacycheck %}
<div class="check{{ check[0] }} {% if check[1] contains "checkgood" %}checkgood{% elsif check[1] contains "checkpass" %}checkpass{% elsif check[1] contains "checkneutral" %}checkneutral{% else %}checkfail{% endif %}">{% translate {{check[1]}} %}<div><div>
{% for privacycheck in platform.privacycheck %}
@ -972,7 +972,7 @@ wallets:
<p>{% translate {{platform.text}} %}</p>
<div><img src="/img/screenshots/{{ platform.screenshot }}" alt="screenshot"></div>
</div>
<a href="#" onclick="return false;"><img src="/img/wallet/{{ wallet[0] }}.png" alt="{{ wallet[1].title }}" />{{ wallet[1].titleshort }}<span></span></a>
<a><img src="/img/wallet/{{ wallet[0] }}.png" alt="{{ wallet[1].title }}" />{{ wallet[1].titleshort }}<span></span></a>
</div>
{% endfor %}{% endfor %}
</div>
@ -985,7 +985,7 @@ wallets:
<h2>{{ wallet[1].title }}</h2>
<div>{% for os in platform[1].os %}<img src="/img/os/{{ os }}.png" alt="{% translate platform{{os}} %}" title="{% translate platform{{os}} %}" />{% endfor %}</div>
<div>{% if platform[1].link == 'bitcoincore' %}<a href="/{{ page.lang }}/{% translate download url %}">{% translate walletdownload %}</a>{% elsif platform[1].link contains 'play.google.com' or platform[1].link contains 'itunes.apple.com' or platform[1].link contains 'chrome.google.com' %}<a href="{{ platform[1].link }}">{% translate walletdownload %}</a>{% else %}<a href="{{ platform[1].link }}">{% translate walletvisit %}</a>{% endif %}{% if platform[1].source %}<a href="{{ platform[1].source }}">{% translate walletsourcecode %}</a>{% endif %}</div>
<div>
<div ontouchstart="walletScoreListener(event);" onclick="walletScoreListener(event);">
{% for check in platform[1].check %}{% if check[0] == 'privacy' and platform[1].privacycheck %}
<div class="check{{ check[0] }} {% if check[1] contains "checkgood" %}checkgood{% elsif check[1] contains "checkpass" %}checkpass{% elsif check[1] contains "checkneutral" %}checkneutral{% else %}checkfail{% endif %}">{% translate {{check[1]}} %}<div><div>
{% for privacycheck in platform[1].privacycheck %}
@ -1002,7 +1002,7 @@ wallets:
<p>{% translate {{platform[1].text}} %}</p>
<div><img src="/img/screenshots/{{ platform[1].screenshot }}" alt="screenshot"></div>
</div>
<a href="#" onclick="return false;"><img src="/img/wallet/{{ wallet[0] }}.png" alt="{{ wallet[1].title }}" />{{ wallet[1].titleshort }}<span></span></a>
<a><img src="/img/wallet/{{ wallet[0] }}.png" alt="{{ wallet[1].title }}" />{{ wallet[1].titleshort }}<span></span></a>
</div>
{% endfor %}{% endfor %}{% endfor %}
</div>

View file

@ -56,7 +56,7 @@ id: development
<li><a href="https://github.com/jgarzik/picocoin">picocoin</a> - A tiny library with lightweight client and utilities, written in C.</li>
<li><a href="https://github.com/petertodd/python-bitcoinlib">python-bitcoinlib</a> - A library for structures and protocols, written in Python.</li>
<li><a href="https://gitlab.com/bitcoin/python-blkmaker">Python Blkmaker</a> - A client library for the getblocktemplate mining protocol, written in Python.</li>
<li class="more"><a href="#" onclick="librariesShow(event)">{% translate moremore %}</a></li>
<li class="more"><a onclick="librariesShow(event)" ontouchstart="librariesShow(event);" class="link-js">{% translate moremore %}</a></li>
</ul>
<section id="devcommunities">

View file

@ -55,26 +55,26 @@ dialogs:
<div class="press-faq">
<div>
<a href="#" onclick="faqShow(event);">{% translate whatisbitcoin faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate whatisbitcoin faq %}</a>
<div>
<p>{% translate whatisbitcointxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate howitworks faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate howitworks faq %}</a>
<div>
<p>{% translate howitworkstxt1 faq %}</p>
<p>{% translate howitworkstxt2 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate whatismining faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate whatismining faq %}</a>
<div>
<p>{% translate whatisminingtxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate acquire faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate acquire faq %}</a>
<div>
<ul>
<li>{% translate acquireli1 faq %}</li>
@ -86,7 +86,7 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate used faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate used faq %}</a>
<div>
<p>{% translate usedtxt1 faq %}</p>
<p>
@ -95,14 +95,14 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate makepayment faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate makepayment faq %}</a>
<div>
<p>{% translate makepaymenttxt1 faq %}</p>
<p><img src="/img/faq/mobile_send.png" style="height:325px;width:190px;" alt="Screenshot"><img src="/img/faq/mobile_receive.png" style="height:325px;width:190px;" alt="Screenshot"></p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate advantages faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate advantages faq %}</a>
<div>
<ul>
<li>{% translate advantagesli1 faq %}</li>
@ -114,7 +114,7 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate disadvantages faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate disadvantages faq %}</a>
<div>
<ul>
<li>{% translate disadvantagesli1 faq %}</li>
@ -124,13 +124,13 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate secure faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate secure faq %}</a>
<div>
<p>{% translate securetxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate islegal faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate islegal faq %}</a>
<div>
<p>{% translate islegaltxt1 faq %}</p>
<p>{% translate islegaltxt2 faq %}</p>
@ -141,13 +141,13 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate taxes faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate taxes faq %}</a>
<div>
<p>{% translate taxestxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate illegalactivities faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate illegalactivities faq %}</a>
<div>
<p>{% translate illegalactivitiestxt1 faq %}</p>
<p>{% translate illegalactivitiestxt2 faq %}</p>
@ -155,51 +155,51 @@ dialogs:
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate bubble faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate bubble faq %}</a>
<div>
<p>{% translate bubbletxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate whyvalue faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate whyvalue faq %}</a>
<div>
<p>{% translate whyvaluetxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate ponzi faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate ponzi faq %}</a>
<div>
<p>{% translate ponzitxt1 faq %}</p>
<p>{% translate ponzitxt2 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate creator faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate creator faq %}</a>
<div>
<p>{% translate creatortxt1 faq %}</p>
<p>{% translate creatortxt2 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate worthless faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate worthless faq %}</a>
<div>
<p>{% translate worthlesstxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate virtual faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate virtual faq %}</a>
<div>
<p>{% translate virtualtxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate trust faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate trust faq %}</a>
<div>
<p>{% translate trusttxt1 faq %}</p>
</div>
</div>
<div>
<a href="#" onclick="faqShow(event);">{% translate anonymous faq %}</a>
<a onclick="faqShow(event);" ontouchstart="faqShow(event);" class="link-js">{% translate anonymous faq %}</a>
<div>
<p>{% translate anonymoustxt1 faq %}</p>
<p>{% translate anonymoustxt2 faq %}</p>
@ -252,7 +252,7 @@ What is Bitcoin - Weusecoins<br>
<p><span>{{ page.dialogs.quotenavalravikant }}</span><span>Naval Ravikant, Founder of Angellist</span></p>
<p><span>{{ page.dialogs.quotemaxkeiser }}</span><span>Max Keiser, Journalist &amp; TV Host</span></p>
</div>
<a href="#" onclick="materialShow(event);">{{ page.dialogs.materialquotemore }}</a>
<a href="#" onclick="materialShow(event);" ontouchstart="materialShow(event);">{{ page.dialogs.materialquotemore }}</a>
</div>

View file

@ -50,7 +50,7 @@ id: secure-your-wallet
<p>{% translate offlinetxt %}</p>
<div class="box boxexpand">
<h3 id="offlinetx"><a href="#" onclick="boxShow(event);">{% translate offlinetx %}</a></h3>
<h3 id="offlinetx"><a onclick="boxShow(event);" ontouchstart="boxShow(event);" class="link-js">{% translate offlinetx %}</a></h3>
<p>{% translate offlinetxtxt1 %}</p>
<ol>
<li>{% translate offlinetxtxt2 %}</li>
@ -62,7 +62,7 @@ id: secure-your-wallet
<br>
<div class="box boxexpand">
<h3 id="hardwarewallet"><a href="#" onclick="boxShow(event);">{% translate hardwarewallet %}</a></h3>
<h3 id="hardwarewallet"><a onclick="boxShow(event);" ontouchstart="boxShow(event);" class="link-js">{% translate hardwarewallet %}</a></h3>
<p>{% translate hardwarewallettxt %}</p>
</div>

View file

@ -7,182 +7,201 @@
"use strict"
function addEvent(a, b, c) {
// Attach event to a DOM node.
// Ex. addEvent(node,'click',function);
return (a.addEventListener) ? a.addEventListener(b, c, false) : (a.attachEvent) ? a.attachEvent('on' + b, c) : false;
// Attach event to a DOM node.
// Ex. addEvent(node,'click',function);
return (a.addEventListener) ? a.addEventListener(b, c, false) : (a.attachEvent) ? a.attachEvent('on' + b, c) : false;
}
function removeEvent(a, b, c) {
// Detach event from a DOM node.
// Ex. removeEvent(node,'click',function);
return (a.removeEventListener) ? a.removeEventListener(b, c, false) : (a.detachEvent) ? a.detachEvent('on' + b, c) : false;
// Detach event from a DOM node.
// Ex. removeEvent(node,'click',function);
return (a.removeEventListener) ? a.removeEventListener(b, c, false) : (a.detachEvent) ? a.detachEvent('on' + b, c) : false;
}
function cancelEvent(e) {
// Cancel current event.
// Ex. cancelEvent(event);
if (!e) var e = window.event;
(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
// Cancel current event.
// Ex. cancelEvent(event);
if (!e) var e = window.event;
(e.preventDefault) ? e.preventDefault(): e.returnValue = false;
}
function getEventTarget(e) {
// Return target DOM node on which the event is triggered.
// Ex. getEventTarget(event);
if (!e) var e = window.event;
return (e.target && e.target.nodeType == 3) ? e.target.parentNode : (e.target) ? e.target : e.srcElement;
function getEvent(e, a) {
// Return requested event property.
// Ex. var target = getEvent(event, 'target');
e = (e) ? e : window.event;
switch (a) {
case 'type':
return e.type;
case 'target':
return (e.target && e.target.nodeType == 3) ? e.target.parentNode : (e.target) ? e.target : e.srcElement;
}
}
function getStyle(a, b) {
// Return the value of the computed style on a DOM node.
// Ex. getStyle(node,'padding-bottom');
if (window.getComputedStyle) return document.defaultView.getComputedStyle(a, null).getPropertyValue(b);
var n = b.indexOf('-');
if (n !== -1) b = b.substr(0, n) + b.substr(n + 1, 1).toUpperCase() + b.substr(n + 2);
return a.currentStyle[b];
// Return the value of the computed style on a DOM node.
// Ex. getStyle(node,'padding-bottom');
if (window.getComputedStyle) return document.defaultView.getComputedStyle(a, null).getPropertyValue(b);
var n = b.indexOf('-');
if (n !== -1) b = b.substr(0, n) + b.substr(n + 1, 1).toUpperCase() + b.substr(n + 2);
return a.currentStyle[b];
}
function addClass(node, data) {
// Add class to node.
var cl = node.className.split(' ');
for (var i = 0, n = cl.length; i < n; i++) {
if (cl[i] == data) return;
}
cl.push(data);
node.className = cl.join(' ');
// Add class to node.
var cl = node.className.split(' ');
for (var i = 0, n = cl.length; i < n; i++) {
if (cl[i] == data) return;
}
cl.push(data);
node.className = cl.join(' ');
}
function removeClass(node, data) {
// Remove class from node.
var ocl = node.className.split(' ');
var ncl = [];
for (var i = 0, n = ocl.length; i < n; i++) {
if (ocl[i] != data) ncl.push(ocl[i]);
}
node.className = ncl.join(' ');
// Remove class from node.
var ocl = node.className.split(' ');
var ncl = [];
for (var i = 0, n = ocl.length; i < n; i++) {
if (ocl[i] != data) ncl.push(ocl[i]);
}
node.className = ncl.join(' ');
}
function supportsSVG() {
// Return true if the browser supports SVG.
// Ex. if(!supportsSVG()){..apply png fallback..}
// Old FF 3.5 and Safari 3 versions have svg support, but a very poor one
// http://www.w3.org/TR/SVG11/feature#Image Defeat FF 3.5 only
// http://www.w3.org/TR/SVG11/feature#Animation Defeat Saf 3 but also returns false in IE9
// http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute Defeat Saf 3 but also returns false in Chrome and safari4
// http://www.w3.org/TR/SVG11/feature#Text Defeat Saf 3 but also returns false in FF and safari4
if (!document.createElementNS || !document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect) return false;
if (!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) return false;
if (!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute", "1.1") && !document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Animation", "1.1") && !document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Text", "1.1")) return false;
return true;
// Return true if the browser supports SVG.
// Ex. if(!supportsSVG()){..apply png fallback..}
// Old FF 3.5 and Safari 3 versions have svg support, but a very poor one
// http://www.w3.org/TR/SVG11/feature#Image Defeat FF 3.5 only
// http://www.w3.org/TR/SVG11/feature#Animation Defeat Saf 3 but also returns false in IE9
// http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute Defeat Saf 3 but also returns false in Chrome and safari4
// http://www.w3.org/TR/SVG11/feature#Text Defeat Saf 3 but also returns false in FF and safari4
if (!document.createElementNS || !document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect) return false;
if (!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1")) return false;
if (!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicGraphicsAttribute", "1.1") && !document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Animation", "1.1") && !document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Text", "1.1")) return false;
return true;
}
function fallbackSVG() {
// Replace all images extensions from .svg to .png if browser doesn't support SVG files.
if (supportsSVG()) return;
for (var i = 0, nd = document.getElementsByTagName('*'), n = nd.length; i < n; i++) {
if (nd[i].nodeName == 'IMG' && /.*\.svg$/.test(nd[i].src)) nd[i].src = nd[i].src.slice(0, -3) + 'png';
if (/\.svg/.test(getStyle(nd[i], 'background-image'))) nd[i].style.backgroundImage = getStyle(nd[i], 'background-image').replace('.svg', '.png');
if (/\.svg/.test(getStyle(nd[i], 'background'))) nd[i].style.background = getStyle(nd[i], 'background').replace('.svg', '.png');
}
// Replace all images extensions from .svg to .png if browser doesn't support SVG files.
if (supportsSVG()) return;
for (var i = 0, nd = document.getElementsByTagName('*'), n = nd.length; i < n; i++) {
if (nd[i].nodeName == 'IMG' && /.*\.svg$/.test(nd[i].src)) nd[i].src = nd[i].src.slice(0, -3) + 'png';
if (/\.svg/.test(getStyle(nd[i], 'background-image'))) nd[i].style.backgroundImage = getStyle(nd[i], 'background-image').replace('.svg', '.png');
if (/\.svg/.test(getStyle(nd[i], 'background'))) nd[i].style.background = getStyle(nd[i], 'background').replace('.svg', '.png');
}
}
function onTouchClick(e, callback) {
// Detect and handle clicks using click and touch events while preventing accidental or ghost clicks.
var timeout = 1000,
function onTouchClick(e, callback, callbackClick) {
// Detect and handle clicks using click and touch events while preventing accidental or ghost clicks.
var timeout = 1000,
srcEvent = e,
touchEndListener = function(e) {
// Call callback if touch events match the patterns of a click.
removeEvent(t, 'touchend', touchEndListener);
setClickTimeout();
if (Math.abs(e.changedTouches[0].pageX - x) > 20 || Math.abs(e.changedTouches[0].pageY - y) > 20) return;
callback(e);
// Call callback if touch events match the patterns of a click.
removeEvent(t, 'touchend', touchEndListener);
setClickTimeout();
if (Math.abs(e.changedTouches[0].pageX - x) > 20 || Math.abs(e.changedTouches[0].pageY - y) > 20) return;
callback(srcEvent);
},
wrongClickListener = function(e) {
// Cancel click events on different targets within timeframe.
// This avoids accidental clicks when the page is scrolled or updated due to the 300ms click event delay on mobiles.
removeEvent(document.body, 'click', wrongClickListener);
if (!clickReady() && getEventTarget(e) != t) cancelEvent(e);
// Cancel click events on different targets within timeframe.
// This avoids accidental clicks when the page is scrolled or updated due to the 300ms click event delay on mobiles.
removeEvent(document.body, 'click', wrongClickListener);
if (!clickReady() && getEvent(e, 'target') != t) cancelEvent(e);
},
setClickTimeout = function() {
// Update timeout during which click events will be blocked.
document.body.setAttribute('data-touchtimeout', new Date().getTime() + timeout);
// Update timeout during which click events will be blocked.
document.body.setAttribute('data-touchtimeout', new Date().getTime() + timeout);
},
clickReady = function() {
// Check if timeout during click events are blocked has expired.
var ti = document.body.getAttribute('data-touchtimeout');
return (ti === null || ti === '' || parseInt(ti, 10) < new Date().getTime());
// Check if timeout during click events are blocked has expired.
var ti = document.body.getAttribute('data-touchtimeout');
return (ti === null || ti === '' || parseInt(ti, 10) < new Date().getTime());
};
// Apply appropriate actions according to each event type.
switch (e.type) {
case 'touchstart':
// Save initial touchstart coordinates and listen for touchend events and accidental click events.
var x = e.changedTouches[0].pageX,
y = e.changedTouches[0].pageY,
t = e.changedTouches[0].target;
setClickTimeout();
addEvent(t, 'touchend', touchEndListener);
addEvent(document.body, 'click', wrongClickListener);
setTimeout(function() {
removeEvent(document.body, 'click', wrongClickListener);
}, timeout);
break;
case 'click':
// Call callback on click in the absence of a recent touchstart event to prevent ghost clicks.
if (!clickReady()) return;
callback();
break;
}
if (callbackClick === undefined) callbackClick = function() {};
// Apply appropriate actions according to each event type.
switch (getEvent(e, 'type')) {
case 'touchstart':
// Save initial touchstart coordinates and listen for touchend events and accidental click events.
var x = e.changedTouches[0].pageX,
y = e.changedTouches[0].pageY,
t = e.changedTouches[0].target;
setClickTimeout();
addEvent(t, 'touchend', touchEndListener);
addEvent(document.body, 'click', wrongClickListener);
setTimeout(function() {
removeEvent(document.body, 'click', wrongClickListener);
}, timeout);
break;
case 'click':
// Call callback on click in the absence of a recent touchstart event to prevent ghost clicks.
// Always call callbackClick to let it cancel click events on links.
callbackClick(srcEvent);
if (!clickReady()) return;
callback(srcEvent);
break;
}
}
function mobileMenuShow(e) {
// Show the mobile menu when the visitors touch the menu icon.
var show = function() {
var mm = document.getElementById('menusimple');
var ml = document.getElementById('langselect');
mm.style.display = ml.style.display = (mm.style.display == 'block') ? '' : 'block';
cancelEvent(e);
};
onTouchClick(e, show);
// Show the mobile menu when the visitors touch the menu icon.
var show = function() {
var mm = document.getElementById('menusimple');
var ml = document.getElementById('langselect');
mm.style.display = ml.style.display = (mm.style.display == 'block') ? '' : 'block';
addClass(mm, 'menutap');
cancelEvent(e);
};
onTouchClick(e, show);
}
function mobileMenuHover(e) {
// Prevent mobile menu to shrink on hover to prevent accidental clicks on other entries.
var t = getEventTarget(e),
// Prevent mobile menu to shrink on hover to prevent accidental clicks on other entries.
var t = getEvent(e, 'target'),
fn = (t.parentNode.className.indexOf('hover') === -1) ? addClass : removeClass,
initHover = function() {
if (t.nodeName != 'A') return;
if (fn == removeClass && t.parentNode.getElementsByTagName('UL').length == 0) return;
var p = t;
while (p.parentNode.nodeName == 'UL' || p.parentNode.nodeName == 'LI') p = p.parentNode;
addClass(p, 'menutap');
for (var i = 0, nds = p.getElementsByTagName('LI'), n = nds.length; i < n; i++) {
if (nds[i] == t.parentNode) continue;
removeClass(nds[i], 'active');
if (nds[i].getElementsByTagName('UL').length > 0) continue;
removeClass(nds[i], 'hover');
}
while (t != p) {
if (t.nodeName == 'LI') {
fn(t, 'hover');
fn(t, 'active');
}
t = t.parentNode;
}
if (t.nodeName != 'A') return;
if (fn == removeClass && !hasSubItems(t)) return;
var p = t;
while (p.parentNode.nodeName == 'UL' || p.parentNode.nodeName == 'LI') p = p.parentNode;
for (var i = 0, nds = p.getElementsByTagName('LI'), n = nds.length; i < n; i++) {
if (nds[i] == t.parentNode) continue;
removeClass(nds[i], 'active');
if (hasSubItems(nds[i])) continue;
removeClass(nds[i], 'hover');
}
while (t != p) {
if (t.nodeName == 'LI') {
fn(t, 'hover');
fn(t, 'active');
}
t = t.parentNode;
}
},
hasSubItems = function(t) {
while (t.nodeName != 'LI') t = t.parentNode;
return (t.getElementsByTagName('UL').length > 0);
},
// Prevent clicks on parent element links in the menu.
filterClick = function(e) {
var t = getEvent(e, 'target');
if (t.nodeName != 'A') return;
if (hasSubItems(t)) cancelEvent(e);
};
onTouchClick(e, initHover);
onTouchClick(e, initHover, filterClick);
}
function addAnchorLinks() {
// Apply anchor links icon on each title displayed on CSS hover.
var nodes = [];
var tags = ['H2', 'H3', 'H4', 'H5', 'H6'];
for (var i = 0, n = tags.length; i < n; i++) {
for (var ii = 0, t = document.getElementsByTagName(tags[i]), nn = t.length; ii < nn; ii++) nodes.push(t[ii]);
}
for (var i = 0, n = nodes.length; i < n; i++) {
if (!nodes[i].id) continue;
if (nodes[i].getElementsByTagName('A').length > 0 && nodes[i].getElementsByTagName('A')[0].innerHTML == '') return;
addClass(nodes[i], 'anchorAf');
var anc = document.createElement('A');
anc.href = '#' + nodes[i].id;
nodes[i].insertBefore(anc, nodes[i].firstChild);
}
// Apply anchor links icon on each title displayed on CSS hover.
var nodes = [];
var tags = ['H2', 'H3', 'H4', 'H5', 'H6'];
for (var i = 0, n = tags.length; i < n; i++) {
for (var ii = 0, t = document.getElementsByTagName(tags[i]), nn = t.length; ii < nn; ii++) nodes.push(t[ii]);
}
for (var i = 0, n = nodes.length; i < n; i++) {
if (!nodes[i].id) continue;
if (nodes[i].getElementsByTagName('A').length > 0 && nodes[i].getElementsByTagName('A')[0].innerHTML == '') return;
addClass(nodes[i], 'anchorAf');
var anc = document.createElement('A');
anc.href = '#' + nodes[i].id;
nodes[i].insertBefore(anc, nodes[i].firstChild);
}
}

View file

@ -38,36 +38,36 @@ category: "{{category_name}}"
// code adapted from http://jqueryui.com/autocomplete/#categories
// MIT license: https://jquery.org/license/
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_create: function() {
this._super();
this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
},
_renderMenu: function( ul, items ) {
var that = this,
currentCategory = "";
$.each( items, function( index, item ) {
var li;
if ( item.category != currentCategory ) {
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
currentCategory = item.category;
}
li = that._renderItemData( ul, item );
if ( item.category ) {
li.attr( "aria-label", item.category + " : " + item.label );
}
});
}
$.widget("custom.catcomplete", $.ui.autocomplete, {
_create: function() {
this._super();
this.widget().menu("option", "items", "> :not(.ui-autocomplete-category)");
},
_renderMenu: function(ul, items) {
var that = this,
currentCategory = "";
$.each(items, function(index, item) {
var li;
if (item.category != currentCategory) {
ul.append("<li class='ui-autocomplete-category'>" + item.category + "</li>");
currentCategory = item.category;
}
li = that._renderItemData(ul, item);
if (item.category) {
li.attr("aria-label", item.category + " : " + item.label);
}
});
}
});
$(function() {
$( "#glossary_term" ).catcomplete({
source: search_data,
delay: 0,
minLength: 2,
autoFocus: true,
select: function( event, ui ) {
location.href = ui.item.uri;
}
});
$("#glossary_term").catcomplete({
source: search_data,
delay: 0,
minLength: 2,
autoFocus: true,
select: function(event, ui) {
location.href = ui.item.uri;
}
});
});
{% endraw %}

View file

@ -7,18 +7,25 @@ layout: null
"use strict"
var zoom=2;
var minzoom=1;
if(isMobile())var zoom=minzoom=0;
var map = L.map('eventmap',{ 'zoom': zoom, 'minZoom': minzoom, 'center': [20.00, 10.00]});
var zoom = 2;
var minzoom = 1;
if (isMobile()) var zoom = minzoom = 0;
var map = L.map('eventmap', {
'zoom': zoom,
'minZoom': minzoom,
'center': [20.00, 10.00]
});
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Data &copy; by <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>.',
maxZoom: 18
attribution: 'Data &copy; by <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>.',
maxZoom: 18
}).addTo(map);
var markers = new L.MarkerClusterGroup({showCoverageOnHover: false, maxClusterRadius: 40});
for (var i=0, nds=document.getElementById('eventdata').getElementsByTagName('DIV'), n=nds.length; i < n; i++) {
L.marker([parseFloat(nds[i].getAttribute('data-lat')), parseFloat(nds[i].getAttribute('data-lon'))]).bindPopup(nds[i].innerHTML).addTo(markers);
var markers = new L.MarkerClusterGroup({
showCoverageOnHover: false,
maxClusterRadius: 40
});
for (var i = 0, nds = document.getElementById('eventdata').getElementsByTagName('DIV'), n = nds.length; i < n; i++) {
L.marker([parseFloat(nds[i].getAttribute('data-lat')), parseFloat(nds[i].getAttribute('data-lon'))]).bindPopup(nds[i].innerHTML).addTo(markers);
}
map.addLayer(markers);

View file

@ -3,44 +3,44 @@
"use strict"
function pngfix(){
//Allows IE6 to render transparent png
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
function pngfix() {
//Allows IE6 to render transparent png
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for (var i = 0; i < document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
{
//Workaround to skip github icons
if(img.src.indexOf('gravatar.com')!==-1)continue;
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + " ieimg' " : "class='ieimg' "
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
var imgWidth = img.width;
var imgHeight = img.height;
//Workaround for hidden img to prevent 0px width and height
if(img.src.indexOf('/img/clients/')!==-1){imgWidth='72';imgHeight='72';}
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + imgWidth + "px; height:" + imgHeight + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
//Workaround to skip github icons
if (img.src.indexOf('gravatar.com') !== -1) continue;
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + " ieimg' " : "class='ieimg' "
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
var imgWidth = img.width;
var imgHeight = img.height;
//Workaround for hidden img to prevent 0px width and height
if (img.src.indexOf('/img/clients/') !== -1) {
imgWidth = '72';
imgHeight = '72';
}
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + imgWidth + "px; height:" + imgHeight + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i - 1
}
}
}
}
}
}
//Let other scripts know browser is IE6-7
var legacyIE=true;
var legacyIE = true;
//Render all transparent pngs
window.onload=pngfix;
window.onload = pngfix;

View file

@ -7,301 +7,316 @@
"use strict"
function getWidth(a) {
// Return the integer value of the computed width of a DOM node.
// Ex. getWidth(node);
var w = getStyle(a, 'width');
if (w.indexOf('px') !== -1) return parseInt(w.replace('px', ''));
var p = [getStyle(a, 'padding-top'), getStyle(a, 'padding-right'), getStyle(a, 'padding-bottom'), getStyle(a, 'padding-left')];
for (var i = 0; i < 4; i++) {
p[i] = (p[i].indexOf('px') !== -1) ? parseInt(p[i]) : 0;
}
return Math.max(0, a.offsetWidth - p[1] - p[3]);
// Return the integer value of the computed width of a DOM node.
// Ex. getWidth(node);
var w = getStyle(a, 'width');
if (w.indexOf('px') !== -1) return parseInt(w.replace('px', ''));
var p = [getStyle(a, 'padding-top'), getStyle(a, 'padding-right'), getStyle(a, 'padding-bottom'), getStyle(a, 'padding-left')];
for (var i = 0; i < 4; i++) {
p[i] = (p[i].indexOf('px') !== -1) ? parseInt(p[i]) : 0;
}
return Math.max(0, a.offsetWidth - p[1] - p[3]);
}
function getHeight(a) {
// Return the integer value of the computed height of a DOM node.
// Ex. getHeight(node);
var h = getStyle(a, 'height');
if (h.indexOf('px') !== -1) return parseInt(h.replace('px', ''));
var p = [getStyle(a, 'padding-top'), getStyle(a, 'padding-right'), getStyle(a, 'padding-bottom'), getStyle(a, 'padding-left')];
for (var i = 0; i < 4; i++) {
p[i] = (p[i].indexOf('px') !== -1) ? parseInt(p[i]) : 0;
}
return Math.max(0, a.offsetHeight - p[0] - p[2]);
// Return the integer value of the computed height of a DOM node.
// Ex. getHeight(node);
var h = getStyle(a, 'height');
if (h.indexOf('px') !== -1) return parseInt(h.replace('px', ''));
var p = [getStyle(a, 'padding-top'), getStyle(a, 'padding-right'), getStyle(a, 'padding-bottom'), getStyle(a, 'padding-left')];
for (var i = 0; i < 4; i++) {
p[i] = (p[i].indexOf('px') !== -1) ? parseInt(p[i]) : 0;
}
return Math.max(0, a.offsetHeight - p[0] - p[2]);
}
function getLeft(a) {
// Return the integer value of the computed distance between given node and the browser window.
// Ex. getLeft(node);
var b = a.offsetLeft;
while (a.offsetParent) {
a = a.offsetParent;
b += a.offsetLeft;
}
return b;
// Return the integer value of the computed distance between given node and the browser window.
// Ex. getLeft(node);
var b = a.offsetLeft;
while (a.offsetParent) {
a = a.offsetParent;
b += a.offsetLeft;
}
return b;
}
function getTop (a) {
// Return the integer value of the computed distance between given node and the browser window.
// Ex. getTop(node);
var b = a.offsetTop;
while (a.offsetParent) {
a = a.offsetParent;
b += a.offsetTop;
}
return b;
function getTop(a) {
// Return the integer value of the computed distance between given node and the browser window.
// Ex. getTop(node);
var b = a.offsetTop;
while (a.offsetParent) {
a = a.offsetParent;
b += a.offsetTop;
}
return b;
}
function getPageYOffset() {
// Return the integer value for the vertical position of the scroll bar.
return window.pageYOffset || document.documentElement.scrollTop;
// Return the integer value for the vertical position of the scroll bar.
return window.pageYOffset || document.documentElement.scrollTop;
}
function getPageXOffset() {
// Return the integer value for the horizontal position of the scroll bar.
return window.pageXOffset || document.documentElement.scrollLeft;
// Return the integer value for the horizontal position of the scroll bar.
return window.pageXOffset || document.documentElement.scrollLeft;
}
function getWindowY() {
// Return the integer value for the browser window height.
return window.innerHeight || document.documentElement.clientHeight;
// Return the integer value for the browser window height.
return window.innerHeight || document.documentElement.clientHeight;
}
function getWindowX() {
// Return the integer value for the browser window width.
return window.innerWidth || document.documentElement.clientWidth;
// Return the integer value for the browser window width.
return window.innerWidth || document.documentElement.clientWidth;
}
function isMobile() {
// Return true if the mobile CSS stylesheet is used.
if (getStyle(document.getElementById('detectmobile'), 'display') != 'none') return true;
return false;
// Return true if the mobile CSS stylesheet is used.
if (getStyle(document.getElementById('detectmobile'), 'display') != 'none') return true;
return false;
}
function scrollToNode(t) {
// Scroll to any node on the page.
if (document.body.getAttribute('data-scrollstatus') != null) {
clearInterval(document.body.getAttribute('data-scrollstatus'));
document.body.removeAttribute('data-scrollstatus');
}
var delay = 800;
var py = getPageYOffset();
var fy = getTop(t)
var dy = fy - py;
var x = getPageXOffset();
var oti = new Date().getTime();
document.body.setAttribute('data-scrollstatus', setInterval(function() {
var nti = new Date().getTime() - oti;
if (nti >= delay) {
window.scrollTo(x, fy);
clearInterval(document.body.getAttribute('data-scrollstatus'));
document.body.removeAttribute('data-scrollstatus');
return;
}
var p = nti / delay;
p = p * (1 + (0.5 * (1 - p)));
window.scrollTo(x, (py + (dy * p)).toFixed(0));
}, 10));
// Scroll to any node on the page.
if (document.body.getAttribute('data-scrollstatus') != null) {
clearInterval(document.body.getAttribute('data-scrollstatus'));
document.body.removeAttribute('data-scrollstatus');
}
var delay = 800;
var py = getPageYOffset();
var fy = getTop(t)
var dy = fy - py;
var x = getPageXOffset();
var oti = new Date().getTime();
document.body.setAttribute('data-scrollstatus', setInterval(function() {
var nti = new Date().getTime() - oti;
if (nti >= delay) {
window.scrollTo(x, fy);
clearInterval(document.body.getAttribute('data-scrollstatus'));
document.body.removeAttribute('data-scrollstatus');
return;
}
var p = nti / delay;
p = p * (1 + (0.5 * (1 - p)));
window.scrollTo(x, (py + (dy * p)).toFixed(0));
}, 10));
}
function supportCSS(id) {
// Return true if the browser supports given CSS feature.
var domPrefixes = 'Webkit Moz ms O'.split(' ');
var nd = document.createElement('DIV');
id = id.toLowerCase();
if (nd.style[id] !== undefined) return true;
idc = id.charAt(0).toUpperCase() + id.substr(1);
for (var i = 0, n = domPrefixes.length; i < n; i++) {
if (nd.style[domPrefixes[i] + idc] !== undefined) return true;
}
return false;
// Return true if the browser supports given CSS feature.
var domPrefixes = 'Webkit Moz ms O'.split(' ');
var nd = document.createElement('DIV');
id = id.toLowerCase();
if (nd.style[id] !== undefined) return true;
idc = id.charAt(0).toUpperCase() + id.substr(1);
for (var i = 0, n = domPrefixes.length; i < n; i++) {
if (nd.style[domPrefixes[i] + idc] !== undefined) return true;
}
return false;
}
function loadYoutubeVideo(e) {
// Load Youtube video on target node on click.
var t = getEventTarget(e),
nd = document.createElement('IFRAME');
while (t.getAttribute('data-youtubeurl') === null || t.getAttribute('data-youtubeurl') === '') t = t.parentNode;
nd.src = t.getAttribute('data-youtubeurl');
nd.setAttribute('frameborder', 0);
nd.setAttribute('allowfullscreen', true);
t.innerHTML = '';
t.appendChild(nd);
t.onclick = '';
// Load Youtube video on target node on click.
function init(e) {
var t = getEvent(e, 'target'),
nd = document.createElement('IFRAME');
while (t.getAttribute('data-youtubeurl') === null || t.getAttribute('data-youtubeurl') === '') t = t.parentNode;
nd.src = t.getAttribute('data-youtubeurl');
nd.setAttribute('frameborder', 0);
nd.setAttribute('allowfullscreen', true);
t.innerHTML = '';
t.appendChild(nd);
t.onclick = '';
}
onTouchClick(e, init);
}
function expandBox(t) {
// Expand or shrink box.
var phe = getHeight(t);
t.style.transition = t.style.MozTransition = t.style.WebkitTransition = 'all 0s ease 0s';
if (t.className.indexOf('expanded') === -1) addClass(t, 'expanded');
else removeClass(t, 'expanded');
t.style.height = '';
var nhe = getHeight(t);
t.style.height = phe + 'px';
// Async call to prevent transition from applying on last style.height statement.
setTimeout(function() {
t.style.transition = t.style.MozTransition = t.style.WebkitTransition = '';
t.style.height = nhe + 'px';
}, 20);
// Expand or shrink box.
var phe = getHeight(t);
t.style.transition = t.style.MozTransition = t.style.WebkitTransition = 'all 0s ease 0s';
if (t.className.indexOf('expanded') === -1) addClass(t, 'expanded');
else removeClass(t, 'expanded');
t.style.height = '';
var nhe = getHeight(t);
t.style.height = phe + 'px';
// Async call to prevent transition from applying on last style.height statement.
setTimeout(function() {
t.style.transition = t.style.MozTransition = t.style.WebkitTransition = '';
t.style.height = nhe + 'px';
}, 20);
}
function boxShow(e) {
// Display the box content when the user click a box on the "Secure your wallet" page.
var t = getEventTarget(e);
while (t.nodeName != 'DIV') t = t.parentNode;
expandBox(t);
cancelEvent(e);
// Display the box content when the user click a box on the "Secure your wallet" page.
function init(e) {
var t = getEvent(e, 'target');
while (t.nodeName != 'DIV') t = t.parentNode;
expandBox(t);
cancelEvent(e);
}
onTouchClick(e, init);
}
function faqShow(e) {
// Display the content of a question in the FAQ at user request.
var t = getEventTarget(e);
while (t.nodeType != 1 || t.nodeName != 'DIV') t = t.nextSibling;
expandBox(t);
cancelEvent(e);
// Display the content of a question in the FAQ at user request.
function init(e) {
var t = getEvent(e, 'target');
while (t.nodeType != 1 || t.nodeName != 'DIV') t = t.nextSibling;
expandBox(t);
cancelEvent(e);
}
onTouchClick(e, init);
}
function materialShow(e) {
// Display more materials on the "Press center" page at user request.
var t = getEventTarget(e),
p = t;
while (p.nodeType != 1 || p.nodeName != 'DIV') p = p.parentNode;
expandBox(p);
cancelEvent(e);
// Display more materials on the "Press center" page at user request.
function init(e) {
var t = getEvent(e, 'target'),
p = t;
while (p.nodeType != 1 || p.nodeName != 'DIV') p = p.parentNode;
expandBox(p);
cancelEvent(e);
}
onTouchClick(e, init);
}
function librariesShow(e) {
// Display more open source projects on the "Development" page at user request.
var t = getEventTarget(e),
p = t;
while (p.nodeType != 1 || p.nodeName != 'UL') p = p.parentNode;
expandBox(p);
cancelEvent(e);
// Display more open source projects on the "Development" page at user request.
function init(e) {
var t = getEvent(e, 'target'),
p = t;
while (p.nodeType != 1 || p.nodeName != 'UL') p = p.parentNode;
expandBox(p);
cancelEvent(e);
}
onTouchClick(e, init);
}
function freenodeShow(e) {
// Display freenode chat window on the "Development" page at user request.
document.getElementById('chatbox').innerHTML = '<iframe style=width:98%;min-width:400px;height:600px src="http://webchat.freenode.net/?channels=bitcoin-dev" />';
cancelEvent(e);
// Display freenode chat window on the "Development" page at user request.
document.getElementById('chatbox').innerHTML = '<iframe style=width:98%;min-width:400px;height:600px src="http://webchat.freenode.net/?channels=bitcoin-dev" />';
cancelEvent(e);
}
function updateToc() {
// Update table of content active entry and browser url on scroll.
var pageoffset;
var windowy;
var toc;
var fallback;
var first;
var last;
var closer;
var init = function() {
setenv();
updatehistory();
updatetoc();
}
// Set variables.
var setenv = function() {
pageoffset = getPageYOffset();
windowy = getWindowY();
toc = document.getElementById('toc');
fallback = document.getElementsByTagName('H2')[0];
first = [fallback, getTop(fallback)];
last = [fallback, getTop(fallback)];
closer = [fallback, getTop(fallback)];
// Find all titles in toc.
var nodes = [];
var tags = ['H2', 'H3', 'H4', 'H5', 'H6'];
for (var i = 0, n = tags.length; i < n; i++) {
for (var ii = 0, t = document.getElementsByTagName(tags[i]), nn = t.length; ii < nn; ii++) {
if (t[ii].className.indexOf('no_toc')!==-1) continue;
nodes.push(t[ii]);
}
}
// Find first title, last title and closer title.
for (var i = 0, n = nodes.length; i < n; i++) {
if (!nodes[i].id) continue;
var top = getTop(nodes[i]);
if (top < first[1]) first = [nodes[i], top];
if (top > last[1]) last = [nodes[i], top];
if (top < pageoffset + 10 && top > closer[1]) closer = [nodes[i], top];
}
// Set closer title to first or last title if at the top or bottom of the page.
if (pageoffset < first[1]) closer = [first[0], first[1]];
if (windowy + pageoffset >= getHeight(document.body)) closer = [last[0], last[1]];
}
// Update toc position and set active toc entry.
var updatetoc = function() {
// Set bottom and top to fit within window and not overflow its parent node.
var div = toc.getElementsByTagName('DIV')[0];
if (pageoffset > getTop(toc)) {
addClass(div, 'scroll');
div.style.top = '20px';
div.style.bottom = Math.max((pageoffset + windowy) - (getHeight(toc.parentNode) + getTop(toc.parentNode)), 20) + 'px';
} else removeClass(div, 'scroll');
// Remove .active class from toc and find new active toc entry.
var a = false;
for (var i = 0, t = toc.getElementsByTagName('*'), n = t.length; i < n; i++) {
removeClass(t[i], 'active');
if (t[i].nodeName == 'A' && t[i].getAttribute('href') == '#' + closer[0].id) a = t[i];
}
if (a === false) return;
// Set .active class on new active toc entry.
var nd = a;
while (nd.parentNode.nodeName == 'LI' || nd.parentNode.nodeName == 'UL') {
addClass(nd, 'active');
nd = nd.parentNode;
}
// Auto-scroll in toc to keep active toc entry visible.
var nd = a;
var otop = nd.offsetTop;
while (nd.offsetParent != div && nd.offsetParent) {
nd = nd.offsetParent;
otop += nd.offsetTop;
}
var bdiff = getHeight(a) + otop - div.scrollTop - getHeight(div);
var tdiff = getHeight(a) - otop + div.scrollTop;
if (tdiff > 0 || bdiff > 0) div.scrollTop -= tdiff;
}
// Update browser url.
var updatehistory = function() {
// Don't call window.history if not supported.
if (!window.history || !window.history.replaceState) return;
// Don't update window url when it doesn't need to be updated.
if (new RegExp('#' + closer[0].id + '$').test(window.location.href.toString())) return;
// Don't update window url when the window is over the first title in the page.
if (pageoffset < first[1]) return;
// Don't update window url when page is not loaded, or user just clicked a url.
if (!toc.hasAttribute('data-timestamp') || toc.getAttribute('data-timestamp') > new Date().getTime() - 1000) return;
window.history.replaceState(null, null, '#' + closer[0].id);
}
// Update the toc when the page stops scrolling.
var evtimeout = function() {
toc = document.getElementById('toc');
clearTimeout(toc.getAttribute('data-timeout'));
toc.setAttribute('data-timeout', setTimeout(init, 1));
}
// Reset timestamp on page load and each time the user clicks a url.
var evtimestamp = function() {
toc = document.getElementById('toc');
document.getElementById('toc').setAttribute('data-timestamp', new Date().getTime());
}
addEvent(window, 'scroll', evtimeout);
addEvent(window, 'popstate', evtimestamp);
addEvent(window, 'load', evtimestamp);
init();
// Update table of content active entry and browser url on scroll.
var pageoffset;
var windowy;
var toc;
var fallback;
var first;
var last;
var closer;
var init = function() {
setenv();
updatehistory();
updatetoc();
}
// Set variables.
var setenv = function() {
pageoffset = getPageYOffset();
windowy = getWindowY();
toc = document.getElementById('toc');
fallback = document.getElementsByTagName('H2')[0];
first = [fallback, getTop(fallback)];
last = [fallback, getTop(fallback)];
closer = [fallback, getTop(fallback)];
// Find all titles in toc.
var nodes = [];
var tags = ['H2', 'H3', 'H4', 'H5', 'H6'];
for (var i = 0, n = tags.length; i < n; i++) {
for (var ii = 0, t = document.getElementsByTagName(tags[i]), nn = t.length; ii < nn; ii++) {
if (t[ii].className.indexOf('no_toc') !== -1) continue;
nodes.push(t[ii]);
}
}
// Find first title, last title and closer title.
for (var i = 0, n = nodes.length; i < n; i++) {
if (!nodes[i].id) continue;
var top = getTop(nodes[i]);
if (top < first[1]) first = [nodes[i], top];
if (top > last[1]) last = [nodes[i], top];
if (top < pageoffset + 10 && top > closer[1]) closer = [nodes[i], top];
}
// Set closer title to first or last title if at the top or bottom of the page.
if (pageoffset < first[1]) closer = [first[0], first[1]];
if (windowy + pageoffset >= getHeight(document.body)) closer = [last[0], last[1]];
}
// Update toc position and set active toc entry.
var updatetoc = function() {
// Set bottom and top to fit within window and not overflow its parent node.
var div = toc.getElementsByTagName('DIV')[0];
if (pageoffset > getTop(toc)) {
addClass(div, 'scroll');
div.style.top = '20px';
div.style.bottom = Math.max((pageoffset + windowy) - (getHeight(toc.parentNode) + getTop(toc.parentNode)), 20) + 'px';
} else removeClass(div, 'scroll');
// Remove .active class from toc and find new active toc entry.
var a = false;
for (var i = 0, t = toc.getElementsByTagName('*'), n = t.length; i < n; i++) {
removeClass(t[i], 'active');
if (t[i].nodeName == 'A' && t[i].getAttribute('href') == '#' + closer[0].id) a = t[i];
}
if (a === false) return;
// Set .active class on new active toc entry.
var nd = a;
while (nd.parentNode.nodeName == 'LI' || nd.parentNode.nodeName == 'UL') {
addClass(nd, 'active');
nd = nd.parentNode;
}
// Auto-scroll in toc to keep active toc entry visible.
var nd = a;
var otop = nd.offsetTop;
while (nd.offsetParent != div && nd.offsetParent) {
nd = nd.offsetParent;
otop += nd.offsetTop;
}
var bdiff = getHeight(a) + otop - div.scrollTop - getHeight(div);
var tdiff = getHeight(a) - otop + div.scrollTop;
if (tdiff > 0 || bdiff > 0) div.scrollTop -= tdiff;
}
// Update browser url.
var updatehistory = function() {
// Don't call window.history if not supported.
if (!window.history || !window.history.replaceState) return;
// Don't update window url when it doesn't need to be updated.
if (new RegExp('#' + closer[0].id + '$').test(window.location.href.toString())) return;
// Don't update window url when the window is over the first title in the page.
if (pageoffset < first[1]) return;
// Don't update window url when page is not loaded, or user just clicked a url.
if (!toc.hasAttribute('data-timestamp') || toc.getAttribute('data-timestamp') > new Date().getTime() - 1000) return;
window.history.replaceState(null, null, '#' + closer[0].id);
}
// Update the toc when the page stops scrolling.
var evtimeout = function() {
toc = document.getElementById('toc');
clearTimeout(toc.getAttribute('data-timeout'));
toc.setAttribute('data-timeout', setTimeout(init, 1));
}
// Reset timestamp on page load and each time the user clicks a url.
var evtimestamp = function() {
toc = document.getElementById('toc');
document.getElementById('toc').setAttribute('data-timestamp', new Date().getTime());
}
addEvent(window, 'scroll', evtimeout);
addEvent(window, 'popstate', evtimestamp);
addEvent(window, 'load', evtimestamp);
init();
}
function updateIssue(e) {
// Update GitHub issue link pre-filled with current page location.
var t = getEventTarget(e);
t.href = 'https://github.com/bitcoin-dot-org/bitcoin.org/issues/new?body=' + encodeURIComponent('Location: ' + window.location.href.toString() + "\n\n");
// Update GitHub issue link pre-filled with current page location.
var t = getEvent(e, 'target');
t.href = 'https://github.com/bitcoin-dot-org/bitcoin.org/issues/new?body=' + encodeURIComponent('Location: ' + window.location.href.toString() + "\n\n");
}
function updateSource(e){
// Update GitHub source file link pre-filled with current page location.
if (!document.getElementsByClassName) return;
var t = getEventTarget(e),
function updateSource(e) {
// Update GitHub source file link pre-filled with current page location.
if (!document.getElementsByClassName) return;
var t = getEvent(e, 'target'),
nodes = document.getElementsByClassName('sourcefile'),
pageoffset = Math.max(0, getPageYOffset() + 100),
windowy = getWindowY(),
@ -309,212 +324,230 @@ var t = getEventTarget(e),
first = [fallback, getTop(fallback)],
last = [fallback, getTop(fallback)],
closer = [fallback, getTop(fallback)];
// Find first, last and closer node.
for (var i = 0, n = nodes.length; i < n; i++) {
var top = getTop(nodes[i]);
if (top < first[1]) first = [nodes[i], top];
if (top > last[1]) last = [nodes[i], top];
if (top < pageoffset + 10 && top > closer[1]) closer = [nodes[i], top];
}
// Set closer title to first or last title if at the top or bottom of the page.
if (pageoffset < first[1]) closer = [first[0], first[1]];
if (windowy + pageoffset >= getHeight(document.body)) closer = [last[0], last[1]];
// Set updated url to source file.
t.href = 'https://github.com/bitcoin-dot-org/bitcoin.org/edit/master/' + closer[0].getAttribute('data-sourcefile');
// Find first, last and closer node.
for (var i = 0, n = nodes.length; i < n; i++) {
var top = getTop(nodes[i]);
if (top < first[1]) first = [nodes[i], top];
if (top > last[1]) last = [nodes[i], top];
if (top < pageoffset + 10 && top > closer[1]) closer = [nodes[i], top];
}
// Set closer title to first or last title if at the top or bottom of the page.
if (pageoffset < first[1]) closer = [first[0], first[1]];
if (windowy + pageoffset >= getHeight(document.body)) closer = [last[0], last[1]];
// Set updated url to source file.
t.href = 'https://github.com/bitcoin-dot-org/bitcoin.org/edit/master/' + closer[0].getAttribute('data-sourcefile');
}
function disclaimerClose(e) {
// Auto close temporary disclaimer in devel-docs.
if (e) cancelEvent(e);
var t = document.getElementById('develdocdisclaimer')
t.parentNode.removeChild(t);
if (typeof(Storage) === 'undefined') return;
sessionStorage.setItem('develdocdisclaimerclose', '1');
// Auto close temporary disclaimer in devel-docs.
if (e) cancelEvent(e);
var t = document.getElementById('develdocdisclaimer')
t.parentNode.removeChild(t);
if (typeof(Storage) === 'undefined') return;
sessionStorage.setItem('develdocdisclaimerclose', '1');
}
function disclaimerAutoClose() {
// Auto close temporary disclaimer in devel-docs if session says so.
if (typeof(Storage) === 'undefined') return;
if (sessionStorage.getItem('develdocdisclaimerclose') === '1') disclaimerClose();
// Auto close temporary disclaimer in devel-docs if session says so.
if (typeof(Storage) === 'undefined') return;
if (sessionStorage.getItem('develdocdisclaimerclose') === '1') disclaimerClose();
}
function walletMenuListener(e) {
// Listen for events on the wallet menu.
var t = getEventTarget(e),
walletSelectPlatform = function() {
if (t.nodeName != 'A') return;
if (t.parentNode.className.indexOf('active') !== -1) walletShowPlatform(t.getAttribute('data-walletcompat'));
if (isMobile() && t.parentNode.getElementsByTagName('UL').length == 0) scrollToNode(document.getElementById('wallets'));
// Listen for events on the wallet menu.
var walletSelectPlatform = function(e) {
var t = getEvent(e, 'target'),
p = t;
if (t.nodeName != 'A') return;
while (p.parentNode.nodeName == 'UL' || p.parentNode.nodeName == 'LI') p = p.parentNode;
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.
onTouchClick(e, walletSelectPlatform);
// Pre-process events and call appropriate function.
onTouchClick(e, walletSelectPlatform);
}
function walletListener(e) {
// Listen for events on wallets.
var t = getEventTarget(e),
// Listen for events on wallets.
var t = getEvent(e, 'target'),
walletShow = function() {
// Show wallet on click on mobile or desktop.
if (t.id == 'wallets') return;
while (t.parentNode && t.parentNode.id != 'wallets') t = t.parentNode;
if (!t.parentNode) return;
if (isMobile()) {
var p = document.getElementById('walletsmobile');
t = t.cloneNode(true);
p.innerHTML = '';
p.appendChild(t);
scrollToNode(p);
} else {
addClass(t, 'active');
addEvent(document.body, 'click', walletListener);
}
// Show wallet on click on mobile or desktop.
if (t.id == 'wallets') return;
while (t.parentNode && t.parentNode.id != 'wallets') t = t.parentNode;
if (!t.parentNode) return;
if (isMobile()) {
var p = document.getElementById('walletsmobile');
t = t.cloneNode(true);
p.innerHTML = '';
p.appendChild(t);
scrollToNode(p);
} else {
addClass(t, 'active');
addEvent(document.body, 'click', walletListener);
}
},
walletHide = function() {
// Disable wallet when the mouse clicks elsewhere.
for (var i = 0, wallets = document.getElementById('wallets').childNodes, n = wallets.length; i < n; i++) {
if (wallets[i].nodeType != 1) continue;
removeClass(wallets[i], 'active');
}
removeEvent(document.body, 'click', walletListener);
// Disable wallet when the mouse clicks elsewhere.
for (var i = 0, wallets = document.getElementById('wallets').childNodes, n = wallets.length; i < n; i++) {
if (wallets[i].nodeType != 1) continue;
removeClass(wallets[i], 'active');
}
removeEvent(document.body, 'click', walletListener);
};
// Call appropriate function on click.
onTouchClick(e, function() {
walletHide();
walletShow();
});
// Call appropriate function on click.
onTouchClick(e, function() {
walletHide();
walletShow();
});
}
function walletScoreListener(e) {
// Listen for events on wallet scores and display them on tap.
var init = function(e) {
var t = getEvent(e, 'target');
while (!t.parentNode.parentNode.parentNode.id) t = t.parentNode;
(t.className.indexOf('hover') === -1) ? addClass(t, 'hover'): removeClass(t, 'hover');
};
onTouchClick(e, init);
}
function walletShowPlatform(platform) {
// Show wallets for given platform in the menu.
var t = null,
// Show wallets for given platform in the menu.
var t = null,
fallback = '',
walletMenu = document.getElementById('walletmenu'),
getMenuState = function() {
// Find active node in the menu for given platform and fallback category if in a submenu.
for (var i = 0, nds = walletMenu.getElementsByTagName('A'), n = nds.length; i < n; i++) {
if (nds[i].getAttribute('data-walletcompat') != platform) continue;
if (nds[i].getAttribute('data-active') == 1) return false;
t = nds[i];
var p = nds[i].parentNode.parentNode.parentNode;
if (p.nodeName == 'LI') fallback = p.getElementsByTagName('A')[0].getAttribute('data-walletcompat');
break;
}
return true;
// Find active node in the menu for given platform and fallback category if in a submenu.
for (var i = 0, nds = walletMenu.getElementsByTagName('A'), n = nds.length; i < n; i++) {
if (nds[i].getAttribute('data-walletcompat') != platform) continue;
if (nds[i].getAttribute('data-active') == 1) return false;
t = nds[i];
var p = nds[i].parentNode.parentNode.parentNode;
if (p.nodeName == 'LI') fallback = p.getElementsByTagName('A')[0].getAttribute('data-walletcompat');
break;
}
return true;
},
updateMenu = function() {
// Set active nodes in the menu for the new platform.
addClass(walletMenu.getElementsByTagName('UL')[0], 'menutap');
for (var i = 0, nds = walletMenu.getElementsByTagName('A'), n = nds.length; i < n; i++) {
nds[i].removeAttribute('data-active');
removeClass(nds[i].parentNode, 'active');
}
if (platform != 'default') {
t.setAttribute('data-active', '1');
addClass(t.parentNode, 'active');
addClass(t.parentNode, 'hover');
var p = t.parentNode.parentNode.parentNode;
if (p.nodeName == 'LI') {
addClass(p, 'active');
addClass(p, 'hover');
}
}
// Set active nodes in the menu for the new platform.
addClass(walletMenu.getElementsByTagName('UL')[0], 'menutap');
for (var i = 0, nds = walletMenu.getElementsByTagName('A'), n = nds.length; i < n; i++) {
nds[i].removeAttribute('data-active');
removeClass(nds[i].parentNode, 'active');
}
if (platform != 'default') {
t.setAttribute('data-active', '1');
addClass(t.parentNode, 'active');
var p = t.parentNode.parentNode.parentNode;
if (p.nodeName == 'LI') addClass(p, 'active');
}
},
updateWallets = function() {
// Replace wallets by those for given platform and rotate them.
var p = document.getElementById('wallets');
var lasttimeout = p.getAttribute('data-timeout');
var timeout = (lasttimeout !== null && lasttimeout !== '' && supportCSS('transition')) ? 200 : 1;
addClass(p, 'disabled');
addClass(p, 'nohover');
clearTimeout(lasttimeout);
p.setAttribute('data-timeout', setTimeout(function() {
p.innerHTML = '';
var platforms = (platform == 'default') ? ['desktop', 'mobile'] : [platform];
for (var i = 0, nds = document.getElementById('walletsswitch').childNodes, n = nds.length; i < n; i++) {
if (nds[i].nodeType != 1) continue;
var id = nds[i].id.split('-')[1];
if (document.getElementById('wallet-' + id)) continue;
var nd = null;
for (var ii = 0, nn = platforms.length; ii < nn; ii++) {
var wp = document.getElementById('wallet-' + id + '-' + platforms[ii]);
if (wp) var nd = wp;
}
if (nd === null) {
var wf = document.getElementById('wallet-' + id + '-' + fallback);
if (wf && wf.getAttribute('data-walletcompat').indexOf(platform) !== -1) var nd = wf;
}
if (nd === null) continue;
nd = nd.cloneNode(true);
nd.id = 'wallet-' + id;
p.appendChild(nd);
}
walletRotate();
removeClass(p, 'disabled');
document.getElementById('walletsmobile').innerHTML = '';
}, timeout));
// Replace wallets by those for given platform and rotate them.
var p = document.getElementById('wallets');
var lasttimeout = p.getAttribute('data-timeout');
var timeout = (lasttimeout !== null && lasttimeout !== '' && supportCSS('transition')) ? 200 : 1;
addClass(p, 'disabled');
addClass(p, 'nohover');
clearTimeout(lasttimeout);
p.setAttribute('data-timeout', setTimeout(function() {
p.innerHTML = '';
var platforms = (platform == 'default') ? ['desktop', 'mobile'] : [platform];
for (var i = 0, nds = document.getElementById('walletsswitch').childNodes, n = nds.length; i < n; i++) {
if (nds[i].nodeType != 1) continue;
var id = nds[i].id.split('-')[1];
if (document.getElementById('wallet-' + id)) continue;
var nd = null;
for (var ii = 0, nn = platforms.length; ii < nn; ii++) {
var wp = document.getElementById('wallet-' + id + '-' + platforms[ii]);
if (wp) var nd = wp;
}
if (nd === null) {
var wf = document.getElementById('wallet-' + id + '-' + fallback);
if (wf && wf.getAttribute('data-walletcompat').indexOf(platform) !== -1) var nd = wf;
}
if (nd === null) continue;
nd = nd.cloneNode(true);
nd.id = 'wallet-' + id;
p.appendChild(nd);
}
walletRotate();
removeClass(p, 'disabled');
document.getElementById('walletsmobile').innerHTML = '';
}, timeout));
};
if(!getMenuState()) return;
updateMenu();
updateWallets();
if (!getMenuState()) return;
updateMenu();
updateWallets();
}
function walletRotate() {
// Rotate wallets once a day.
var ar = {
1: [],
2: [],
3: [],
4: []
}
for (var i = 0, nds = document.getElementById('wallets').childNodes, n = nds.length; i < n; i++) {
if (nds[i].nodeType != 1) continue;
ar[parseInt(nds[i].getAttribute('data-walletlevel'))].push(nds[i]);
}
var sum = Math.floor(new Date() / 86400000);
for (var k in ar) {
if (ar[k].length == 0) continue;
var pre = ar[k][ar[k].length - 1].nextSibling;
for (i = 0, n = sum % ar[k].length; i < n; i++) ar[k][i].parentNode.insertBefore(ar[k][i], pre);
}
// Rotate wallets once a day.
var ar = {
1: [],
2: [],
3: [],
4: []
}
for (var i = 0, nds = document.getElementById('wallets').childNodes, n = nds.length; i < n; i++) {
if (nds[i].nodeType != 1) continue;
ar[parseInt(nds[i].getAttribute('data-walletlevel'))].push(nds[i]);
}
var sum = Math.floor(new Date() / 86400000);
for (var k in ar) {
if (ar[k].length == 0) continue;
var pre = ar[k][ar[k].length - 1].nextSibling;
for (i = 0, n = sum % ar[k].length; i < n; i++) ar[k][i].parentNode.insertBefore(ar[k][i], pre);
}
}
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.
if (!e) var e = window.event;
switch (e.type) {
case 'mousedown':
if ((e.which && e.which == 3) || (e.button && e.button == 2)) return;
var t = getEventTarget(e);
while (t.parentNode) {
if (getStyle(t, 'overflow') == 'auto' || getStyle(t, 'overflow-y') == 'auto' || getStyle(t, 'overflow-x') == 'auto') return;
t = t.parentNode;
}
addEvent(document.body, 'mouseup', makeEditable);
addEvent(document.body, 'mousemove', makeEditable);
document.body.setAttribute('timeoutEdit', setTimeout(function() {
removeEvent(document.body, 'mouseup', makeEditable);
removeEvent(document.body, 'mousemove', makeEditable);
var c = document.getElementById('content');
c.contentEditable = true;
c.style.borderColor = '#bfbfbf';
setTimeout(function() {
c.style.borderColor = '';
}, 200);
}, 1000));
break;
case 'mouseup':
case 'mousemove':
removeEvent(document.body, 'mouseup', makeEditable);
removeEvent(document.body, 'mousemove', makeEditable);
clearTimeout(document.body.getAttribute('timeoutEdit'));
break;
}
// 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.
if (!e) var e = window.event;
switch (getEvent(e, 'type')) {
case 'mousedown':
if ((e.which && e.which == 3) || (e.button && e.button == 2)) return;
var t = getEvent(e, 'target');
while (t.parentNode) {
if (getStyle(t, 'overflow') == 'auto' || getStyle(t, 'overflow-y') == 'auto' || getStyle(t, 'overflow-x') == 'auto') return;
t = t.parentNode;
}
addEvent(document.body, 'mouseup', makeEditable);
addEvent(document.body, 'mousemove', makeEditable);
document.body.setAttribute('timeoutEdit', setTimeout(function() {
removeEvent(document.body, 'mouseup', makeEditable);
removeEvent(document.body, 'mousemove', makeEditable);
var c = document.getElementById('content');
c.contentEditable = true;
c.style.borderColor = '#bfbfbf';
setTimeout(function() {
c.style.borderColor = '';
}, 200);
}, 1000));
break;
case 'mouseup':
case 'mousemove':
removeEvent(document.body, 'mouseup', makeEditable);
removeEvent(document.body, 'mousemove', makeEditable);
clearTimeout(document.body.getAttribute('timeoutEdit'));
break;
}
}
// Add makeEditable event listener
var xint = setInterval(function() {
if (!document.body) return;
addEvent(document.body, 'mousedown', makeEditable);
clearInterval(xint);
if (!document.body) return;
addEvent(document.body, 'mousedown', makeEditable);
clearInterval(xint);
}, 200);