• Jump To … +
    search_facets.js search_query.js templates.js backbone_extensions.js hotkeys.js inflector.js jquery_extensions.js search_parser.js search_box.js search_facet.js search_input.js visualsearch.js
  • backbone_extensions.js

  • ¶
    (function(){
    
      var $ = jQuery; // Handle namespaced jQuery
  • ¶

    Makes the view enter a mode. Modes have both a ‘mode’ and a ‘group’, and are mutually exclusive with any other modes in the same group. Setting will update the view’s modes hash, as well as set an HTML class of [mode]_[group] on the view’s element. Convenient way to swap styles and behavior.

      Backbone.View.prototype.setMode = function(mode, group) {
        this.modes || (this.modes = {});
        if (this.modes[group] === mode) return;
        $(this.el).setMode(mode, group);
        this.modes[group] = mode;
      };
    
    })();