Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / contextual / js / models / StateModel.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   Drupal.contextual.StateModel = Backbone.Model.extend({
10     defaults: {
11       title: '',
12
13       regionIsHovered: false,
14
15       hasFocus: false,
16
17       isOpen: false,
18
19       isLocked: false
20     },
21
22     toggleOpen: function toggleOpen() {
23       var newIsOpen = !this.get('isOpen');
24       this.set('isOpen', newIsOpen);
25       if (newIsOpen) {
26         this.focus();
27       }
28       return this;
29     },
30     close: function close() {
31       this.set('isOpen', false);
32       return this;
33     },
34     focus: function focus() {
35       this.set('hasFocus', true);
36       var cid = this.cid;
37       this.collection.each(function (model) {
38         if (model.cid !== cid) {
39           model.close().blur();
40         }
41       });
42       return this;
43     },
44     blur: function blur() {
45       if (!this.get('isOpen')) {
46         this.set('hasFocus', false);
47       }
48       return this;
49     }
50   });
51 })(Drupal, Backbone);