Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / contextual / js / views / VisualView.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, Modernizr) {
9   Drupal.contextual.VisualView = Backbone.View.extend({
10     events: function events() {
11       var touchEndToClick = function touchEndToClick(event) {
12         event.preventDefault();
13         event.target.click();
14       };
15       var mapping = {
16         'click .trigger': function clickTrigger() {
17           this.model.toggleOpen();
18         },
19         'touchend .trigger': touchEndToClick,
20         'click .contextual-links a': function clickContextualLinksA() {
21           this.model.close().blur();
22         },
23         'touchend .contextual-links a': touchEndToClick
24       };
25
26       if (!Modernizr.touchevents) {
27         mapping.mouseenter = function () {
28           this.model.focus();
29         };
30       }
31       return mapping;
32     },
33     initialize: function initialize() {
34       this.listenTo(this.model, 'change', this.render);
35     },
36     render: function render() {
37       var isOpen = this.model.get('isOpen');
38
39       var isVisible = this.model.get('isLocked') || this.model.get('regionIsHovered') || isOpen;
40
41       this.$el.toggleClass('open', isOpen).find('.trigger').toggleClass('visually-hidden', !isVisible);
42
43       if ('isOpen' in this.model.changed) {
44         this.$el.closest('.contextual-region').find('.contextual .trigger:not(:first)').toggle(!isOpen);
45       }
46
47       return this;
48     }
49   });
50 })(Drupal, Backbone, Modernizr);