Skip to content

Commit

Permalink
Remove Slider
Browse files Browse the repository at this point in the history
  • Loading branch information
reckel-jm committed Aug 24, 2023
1 parent 4576a46 commit f8a02ba
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 5 deletions.
14 changes: 10 additions & 4 deletions content/_index.en.md
Expand Up @@ -9,9 +9,7 @@ chapter: true

Welcome to this webpage!

Cantara Song is a song presentation software which can be used for presenting songs in churches, small groups or karaoke parties. It supports various input formats and can create beautiful presentation slides or export the presentation to various output formats so that they can be used for various purposes.

{{< carousel items="1" height="500" unit="px" duration="7000" >}}
Cantara Song is a song presentation software which can be used for presenting songs in churches, small groups or karaoke parties. It supports various input formats and can create beautiful presentation slides or export the presentation to various output formats (pictures, pptx, WhatsApp message and a lot more) so that they can be used for a variety of purposes.

Cantara has the following advantages:

Expand All @@ -24,4 +22,12 @@ Cantara has the following advantages:
* **Free and Open Source**: No license fees, no dependence on certain companies–Cantara is licensed under the [GPL3](https://www.gnu.org/licenses/gpl-3.0.html) and can be used everywhere and as you want.
* **Used all over the world and continuously developed**: Although Cantara is still a quite young project, people from many countries are using it. It has been translated to several langauges. In the future, more functions are going to be implemented.

The current version is 2.5.0. [You can easily download and install it for Linux, Windows and Mac OS](tutorial/install-cantara). Cantara is written with the programming language Pascal/Lazarus, therefore it is platform-independent and can be compiled to almost every device. You can also compile Cantara by yourself. [Find more information here](tutorial/install-cantara/#generic-compilation).
The current version is 2.5.0. [You can easily download and install it for Linux, Windows and Mac OS](tutorial/install-cantara). Cantara is written with the programming language Pascal/Lazarus, therefore it is platform-independent and can be compiled to almost every device. You can also compile Cantara by yourself. [Find more information here](tutorial/install-cantara/#generic-compilation).

![Cantara Running Presentation with Background](/images/cantara1.png?width=900)
![Cantara Full Screen](/images/cantara2.png?width=900)
![Cantara Other Layout](/images/cantara3.png?width=900)
![Cantara Other Layout Full Screen](/images/cantara4.png?width=900)
![Cantara Overview](/images/cantara-overview.jpg?width=900)
![Cantara Multiscreen](/images/cantara-multiscreen.jpg?width=900)
![Cantara Song](/images/cantara-song.jpg?width=900)
15 changes: 15 additions & 0 deletions content/releasenotes/_index.en.md
Expand Up @@ -12,6 +12,21 @@ This page contains information about the changes in different versions (releases

## Releases

### Version 2.5.0 (2023-08-21)

- Complete rewriting of large parts of the source code including the internal structures for generating and painting presentation slides
- Improvement of the presentation layout
- Improvement of the song editor
- Implementation of a preview of the presentation in the settings menu
- Implementation of slide export to pptx (using PptxgenJs)
- Implementation of slide export to pictures
- Implementation of song lyrics export to markup text files
- Implementation of a full text search for browsing song lyrics
- Implementation of a two language song presentation
- Improvements of the presentation window and control (more keys and remote controls are supported)
- Fix [issue #17](https://github.com/reckel-jm/cantara/issues/17)
- Cantara can now be directly opened with a ```.songtex```-file.

### Version 2.4.1 (2023-01-30) Italian and Spanish translation

The version 2.4.1. adds Italian and Spanish translation to Cantara. Despite that, there is no additional functionality compared to Version 2.4.0 which means that if you are not using one of the languages, you don't necessarily need to update to this version.
Expand Down
17 changes: 17 additions & 0 deletions content/tutorial/How to use it.en.md
Expand Up @@ -42,6 +42,23 @@ During the presentation mode, you can control the presentation slides via severa
If you are running other programs like Libreoffice Impress or MS PowerPoint in presentation mode at the same time, you can easily switch between the presenters with Alt+Tab. When the presentation mode in Cantara gets started, it will cover the second screen and be in foreground. To move Cantara to the background, press Alt+Tab to navigate to the program you want to show up.
{{% /notice %}}

## Adjust the Presentation

After you have seen the default presentation style, you might want to adjust it according to your wishes and needs. For this, you can open the settings dialog (Edit -> Settings). There you can set up the following:

![](/images/cantara-settings-en.png)

- **Song Repo Path**: The path of the song repository. Use the button with the three points (..) in order to select a file chooser dialog.
- **Empty Slides between songs**: This creates an additional empty slide in the presentation *between* two different songs.
- **Spoil next slides**: Displays the content or parts of of the next slide below the text if the song has an additional slide and the space of the slide is sufficient.
- **Alignment**: Adjust the horizontal and vertical alignment of the text in the presentation slides. Press **Details** to set up the border size.
- **Automatic word wrap**: Brakes the slides into if one stanza (song part) has reached the specified limit of lines (recommended especially if you have songs with long stanzas).
- **Change Font Settings.../Background Color.../Text Color...**: Opens dialogs for specifing the design of the presentation.
- **Background Image**: Opens a file chooser dialog where you can select a background image for your presentations. If available, the folder with some default background pictures will be opened at first.
- **Change Image Transparancy**: Adjusts the image transparency **towards** the background color. That means if the background color is (for example) set to black, a higher value will make the picture *darker*. If the background would be white, a higher value will make the picture *brighter*.
- **Show Meta Data**: Certain Meta data can be shown at a special title slide (if choosen), at the first slide or at the last slide. Enter the syntax in the big edit field at the bottom and see [Meta Data](/tutorial/meta-data) for detalis.
- **Preview image**: Click at the preview to go one slide forward. If the presentation has reached its end, it will go back to the beginning.

## Export Presentation

Cantara offers several ways for exporting presentations so that they can be reused in an other program or for an other purpose. All the export options are available in the *export menu* of the main window. Generally, there are two types of exports:
Expand Down
9 changes: 9 additions & 0 deletions data/carousel.yaml
@@ -0,0 +1,9 @@
images:
- image: /images/cantara1.png
content_html: ""
- image: /images/cantara2.png
content_html: ""
- image: /images/cantara3.png
content_html: ""
- image: /images/cantara4.png
content_html: ""
17 changes: 17 additions & 0 deletions layouts/partials/carousel.html
@@ -0,0 +1,17 @@
{{ .context.Scratch.Set "height" .height }}
{{ .context.Scratch.Set "unit" .unit }}
{{ .context.Scratch.Set "items" .items }}
<div id="carousel10" class="carousel" duration="{{ .duration }}" items="{{ .items }}">
<ul>
{{ range $index, $slide := .context.Site.Data.carousel.images }}
<li id="c10_slide{{ add $index 1}}" style="min-width: calc(100%/{{ $.context.Scratch.Get "items" }}); padding-bottom: {{ $.context.Scratch.Get "height" }}{{ $.context.Scratch.Get "unit" }};"><img src="{{ $slide.image }}" alt="" /><div><div>{{ $slide.content_html }}</div></div></li>
{{ end }}
</ul>
<ol>
{{ range $index, $page := .context.Site.Data.carousel.images }}
<li><a href="#c10_slide{{ add $index 1 }}"></a></li>
{{ end }}
</ol>
<div class="prev">&lsaquo;</div>
<div class="next">&rsaquo;</div>
</div>
2 changes: 2 additions & 0 deletions layouts/partials/custom-footer.html
@@ -0,0 +1,2 @@
<script type="text/javascript" src="/js/carousel.js"></script>
<link rel="stylesheet" href="/css/carousel.css">
2 changes: 1 addition & 1 deletion layouts/partials/menu-footer.html
@@ -1,5 +1,5 @@
<p>This Webpage has been created with <a href="https://gohugo.io/">Hugo</a>, <a href="https://github.com/matcornic/hugo-theme-learn">hugo-theme-learn</a>, <a href="https://neovim.io/">neovim (the best editor in the world)</a> and <a href="https://pages.github.com">GitHub Pages</a>. <a href="https://www.github.com/reckel-jm/cantara-webpage">See the webpage repository</a> to learn how to make changes.</p>
<hr/>
<p>John 3:16: <br/>
For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.
For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life. <br/> <br/>
</p>
18 changes: 18 additions & 0 deletions layouts/shortcodes/carousel.html
@@ -0,0 +1,18 @@
{{ .Scratch.Set "height" (.Get "height") }}
{{ .Scratch.Set "unit" (.Get "unit") }}
{{ .Scratch.Set "ordinal" .Ordinal }}
{{ .Scratch.Set "items" (.Get "items") }}
<div id="carousel{{ .Ordinal }}" class="carousel" duration="{{ .Get `duration` }}">
<ul>
{{ range $index, $slide := .Site.Data.carousel.images }}
<li id="c{{ $.Scratch.Get "ordinal" }}_slide{{ add $index 1}}" style="min-width: calc(100%/{{ $.Scratch.Get "items" }}); padding-bottom: {{ $.Scratch.Get "height" }}{{ $.Scratch.Get "unit" }};"><img src="{{ $slide.image }}" alt="" /><div><div>{{ $slide.content_html }}</div></div></li>
{{ end }}
</ul>
<ol>
{{ range $index, $page := .Site.Data.carousel.images }}
<li><a href="#c{{ $.Scratch.Get "ordinal" }}_slide{{ add $index 1 }}"></a></li>
{{ end }}
</ol>
<div class="prev">&lsaquo;</div>
<div class="next">&rsaquo;</div>
</div>
13 changes: 13 additions & 0 deletions static/css/carousel.css
@@ -0,0 +1,13 @@
.carousel {position: relative;}
.carousel ul {overflow: auto; display: flex; flex-wrap: nowrap; scroll-snap-type: x mandatory; scroll-snap-points-y: repeat(100%); scroll-behavior: smooth; background: transparent; -ms-overflow-style: none; scrollbar-width: none; margin: 0; padding: 0;}
.carousel ul::-webkit-scrollbar {display: none; /* Hide scrollbar for Chrome, Safari and Opera */}
.carousel ul li {position: relative; min-width: 100%; list-style: none; background: url() center center / cover no-repeat; scroll-snap-align: start;}
.carousel ul li > * {position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.carousel ul li > img {object-fit: cover;}
.carousel ul li > div {display: flex; justify-content: center; align-items: center; color: white; font-weight: bold; font-size: 20px;}
.carousel ol {position: absolute; bottom: 15px; display: flex; justify-content: center; left: 50%; transform: translateX(-50%); z-index: 9;}
.carousel ol li {list-style: none; padding: 0 5px;}
.carousel ol li a {display: block; height: 10px; width: 10px; border: 2px solid white; background: transparent; border-radius: 100%;}
.carousel ol li.selected a {background: white;}
.carousel .prev, .carousel .next {display: none; user-select:none; cursor: pointer; font-size: 50px; color: white; position: absolute; left: 0; padding: 15px 15px 30px; top: 50%; transform: translateY(-50%); z-index: 9; line-height: 0;}
.carousel .next {left: auto; right: 0;}
Binary file added static/images/cantara-markup-export.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/cantara-settings-en.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions static/js/carousel.js
@@ -0,0 +1,127 @@
document.addEventListener('DOMContentLoaded', function() {

const carousels = document.querySelectorAll('.carousel');
carousels.forEach(function( carousel ) {

const ele = carousel.querySelector('ul');
const amountvisible = Math.round(ele.offsetWidth/ele.querySelector('li:nth-child(1)').offsetWidth);
const bullets = carousel.querySelectorAll('ol li');
const slides = carousel.querySelectorAll('ul li');
const nextarrow = carousel.querySelector('.next');
const prevarrow = carousel.querySelector('.prev');

// Initialize the carousel
nextarrow.style.display = 'block';
prevarrow.style.display = 'block';
ele.scrollLeft = 0;
bullets[0].classList.add('selected');
slides[0].classList.add('selected');
if(amountvisible>1) {
var removeels = carousel.querySelectorAll('ol li:nth-last-child(-n + '+(amountvisible-1)+')');
removeels.forEach(function(removeel) {
removeel.remove();
});
}

const setSelected = function() {
bullets.forEach(function(bullet) {
bullet.classList.remove('selected');
});
slides.forEach(function(slide) {
slide.classList.remove('selected');
});
const scrolllength = carousel.querySelector('ul li:nth-child(2)').offsetLeft - carousel.querySelector('ul li:nth-child(1)').offsetLeft;
const nthchild = (Math.round((ele.scrollLeft/scrolllength)+1));
carousel.querySelector('ol li:nth-child('+nthchild+')').classList.add('selected');
carousel.querySelector('ul li:nth-child('+nthchild+')').classList.add('selected');
if(carousel.parentElement.parentElement.querySelector('.dynamictitle')) {
const title = carousel.querySelector('ul li:nth-child('+nthchild+') img').getAttribute('title');
if(title) carousel.parentElement.parentElement.querySelector('.dynamictitle').innerHTML = title;
}
}

const scrollTo = function(event) {
event.preventDefault();
ele.scrollLeft = ele.querySelector(this.getAttribute('href')).offsetLeft;
}

const nextSlide = function() {
if(!carousel.querySelector('ol li:last-child').classList.contains('selected')) {
carousel.querySelector('ol li.selected').nextElementSibling.querySelector('a').click();
} else {
carousel.querySelector('ol li:first-child a').click();
}
}

const prevSlide = function() {
if(!carousel.querySelector('ol li:first-child').classList.contains('selected')) {
carousel.querySelector('ol li.selected').previousElementSibling.querySelector('a').click();
} else {
carousel.querySelector('ol li:last-child a').click();
}
}

const setInteracted = function() {
ele.classList.add('interacted');
}

// Attach the handlers
ele.addEventListener("scroll", debounce(setSelected));
ele.addEventListener("touchstart", setInteracted);
ele.addEventListener('keydown', function (e){
if(e.key == 'ArrowLeft') ele.classList.add('interacted');
if(e.key == 'ArrowRight') ele.classList.add('interacted');
});

nextarrow.addEventListener("click", nextSlide);
nextarrow.addEventListener("mousedown", setInteracted);
nextarrow.addEventListener("touchstart", setInteracted);

prevarrow.addEventListener("click", prevSlide);
prevarrow.addEventListener("mousedown", setInteracted);
prevarrow.addEventListener("touchstart", setInteracted);

bullets.forEach(function(bullet) {
bullet.querySelector('a').addEventListener('click', scrollTo);
bullet.addEventListener("mousedown", setInteracted);
bullet.addEventListener("touchstart", setInteracted);
});

//setInterval for autoplay
if(carousel.getAttribute('duration')) {
setInterval(function(){
if (ele != document.querySelector(".carousel:hover ul") && ele.classList.contains('interacted')==false) {
nextarrow.click();
}
}, carousel.getAttribute('duration'));
}


}); //end foreach

}); //end onload


/**
* Debounce functions for better performance
* (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com
* @param {Function} fn The function to debounce
*/
function debounce (fn) {
// Setup a timer
let timeout;
// Return a function to run debounced
return function () {
// Setup the arguments
let context = this;
let args = arguments;
// If there's a timer, cancel it
if (timeout) {
window.cancelAnimationFrame(timeout);
}
// Setup the new requestAnimationFrame()
timeout = window.requestAnimationFrame(function () {
fn.apply(context, args);
});
};
}

0 comments on commit f8a02ba

Please sign in to comment.