Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/templates/g5_hydrogen/custom/particles/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/templates/g5_hydrogen/custom/particles/jlprogress-bar.html.twig

{% extends '@nucleus/partials/particle.html.twig' %}

{% block stylesheets %}
{% if particle.particle_title_color or particle.particle_title_fontsize or
particle.customize_title_color or particle.customize_title_fontsize or
particle.lineshape_color or particle.lineshape_fontsize or
particle.lineshape_margin or particle.lineshape_color or
particle.lineshape_fontsize or particle.lineshape_margin or
particle.circle_color or particle.circle_fontsize or
particle.semicircle_color or particle.semicircle_fontsize %}
<style>
{% if particle.particle_title_color or particle.particle_title_fontsize %}
#{{ id }}.g5-particle-title { {% if particle.particle_title_color %}color:
{{ particle.particle_title_color }};{% endif %}{% if
particle.particle_title_fontsize %}font-size:
{{particle.particle_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.customize_title_color or particle.customize_title_fontsize
%}
#{{ id }} .tm-title { {% if particle.customize_title_color %}color:
{{particle.customize_title_color}}; {% endif %}{% if
particle.customize_title_fontsize %}font-size:
{{particle.customize_title_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.customize_label_color or particle.customize_label_fontsize
%}
#{{ id }} .tm-progress-label { {% if particle.customize_label_color
%}color: {{particle.customize_label_color}} !important; {% endif %}{% if
particle.customize_label_fontsize %}font-size:
{{particle.customize_label_fontsize}}px;{% endif %} }
{% endif %}
{% if particle.lineshape_color or particle.lineshape_fontsize or
particle.lineshape_margin %}
#{{ id }} .tm-progress-label { {% if particle.lineshape_color %}color:
{{particle.lineshape_color}} !important;{% endif %}{% if
particle.lineshape_fontsize %} font-size:
{{particle.lineshape_fontsize}}px;{% endif %}{% if
particle.lineshape_margin %}margin-top: -{{particle.lineshape_margin}}px
!important;{% endif %} }
{% endif %}
{% if particle.circle_color or particle.circle_fontsize %}
#{{ id }} .tm-progress-label-circle { {% if particle.circle_color %}color:
{{particle.circle_color}} !important;{% endif %}{% if
particle.circle_fontsize %} font-size: {{particle.circle_fontsize}}px;{%
endif %} }
{% endif %}
{% if particle.semicircle_color or particle.semicircle_fontsize %}
#{{ id }} .tm-progress-label-semicircle { {% if particle.semicircle_color
%}color: {{particle.semicircle_color}} !important;{% endif %}{% if
particle.semicircle_fontsize %} font-size:
{{particle.semicircle_fontsize}}px;{% endif %} }
{% endif %}
</style>
{% endif %}
{% endblock %}
{% set rand = random() %}

