Sha256: 5585e846bd7de47b500f8620e8237576b2dfc2de8d588ccce9d4b3f0edebe028

Contents?: true

Size: 1.29 KB

Versions: 62

Compression:

Stored size: 1.29 KB

Contents

/**
 * Handles the faux-typing effect featured within `live-search` components.
 *
 * TODO remove in v4, not used >= 3.4
 *
 * @namespace WORKAREA.liveSearchText
 */
WORKAREA.registerModule('liveSearchText', (function () {
    'use strict';

    var typeString = function (container) {
            var index = $(container).data('liveSearchStringIndex'),
                strings = $(container).data('liveSearchText'),
                string = strings[index];

            $(container).text(string);

            $(container).liveType({
                typeSpeed: 75
            });

            if (_.isUndefined(strings[index + 1])) {
                $(container).data('liveSearchStringIndex', 0);
            } else {
                $(container).data('liveSearchStringIndex', index + 1);
            }
        },

        gatherStrings = function (index, container) {
            $(container).data('liveSearchStringIndex', 0);

            typeString(container);

            window.setInterval(_.partial(typeString, container), 5000);
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.liveSearchText
         */
        init = function ($scope) {
            $('[data-live-search-text]', $scope).each(gatherStrings);
        };

    return {
        init: init
    };
}()));

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.27 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.4 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.26 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.3 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.25 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.2 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.24 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.1 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.23 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.22 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.0 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.21 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.5.0.beta.1 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.20 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.19 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.18 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.17 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.16 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.15 app/assets/javascripts/workarea/admin/modules/live_search_text.js
workarea-admin-3.4.14 app/assets/javascripts/workarea/admin/modules/live_search_text.js