Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/output-widgets.html @ 984:5da9200418db
reasoning: -v verbose setting, more oneshot support, some custom stuff for mpd commands
Ignore-this: 7646fba7b5496eb1f33a87452af6c6de
darcs-hash:20150514083000-312f9-ef4db22cf33250e690b6021b6b1968cc788d14cb
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Thu, 14 May 2015 01:30:00 -0700 |
parents | e9ed6159b5fa |
children | fc5fdcc3ed4a |
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> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
5 <core-ajax id="output" url="../output" method="POST"></core-ajax> |
978
e9ed6159b5fa
handle compact/full uris better, but still not always right
drewp <drewp@bigasterisk.com>
parents:
976
diff
changeset
|
6 Set this device'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 function ntriple(s, p, o) { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
10 // incomplete |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
11 o = o.replace('\n', '\\n'); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
12 return '<'+s+'> <'+p+'> "'+o+'".'; |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
13 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
14 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
15 valueChanged: function() { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
16 this.$.output.body = ntriple(this.subj, this.pred, this.value); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
17 this.$.output.go(); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
18 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
19 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
20 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
21 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
22 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
23 <polymer-element name="output-slider" extends="output-widget" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
24 attributes="min max step" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
25 noscript> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
26 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
27 <shadow></shadow> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
28 <input type="range" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
29 min="{{min}}" max="{{max}}" step="{{step}}" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
30 value="{{value}}"> {{value}} |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
31 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
32 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
33 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
34 <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
|
35 attributes="rows cols" |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
36 noscript> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
37 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
38 <textarea rows="{{rows}}" cols="{{cols}}" value="{{value}}"></textarea> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
39 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
40 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
41 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
42 <polymer-element name="output-switch" extends="output-widget"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
43 <template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
44 <shadow></shadow> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
45 <input type="checkbox" checked="{{check}}"> {{value}} |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
46 </template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
47 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
48 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
49 check: false, |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
50 checkChanged: function() { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
51 this.value = this.check ? "high" : "low"; |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
52 } |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
53 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
54 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
55 </polymer-element> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
56 |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
57 <polymer-element name="output-widget-any" attributes="desc"> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
58 <template></template> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
59 <script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
60 Polymer({ |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
61 domReady: function() { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
62 var elem = document.createElement(this.desc.element); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
63 this.shadowRoot.appendChild(elem); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
64 for (var k of Object.keys(this.desc)) { |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
65 elem.setAttribute(k, this.desc[k]); |
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 }); |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
69 </script> |
f3023410d875
polymer board debug page with working output widgets
drewp <drewp@bigasterisk.com>
parents:
diff
changeset
|
70 </polymer-element> |