src/widgets/Tagcloud.js
changeset 983 97fef7a4b189
parent 965 eadb7290c325
child 1013 392ddcd212d7
equal deleted inserted replaced
982:cfcbac34d020 983:97fef7a4b189
    37         'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your'
    37         'they', 'this', 'very', 'what', 'when', 'where', 'who', 'why', 'will', 'with', 'www', 'you', 'your'
    38     ]
    38     ]
    39 }
    39 }
    40 
    40 
    41 IriSP.Widgets.Tagcloud.prototype.draw = function() {
    41 IriSP.Widgets.Tagcloud.prototype.draw = function() {
    42     this.onMdpEvent("search", "onSearch");
       
    43     this.onMdpEvent("search.closed", "onSearch");
       
    44     this.onMdpEvent("search.cleared", "onSearch");
       
    45     
    42     
    46     if (this.segment_annotation_type) {
    43     if (this.segment_annotation_type) {
    47         var _this = this;
    44         var _this = this;
    48         this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
    45         this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
    49             _a.on("enter", function() {
    46             _a.on("enter", function() {
   106             });
   103             });
   107     }
   104     }
   108     this.$.html(Mustache.to_html(this.template,  {words: _words }));
   105     this.$.html(Mustache.to_html(this.template,  {words: _words }));
   109     this.$.find(".Ldt-Tagcloud-item").click(function() {
   106     this.$.find(".Ldt-Tagcloud-item").click(function() {
   110         var _txt = IriSP.jQuery(this).attr("content");
   107         var _txt = IriSP.jQuery(this).attr("content");
   111         _this.player.trigger("search.triggeredSearch", _txt);
   108         _this.source.getAnnotations().search(_txt);
   112     });
   109     });
   113     
   110     this.source.getAnnotations().on("search", this.functionWrapper("onSearch"));
       
   111     this.source.getAnnotations().on("search-cleared", this.functionWrapper("onSearch"));
   114 }
   112 }
   115 
   113 
   116 IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) {
   114 IriSP.Widgets.Tagcloud.prototype.onSearch = function(searchString) {
   117     searchString = typeof searchString !== "undefined" ? searchString : '';
   115     searchString = typeof searchString !== "undefined" ? searchString : '';
   118     if (searchString) {
   116     if (searchString) {