123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /**
- * DO NOT EDIT THIS FILE.
- * See the following change record for more information,
- * https://www.drupal.org/node/2815083
- * @preserve
- **/
- (function (Drupal, Backbone) {
- Drupal.contextual.StateModel = Backbone.Model.extend({
- defaults: {
- title: '',
- regionIsHovered: false,
- hasFocus: false,
- isOpen: false,
- isLocked: false
- },
- toggleOpen: function toggleOpen() {
- var newIsOpen = !this.get('isOpen');
- this.set('isOpen', newIsOpen);
- if (newIsOpen) {
- this.focus();
- }
- return this;
- },
- close: function close() {
- this.set('isOpen', false);
- return this;
- },
- focus: function focus() {
- this.set('hasFocus', true);
- var cid = this.cid;
- this.collection.each(function (model) {
- if (model.cid !== cid) {
- model.close().blur();
- }
- });
- return this;
- },
- blur: function blur() {
- if (!this.get('isOpen')) {
- this.set('hasFocus', false);
- }
- return this;
- }
- });
- })(Drupal, Backbone);
|