--- regenerate: true exclude_from_search: true --- {%- capture cache -%} {% comment %} # ----------------------------------------------------------------------------- # ~/assets/data/amplitude.html # Liquid procedure to generate HTML (UI) portion for AmplitudeJS v4 Players # # Product/Info: # https://jekyll.one # # Copyright (C) 2023, 2024 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE # ----------------------------------------------------------------------------- # Test data: # {{variable | debug}} # ----------------------------------------------------------------------------- {% endcomment %} {% comment %} Liquid procedures -------------------------------------------------------------------------------- {% endcomment %} {% comment %} Liquid initialization (vars) -------------------------------------------------------------------------------- {% endcomment %} {% comment %} set config files -------------------------------------------------------------------------------- {% endcomment %} {% assign template_config = site.data.j1_config %} {% assign modules = site.data.modules %} {% comment %} set config data amplitude_settings: {{amplitude_settings | debug}} amplitude_defaults: {{amplitude_defaults | debug}} -------------------------------------------------------------------------------- {% endcomment %} {% assign environment = site.environment %} {% assign amplitude_settings = modules.amplitude.settings %} {% assign amplitude_defaults = modules.defaults.amplitude.defaults %} {% comment %} set config options -------------------------------------------------------------------------------- {% endcomment %} {% assign amplitude_options = amplitude_defaults | merge: amplitude_settings %} {% comment %} set permalink setting -------------------------------------------------------------------------------- {% endcomment %} {% assign ext = '' %} {% if site.permalink == 'none' %} {% assign ext = '.html' %} {% endif %} {% comment %} detect production mode -------------------------------------------------------------------------------- {% endcomment %} {% assign production = false %} {% if environment == 'prod' or environment == 'production' %} {% assign production = true %} {% endif %} {% comment %} main ================================================================================ {% endcomment %} HTML portion (UI) for AmplitudeJS v4 Players {% comment %} create player instances player.volume_slider: {{player.volume_slider | debug}} amplitude_defaults.volume_slider: {{amplitude_defaults.player.volume_slider | debug}} volume_slider: {{volume_slider}} ============================================================================== {% endcomment %} {% for player in amplitude_options.players %} {% if player.enabled %} {% comment %} player default settings ---------------------------------------------------------------------------- {% endcomment %} {% assign source_media = amplitude_defaults.player.source %} {% assign song_progress_bar = amplitude_defaults.player.song_progress_bar %} {% assign display_hours = amplitude_defaults.player.display_hours %} {% assign volume_slider = amplitude_defaults.player.volume_slider.enabled %} {% assign volume_slider_min = amplitude_defaults.player.volume_slider.min_value %} {% assign volume_slider_max = amplitude_defaults.player.volume_slider.max_value %} {% assign volume_slider_step = amplitude_defaults.player.volume_slider.slider_step %} {% assign shuffle_repeat_button = amplitude_defaults.player.shuffle_repeat_button %} {% assign shuffle_button = amplitude_defaults.player.shuffle_button %} {% assign skip_forward_backward_button = amplitude_defaults.player.skip_forward_backward_button %} {% assign playlist_controls = amplitude_defaults.player.playlist.controls %} {% assign playlist_audio_info = amplitude_defaults.player.playlist.audio_info %} {% comment %} player settings ---------------------------------------------------------------------------- {% endcomment %} {% assign player_enabled = player.enabled %} {% assign player_id = player.id %} {% assign player_playlist = player.playlist.name | strip %} {% if player.type %} {% assign player_type = player.type %} {% endif %} {% if player.playlist.controls %} {% assign playlist_controls = player.playlist.controls %} {% endif %} {% if player.song_progress_bar %} {% assign song_progress_bar = player.song_progress_bar %} {% endif %} {% comment %} NOTE: slider VALUE is set by Adapter|Amplitude API (volume) ---------------------------------------------------------------------------- {% endcomment %} {% if player.volume_slider %} {% assign volume_slider = player.volume_slider.enabled %} {% assign volume_slider_min = amplitude_defaults.player.volume_slider.min_value %} {% assign volume_slider_max = amplitude_defaults.player.volume_slider.max_value %} {% assign volume_slider_step = amplitude_defaults.player.volume_slider.slider_step %} {% endif %} {% if player.shuffle_repeat_button %} {% assign shuffle_repeat_button = player.shuffle_repeat_button %} {% endif %} {% if player.shuffle_button %} {% assign shuffle_button = player.shuffle_button %} {% endif %} {% if player.repeat_button %} {% assign repeat_button = player.repeat_button %} {% endif %} {% if player.skip_forward_backward_button %} {% assign skip_forward_backward_button = player.skip_forward_backward_button %} {% endif %} {% if player.display_hours %} {% assign display_hours = player.display_hours %} {% endif %} {% if player.playlist.audio_info %} {% assign player_audio_info = player.playlist.audio_info %} {% endif %} {% comment %} unused ---------------------------------------------------------------------------- {% unless player.playlist.scrollbar %} {% assign player_scrollbar_class = 'hide-scrollbar' %} {% else %} {% unless amplitude_defaults.player.playlist.scrollbar %} {% assign player_scrollbar_class = 'hide-scrollbar' %} {% else %} {% assign player_scrollbar_class = '' %} {% endunless %} {% endunless %} ---------------------------------------------------------------------------- {% endcomment %} {% comment %} collect playlist items ---------------------------------------------------------------------------- {% endcomment %} {% for playlist in amplitude_options.playlists %} {% if playlist.enabled %} {% assign playlist_name = playlist.name | strip %} {% if playlist_name == player_playlist %} {% assign playlist_items = playlist.items %} {% break %} {% else %} {% continue %} {% endif %} {% endif %} {% endfor %} {% comment %} collect player instances ============================================================================ {% endcomment %} {% case player_type %} {% comment %} MINI player ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {% endcomment %} {% when 'mini' %} {% if player_enabled %}
{% if song_progress_bar %} {% endif %}
{% if display_hours %} : {% endif %} : {% if display_hours %} : {% endif %} :
{% if volume_slider %} Volume Icon {% endif %}
{% endif %} {% comment %} END MINI player ========================================================================== {% endcomment %} {% comment %} COMPACT player ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {% endcomment %} {% when 'compact' %} {% if player_enabled %}
Up Arrow Hide Playlist
{% if playlist_controls %}
{% endif %}
{% for item in playlist_items %} {% if item.enabled %}
{{forloop.index}} now-playing
{{item.title}} {{item.name}} · {{item.artist}}
{% if player_audio_info %} audio-info {% else %} {% endif %} {{item.duration}}
{% endif %} {% endfor %}
· Down Arrow
album cover
{% if song_progress_bar %} {% endif %}
{% if shuffle_button %}
{% endif %}
{% if skip_forward_backward_button %}
{% endif %}
{% if skip_forward_backward_button %}
{% endif %}
{% if repeat_button %}
{% endif %}
{% if volume_slider %}
{% endif %}
{% if display_hours %} : {% endif %} : {% if display_hours %} : {% endif %} :
{% endif %} {% comment %} END COMPACT player ========================================================================== {% endcomment %} {% comment %} LARGE player player.source: {{source_media}} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {% endcomment %} {% when 'large' %} {% if player_enabled %} {% if player.source %} {% assign source_media = player.source %} {% endif %} {% if player.source == 'video' %} {% assign source_media_attribute = 'youtube' %} {% else %} {% assign source_media_attribute = 'audio' %} {% endif %} {% capture large_player_left_side %}
·
album cover {% if song_progress_bar %} {% endif %}
{% if shuffle_button %}
{% endif %}
{% if skip_forward_backward_button %}
{% endif %}
{% if skip_forward_backward_button %}
{% endif %}
{% if repeat_button %}
{% endif %}
{% if volume_slider %}
{% endif %}
{% if display_hours %} : {% endif %} : {% if display_hours %} : {% endif %} :
{% endcapture %}
{{large_player_left_side}}
Playlist
{% if playlist_controls %}
{% endif %}
{% for item in playlist_items %}{% if item.enabled %}
{{forloop.index}} now-playing
{% if player_audio_info %} audio-info {% else %} {% endif %} {{item.duration}}
{% endif %}{% endfor %}
{% endif %} {% comment %} END LARGE player ========================================================================== {% endcomment %} {% comment %} Reset element variables (already processed) -------------------------------------------------------------------------- {% endcomment %} {% assign amplitude_settings = false %} {% assign player_playlist = false %} {% assign playlist_items = false %} {% endcase %} {% endif %} {% endfor %} {% comment %} END create player instances ============================================================================== {% endcomment %} {%- endcapture -%} {% comment %} beautify|compress page -------------------------------------------------------------------------------- {% endcomment %} {%- if production -%} {% capture _LINE_FEED %}{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment %}{{ cache | strip_html_comments }}{% else %}{% capture _content %}{{ cache | strip_html_comments }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _END %}{% endcapture %}{% assign _content = _content | remove: _END %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "" %}{% endif %}{% unless _pre_before contains "" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " ;; ;" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %}
Step Bytes
raw {{ cache | strip_html_comments | size }}{% if _profile_endings %}
endings {{ _profile_endings }}{% endif %}{% if _profile_startings %}
startings {{ _profile_startings }}{% endif %}{% if _profile_comments %}
comments {{ _profile_comments }}{% endif %}{% if _profile_collapse %}
collapse {{ _profile_collapse }}{% endif %}{% if _profile_clippings %}
clippings {{ _profile_clippings }}{% endif %}
{% endif %}{% endif %} {%- else -%} {{ cache | remove:'' | remove:'' | strip_empty_lines }} {%- endif -%} {% comment %} reset page cache -------------------------------------------------------------------------------- {% endcomment %} {%- assign cache = false -%}