blob: 4eeee39ecab0b06ed32dcc7e97719f00c58884d2 [file] [log] [blame]
Chris Craikf516a622015-04-01 17:52:39 -07001<!DOCTYPE html>
2<!--
3Copyright 2015 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
Chris Craik44c28202015-05-12 17:25:16 -07008<link rel="import" href="/core/scripting_controller.html">
Chris Craikf516a622015-04-01 17:52:39 -07009<link rel="import" href="/extras/tquery/filter.html">
10
Chris Craik44c28202015-05-12 17:25:16 -070011<script>
12'use strict';
Chris Craikf516a622015-04-01 17:52:39 -070013
Chris Craik44c28202015-05-12 17:25:16 -070014tv.exportTo('tv.e.tquery', function() {
15 function FilterHasTitle(expected) {
16 tv.e.tquery.Filter.call(this);
17 this.expected = expected;
18 }
Chris Craikf516a622015-04-01 17:52:39 -070019
Chris Craik44c28202015-05-12 17:25:16 -070020 FilterHasTitle.prototype = {
21 __proto__: tv.e.tquery.Filter.prototype,
Chris Craikf516a622015-04-01 17:52:39 -070022
23 evaluate: function(context) {
24 return this.matchValue_(context.event.title, this.expected);
25 }
Chris Craik44c28202015-05-12 17:25:16 -070026 };
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>