src/js/model.js
changeset 1026 420608a77566
parent 1013 392ddcd212d7
child 1044 d8339b45edc4
equal deleted inserted replaced
1025:5fb8d735fde0 1026:420608a77566
   274     });
   274     });
   275     this.trigger(res.length ? "found" : "not-found",res);
   275     this.trigger(res.length ? "found" : "not-found",res);
   276     return res;
   276     return res;
   277 };
   277 };
   278 
   278 
       
   279 List.prototype.searchByTags = function(_text) {
       
   280     if (!_text) {
       
   281         this.trigger("clear-search");
       
   282         return this;
       
   283     }
       
   284     this.searching = true;
       
   285     this.trigger("search", _text);
       
   286     var rxsource = fullTextRegexps(_text),
       
   287         rgxp = new RegExp(rxsource,"im");
       
   288     this.regexp = new RegExp(rxsource,"gim");
       
   289     var res = this.filter(function(_element, _k) {
       
   290         var _isfound = rgxp.test(_element.getTagTexts());
       
   291         _element.found = _isfound;
       
   292         _element.trigger(_isfound ? "found" : "not-found");
       
   293         return _isfound;
       
   294     });
       
   295     this.trigger(res.length ? "found" : "not-found",res);
       
   296     return res;
       
   297 };
       
   298 
   279 List.prototype.getTitles = function() {
   299 List.prototype.getTitles = function() {
   280     return this.map(function(_el) {
   300     return this.map(function(_el) {
   281         return _el.title;
   301         return _el.title;
   282     });
   302     });
   283 };
   303 };