minimal-music-project 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83c6d910205c9328757cf56b0c2e50df907fedcd650966b0b9898cbd3fb51aaa
4
- data.tar.gz: cc1222e1c478d9cb01840d7567b99b354251c5c29c7255446d8463c7293a602d
3
+ metadata.gz: edd9c6b971a10e388ca18b42699c6bc9a76948bc90d1a270478f8dbd86d659c2
4
+ data.tar.gz: '096ce7fdcfc914bced72f2c936cbd0a8babe65cc2ce141d9752f143aeb49418b'
5
5
  SHA512:
6
- metadata.gz: 3c2952ee9d4a34a6e3eabed59790d60a14937e5bbe8d95ca79a573fcd15aa70a84e9999eaa9ff499335fda3b418f8146f7bfb3f9f7ffb747e81761c255fba879
7
- data.tar.gz: 99af8f826d34e242fc443712a3396bb7b511c3c405072bba1c2731cf766ddb0a981b9bef7725bd527598a58ebda18439f4943edc2959bcf011f244e8c60ef3e7
6
+ metadata.gz: 4baaf80ffac9e6de479ec022ac1aee2774f6297df00907e44ef23503dc7c6345978cf3fca5e9d57546a5b8e9e0c261627312e6aba789f1a18a4a5ef837266779
7
+ data.tar.gz: 0f3beda45e38193f7d90266be68a1174c881eb28bf92535a43beb2d862318bba2a6c635f0606ea4b5fa351cdb01f4402f45dda0d71d7d5833677522688a1b7a9
data/README.md CHANGED
@@ -67,6 +67,7 @@ Structure of `_data/menu.yml`:
67
67
  Structure of `_data/metaData.yml`:
68
68
  * author: Site Author name
69
69
  * logo: relative url to the logo
70
+ * clickToEnlargeImages: boolean value to enable/disable "full-screen" images on click
70
71
  * cookies: customize information about site cookies
71
72
  * enabled: determine if should show cookies pop-up
72
73
  * message: text on cookie pop-up
@@ -84,6 +85,18 @@ Structure of `_data/customs.yml`:
84
85
  * custom-css: a list of urls to custom css files
85
86
  * custom-js: a list of urls to custom javascript files
86
87
 
