mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Avoid duplicate code and non-reusable functions with hardcoded variables
This commit is contained in:
parent
17886b6564
commit
3d9c178df3
3 changed files with 15 additions and 28 deletions
|
@ -5,21 +5,8 @@
|
||||||
layout: base
|
layout: base
|
||||||
id: index
|
id: index
|
||||||
---
|
---
|
||||||
<script>
|
|
||||||
function loadMainVideo() {
|
|
||||||
var p = document.getElementById('mainvideo'),
|
|
||||||
t = p.getElementsByTagName('DIV')[0],
|
|
||||||
nd = document.createElement('IFRAME');
|
|
||||||
nd.src = '//www.youtube.com/embed/Gc2en3nHxA4?rel=0&showinfo=0&wmode=opaque&autoplay=1{% if page.lang != 'en' %}&cc_load_policy=1&hl={{ page.lang }}&cc_lang_pref={{ page.lang }}{% endif %}';
|
|
||||||
nd.setAttribute('frameborder', 0);
|
|
||||||
nd.setAttribute('allowfullscreen', true);
|
|
||||||
t.innerHTML = '';
|
|
||||||
t.appendChild(nd);
|
|
||||||
p.onclick = '';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<p class="mainsummary">{% translate listintro %}</p>
|
<p class="mainsummary">{% translate listintro %}</p>
|
||||||
<div class="mainvideo" id="mainvideo" onclick="loadMainVideo();"><div>
|
<div class="mainvideo"><div onclick="loadYoutubeVideo(event);" data-youtubeurl="//www.youtube.com/embed/Gc2en3nHxA4?rel=0&showinfo=0&wmode=opaque&autoplay=1{% if page.lang != 'en' %}&cc_load_policy=1&hl={{ page.lang }}&cc_lang_pref={{ page.lang }}{% endif %}">
|
||||||
<img src="/img/video/video_wuc.jpg" alt="Youtube video">
|
<img src="/img/video/video_wuc.jpg" alt="Youtube video">
|
||||||
<div class="mainvideoicon"></div>
|
<div class="mainvideoicon"></div>
|
||||||
<div class="mainvideoiconhover"></div>
|
<div class="mainvideoiconhover"></div>
|
||||||
|
|
15
index.html
15
index.html
|
@ -7,21 +7,8 @@ lang: en
|
||||||
id: index
|
id: index
|
||||||
title: Bitcoin
|
title: Bitcoin
|
||||||
---
|
---
|
||||||
<script>
|
|
||||||
function loadMainVideo() {
|
|
||||||
var p = document.getElementById('mainvideo'),
|
|
||||||
t = p.getElementsByTagName('DIV')[0],
|
|
||||||
nd = document.createElement('IFRAME');
|
|
||||||
nd.src = '//www.youtube.com/embed/Gc2en3nHxA4?rel=0&showinfo=0&wmode=opaque&autoplay=1{% if page.lang != 'en' %}&cc_load_policy=1&hl={{ page.lang }}&cc_lang_pref={{ page.lang }}{% endif %}';
|
|
||||||
nd.setAttribute('frameborder', 0);
|
|
||||||
nd.setAttribute('allowfullscreen', true);
|
|
||||||
t.innerHTML = '';
|
|
||||||
t.appendChild(nd);
|
|
||||||
p.onclick = '';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<p class="mainsummary">{% translate listintro %}</p>
|
<p class="mainsummary">{% translate listintro %}</p>
|
||||||
<div class="mainvideo" id="mainvideo" onclick="loadMainVideo();"><div>
|
<div class="mainvideo"><div onclick="loadYoutubeVideo(event);" data-youtubeurl="//www.youtube.com/embed/Gc2en3nHxA4?rel=0&showinfo=0&wmode=opaque&autoplay=1{% if page.lang != 'en' %}&cc_load_policy=1&hl={{ page.lang }}&cc_lang_pref={{ page.lang }}{% endif %}">
|
||||||
<img src="/img/video/video_wuc.jpg" alt="Youtube video">
|
<img src="/img/video/video_wuc.jpg" alt="Youtube video">
|
||||||
<div class="mainvideoicon"></div>
|
<div class="mainvideoicon"></div>
|
||||||
<div class="mainvideoiconhover"></div>
|
<div class="mainvideoiconhover"></div>
|
||||||
|
|
13
js/main.js
13
js/main.js
|
@ -115,6 +115,19 @@ for (var i = 0, n = domPrefixes.length; i < n; i++) {
|
||||||
return false;
|
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 = '';
|
||||||
|
}
|
||||||
|
|
||||||
function boxShow(e) {
|
function boxShow(e) {
|
||||||
// Display the box content when the user click a box on the "Secure your wallet" page.
|
// Display the box content when the user click a box on the "Secure your wallet" page.
|
||||||
var p = t = getEventTarget(e);
|
var p = t = getEventTarget(e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue