2 * DO NOT EDIT THIS FILE.
3 * See the following change record for more information,
4 * https://www.drupal.org/node/2815083
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();
16 'click .trigger': function clickTrigger() {
17 this.model.toggleOpen();
19 'touchend .trigger': touchEndToClick,
20 'click .contextual-links a': function clickContextualLinksA() {
21 this.model.close().blur();
23 'touchend .contextual-links a': touchEndToClick
26 if (!Modernizr.touchevents) {
27 mapping.mouseenter = function () {
33 initialize: function initialize() {
34 this.listenTo(this.model, 'change', this.render);
36 render: function render() {
37 var isOpen = this.model.get('isOpen');
39 var isVisible = this.model.get('isLocked') || this.model.get('regionIsHovered') || isOpen;
41 this.$el.toggleClass('open', isOpen).find('.trigger').toggleClass('visually-hidden', !isVisible);
43 if ('isOpen' in this.model.changed) {
44 this.$el.closest('.contextual-region').find('.contextual .trigger:not(:first)').toggle(!isOpen);
50 })(Drupal, Backbone, Modernizr);