--- regenerate: true --- {% capture cache %} {% comment %} # ----------------------------------------------------------------------------- # ~/assets/themes/j1/core/js/adapter/back2top.js # Liquid template to create the Template Adapter for Back2Top # # Product/Info: # https://jekyll.one # http://dynamicdrive.com/dynamicindex3/scrolltop.htm # # Copyright (C) 2019 Juergen Adams # Copyright (C) 2009 dynamicdrive.com # # J1 Template is licensed under the MIT License. # For details, see https://jekyll.one # # ----------------------------------------------------------------------------- # Test data: # {{ liquid_var | debug }} # # ----------------------------------------------------------------------------- {% endcomment %} /* # ----------------------------------------------------------------------------- # ~/assets/themes/j1/core/js/adapter/back2top.js # JS Adapter for J1 Back2Top # # Product/Info: # https://jekyll.one # http://dynamicdrive.com/dynamicindex3/scrolltop.htm # # Copyright (C) 2019 Juergen Adams # Copyright (C) 2009 dynamicdrive.com # # J1 Template is licensed under the MIT License. # For details, see https://jekyll.one # # ----------------------------------------------------------------------------- # Adapter generated: {{site.time}} # ----------------------------------------------------------------------------- */ 'use strict'; {% comment %} Liquid procedures --------------------------------------------------------------- {% endcomment %} {% capture select_color %}themes/{{site.template.name}}/procedures/global/select_color.proc{% endcapture %} {% comment %} Variables --------------------------------------------------------------- {% endcomment %} {% assign environment = site.environment %} {% assign back2top_config = site.data.modules.j1_back2top %} {% assign active_color = back2top_config.active_color %} {% assign background_color = back2top_config.background_color %} {% capture back2top_icon %}{{back2top_config.icon}}{% endcapture %} {% capture back2top_icon_family %}{{back2top_config.icon_family}}{% endcapture %} {% capture color %}{{back2top_config.color}}{% endcapture %} {% comment %} Initialize icon colors --------------------------------------------------------------- {% endcomment %} {% include {{select_color}} color=background_color fallback="#283593" %} {% assign background_color = color %} {% include {{select_color}} color=active_color fallback="#3F51B5" %} {% assign active_color = color %} {% comment %} Main --------------------------------------------------------------- {% endcomment %} j1.Back2Top = (function (j1, window) { var environment = '{{environment}}'; // Set environment var state = 'unknown'; var logger; var logText; return { // Initialize init: function () { // Setup logger logger = log4javascript.getLogger("j1.Back2Top"); state = 'started'; logger.info('state: ' + state); // Set|Log status // TODO: Make JS of Back2Top configurable //this.back2TopInit(); this.setCss(); state = 'finished'; logger.info('state: ' + state); // Set|Log status logger.info("J1 Back2Top successfully initialized"); }, // ------------------------------------------------------------------------- // Set Back2Top options // ------------------------------------------------------------------------- back2TopInit: function () { var back2Top = Back2Top({ startLine: {{ back2top_config.startLine | json }}, scrollTo: {{ back2top_config.scrollTo | json }}, scrollDuration: {{ back2top_config.scrollDuration | json }}, fadeDuration: {{ back2top_config.fadeDuration | json }}, controlHTML: {{ back2top_config.controlHTML | json }}, controlOffsetX: {{ back2top_config.controlOffsetX | json }}, controlOffsetY: {{ back2top_config.controlOffsetY | json }}, anchorKeyword: {{ back2top_config.anchorKeyword | json }}, }); }, // ------------------------------------------------------------------------- // Set dynamic styles for Back2Top // ------------------------------------------------------------------------- setCss: function () { $('head').append(""); $('head').append(""); $('head').append(""); }, // ------------------------------------------------------------------------- // returns the current (processing) state of the module // ------------------------------------------------------------------------- state: function () { return state; } }; // end return })(j1, window); {% endcapture %} {{ cache | strip_empty_lines }} {% assign cache = nil %}