+ },
+ postVisibilityUpdate: function(inSender, inEvent) {
+ if (inEvent.showing) {
+ this.show();
+ if (inEvent.data && this.getData() == "")
+ this.setData(inEvent.data);
+ } else {
+ this.hide();
+ }
+ },
+ resizePostContent: function(inSender, inEvent) {
+ if (this.resizePostContentTimeout)
+ clearTimeout(this.resizePostContentTimeout);
+ this.resizePostContentTimeout = setTimeout(function() {
+ var n = this.$.postContent.hasNode();
+ if (!n)
+ return;
+ var c = this.getData();
+ var lines = Math.floor(c.length / (100 * (n.clientWidth / 1000))) + 1;
+ var m = c.match(/\r?\n/g);
+ if (m)
+ lines += m.length;
+ if (lines <= 3) {
+ this.$.postContent.setStyle("");
+ } else {
+ this.$.postContent.setStyle("height: " + (lines * 17) + "pt");
+ }
+ this.resizePostContentTimeout = null;
+ }.bind(this), 150);