core/modules/contextual/contextual.toolbar.js | 48 ++----------------------- 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/core/modules/contextual/contextual.toolbar.js b/core/modules/contextual/contextual.toolbar.js index 704bfdb..0c911c0 100644 --- a/core/modules/contextual/contextual.toolbar.js +++ b/core/modules/contextual/contextual.toolbar.js @@ -20,18 +20,12 @@ Drupal.behaviors.contextualToolbar = { var $contextuals = $(context).find('.contextual-links'); var $tab = $('.js .toolbar .bar .contextual-toolbar-tab'); var model = new Drupal.contextualToolbar.models.EditToggleModel({ - isViewing: (localStorage.getItem('Drupal.contextualToolbar.isViewing') === null) ? true : false, - '$contextuals': $contextuals + isViewing: (localStorage.getItem('Drupal.contextualToolbar.isViewing') === null) ? true : false }); - var visualView = new Drupal.contextualToolbar.views.EditToggleVisualView({ + var view = new Drupal.contextualToolbar.views.EditToggleView({ el: $tab, model: model }); - var auralView = new Drupal.contextualToolbar.views.editToggleAuralView({ - // Append a messages element for aural state change announcements. - el: $(Drupal.theme('contextualMessageBox')).appendTo($tab), - model: model - }); // Update the model based on overlay events. $(document) @@ -72,7 +66,7 @@ Drupal.contextualToolbar.models.EditToggleModel = Backbone.Model.extend({ /** * Handles edit mode toggle interactions. */ -Drupal.contextualToolbar.views.EditToggleVisualView = Backbone.View.extend({ +Drupal.contextualToolbar.views.EditToggleView = Backbone.View.extend({ events: { 'click': 'onClick' }, @@ -119,40 +113,4 @@ Drupal.contextualToolbar.views.EditToggleVisualView = Backbone.View.extend({ } }); -/** - * Responds to edit mode changes by announcing the application state. - */ -Drupal.contextualToolbar.views.editToggleAuralView = Backbone.View.extend({ - /** - * Implements Backbone Views' initialize(). - */ - initialize: function () { - this.model.on('change', this.render, this); - }, - - /** - * Implements Backbone Views' render(). - */ - render: function () { - var isViewing = this.model.get('isViewing'); - // Inform aural users of state change. - var activatedText = Drupal.t('Edit mode is active. There are @count contextual link triggers. Tabbing will navigate between them.', {'@count': this.model.get('$contextuals').length}); - var deactivatedText = Drupal.t('Edit mode is inactive'); - this.$el - .text((!isViewing) ? activatedText : deactivatedText); - - return this; - } -}); - -/** - * A region to post messages that a screen reading UA will announce. - * - * @return {String} - * A string representing a DOM fragment. - */ -Drupal.theme.contextualMessageBox = function () { - return '
'; -}; - })(jQuery, Backbone, Drupal, document, localStorage);