Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 | Use of this source code is governed by a BSD-style license that can be |
| 5 | found in the LICENSE file. |
| 6 | --> |
| 7 | |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 8 | <link rel="import" href="/core/scripting_controller.html"> |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 9 | <link rel="import" href="/extras/tquery/filter.html"> |
| 10 | |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 11 | <script> |
| 12 | 'use strict'; |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 13 | |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 14 | tv.exportTo('tv.e.tquery', function() { |
| 15 | function FilterHasTitle(expected) { |
| 16 | tv.e.tquery.Filter.call(this); |
| 17 | this.expected = expected; |
| 18 | } |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 19 | |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 20 | FilterHasTitle.prototype = { |
| 21 | __proto__: tv.e.tquery.Filter.prototype, |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 22 | |
| 23 | evaluate: function(context) { |
| 24 | return this.matchValue_(context.event.title, this.expected); |
| 25 | } |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 26 | }; |
| 27 | tv.c.ScriptingObjectRegistry.register( |
| 28 | function(expected) { |
| 29 | var filter = new tv.e.tquery.FilterHasTitle(expected); |
| 30 | return filter; |
| 31 | }, |
| 32 | { |
| 33 | name: 'hasTitle' |
| 34 | } |
| 35 | ); |
| 36 | |
| 37 | return { |
| 38 | FilterHasTitle: FilterHasTitle |
| 39 | }; |
| 40 | }); |
| 41 | </script> |