diff --git a/website/source/assets/javascripts/consul-connect/carousel.js b/website/source/assets/javascripts/consul-connect/carousel.js new file mode 100644 index 000000000..6a4a32387 --- /dev/null +++ b/website/source/assets/javascripts/consul-connect/carousel.js @@ -0,0 +1,41 @@ +// siema carousels +var dots = qsa('.g-carousel .pagination li') +var carousel = new Siema({ + selector: '.siema', + duration: 200, + easing: 'ease-out', + perPage: 1, + startIndex: 0, + draggable: true, + multipleDrag: true, + threshold: 20, + loop: true, + rtl: false, + onChange: () => { + for (var i = 0; i < dots.length; i++) { + dots[i].classList.remove('active') + } + dots[carousel.currentSlide].classList.add('active') + } +}) + +// on previous button click +document + .querySelector('.g-carousel .prev') + .addEventListener('click', function() { + carousel.prev() + }) + +// on next button click +document + .querySelector('.g-carousel .next') + .addEventListener('click', function() { + carousel.next() + }) + +// on dot click +for (let i = 0; i < dots.length; i++) { + dots[i].addEventListener('click', function() { + carousel.goTo(i) + }) +} \ No newline at end of file diff --git a/website/source/assets/javascripts/consul-connect/application.js b/website/source/assets/javascripts/consul-connect/home-hero.js similarity index 74% rename from website/source/assets/javascripts/consul-connect/application.js rename to website/source/assets/javascripts/consul-connect/home-hero.js index 04a255bd3..92ead8aac 100644 --- a/website/source/assets/javascripts/consul-connect/application.js +++ b/website/source/assets/javascripts/consul-connect/home-hero.js @@ -1,6 +1,3 @@ -// -// -// home video carousel var qs = document.querySelector.bind(document) var qsa = document.querySelectorAll.bind(document) @@ -30,10 +27,11 @@ function initialiateVideoChange(index) { ) loadingBar.style.transitionDuration = '0s' - // reset the current video and stop deactivation + // reset the current video $$videos[currentIndex].currentTime = 0 $$videoControls[currentIndex].classList.remove('playing') + // stop deactivation wrapper.classList.remove('deactivate') // check if the video is loaded @@ -90,48 +88,4 @@ for (var i = 0; i < $$videoControls.length; i++) { // go to first video to start this thing if ($$videos.length > 0) { initialiateVideoChange(0) -} - -// -// -// siema carousels -var dots = qsa('.g-carousel .pagination li') -var carousel = new Siema({ - selector: '.siema', - duration: 200, - easing: 'ease-out', - perPage: 1, - startIndex: 0, - draggable: true, - multipleDrag: true, - threshold: 20, - loop: true, - rtl: false, - onChange: () => { - for (var i = 0; i < dots.length; i++) { - dots[i].classList.remove('active') - } - dots[carousel.currentSlide].classList.add('active') - } -}) - -// on previous button click -document - .querySelector('.g-carousel .prev') - .addEventListener('click', function() { - carousel.prev() - }) - -// on next button click -document - .querySelector('.g-carousel .next') - .addEventListener('click', function() { - carousel.next() - }) - -// on dot click -for (let i = 0; i < dots.length; i++) { - dots[i].addEventListener('click', function() { - carousel.goTo(i) - }) -} +} \ No newline at end of file diff --git a/website/source/configuration.html.erb b/website/source/configuration.html.erb index 1a1bf1b90..06298374c 100644 --- a/website/source/configuration.html.erb +++ b/website/source/configuration.html.erb @@ -250,3 +250,7 @@ description: |- + +<% content_for :scripts do %> + +<% end %> \ No newline at end of file diff --git a/website/source/discovery.html.erb b/website/source/discovery.html.erb index 0abd9a53b..ff259a525 100644 --- a/website/source/discovery.html.erb +++ b/website/source/discovery.html.erb @@ -250,3 +250,7 @@ description: |- + +<% content_for :scripts do %> + +<% end %> \ No newline at end of file diff --git a/website/source/index.html.erb b/website/source/index.html.erb index 87d3c63dc..adef8ca9b 100644 --- a/website/source/index.html.erb +++ b/website/source/index.html.erb @@ -267,3 +267,7 @@ description: |- + +<% content_for :scripts do %> + +<% end %> \ No newline at end of file diff --git a/website/source/layouts/layout.erb b/website/source/layouts/layout.erb index c56a007b5..7bde4b7d5 100644 --- a/website/source/layouts/layout.erb +++ b/website/source/layouts/layout.erb @@ -34,7 +34,6 @@ <%= javascript_include_tag "consul-connect/vendor/intersection-observer-polyfill", defer: true %> <%= javascript_include_tag "consul-connect/vendor/siema.min", defer: true %> - <%= javascript_include_tag "consul-connect/application", defer: true %> <%= javascript_include_tag "application", defer: true %> @@ -120,6 +119,8 @@ + <%= yield_content :scripts %> +