Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/output-widgets.html @ 997:b24885725f59
support for pwm board
Ignore-this: 4bf59699c590c75c79e6ae72d719343a
darcs-hash:20150830081929-312f9-45f7134e807c5de2bb0dad13a5a9d1fa032bf471
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 30 Aug 2015 01:19:29 -0700 |
parents | ed1f54d81fc9 |
children | 960b3b4cdd29 |
rev | line source |
---|---|
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
1 <link rel="import" href="/lib/polymer/0.5.2/core-ajax/core-ajax.html"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
2 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
3 <polymer-element name="output-widget" attributes="subj pred"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
4 <template> |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
5 <core-ajax id="output" url="../output" method="PUT"></core-ajax> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
6 Set <a href="{{subj}}">{{subj | compactUri}}</a>'s {{pred | compactUri}} to |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
7 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
8 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
9 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 valueChanged: function() { |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
11 //this.$.output.headers = {'content-type': ...} |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
12 // broken in polymer 0.5 this.$.output.params = {s: this.subj, p: this.pred}; |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
13 this.$.output.url = "output?s="+encodeURIComponent(this.subj)+"&p="+encodeURIComponent(this.pred); |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
14 this.$.output.body = this.value; |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 this.$.output.go(); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
20 |
992
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
21 <polymer-element name="output-rgb" extends="output-widget"> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
22 <template> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
23 <color-picker id="pick" width="200" height="100" color="{{value}}"></color-picker> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
24 color pick {{value}} |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
25 </template> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
26 <script> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
27 Polymer({ |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
28 domReady: function() { |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
29 this.$.pick.addEventListener('colorselected', function(ev) { |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
30 this.value = ev.detail.hex; |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
31 }.bind(this)); |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
32 } |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
33 }); |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
34 </script> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
35 </polymer-element> |
ed1f54d81fc9
board control ui: output-rgb, fix ajax protocol, display output uris
drewp <drewp@bigasterisk.com>
parents:
978
diff
changeset
|
36 |
975
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 <polymer-element name="output-slider" extends="output-widget" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
38 attributes="min max step" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
39 noscript> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
40 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
41 <shadow></shadow> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
42 <input type="range" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 min="{{min}}" max="{{max}}" step="{{step}}" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 value="{{value}}"> {{value}} |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
45 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
46 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
48 <polymer-element name="output-fixed-text" extends="output-widget" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
49 attributes="rows cols" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
50 noscript> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
51 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
52 <textarea rows="{{rows}}" cols="{{cols}}" value="{{value}}"></textarea> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
53 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
54 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
55 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
56 <polymer-element name="output-switch" extends="output-widget"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
57 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
58 <shadow></shadow> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
59 <input type="checkbox" checked="{{check}}"> {{value}} |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
60 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
61 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
62 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
63 check: false, |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
64 checkChanged: function() { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
65 this.value = this.check ? "high" : "low"; |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
66 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
67 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
68 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
69 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
70 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
71 <polymer-element name="output-widget-any" attributes="desc"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
72 <template></template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
73 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
74 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
75 domReady: function() { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
76 var elem = document.createElement(this.desc.element); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
77 this.shadowRoot.appendChild(elem); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
78 for (var k of Object.keys(this.desc)) { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
79 elem.setAttribute(k, this.desc[k]); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
80 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
81 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
82 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
83 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
84 </polymer-element> |