{# Set Viewport Height #}
{% if particle.viewport_height == 'full' %}
    {% set viewport_height = 'jl-height-viewport="offset-top:
true;"' %}
{% elseif particle.viewport_height == 'percent' %}
    {% set viewport_height = 'jl-height-viewport="offset-top:
true; offset-bottom: 20;"' %}
{% elseif particle.viewport_height == 'section' %}
    {% set viewport_height = 'jl-height-viewport="offset-top:
true; offset-bottom: 50;"' %}
{% elseif particle.viewport_height == 'expand' %}
    {% set viewport_height = 'jl-height-viewport="expand:
true;"' %}
{% endif %}

{# Set Title Text Transform #}
{% set title_text_transform = particle.title_text_transform ? '
jl-text-' ~ particle.title_text_transform|e ~ '' %}

{# Set Max-Width Content Section #}
{% set container_maxwidth = particle.container_maxwidth !=
'default' ? 'jl-container jl-container-' ~
particle.container_maxwidth|e ~ '' : 'jl-container' %}

{# Set Padding #}
{% if particle.padding == 'default' %}
    {% set padding = ' jl-section' %}
{% elseif particle.padding == 'none' %}
    {% set padding = ' jl-section jl-padding-remove-vertical' %}
{% else %}
    {% set padding = ' jl-section jl-section-' ~
particle.padding|e ~ '' %}
{% endif %}

{# Set Background color #}
{% set parallax_bg_color = particle.parallax_bg_color ?
'style="background-color: ' ~ particle.parallax_bg_color ~
';"' %}
{% set parallax_overlay = (particle.parallax_bg_overlay ? '<div
class="jl-position-cover" style="background-color: '~
particle.parallax_bg_overlay ~';"></div>') %}
{% set parallax_easing = particle.parallax_easing ? 'easing:' ~
particle.parallax_easing / 10 ~ '' %}

{# Set Max-Width Content #}
{% set content_maxwidth %}
{% if particle.g_maxwidth != 'inherit' %}
jl-width-{{particle.g_maxwidth}}{% if particle.g_maxwidth_breakpoint !=
'always' %}@{{particle.g_maxwidth_breakpoint}}{% endif %}{% if
particle.g_maxwidth_alignment == 'left' %}{% elseif
particle.g_maxwidth_alignment == 'center' %} jl-margin-auto{%
else %} jl-margin-auto-left{% endif %}{% endif %}
{% endset %}

{# Set Parallax Background #}
{% set parallaxbackground %}
{% if particle.parallax_image %}
<div data-src="{{ url(particle.parallax_image)|e }}"
class="jl-background-norepeat{{ particle.parallax_bg_overlay ? '
jl-position-relative' : '' }}{{padding}}
jl-background-{{particle.background_image_position|e}}{% if
particle.background_image_size != 'auto' %}
jl-background-{{particle.background_image_size|e}}{% endif %}{% if
particle.parallax_bg_visibility != 'always' %}
jl-background-image@{{particle.parallax_bg_visibility|e}}{% endif %}{% if
particle.vertical_alignment != 'none' %} jl-flex
jl-flex-{{particle.vertical_alignment|e}}{% endif %}{% if
particle.parallax_text_color != 'default' %}
jl-{{particle.parallax_text_color|e}}{% endif %}{% if particle.blendmode !=
'inherit' %} jl-background-blend-{{particle.blendmode|e}}{% endif
%}" {{parallax_bg_color|default('')|raw}}{% if
particle.horizontal_start or particle.horizontal_end or
particle.vertical_start or particle.vertical_end or
particle.parallax_easing %} jl-parallax="{% if
particle.horizontal_start or particle.horizontal_end %}bgx:
{{particle.horizontal_start|e}},{{particle.horizontal_end|e}};{% endif %}{%
if particle.vertical_start or particle.vertical_end %}bgy:
{{particle.vertical_start|e}},{{particle.vertical_end|e}};{% endif %}{% if
particle.parallax_bg_breakpoint != 'always' %} media:
@{{particle.parallax_bg_breakpoint|e}};{% endif %}{{parallax_easing}}"
{% endif %} jl-img {{viewport_height|raw}}>
{{parallax_overlay|raw}}
{% if particle.container_maxwidth != 'none' %}
<div class="{{container_maxwidth}}">
{% endif %}
{% endif %}
{% endset %}

{# End Parallax Background #}
{% set endparallaxbackground %}
{% if particle.parallax_image %}
{% if particle.container_maxwidth != 'none' %}
</div>
{% endif %}
</div>
{% endif %}
{% endset %}

{# Set Horizontal #}
{% set pahorizontal %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end %}x: {% if
particle.pa_horizontal_start == '' %}0{% else
%}{{particle.pa_horizontal_start }}{% endif %},{% if
particle.pa_horizontal_end == '' %}0{% else
%}{{particle.pa_horizontal_end }}{% endif %};{% endif %}
{% endset %}

{# Set Vertical #}
{% set pavertical %}
{% if particle.pa_vertical_start or particle.pa_vertical_end %}y: {% if
particle.pa_vertical_start == '' %}0{% else
%}{{particle.pa_vertical_start }}{% endif %},{% if particle.pa_vertical_end
== '' %}0{% else %}{{particle.pa_vertical_end }}{% endif %};{%
endif %}
{% endset %}

{# Set Scale #}
{% set scale %}
{% if particle.scale_start or particle.scale_end %}scale: {% if
particle.scale_start == '' %}1{% else %}{{particle.scale_start /
100 }}{% endif %},{% if particle.scale_end == '' %}1{% else %}
{{particle.scale_end / 100 }}{% endif %};{% endif %}
{% endset %}

{# Set Rotate #}
{% set rotate %}{% if particle.rotate_start or particle.rotate_end %}
rotate: {% if particle.rotate_start == '' %}0{% else
%}{{particle.rotate_start}}{% endif %},{% if particle.rotate_end ==
'' %}0{% else %}{{particle.rotate_end}}{% endif %};{% endif %}
{% endset %}

{# Set Opacity #}
{% set opacity %}
{% if particle.opacity_start or particle.opacity_end %}opacity: {% if
particle.opacity_start == '' %}1{% else
%}{{particle.opacity_start / 100 }}{% endif %},{% if particle.opacity_end
== '' %}1{% else %}{{particle.opacity_end / 100 }}{% endif %};{%
endif %}
{% endset %}

{# Set Scrollspy Animation #}
{% set scrollspy_cls = particle.animation != 'inherit' and
particle.animation != 'parallax' ? '
jl-scrollspy-class' %}

{# Set Animation #}
{% set animation %}
{% if particle.animation != 'inherit' and particle.animation !=
'parallax' %} jl-scrollspy="target: [jl-scrollspy-class];
cls: jl-animation-{{particle.animation|e}};{% if particle.animation_repeat
== 'enabled' %} repeat: true;{% endif %} delay:{% if
particle.delay_element_animations %}
{{particle.animation_delay|default('200')|e}};{% else %} false;{%
endif %}"
{% elseif particle.animation == 'parallax' %}
{% if particle.pa_horizontal_start or particle.pa_horizontal_end or
particle.pa_vertical_start or particle.pa_vertical_end or
particle.scale_start or particle.scale_end or particle.rotate_start or
particle.rotate_end or particle.opacity_start or particle.opacity_end or
particle.easing or particle.pa_viewport or particle.pa_breakpoint %}
jl-parallax="{{pahorizontal}}{{pavertical}}{{scale}}{{rotate}}{{opacity}}{%
if particle.easing == '' %}{% else %}easing: {{ particle.easing /
100 }};{% endif %}{% if particle.pa_viewport != '' %}viewport:{{
particle.pa_viewport / 100 }};{% endif %}{% if particle.pa_breakpoint !=
'always' %}media: @{{particle.pa_breakpoint|e}}{% endif
%}"{% endif %}
{% endif %}
{% endset %}

{# Set Particle Alignment #}
{% set particle_alignment %}
{% if particle.align != 'inherit' %}
jl-text-{{particle.align|e}}{% if particle.breakpoint != 'always'
%}@{{particle.breakpoint|e}}{% endif %}{% endif %}{% if particle.align !=
'inherit' and particle.breakpoint != 'always' %}{% if
particle.fallback != 'inherit' %}
jl-text-{{particle.fallback|e}}{% endif %}{% endif %}
{% endset %}

{# set Particle Title Style #}
{% set particle_title_style %}
{% if particle.particle_title %}
<{{particle.particle_title_element|e}} id="{{ id }}"
class="g5-particle-title{% if particle.particle_title_align !=
'inherit' %} jl-text-{{particle.particle_title_align|e}}{% endif
%}{% if particle.particle_predefined_color != 'default' %}
jl-text-{{particle.particle_predefined_color|e}}{% endif %}{% if
particle.particle_title_style != 'default' %}
jl-{{particle.particle_title_style|e}}{% endif %}{% if
particle.particle_title_decoration != 'none' %}
jl-heading-{{particle.particle_title_decoration|e}}{% endif %}">
{% if particle.particle_title_decoration == 'line' %}
<span>{{particle.particle_title|raw}}</span>
{% else %} {{particle.particle_title|raw}}
{% endif %}
</{{particle.particle_title_element|e}}>
{% endif %}
{% endset %}

{% set grid_column_gap = particle.grid_column_gap != 'default' ?
' jl-grid-column-' ~ particle.grid_column_gap ~ '' %}
{% set grid_row_gap = particle.grid_row_gap != 'default' ? '
jl-grid-row-' ~ particle.grid_row_gap ~ '' %}

{% if ( particle.grid_column_gap == particle.grid_row_gap ) and not
(particle.grid_column_gap == 'default' and particle.grid_row_gap
== 'default') %}
    {% set grid_cr_gap = ' jl-grid-' ~ particle.grid_column_gap ~
'' %}
{% else %}
    {% set grid_cr_gap = grid_column_gap ~ grid_row_gap %}
{% endif %}

{% set center_columns = particle.center_columns ? '
jl-flex-center' %}
{% set center_rows = particle.center_rows ? ' jl-flex-middle' %}

{% block particle %}
{% if particle.enabled %}
{{parallaxbackground}}
{{particle_title_style}}
<div id="{{ id }}"
class="tm-progress-container-{{id}}{{content_maxwidth}}{% if
particle.class %} {{ particle.class }}{% endif %}{% if
particle.grid_divider %} jl-grid-divider{% endif
%}{{grid_cr_gap}}{{center_columns}}{{center_rows}}{% if
particle.phone_portrait %} jl-child-width-1-{{ particle.phone_portrait|e
}}{% endif %}{% if particle.phone_landscape != 'inherit' %}
jl-child-width-1-{{ particle.phone_landscape|e }}@s{% endif %}{% if
particle.tablet_landscape != 'inherit' %} jl-child-width-1-{{
particle.tablet_landscape|e }}@m{% endif %}{% if particle.desktop !=
'inherit' %} jl-child-width-1-{{ particle.desktop|e }}@l{% endif
%}{% if particle.large_desktop != 'inherit' %}
jl-child-width-1-{{ particle.large_desktop|e }}@xl{% endif
%}{{particle_alignment}}{% if particle.margin == 'inherit' %}{%
elseif particle.margin == 'default' %} jl-margin{% else %}
jl-margin-{{particle.margin|e}}{% endif %}{% if particle.visibility !=
'inherit' %} jl-visible@{{particle.visibility|e}}{% endif
%}"{{animation}} jl-grid>

{% for item in particle.items %}

{% set item_title %}
  {% if item.text %}
  <{{particle.title_element|e}} class="tm-title
jl-margin-remove-bottom{{title_text_transform}}{% if
particle.title_margin_top == 'default' %} jl-margin-top{% else %}
jl-margin-{{ particle.title_margin_top|e }}-top{% endif %}{% if
particle.title_color != 'default' %}
jl-text-{{particle.title_color|e}}{% endif %}{% if particle.title_style !=
'default' %} jl-{{particle.title_style|e}}{% endif %}{% if
particle.title_decoration != 'none' %}
jl-heading-{{particle.title_decoration|e}}{% endif %}">
  {% if particle.title_decoration == 'line' %}
  <span>
  {% endif %}
  {{ item.text|raw }}
  {% if particle.title_decoration == 'line' %}
  </span>
  {% endif %}
  </{{particle.title_element|e}}>
  {% endif %}
{% endset %}

<div class="tm-progress-item"{{scrollspy_cls}}>

{% if particle.bar_alignment == 'top' %}
  {{item_title}}
{% endif %}

<div class="tm-progress-bar-{{rand}}{% if particle.bar_margin_top
== 'default' %} jl-margin-top{% else %} jl-margin-{{
particle.bar_margin_top|e }}-top{% endif %}" progress-data='{
  {% if particle.shape == 'Line'
%}"shape":"Line",
  {% elseif particle.shape == "Circle"
%}"shape":"Circle",
  {% else %}"shape":"SemiCircle",{% endif %}
  "width":{{particle.width}},
  "duration":{{particle.duration}},
  "percent":{{item.percent}},
  "stroke":"{{item.stroke == "" ?
"#ff5e14" : item.stroke}}",
  "trail": "{{item.trail == "" ?
"#f5f6f7" : item.trail}}"
}'>
</div>

{% if particle.bar_alignment == 'bottom' %}
  {{item_title}}
{% endif %}

</div>
{% endfor %}
</div>

{{endparallaxbackground}}
{% endif %}
{% endblock %}

{% block javascript_footer %}
{% do gantry.load('jquery') %}
<script src="{{
url('gantry-theme://js/progressbar.min.js')
}}"></script>
<script src="{{
url('gantry-theme://js/jquery.waypoints.min.js')
}}"></script>
<script>
function triggerBar(id){
  arrbar.forEach(function(bar){
    if (bar.id == id){
      bar.item.set(0);
      bar.item.animate(bar.percent/100);
    }
  });
  //bar.animate(50/100);
}
var arrbar = [];
jQuery(function($){

  $('.tm-progress-bar-{{rand}}').each(function(index,element){
    var data = $(this).attr('progress-data');
    data = jQuery.parseJSON(data);
    var mar = 25 + data.width * 15;
    if (data.shape == 'Line'){
      var bar = new ProgressBar.Line(this, {
        strokeWidth: data.width,
        duration: data.duration,
        color: data.stroke,
        trailColor: data.trail,
        text: {
          className: 'tm-progress-label',
          style: {
            'margin-top': '-' + mar + 'px',
            'float' : 'left',
            {% if particle.label_alignment == 'right' or
particle.label_alignment == 'auto' %}
            'margin-left' : data.percent + '%',
            {% else %}
            'margin-left' : '0%',
            {% endif %}

            transform: null
          },
          autoStyleContainer: false
        },
        step: (state, bar) => {
          bar.setText(Math.round(bar.value() * 100) + '%');
          $(this).parent()

          {% if particle.label_alignment == 'auto' %}
         
$(this).children('.tm-progress-label').css('margin-left',bar.value()
* 100 - 3 + '%');
          {% endif %}
        }
      });

    }else if (data.shape=="Circle"){
      var bar = new ProgressBar.Circle(this, {
        strokeWidth: data.width,
        trailWidth: data.width,
        duration: data.duration,
        color: data.stroke,
        trailColor: data.trail,
        text: {
          className: 'tm-progress-label-circle',
          autoStyleContainer: true
        },
        from: { color: data.stroke, width: data.width},
        to: { color: data.stroke, width: data.width },
        step: function(state, circle) {
          circle.path.setAttribute('stroke', state.color);
          circle.path.setAttribute('stroke-width', state.width);

          var value = Math.round(circle.value() * 100);
          if (value === 0) {
            circle.setText('');
          } else {
            circle.setText(value + '%');
          }
        }
      });
    }else if (data.shape=="SemiCircle"){
      var bar = new ProgressBar.SemiCircle(this, {
        strokeWidth: data.width,

        trailWidth: data.width,
        duration: data.duration,
        color: data.stroke,
        trailColor: data.trail,
        text: {
          className: 'tm-progress-label-semicircle',
          alignToBottom: true
        },
        from: { color: data.stroke},
        to: { color: data.stroke },
        step: (state, bar) => {
          bar.path.setAttribute('stroke', state.color);
          var value = Math.round(bar.value() * 100);
          if (value === 0) {
            bar.setText('');
          } else {
            bar.setText(value + '%');
          }
          bar.text.style.color = state.color;
        }
      });
    }
   
arrbar.push({id:$(this).parents(".tm-progress-container").attr('id')
,item : bar, percent : data.percent});
    var waypoint = new Waypoint({
      element: $(this).parent(),
      offset: "bottom-in-view",
      handler: function(direction) {
        bar.animate(data.percent/100);
      }
    })
  });
});
</script>
{% endblock %}