X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Fviews%2FBodyVisualView.js;fp=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Fviews%2FBodyVisualView.js;h=71293844fe39e09fd90f48396d5ee71f56e394ac;hp=64593c9cf914afd6f762749214662d6d22608e26;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/toolbar/js/views/BodyVisualView.js b/web/core/modules/toolbar/js/views/BodyVisualView.js index 64593c9cf..71293844f 100644 --- a/web/core/modules/toolbar/js/views/BodyVisualView.js +++ b/web/core/modules/toolbar/js/views/BodyVisualView.js @@ -1,53 +1,22 @@ /** - * @file - * A Backbone view for the body element. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ (function ($, Drupal, Backbone) { - - 'use strict'; - - Drupal.toolbar.BodyVisualView = Backbone.View.extend(/** @lends Drupal.toolbar.BodyVisualView# */{ - - /** - * Adjusts the body element with the toolbar position and dimension changes. - * - * @constructs - * - * @augments Backbone.View - */ - initialize: function () { - this.listenTo(this.model, 'change:orientation change:offsets change:activeTray change:isOriented change:isFixed change:isViewportOverflowConstrained', this.render); + Drupal.toolbar.BodyVisualView = Backbone.View.extend({ + initialize: function initialize() { + this.listenTo(this.model, 'change:activeTray ', this.render); + this.listenTo(this.model, 'change:isFixed change:isViewportOverflowConstrained', this.isToolbarFixed); }, - - /** - * @inheritdoc - */ - render: function () { - var $body = $('body'); - var orientation = this.model.get('orientation'); - var isOriented = this.model.get('isOriented'); + isToolbarFixed: function isToolbarFixed() { var isViewportOverflowConstrained = this.model.get('isViewportOverflowConstrained'); - - $body - // We are using JavaScript to control media-query handling for two - // reasons: (1) Using JavaScript let's us leverage the breakpoint - // configurations and (2) the CSS is really complex if we try to hide - // some styling from browsers that don't understand CSS media queries. - // If we drive the CSS from classes added through JavaScript, - // then the CSS becomes simpler and more robust. - .toggleClass('toolbar-vertical', (orientation === 'vertical')) - .toggleClass('toolbar-horizontal', (isOriented && orientation === 'horizontal')) - // When the toolbar is fixed, it will not scroll with page scrolling. - .toggleClass('toolbar-fixed', (isViewportOverflowConstrained || this.model.get('isFixed'))) - // Toggle the toolbar-tray-open class on the body element. The class is - // applied when a toolbar tray is active. Padding might be applied to - // the body element to prevent the tray from overlapping content. - .toggleClass('toolbar-tray-open', !!this.model.get('activeTray')) - // Apply padding to the top of the body to offset the placement of the - // toolbar bar element. - .css('padding-top', this.model.get('offsets').top); + $('body').toggleClass('toolbar-fixed', isViewportOverflowConstrained || this.model.get('isFixed')); + }, + render: function render() { + $('body').toggleClass('toolbar-tray-open', !!this.model.get('activeTray')); } }); - -}(jQuery, Drupal, Backbone)); +})(jQuery, Drupal, Backbone); \ No newline at end of file