88
+ ## Posts front matter parameters
89
+
90
+ ### Embedding media
91
+ Each post can have it's own associated player. Information on how to embed the player should be described under *embed\_player* parameter. Each player should have at least two parameters: *src* and *type*, where *type* will define on how to fill *src*. Supported types:
92
+
93
+ * soundcloud - src should be full url to song
94
+ * bandcamp - on a "embed song" option on bandcamp, everything after *EmbeddedPlayer/* in generated code should be put to src parameter in front matter
95
+ * spotify - src should be id of the song. It can be acquired via "copy song link", e.g. for url https://open.spotify.com/track/67IdIp2ij8oqTFsSguvy2I?si=f735480b74414902 the src should be 67IdIp2ij8oqTFsSguvy2I
96
+ * youtube - src should be the *v* uri parameter, e.g. for url https://www.youtube.com/watch?v=dfdruxvE9-0 the src should be dfdruxvE9-0
97
+ * anchor.fm - src is the full episode name (e.g. for URL https://anchor.fm/sucias/episodes/Not-All-Men-e15v6dv src should be Not-All-Men-e15v6dv)
98
+ * audio_file - src should be path to file. Additionaly, required properties are name of the song (it will display in player) and boolean value *is\_relative\_url* (for easy access to files served from the same domain)
99
+
87
100
  ## Contributing
88
101
 
89
102
  Bug reports and pull requests are welcome on [GitHub](https://github.com/ItsMeaga1n/minimal-music-project). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/_data/metaData.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  author: Site Author
2
2
  logo: assets/img/band_logo.png
3
+ clickToEnlargeImages: True
3
4
  cookies:
4
5
  enabled: True
5
6
  message: This site might be using cookies! Customize your message or disable cookies in metaData.yml!
data/_includes/common.js CHANGED
@@ -2,4 +2,62 @@
2
2
  window.toggleExpander = function toggleExpander(x) {
3
3
  document.getElementsByClassName("menu")[0].classList.toggle("expanded");
4
4
  }
5
+ window.addEventListener("load", () => {
6
+ // #region click to enlarge images
7
+ const images = document.querySelectorAll("img[click-to-enlarge]");
8
+ images.forEach(img => {
9
+ {% if site.data.metaData.clickToEnlargeImages %}
10
+ img.addEventListener("click", () => {
11
+ const src = img.attributes.getNamedItem("src");
12
+ const modal = document.createElement("div");
13
+ const removeModal = function() {
14
+ document.body.removeChild(modal);
15
+ };
16
+ modal.classList.add("modal__picture-zoomed");
17
+ modal.style.backgroundImage = `URL("${src.value}")`;
18
+ modal.addEventListener("click", removeModal);
19
+ document.body.append(modal);
20
+ document.body.addEventListener("keyup", e => {
21
+ if (e.key === 'Escape') {
22
+ removeModal();
23
+ }
24
+ }, {once : true})
25
+ });
26
+ {% else %}
27
+ img.removeAttribute("click-to-enlarge");
28
+ {% endif %}
29
+ });
30
+ // #endregion click to enlarge images
31
+ // #region embedded audio players
32
+ const players = document.querySelectorAll("iframe.embedded-player");
33
+ const getParamsByPlayerType = (src, type) => {
34
+ const rt = (src, height) => ({
35
+ src: src,
36
+ height: height
37
+ });
38
+ switch (type.toLocaleLowerCase()) {
39
+ case "soundcloud":
40
+ return rt(`https://w.soundcloud.com/player/?url=${src}`, 125);
41
+ case "bandcamp":
42
+ return rt(`https://bandcamp.com/EmbeddedPlayer/${src}`, 125);
43
+ case "spotify":
44
+ return rt(`https://open.spotify.com/embed/track/${src}`, 80);
45
+ case "youtube":
46
+ return rt(`https://www.youtube.com/embed/${src}`, 350);
47
+ case "anchor.fm":
48
+ return rt(`https://anchor.fm/sucias/embed/episodes/${src}`,102);
49
+ default:
50
+ return rt(src, 125);
51
+ }
52
+ };
53
+ players.forEach(player => {
54
+ const givenSrc = player.getAttribute("givenSrc");
55
+ const type = player.getAttribute("type");
56
+ const { src, height } = getParamsByPlayerType(givenSrc, type);
57
+ player.setAttribute("src", src);
58
+ player.setAttribute("height", height);
59
+ player.classList.remove("hidden");
60
+ });
61
+ // #endregion embedded audio players
62
+ });
5
63
  })();
@@ -59,22 +59,19 @@
59
59
  {% endfor %}
60
60
  </p>
61
61
  {% endif %}
62
- {% if include.currPost.play_here %}
63
- {% include music-player.html audioData=include.currPost.play_here %}
64
- {% endif %}
65
- {% if include.currPost.play_soundcloud_embed %}
66
- <iframe width="100%" height="110" scrolling="no" frameborder="no" allow="autoplay"
67
- src="{{ include.currPost.play_soundcloud_embed.src }}"></iframe>
68
- <div
69
- style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;">
70
- <a href="{{ include.currPost.play_soundcloud_embed.artist_href }}" title="{{ include.currPost.play_soundcloud_embed.artist_title }}" target="_blank"
71
- style="color: #cccccc; text-decoration: none;">{{ include.currPost.play_soundcloud_embed.artist_title }}</a> · <a
72
- href="{{ include.currPost.play_soundcloud_embed.song_href }}"
73
- title="{{ include.currPost.play_soundcloud_embed.song_title }}" target="_blank"
74
- style="color: #cccccc; text-decoration: none;">{{ include.currPost.play_soundcloud_embed.song_title }}</a></div>
62
+
63
+ {% if include.currPost.embed_player %}
64
+ {% if include.currPost.embed_player.type == "audio_file" %}
65
+ {% include music-player.html audioData=include.currPost.embed_player %}
66
+ {% else %}
67
+ <iframe
68
+ class="embedded-player hidden"
69
+ givenSrc="{{include.currPost.embed_player.src}}"
70
+ type="{{include.currPost.embed_player.type}}"
71
+ allow="encrypted-media; picture-in-picture"
72
+ height="80"
73
+ frameborder="0"
74
+ scrolling="no">
75
+ </iframe>
76
+ {% endif %}
75
77
  {% endif %}
76
- {% if include.currPost.play_bandcamp_embed %}
77
- <iframe style="border: 0; width: 100%; height: 120px;"
78
- src="{{ include.currPost.play_bandcamp_embed.src }}" seamless>
79
- <a href="{{ include.currPost.play_bandcamp_embed.href }}">{{ include.currPost.play_bandcamp_embed.title }}</a></iframe>
80
- {% endif %}
@@ -2,7 +2,7 @@
2
2
  <header>
3
3
  <figure class="discography-album_cover-wrapper">
4
4
  <div class="discography-album_cover">
5
- <img src="{{ include.currPost.image | relative_url }}" alt="{{ page.image_alt }}" />
5
+ <img click-to-enlarge src="{{ include.currPost.image | relative_url }}" alt="{{ page.image_alt }}" />
6
6
  </div>
7
7
  </figure>
8
8
  </header>
data/_layouts/post.html CHANGED
@@ -10,7 +10,7 @@ layout: default
10
10
  {% if page.image %}
11
11
  <figure class="post-cover">
12
12
  <!-- TODO: Images for diffrent screen size -->
13
- <img src="{{ page.image | relative_url }}" alt="{{ page.image_alt }}" class="post-cover_image" />
13
+ <img click-to-enlarge src="{{ page.image | relative_url }}" alt="{{ page.image_alt }}" class="post-cover_image" />
14
14
  </figure>
15
15
  {% endif %}
16
16
  </header>
@@ -23,7 +23,7 @@ category: home
23
23
  </header>
24
24
  <section>
25
25
  <figure>
26
- <img src="{{ post.image | relative_url }}" alt="{{ page.image_alt }}" class="post-feed_image" />
26
+ <img click-to-enlarge src="{{ post.image | relative_url }}" alt="{{ page.image_alt }}" class="post-feed_image" />
27
27
  </figure>
28
28
  <p>
29
29
  {{ post.description }}
@@ -102,6 +102,13 @@ img {
102
102
  margin: 0;
103
103
  vertical-align: top;
104
104
  object-fit: cover;
105
+ &[click-to-enlarge] {
106
+ cursor: zoom-in;
107
+ &:hover {
108
+ box-shadow: 0 0 8px $black;
109
+ transition: all 0.4s ease-in-out 0.1s;
110
+ }
111
+ }
105
112
  }
106
113
 
107
114
  @include mobile {
@@ -0,0 +1,9 @@
1
+ .embedded-player {
2
+ width: 100%;
3
+ max-width: 600px;
4
+ outline: none;
5
+ border: none;
6
+ &.hidden {
7
+ visibility: hidden;
8
+ }
9
+ }
@@ -5,4 +5,6 @@
5
5
  @import './post';
6
6
  @import './cookies';
7
7
  @import './discography';
8
- @import './music-player.scss';
8
+ @import './music-player';
9
+ @import './modal';
10
+ @import './embedded-player';
@@ -0,0 +1,19 @@
1
+ .modal {
2
+ &__picture-zoomed {
3
+ background-color: RGBA(0,0,0,0.5);
4
+ background-position: center;
5
+ background-repeat: no-repeat;
6
+ background-size: auto;
7
+ width: 100%;
8
+ height: 100%;
9
+ position: fixed;
10
+ z-index: 10000;
11
+ top: 0;
12
+ left: 0;
13
+ cursor: zoom-out;
14
+ transition: all 0.4s ease-in-out 0.2s;
15
+ @include mobile {
16
+ background-size: contain;
17
+ }
18
+ }
19
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimal-music-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patryk Bieszke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-07 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -59,9 +59,11 @@ files:
59
59
  - _sass/styles/_cookies.scss
60
60
  - _sass/styles/_defaults.scss
61
61
  - _sass/styles/_discography.scss
62
+ - _sass/styles/_embedded-player.scss
62
63
  - _sass/styles/_index.scss
63
64
  - _sass/styles/_layout.scss
64
65
  - _sass/styles/_menu.scss
66
+ - _sass/styles/_modal.scss
65
67
  - _sass/styles/_music-player.scss
66
68
  - _sass/styles/_post.scss
67
69
  - _sass/styles/_posts_feed.scss