Mercurial > hg > isophonics-drupal-site
comparison core/modules/toolbar/js/views/ToolbarAuralView.js @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 /** | |
2 * DO NOT EDIT THIS FILE. | |
3 * See the following change record for more information, | |
4 * https://www.drupal.org/node/2815083 | |
5 * @preserve | |
6 **/ | |
7 | |
8 (function (Backbone, Drupal) { | |
9 Drupal.toolbar.ToolbarAuralView = Backbone.View.extend({ | |
10 initialize: function initialize(options) { | |
11 this.strings = options.strings; | |
12 | |
13 this.listenTo(this.model, 'change:orientation', this.onOrientationChange); | |
14 this.listenTo(this.model, 'change:activeTray', this.onActiveTrayChange); | |
15 }, | |
16 onOrientationChange: function onOrientationChange(model, orientation) { | |
17 Drupal.announce(Drupal.t('Tray orientation changed to @orientation.', { | |
18 '@orientation': orientation | |
19 })); | |
20 }, | |
21 onActiveTrayChange: function onActiveTrayChange(model, tray) { | |
22 var relevantTray = tray === null ? model.previous('activeTray') : tray; | |
23 | |
24 if (!relevantTray) { | |
25 return; | |
26 } | |
27 var action = tray === null ? Drupal.t('closed') : Drupal.t('opened'); | |
28 var trayNameElement = relevantTray.querySelector('.toolbar-tray-name'); | |
29 var text = void 0; | |
30 if (trayNameElement !== null) { | |
31 text = Drupal.t('Tray "@tray" @action.', { | |
32 '@tray': trayNameElement.textContent, '@action': action | |
33 }); | |
34 } else { | |
35 text = Drupal.t('Tray @action.', { '@action': action }); | |
36 } | |
37 Drupal.announce(text); | |
38 } | |
39 }); | |
40 })(Backbone, Drupal); |