6 onPostVisibility: "postVisibilityUpdate"
8 resizePostContentTimeout: null,
10 {tag: "h2", content: "What's on your mind?"},
11 {kind: "onyx.InputDecorator", components: [
12 {name: "postContent", classes: "content", kind: "onyx.TextArea", onkeydown: "resizePostContent"}
14 {classes: "buttons", components: [
15 {kind: "onyx.Button", content: "Close", onclick: "closePost", classes: "onyx-negative"},
16 {kind: "onyx.Button", content: "Post", onclick: "doPost", classes: "onyx-affirmative"}
20 return this.$.postContent.getValue();
22 setData: function(inVal) {
23 this.$.postContent.setValue(inVal);
25 closePost: function() {
26 this.bubble('onPostVisibility', {showing: false});
29 this.bubble('onPost', {data: this.getData()});
31 postVisibilityUpdate: function(inSender, inEvent) {
32 if (inEvent.showing) {
34 if (inEvent.data && this.getData() == "")
35 this.setData(inEvent.data);
40 resizePostContent: function(inSender, inEvent) {
41 if (this.resizePostContentTimeout)
42 clearTimeout(this.resizePostContentTimeout);
43 this.resizePostContentTimeout = setTimeout(function() {
44 var n = this.$.postContent.hasNode();
47 var c = this.getData();
48 var lines = Math.floor(c.length / (100 * (n.clientWidth / 1000))) + 1;
49 var m = c.match(/\r?\n/g);
53 this.$.postContent.setStyle("");
55 this.$.postContent.setStyle("height: " + (lines * 17) + "pt");
57 this.resizePostContentTimeout = null;