3b026d7355554c89be4e7efde0f6f314da5070d9
[yaffs-website] / web / core / modules / contextual / js / contextual.toolbar.js
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 ($, Drupal, Backbone) {
9   var strings = {
10     tabbingReleased: Drupal.t('Tabbing is no longer constrained by the Contextual module.'),
11     tabbingConstrained: Drupal.t('Tabbing is constrained to a set of @contextualsCount and the edit mode toggle.'),
12     pressEsc: Drupal.t('Press the esc key to exit.')
13   };
14
15   function initContextualToolbar(context) {
16     if (!Drupal.contextual || !Drupal.contextual.collection) {
17       return;
18     }
19
20     var contextualToolbar = Drupal.contextualToolbar;
21     contextualToolbar.model = new contextualToolbar.StateModel({
22       isViewing: localStorage.getItem('Drupal.contextualToolbar.isViewing') !== 'false'
23     }, {
24       contextualCollection: Drupal.contextual.collection
25     });
26
27     var viewOptions = {
28       el: $('.toolbar .toolbar-bar .contextual-toolbar-tab'),
29       model: contextualToolbar.model,
30       strings: strings
31     };
32     new contextualToolbar.VisualView(viewOptions);
33     new contextualToolbar.AuralView(viewOptions);
34   }
35
36   Drupal.behaviors.contextualToolbar = {
37     attach: function attach(context) {
38       if ($('body').once('contextualToolbar-init').length) {
39         initContextualToolbar(context);
40       }
41     }
42   };
43
44   Drupal.contextualToolbar = {
45     model: null
46   };
47 })(jQuery, Drupal, Backbone);