lib/starter_web/assets/themes/j1/adapter/js/toccer.js in j1_template-2019.4.7 vs lib/starter_web/assets/themes/j1/adapter/js/toccer.js in j1_template-2019.4.8

- old
+ new

@@ -43,24 +43,27 @@ {% assign blocks = site.data.blocks %} {% assign modules = site.data.modules %} {% comment %} Set config data -------------------------------------------------------------------------------- {% endcomment %} -{% assign toccer_config = modules.j1_toccer %} -{% assign footer_config = modules.j1_footer %} -{% assign footer_id = modules.j1_footer.global.id %} +{% assign toccer_defaults = modules.defaults.toccer.defaults %} +{% assign toccer_settings = modules.toccer.settings %} +{% assign footer_config = modules.j1_footer %} +{% assign footer_id = modules.j1_footer.global.id %} {% comment %} Set config options -------------------------------------------------------------------------------- {% endcomment %} +{% assign toccer_options = toccer_defaults | merge: toccer_settings %} {% assign active_link_color_fallback = '#204A87' %} -{% if toccer_config.defaults.activeLinkColor %} - {% assign active_link_color = toccer_config.defaults.activeLinkColor %} +{% if toccer_options.activeLinkColor %} + {% assign active_link_color = toccer_options.activeLinkColor %} {% else %} {% assign active_link_color = active_link_color_fallback %} {% endif %} + /* # ----------------------------------------------------------------------------- # ~/assets/themes/j1/adapter/js/toccer.js # JS Adapter for J1 Toccer # @@ -73,11 +76,11 @@ # J1 Template is licensed under the MIT License. # For details, see https://jekyll.one # Tocbot is licensed under under the MIT License. # For details, see https://tscanlin.github.io/tocbot # ----------------------------------------------------------------------------- - # Adapter generated: {{site.time}} + # Adapter generated: {{site.time}} # ----------------------------------------------------------------------------- */ 'use strict'; {% comment %} Main @@ -125,15 +128,15 @@ // cast text-based booleans var isToc = (options.toc === 'true'); var isComments = (options.comments === 'true'); if ( settings.collapseDepth === undefined ) { - settings.collapseDepth = {{toccer_config.defaults.collapseDepth}}; + settings.collapseDepth = {{toccer_options.collapseDepth}}; } if ( settings.headingsOffset === undefined ) { - settings.scrollOffset = {{toccer_config.defaults.smoothScrollOffset}}; + settings.scrollOffset = {{toccer_options.smoothScrollOffset}}; } else { settings.scrollOffset = settings.headingsOffset } if ( settings.enabled === undefined ) { @@ -191,17 +194,17 @@ state = 'running'; logger.info('state: ' + state); // Set|Log status tocbot.init({ - log: {{ toccer_config.log | json }}, - tocSelector: {{ toccer_config.defaults.tocSelector | json }}, - headingSelector: {{ toccer_config.defaults.headingSelector | json }}, - ignoreSelector: {{ toccer_config.defaults.ignoreSelector | json }}, - contentSelector: {{ toccer_config.defaults.contentSelector | json }}, + log: {{ toccer_options.log | json }}, + tocSelector: {{ toccer_options.tocSelector | json }}, + headingSelector: {{ toccer_options.headingSelector | json }}, + ignoreSelector: {{ toccer_options.ignoreSelector | json }}, + contentSelector: {{ toccer_options.contentSelector | json }}, collapseDepth: settings.collapseDepth, - throttleTimeout: {{ toccer_config.defaults.throttleTimeout | json }}, + throttleTimeout: {{ toccer_options.throttleTimeout | json }}, includeHtml: false, linkClass: 'toc-link', extraLinkClasses: '', activeLinkClass: 'is-active-link', listClass: 'toc-list', @@ -210,15 +213,15 @@ collapsibleClass: 'is-collapsible', listItemClass: 'toc-list-item', positionFixedSelector: '', positionFixedClass: 'is-position-fixed', fixedSidebarOffset: 'auto', - smoothScroll: {{ toccer_config.defaults.smoothScrollEnabled | json }}, - smoothScrollOffset: {{ toccer_config.defaults.smoothScrollOffset | json }}, - smoothScrollDuration: {{ toccer_config.defaults.smoothScrollDuration | json }}, - headingsOffset: {{ toccer_config.defaults.headingsOffset | json }}, - throttleTimeout: {{ toccer_config.defaults.throttleTimeout | json }} + smoothScroll: {{ toccer_options.smoothScrollEnabled | json }}, + smoothScrollOffset: {{ toccer_options.smoothScrollOffset | json }}, + smoothScrollDuration: {{ toccer_options.smoothScrollDuration | json }}, + headingsOffset: {{ toccer_options.headingsOffset | json }}, + throttleTimeout: {{ toccer_options.throttleTimeout | json }} }); if (tocbot.options.log == true) { // Writes all of the current option settings to JS console console.log( tocbot.options ); @@ -330,17 +333,17 @@ // ------------------------------------------------------------------------- // Set the current (processing) state of the module // ------------------------------------------------------------------------- setState: function ( stat ) { state = stat; - }, // end setState + }, // END setState // ------------------------------------------------------------------------- // Returns the current (processing) state of the module // ------------------------------------------------------------------------- getState: function () { return state; - } // end state + } // END state }; // END return })(j1, window); {% endcapture %}