Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: Tools/GardeningServer/ui/ct-view.html

Issue 728023004: Remove GardeningServer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6
7 <polymer-element name="ct-view" attributes="path" hidden="true">
8 <template>
9 <style>
10 ::content > * {
11 /* For independent scrolling of the view within a positioned element. */
12 position: absolute;
13 overflow: auto;
14 top: 0;
15 right: 0;
16 bottom: 0;
17 left: 0;
18 }
19 </style>
20 <content select="*"></content>
21 </template>
22 <script>
23 Polymer("ct-view", {
24 parts: null,
25 regex: null,
26
27 pathChanged: function(oldValue, newValue) {
28 var self = this;
29 this.parts = [];
30 var regex = newValue.replace(/\{([\w\d]+)\}/g, function(match, name) {
31 self.parts.push(name);
32 return "([^\/]+)";
33 });
34 regex = regex.replace(/\*([\w\d]+)/g, function(match, name) {
35 self.parts.push(name);
36 return "(.*)";
37 });
38 this.regex = new RegExp("^" + regex + "/?$", "i");
39 },
40
41 showView: function(path) {
42 if (path) {
43 var params = this._matchPath(path);
44 if (!params)
45 return null;
46 }
47 if (!this.children.length)
48 return null;
49 if (!this.view)
50 this.view = this.children[0];
51 if (params) {
52 Object.keys(params).forEach(function(name) {
53 this.view.setAttribute(name, decodeURIComponent(params[name]));
54 }, this);
55 }
56 this.hidden = false;
57 return this.view;
58 },
59
60 _matchPath: function(path) {
61 if (!this.regex || !this.parts)
62 return null;
63 var match = path.match(this.regex);
64 if (!match)
65 return null;
66 var result = {};
67 this.parts.forEach(function(name, i) {
68 result[name] = match[i + 1];
69 });
70 return result;
71 },
72 });
73 </script>
74 </polymer-element>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/ui/ct-unexpected-failures.html ('k') | Tools/GardeningServer/ui/ct-view-handler.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698