X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Fviews%2FToolbarAuralView.js;fp=web%2Fcore%2Fmodules%2Ftoolbar%2Fjs%2Fviews%2FToolbarAuralView.js;h=f4cca42bd3f5a15ae9f2f35a36b5435eb1fdd24e;hp=3cc9adaf4c96d475848e6f6e8c278fda317217ee;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/toolbar/js/views/ToolbarAuralView.js b/web/core/modules/toolbar/js/views/ToolbarAuralView.js index 3cc9adaf4..f4cca42bd 100644 --- a/web/core/modules/toolbar/js/views/ToolbarAuralView.js +++ b/web/core/modules/toolbar/js/views/ToolbarAuralView.js @@ -1,70 +1,40 @@ /** - * @file - * A Backbone view for the aural feedback of the toolbar. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ (function (Backbone, Drupal) { - - 'use strict'; - - Drupal.toolbar.ToolbarAuralView = Backbone.View.extend(/** @lends Drupal.toolbar.ToolbarAuralView# */{ - - /** - * Backbone view for the aural feedback of the toolbar. - * - * @constructs - * - * @augments Backbone.View - * - * @param {object} options - * Options for the view. - * @param {object} options.strings - * Various strings to use in the view. - */ - initialize: function (options) { + Drupal.toolbar.ToolbarAuralView = Backbone.View.extend({ + initialize: function initialize(options) { this.strings = options.strings; this.listenTo(this.model, 'change:orientation', this.onOrientationChange); this.listenTo(this.model, 'change:activeTray', this.onActiveTrayChange); }, - - /** - * Announces an orientation change. - * - * @param {Drupal.toolbar.ToolbarModel} model - * The toolbar model in question. - * @param {string} orientation - * The new value of the orientation attribute in the model. - */ - onOrientationChange: function (model, orientation) { + onOrientationChange: function onOrientationChange(model, orientation) { Drupal.announce(Drupal.t('Tray orientation changed to @orientation.', { '@orientation': orientation })); }, + onActiveTrayChange: function onActiveTrayChange(model, tray) { + var relevantTray = tray === null ? model.previous('activeTray') : tray; - /** - * Announces a changed active tray. - * - * @param {Drupal.toolbar.ToolbarModel} model - * The toolbar model in question. - * @param {HTMLElement} tray - * The new value of the tray attribute in the model. - */ - onActiveTrayChange: function (model, tray) { - var relevantTray = (tray === null) ? model.previous('activeTray') : tray; - var action = (tray === null) ? Drupal.t('closed') : Drupal.t('opened'); + if (!relevantTray) { + return; + } + var action = tray === null ? Drupal.t('closed') : Drupal.t('opened'); var trayNameElement = relevantTray.querySelector('.toolbar-tray-name'); - var text; + var text = void 0; if (trayNameElement !== null) { text = Drupal.t('Tray "@tray" @action.', { '@tray': trayNameElement.textContent, '@action': action }); - } - else { - text = Drupal.t('Tray @action.', {'@action': action}); + } else { + text = Drupal.t('Tray @action.', { '@action': action }); } Drupal.announce(text); } }); - -}(Backbone, Drupal)); +})(Backbone, Drupal); \ No newline at end of file