Sha256: 06cdd9626172b4d4cd0e9283108ad683d2b121f9472107e90433b84d3faec1d4

Contents?: true

Size: 1.3 KB

Versions: 62

Compression:

Stored size: 1.3 KB

Contents

/**
 * Manages the Sticky presentation of the content editor.
 *
 * @namespace WORKAREA.contentEditor
 */
WORKAREA.registerModule('contentEditor', (function () {
    'use strict';

    var calculateOffset = function (editor) {
            var editorTopOffset = $(editor).offset().top,
                headerHeight = $('#header').height(),
                pageContentPadding = window.parseInt(
                    $(editor).closest('.page-content').css('paddingTop')
                ) + window.parseInt(
                    $(editor).closest('.page-content__main').css('paddingTop')
                );

            return (headerHeight + pageContentPadding - editorTopOffset);
        },

        makeSticky = function (index, editor) {
            if ($(editor).data('contentEditorSticky')) { return; }

            $(editor).data('contentEditorSticky', new Waypoint.Sticky({
                element: editor,
                stuckClass: 'content-editor--stuck',
                wrapper: false,
                offset: calculateOffset(editor)
            }));
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.contentEditor
         */
        init = function ($scope) {
            $('.content-editor', $scope).each(makeSticky);
        };

    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/content_editor.js
workarea-admin-3.5.4 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.26 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.5.3 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.25 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.5.2 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.24 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.5.1 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.23 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.22 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.5.0 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.21 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.5.0.beta.1 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.20 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.19 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.18 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.17 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.16 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.15 app/assets/javascripts/workarea/admin/modules/content_editor.js
workarea-admin-3.4.14 app/assets/javascripts/workarea/admin/modules/content_editor.js